diff --git a/gulliver/system/class.form.php b/gulliver/system/class.form.php index 1d27ed675..75751684d 100755 --- a/gulliver/system/class.form.php +++ b/gulliver/system/class.form.php @@ -47,6 +47,7 @@ class Form extends XmlForm var $objectRequiredFields = null; var $nextstepsave = ''; var $printdynaform = ''; + var $adjustgridswidth = '0'; public $visual_frontend; diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 16b0cb3e9..29b68d7e7 100755 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -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 ); diff --git a/workflow/engine/classes/class.dynaformEditor.php b/workflow/engine/classes/class.dynaformEditor.php index 6040d03f5..1559ae051 100755 --- a/workflow/engine/classes/class.dynaformEditor.php +++ b/workflow/engine/classes/class.dynaformEditor.php @@ -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) { diff --git a/workflow/engine/templates/grid.html b/workflow/engine/templates/grid.html index 10c054256..1d47cc8ab 100755 --- a/workflow/engine/templates/grid.html +++ b/workflow/engine/templates/grid.html @@ -2,7 +2,7 @@ {* this is the grid template *}
-
+
diff --git a/workflow/engine/templates/grid_preview.html b/workflow/engine/templates/grid_preview.html index 4c6fc92b1..0fd8d6018 100755 --- a/workflow/engine/templates/grid_preview.html +++ b/workflow/engine/templates/grid_preview.html @@ -2,7 +2,7 @@ {* this is the grid template *}
-
+
{$form->label}
{$form->label} diff --git a/workflow/engine/templates/grid_view.html b/workflow/engine/templates/grid_view.html index 5387a982a..4933fc272 100755 --- a/workflow/engine/templates/grid_view.html +++ b/workflow/engine/templates/grid_view.html @@ -2,7 +2,7 @@ {* this is the grid template *}
-
+
diff --git a/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml b/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml index 5001bab07..69a3f5b68 100755 --- a/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml +++ b/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml @@ -53,11 +53,14 @@ - + Show print dynaform button + + Adjust the grid width to the width of the main form + @@ -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:
" + response,"alert");
{$form->label}