From ae11d5c1067f72e6137496ddec5ffacffeb31b29 Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Wed, 3 Oct 2012 11:57:16 -0400 Subject: [PATCH 1/4] BUG 9508 I add the option the show scroll I add propety in form to the grids with scroll --- gulliver/system/class.form.php | 1 + gulliver/system/class.xmlform.php | 30 +++++++++++++++++-- .../engine/classes/class.dynaformEditor.php | 4 +++ workflow/engine/templates/grid.html | 6 ++-- .../dynaforms/dynaforms_Properties.xml | 8 ++++- 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/gulliver/system/class.form.php b/gulliver/system/class.form.php index 1d27ed675..599404250 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 $adjustgridswith = '0'; public $visual_frontend; diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 703f5fb88..f173bbdf1 100755 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -3295,8 +3295,34 @@ class XmlForm_Field_Grid extends XmlForm_Field $fieldsSize += $size; $emptyRow [$key] = array ($emptyValue); } - if($fieldsSize>100) - $owner->width = '100%'; + + if (isset($owner->adjustgridswith) && $owner->adjustgridswith == '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..fd8017a5b 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, + 'ADJUSTGRIDSWITH'=> $form->adjustgridswith, '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['ADJUSTGRIDSWITH'])) { + $ses2->execute(G::replaceDataField("UPDATE . SET ADJUSTGRIDSWITH = @@ADJUSTGRIDSWITH 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 758a4f215..d0656c506 100755 --- a/workflow/engine/templates/grid.html +++ b/workflow/engine/templates/grid.html @@ -2,18 +2,19 @@ {* this is the grid template *}
-
+
{$form->label}
+
{if ($form->addRow) } - +
 {$form->NewLabel}  {$form->NewLabel}
{/if} @@ -66,6 +67,7 @@
+
diff --git a/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml b/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml index 5001bab07..955c200c2 100755 --- a/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml +++ b/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml @@ -53,11 +53,15 @@ - + Show print dynaform button + + Adjust the grid width to the width of the main form + + @@ -83,6 +87,7 @@ if(document.getElementById("form[DYN_TYPE]").value=="grid"){ hideRowById('WIDTH'); hideRowById('NEXTSTEPSAVE'); hideRowById('PRINTDYNAFORM'); + hideRowById('ADJUSTGRIDSWITH'); } function getElementsByClassNameCrossBrowser(searchClass,node,tag) { @@ -145,6 +150,7 @@ function validateGridConversion(proUid,dynUid){ hideRowById('WIDTH'); hideRowById('NEXTSTEPSAVE'); hideRowById('PRINTDYNAFORM'); + hideRowById('ADJUSTGRIDSWITH'); } else { setDropdownSelection("form[DYN_TYPE]" , "xmlform"); msgBox("Grid forms can not contain the following fields:
" + response,"alert"); From ac920502cf7fb98bd102b7494f6c5c1013bc3155 Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Thu, 4 Oct 2012 15:33:11 -0400 Subject: [PATCH 2/4] BUG 9508 I changed the variable name I changed thevariable name adjustgridswith for adjustgridswidth --- gulliver/system/class.form.php | 2 +- gulliver/system/class.xmlform.php | 2 +- workflow/engine/classes/class.dynaformEditor.php | 6 +++--- workflow/engine/templates/grid.html | 4 +--- .../engine/xmlform/dynaforms/dynaforms_Properties.xml | 10 +++++----- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/gulliver/system/class.form.php b/gulliver/system/class.form.php index 599404250..75751684d 100755 --- a/gulliver/system/class.form.php +++ b/gulliver/system/class.form.php @@ -47,7 +47,7 @@ class Form extends XmlForm var $objectRequiredFields = null; var $nextstepsave = ''; var $printdynaform = ''; - var $adjustgridswith = '0'; + var $adjustgridswidth = '0'; public $visual_frontend; diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 1ac8c1953..29b68d7e7 100755 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -3297,7 +3297,7 @@ class XmlForm_Field_Grid extends XmlForm_Field $emptyRow [$key] = array ($emptyValue); } - if (isset($owner->adjustgridswith) && $owner->adjustgridswith == '1') { + if (isset($owner->adjustgridswidth) && $owner->adjustgridswidth == '1') { // 400w -> 34s to Firefox // 400w -> 43s to Chrome diff --git a/workflow/engine/classes/class.dynaformEditor.php b/workflow/engine/classes/class.dynaformEditor.php index fd8017a5b..6ed8a6389 100755 --- a/workflow/engine/classes/class.dynaformEditor.php +++ b/workflow/engine/classes/class.dynaformEditor.php @@ -716,7 +716,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax //'ENABLETEMPLATE'=> $form->enableTemplate, 'MODE' => $form->mode, 'PRINTDYNAFORM' => $form->printdynaform, - 'ADJUSTGRIDSWITH'=> $form->adjustgridswith, + 'ADJUSTGRIDSWIDTH' => $form->adjustgridswith, 'NEXTSTEPSAVE' => $form->nextstepsave ); $tmp['Properties']=$Properties; @@ -777,8 +777,8 @@ 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['ADJUSTGRIDSWITH'])) { - $ses2->execute(G::replaceDataField("UPDATE . SET ADJUSTGRIDSWITH = @@ADJUSTGRIDSWITH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields)); + if (isset($Fields['ADJUSTGRIDSWIDTH'])) { + $ses2->execute(G::replaceDataField("UPDATE . SET ADJUSTGRIDSWIDTH = @@ADJUSTGRIDSWIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields)); } return 0; } diff --git a/workflow/engine/templates/grid.html b/workflow/engine/templates/grid.html index 375a894a2..1d47cc8ab 100755 --- a/workflow/engine/templates/grid.html +++ b/workflow/engine/templates/grid.html @@ -8,13 +8,12 @@ {$form->label} -
{if ($form->addRow) } - +
 {$form->NewLabel} {$form->NewLabel}
{/if} @@ -67,7 +66,6 @@
-
diff --git a/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml b/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml index 955c200c2..69a3f5b68 100755 --- a/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml +++ b/workflow/engine/xmlform/dynaforms/dynaforms_Properties.xml @@ -58,10 +58,9 @@ Show print dynaform button - + Adjust the grid width to the width of the main form - - + @@ -87,7 +86,7 @@ if(document.getElementById("form[DYN_TYPE]").value=="grid"){ hideRowById('WIDTH'); hideRowById('NEXTSTEPSAVE'); hideRowById('PRINTDYNAFORM'); - hideRowById('ADJUSTGRIDSWITH'); + hideRowById('ADJUSTGRIDSWIDTH'); } function getElementsByClassNameCrossBrowser(searchClass,node,tag) { @@ -124,6 +123,7 @@ leimnud.event.add(getField('DYN_TYPE'), 'change', function() { showRowById('WIDTH'); showRowById('NEXTSTEPSAVE'); showRowById('PRINTDYNAFORM'); + showRowById('ADJUSTGRIDSWIDTH'); } }); @@ -150,7 +150,7 @@ function validateGridConversion(proUid,dynUid){ hideRowById('WIDTH'); hideRowById('NEXTSTEPSAVE'); hideRowById('PRINTDYNAFORM'); - hideRowById('ADJUSTGRIDSWITH'); + hideRowById('ADJUSTGRIDSWIDTH'); } else { setDropdownSelection("form[DYN_TYPE]" , "xmlform"); msgBox("Grid forms can not contain the following fields:
" + response,"alert"); From 09f0554071a42a6c5e728d2d82e074fc40b69d81 Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Thu, 4 Oct 2012 15:41:44 -0400 Subject: [PATCH 3/4] BUG 9508 I add the letter 'd' I add the letter 'd' --- workflow/engine/classes/class.dynaformEditor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/classes/class.dynaformEditor.php b/workflow/engine/classes/class.dynaformEditor.php index 6ed8a6389..1559ae051 100755 --- a/workflow/engine/classes/class.dynaformEditor.php +++ b/workflow/engine/classes/class.dynaformEditor.php @@ -716,7 +716,7 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax //'ENABLETEMPLATE'=> $form->enableTemplate, 'MODE' => $form->mode, 'PRINTDYNAFORM' => $form->printdynaform, - 'ADJUSTGRIDSWIDTH' => $form->adjustgridswith, + 'ADJUSTGRIDSWIDTH' => $form->adjustgridswidth, 'NEXTSTEPSAVE' => $form->nextstepsave ); $tmp['Properties']=$Properties; From 154639c9e3e1841bc12b0314fe3e3453d4e9086c Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Thu, 4 Oct 2012 15:59:13 -0400 Subject: [PATCH 4/4] BUG 9508 I add the option the show scroll I add propety in form to the grids with scroll --- workflow/engine/templates/grid_preview.html | 2 +- workflow/engine/templates/grid_view.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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} 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 *}
-
+
{$form->label}