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 *}
-
+
| {$form->label} |
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 *}