Merge pull request #662 from brayanpereyra/BUG-9508

BUG 9508 I add the option the show scroll
This commit is contained in:
julceslauhub
2012-10-04 13:08:27 -07:00
7 changed files with 43 additions and 6 deletions

View File

@@ -47,6 +47,7 @@ class Form extends XmlForm
var $objectRequiredFields = null;
var $nextstepsave = '';
var $printdynaform = '';
var $adjustgridswidth = '0';
public $visual_frontend;

View File

@@ -3296,8 +3296,34 @@ class XmlForm_Field_Grid extends XmlForm_Field
$fieldsSize += $size;
$emptyRow [$key] = array ($emptyValue);
}
if($fieldsSize>100)
$owner->width = '100%';
if (isset($owner->adjustgridswidth) && $owner->adjustgridswidth == '1') {
// 400w -> 34s to Firefox
// 400w -> 43s to Chrome
$baseWidth = 400;
$minusWidth = 30;
if (eregi('chrome', $_SERVER['HTTP_USER_AGENT'])) {
$baseSize = 43;
} else {
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) {
$minusWidth = 20;
}
$baseSize = 34;
}
$baseWidth = 400;
$formWidth = (int)$owner->width;
$maxSize = (($formWidth*$baseSize) / $baseWidth);
if ($fieldsSize > $maxSize) {
$this->scrollStyle = 'height:100%; overflow-x: scroll; width:';
$this->scrollStyle .= $formWidth - $minusWidth . ';';
}
} else {
if($fieldsSize>100)
$owner->width = '100%';
}
// else
// $owner->width = $fieldsSize . 'em';
return $this->renderGrid ( $emptyRow, $owner );

View File

@@ -716,6 +716,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
//'ENABLETEMPLATE'=> $form->enableTemplate,
'MODE' => $form->mode,
'PRINTDYNAFORM' => $form->printdynaform,
'ADJUSTGRIDSWIDTH' => $form->adjustgridswidth,
'NEXTSTEPSAVE' => $form->nextstepsave
);
$tmp['Properties']=$Properties;
@@ -776,6 +777,9 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
if (isset($Fields['PRINTDYNAFORM'])) {
$ses2->execute(G::replaceDataField("UPDATE . SET PRINTDYNAFORM = @@PRINTDYNAFORM WHERE XMLNODE_NAME = 'dynaForm' ", $Fields));
}
if (isset($Fields['ADJUSTGRIDSWIDTH'])) {
$ses2->execute(G::replaceDataField("UPDATE . SET ADJUSTGRIDSWIDTH = @@ADJUSTGRIDSWIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields));
}
return 0;
}
catch(Exception $e) {

View File

@@ -2,7 +2,7 @@
{* this is the grid template *}
<div class="grid">
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="content">
<div class="content" style="{$form->scrollStyle};">
<table class="" width="100%" cellpadding="0" cellspacing="0">
<tr>
<th>{$form->label}</th>

View File

@@ -2,7 +2,7 @@
{* this is the grid template *}
<div class="grid">
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="content">
<div class="content" style="{$form->scrollStyle};">
<table class="FormSubTitle" width="100%" cellpadding="0" cellspacing="0">
<tr>
<th>{$form->label}

View File

@@ -2,7 +2,7 @@
{* this is the grid template *}
<div class="pagedTableDefault">
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="content">
<div class="content" style="{$form->scrollStyle};">
<table class="" width="100%" cellpadding="0" cellspacing="0">
<tr>
<th>{$form->label}</th>

View File

@@ -53,11 +53,14 @@
<option name="prompt">Show prompt</option>
</en>
</NEXTSTEPSAVE>
<PRINTDYNAFORM type="checkbox" falseValue="0" value="1" defaultvalue="0" labelOnRight="0">
<en>Show print dynaform button</en>
</PRINTDYNAFORM>
<ADJUSTGRIDSWIDTH type="checkbox" falseValue="0" value="0" defaultvalue="0" labelOnRight="0">
<en>Adjust the grid width to the width of the main form</en>
</ADJUSTGRIDSWIDTH>
<!--<ENABLETEMPLATE type="checkbox" value="1" defaultvalue="0" labelOnRight="0">
<en>Enable Template</en>
</ENABLETEMPLATE>-->
@@ -83,6 +86,7 @@ if(document.getElementById("form[DYN_TYPE]").value=="grid"){
hideRowById('WIDTH');
hideRowById('NEXTSTEPSAVE');
hideRowById('PRINTDYNAFORM');
hideRowById('ADJUSTGRIDSWIDTH');
}
function getElementsByClassNameCrossBrowser(searchClass,node,tag) {
@@ -119,6 +123,7 @@ leimnud.event.add(getField('DYN_TYPE'), 'change', function() {
showRowById('WIDTH');
showRowById('NEXTSTEPSAVE');
showRowById('PRINTDYNAFORM');
showRowById('ADJUSTGRIDSWIDTH');
}
});
@@ -145,6 +150,7 @@ function validateGridConversion(proUid,dynUid){
hideRowById('WIDTH');
hideRowById('NEXTSTEPSAVE');
hideRowById('PRINTDYNAFORM');
hideRowById('ADJUSTGRIDSWIDTH');
} else {
setDropdownSelection("form[DYN_TYPE]" , "xmlform");
msgBox("Grid forms can not contain the following fields: <br>" + response,"alert");