From 2703717619cd800e61cd1a24e6016bacb00e5844 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 11 Aug 2017 18:13:07 -0400 Subject: [PATCH 1/3] HOR-3670-RG-5 Files review: workflow/engine/classes/XmlForm_Field_TextareaPM.php workflow/engine/classes/XmlForm_Field_ToolBar.php workflow/engine/classes/XmlForm_Field_ToolButton.php workflow/engine/classes/Zip_File.php --- ...tareaPM.php => XmlFormFieldTextAreaPm.php} | 66 ++----- .../engine/classes/XmlFormFieldTextPm.php | 120 ++++++++++++ .../engine/classes/XmlFormFieldToolBar.php | 48 +++++ ...lButton.php => XmlFormFieldToolButton.php} | 36 +--- .../engine/classes/XmlForm_Field_TextPM.php | 181 ------------------ .../engine/classes/XmlForm_Field_ToolBar.php | 75 -------- .../classes/{Zip_File.php => ZipFile.php} | 14 +- 7 files changed, 196 insertions(+), 344 deletions(-) rename workflow/engine/classes/{XmlForm_Field_TextareaPM.php => XmlFormFieldTextAreaPm.php} (50%) create mode 100644 workflow/engine/classes/XmlFormFieldTextPm.php create mode 100644 workflow/engine/classes/XmlFormFieldToolBar.php rename workflow/engine/classes/{XmlForm_Field_ToolButton.php => XmlFormFieldToolButton.php} (83%) delete mode 100644 workflow/engine/classes/XmlForm_Field_TextPM.php delete mode 100644 workflow/engine/classes/XmlForm_Field_ToolBar.php rename workflow/engine/classes/{Zip_File.php => ZipFile.php} (94%) diff --git a/workflow/engine/classes/XmlForm_Field_TextareaPM.php b/workflow/engine/classes/XmlFormFieldTextAreaPm.php similarity index 50% rename from workflow/engine/classes/XmlForm_Field_TextareaPM.php rename to workflow/engine/classes/XmlFormFieldTextAreaPm.php index fa74e128e..25bbb751b 100644 --- a/workflow/engine/classes/XmlForm_Field_TextareaPM.php +++ b/workflow/engine/classes/XmlFormFieldTextAreaPm.php @@ -1,36 +1,9 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - * @package workflow.engine.classes - **/ - - -/** - * Class XmlForm_Field_TextareaPM - */class XmlForm_Field_TextareaPM extends XmlForm_Field + * Class XmlFormFieldTextareaPm + */ +class XmlFormFieldTextAreaPm extends XmlForm_Field { public $rows = 12; public $cols = 40; @@ -50,24 +23,24 @@ * @param eter string owner * @return string */ - public function render ($value = null, $owner) + public function render($value = null, $owner) { if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); + $this->process = G::replaceDataField($this->process, $owner->values); $sShowVars = ' '; } else { $sShowVars = ''; } if ($this->mode === 'edit') { if ($this->readOnly) { - return '' . $sShowVars; + return '' . $sShowVars; } else { - return '' . $sShowVars; + return '' . $sShowVars; } } elseif ($this->mode === 'view') { - return ''; + return ''; } else { - return ''; + return ''; } } @@ -80,34 +53,31 @@ * @param eter string owner * @return string */ - public function renderGrid ($owner, $values = null) + public function renderGrid($owner, $values = null) { - $result = array (); + $result = array(); $r = 1; foreach ($values as $v) { if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; + $this->process = G::replaceDataField($this->process, $owner->values); $sShowVars = ' '; } else { $sShowVars = ''; } if ($this->mode === 'edit') { if ($this->readOnly) { - $result[] = 'htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly"/>' . $sShowVars; + $result[] = 'htmlentities($v, ENT_COMPAT, 'utf-8') . '\' readOnly="readOnly"/>' . $sShowVars; } else { - $result[] = 'htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '\' />' . $sShowVars; + $result[] = 'htmlentities($v, ENT_COMPAT, 'utf-8') . '\' />' . $sShowVars; } } elseif ($this->mode === 'view') { - if (stristr( $_SERVER['HTTP_USER_AGENT'], 'iPhone' )) { - //$result[] = '
'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'
'; - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + if (stristr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) { + $result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8'); } else { - //$result[] = '
'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'
'; - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + $result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8'); } } else { - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + $result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8'); } $r ++; } diff --git a/workflow/engine/classes/XmlFormFieldTextPm.php b/workflow/engine/classes/XmlFormFieldTextPm.php new file mode 100644 index 000000000..20b1fbcf8 --- /dev/null +++ b/workflow/engine/classes/XmlFormFieldTextPm.php @@ -0,0 +1,120 @@ + + * @access public + * @param eter string value + * @param eter string owner + * @return string + */ + public function render($value = null, $owner = null) + { + //NOTE: string functions must be in G class + if ($this->strTo === 'UPPER') { + $value = strtoupper($value); + } + if ($this->strTo === 'LOWER') { + $value = strtolower($value); + } + + $onkeypress = G::replaceDataField($this->onkeypress, $owner->values); + if ($this->replaceTags == 1) { + $value = G::replaceDataField($value, $owner->values); + } + if ($this->showVars == 1) { + $this->process = G::replaceDataField($this->process, $owner->values); + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + return 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' readOnly="readOnly" style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars; + } else { + return 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars; + } + } elseif ($this->mode === 'view') { + return 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' style="display:none;' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $this->htmlentities($value, ENT_COMPAT, 'utf-8'); + } else { + return $this->htmlentities($value, ENT_COMPAT, 'utf-8'); + } + } + + /** + * Function renderGrid + * + * @author Julio Cesar Laura Avendano + * @access public + * @param eter array values + * @param eter string owner + * @return string + */ + public function renderGrid($values = array(), $owner) + { + $result = array(); + $r = 1; + foreach ($values as $v) { + if ($this->replaceTags == 1) { + $v = G::replaceDataField($v, $owner->values); + } + if ($this->showVars == 1) { + $this->process = G::replaceDataField($this->process, $owner->values); + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + $result[] = '' . $sShowVars; + } else { + $result[] = '' . $sShowVars; + } + } elseif ($this->mode === 'view') { + $result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8'); + } else { + $result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8'); + } + $r ++; + } + return $result; + } + + /** + * Function attachEvents + * + * @access public + * @param eter string $element + * @return string + */ + public function attachEvents($element) + { + return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); + myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");"; + } +} diff --git a/workflow/engine/classes/XmlFormFieldToolBar.php b/workflow/engine/classes/XmlFormFieldToolBar.php new file mode 100644 index 000000000..34ff0a56e --- /dev/null +++ b/workflow/engine/classes/XmlFormFieldToolBar.php @@ -0,0 +1,48 @@ +home = $home; + } + + /** + * Prints the ToolBar + * + * @param string $value + * @return string + */ + public function render($value) + { + $this->toolBar = new ToolBar($this->xmlfile, $this->home); + $template = PATH_CORE . 'templates/' . $this->type . '.html'; + $out = $this->toolBar->render($template, $scriptCode); + $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher->addScriptFile($this->toolBar->scriptURL); + $oHeadPublisher->addScriptCode($scriptCode); + return $out; + } +} diff --git a/workflow/engine/classes/XmlForm_Field_ToolButton.php b/workflow/engine/classes/XmlFormFieldToolButton.php similarity index 83% rename from workflow/engine/classes/XmlForm_Field_ToolButton.php rename to workflow/engine/classes/XmlFormFieldToolButton.php index a686fa5b5..b5a196e76 100644 --- a/workflow/engine/classes/XmlForm_Field_ToolButton.php +++ b/workflow/engine/classes/XmlFormFieldToolButton.php @@ -1,40 +1,13 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - -/** - * ToolBar - ToolBar -/** - * XmlForm_Field_toolButton - XmlForm_Field_toolButton class - * - * @package workflow.engine.ProcessMaker - */class XmlForm_Field_toolButton extends XmlForm_Field +class XmlFormFieldToolButton extends XmlForm_Field { - public $file = ''; public $fileAlt = ''; public $url = ''; @@ -95,8 +68,6 @@ break; case 'html': $html = '
' . $this->label . '
'; - - //$html=$this->label; break; case 'image/text': $html = 'style) ? ' style="' . $this->style . '"' : '') . '/>
' . $this->htmlentities($this->label, ENT_QUOTES, 'utf-8'); @@ -107,7 +78,6 @@ case 'dropdown': $html = ''; if (isset($this->owner->values['PRO_UID'])) { - $criteria = ProcessMap::getDynaformsCriteria($this->owner->values['PRO_UID']); $dataset = DynaformPeer::doSelectRS($criteria); if ($dataset->getRecordCount() > 0) { diff --git a/workflow/engine/classes/XmlForm_Field_TextPM.php b/workflow/engine/classes/XmlForm_Field_TextPM.php deleted file mode 100644 index 54c23914a..000000000 --- a/workflow/engine/classes/XmlForm_Field_TextPM.php +++ /dev/null @@ -1,181 +0,0 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - * @package workflow.engine.classes - **/ - - -/** - * class.xmlfield_InputPM.php - * - * @package workflow.engine.classes - * - * ProcessMaker Open Source Edition - * Copyright (C) 2004 - 2011 Colosa Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - * @package workflow.engine.classes - **/class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText -{ - public $size = 15; - public $maxLength = 64; - public $validate = 'Any'; - public $mask = ''; - public $defaultValue = ''; - public $required = false; - public $dependentFields = ''; - public $linkField = ''; - //Possible values:(-|UPPER|LOWER|CAPITALIZE) - public $strTo = ''; - public $readOnly = false; - public $sqlConnection = 0; - public $sql = ''; - public $sqlOption = array (); - //Atributes only for grids - public $formula = ''; - public $function = ''; - public $replaceTags = 0; - public $showVars = 0; - public $process = ''; - public $symbol = '@@'; - - /** - * Function render - * - * @author Julio Cesar Laura Avendano - * @access public - * @param eter string value - * @param eter string owner - * @return string - */ - public function render ($value = null, $owner = null) - { - //$this->executeSQL(); - //if (isset($this->sqlOption)) { - // reset($this->sqlOption); - // $firstElement=key($this->sqlOption); - // if (isset($firstElement)) $value = $firstElement; - //} - //NOTE: string functions must be in G class - if ($this->strTo === 'UPPER') { - $value = strtoupper( $value ); - } - if ($this->strTo === 'LOWER') { - $value = strtolower( $value ); - } - //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); - $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); - if ($this->replaceTags == 1) { - $value = G::replaceDataField( $value, $owner->values ); - } - if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } else { - $sShowVars = ''; - } - if ($this->mode === 'edit') { - if ($this->readOnly) { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; - } else { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; - } - } elseif ($this->mode === 'view') { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="display:none;' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); - } else { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); - } - } - - /** - * Function renderGrid - * - * @author Julio Cesar Laura Avendano - * @access public - * @param eter array values - * @param eter string owner - * @return string - */ - public function renderGrid ($values = array(), $owner) - { - $result = array (); - $r = 1; - foreach ($values as $v) { - if ($this->replaceTags == 1) { - $v = G::replaceDataField( $v, $owner->values ); - } - if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } else { - $sShowVars = ''; - } - if ($this->mode === 'edit') { - if ($this->readOnly) { - $result[] = '' . $sShowVars; - } else { - $result[] = '' . $sShowVars; - } - } elseif ($this->mode === 'view') { - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); - } else { - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); - } - $r ++; - } - return $result; - } - - /** - * Function attachEvents - * - * @access public - * @param eter string $element - * @return string - */ - public function attachEvents ($element) - { - return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); - myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");"; - } -} diff --git a/workflow/engine/classes/XmlForm_Field_ToolBar.php b/workflow/engine/classes/XmlForm_Field_ToolBar.php deleted file mode 100644 index 387758b8b..000000000 --- a/workflow/engine/classes/XmlForm_Field_ToolBar.php +++ /dev/null @@ -1,75 +0,0 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -/** - * ToolBar - ToolBar -/** - * XmlForm_Field_ToolBar - XmlForm_Field_ToolBar class - * - * @package workflow.engine.ProcessMaker - */class XmlForm_Field_ToolBar extends XmlForm_Field -{ - - public $xmlfile = ''; - public $type = 'toolbar'; - public $toolBar; - public $home = ''; - public $withoutLabel = true; - - /** - * Constructor of the class XmlForm_Field_ToolBar - * - * @param string $xmlNode - * @param string $lang - * @param string $home - * @param string $owner - * @return void - */ - public function XmlForm_Field_ToolBar($xmlNode, $lang = 'en', $home = '', $owner = ' ') - { - parent::XmlForm_Field($xmlNode, $lang, $home, $owner); - $this->home = $home; - } - - /** - * Prints the ToolBar - * - * @param string $value - * @return string - */ - public function render($value) - { - $this->toolBar = new ToolBar($this->xmlfile, $this->home); - $template = PATH_CORE . 'templates/' . $this->type . '.html'; - $out = $this->toolBar->render($template, $scriptCode); - $oHeadPublisher = & headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile($this->toolBar->scriptURL); - $oHeadPublisher->addScriptCode($scriptCode); - return $out; - } -} diff --git a/workflow/engine/classes/Zip_File.php b/workflow/engine/classes/ZipFile.php similarity index 94% rename from workflow/engine/classes/Zip_File.php rename to workflow/engine/classes/ZipFile.php index c265989ed..dbbfd677b 100644 --- a/workflow/engine/classes/Zip_File.php +++ b/workflow/engine/classes/ZipFile.php @@ -1,16 +1,17 @@ archive($name); $this->options['type'] = "zip"; From 912e91682dc01d799154ab6faffbf29328152d79 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 11 Aug 2017 18:13:07 -0400 Subject: [PATCH 2/3] HOR-3670-RG-5 Files review: workflow/engine/classes/XmlForm_Field_TextareaPM.php workflow/engine/classes/XmlForm_Field_ToolBar.php workflow/engine/classes/XmlForm_Field_ToolButton.php workflow/engine/classes/Zip_File.php --- ...tareaPM.php => XmlFormFieldTextAreaPm.php} | 66 ++----- .../engine/classes/XmlFormFieldTextPm.php | 120 ++++++++++++ .../engine/classes/XmlFormFieldToolBar.php | 48 +++++ ...lButton.php => XmlFormFieldToolButton.php} | 36 +--- .../engine/classes/XmlForm_Field_TextPM.php | 181 ------------------ .../engine/classes/XmlForm_Field_ToolBar.php | 75 -------- .../classes/{Zip_File.php => ZipFile.php} | 14 +- 7 files changed, 196 insertions(+), 344 deletions(-) rename workflow/engine/classes/{XmlForm_Field_TextareaPM.php => XmlFormFieldTextAreaPm.php} (50%) create mode 100644 workflow/engine/classes/XmlFormFieldTextPm.php create mode 100644 workflow/engine/classes/XmlFormFieldToolBar.php rename workflow/engine/classes/{XmlForm_Field_ToolButton.php => XmlFormFieldToolButton.php} (83%) delete mode 100644 workflow/engine/classes/XmlForm_Field_TextPM.php delete mode 100644 workflow/engine/classes/XmlForm_Field_ToolBar.php rename workflow/engine/classes/{Zip_File.php => ZipFile.php} (94%) diff --git a/workflow/engine/classes/XmlForm_Field_TextareaPM.php b/workflow/engine/classes/XmlFormFieldTextAreaPm.php similarity index 50% rename from workflow/engine/classes/XmlForm_Field_TextareaPM.php rename to workflow/engine/classes/XmlFormFieldTextAreaPm.php index fa74e128e..25bbb751b 100644 --- a/workflow/engine/classes/XmlForm_Field_TextareaPM.php +++ b/workflow/engine/classes/XmlFormFieldTextAreaPm.php @@ -1,36 +1,9 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - * @package workflow.engine.classes - **/ - - -/** - * Class XmlForm_Field_TextareaPM - */class XmlForm_Field_TextareaPM extends XmlForm_Field + * Class XmlFormFieldTextareaPm + */ +class XmlFormFieldTextAreaPm extends XmlForm_Field { public $rows = 12; public $cols = 40; @@ -50,24 +23,24 @@ * @param eter string owner * @return string */ - public function render ($value = null, $owner) + public function render($value = null, $owner) { if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); + $this->process = G::replaceDataField($this->process, $owner->values); $sShowVars = ' '; } else { $sShowVars = ''; } if ($this->mode === 'edit') { if ($this->readOnly) { - return '' . $sShowVars; + return '' . $sShowVars; } else { - return '' . $sShowVars; + return '' . $sShowVars; } } elseif ($this->mode === 'view') { - return ''; + return ''; } else { - return ''; + return ''; } } @@ -80,34 +53,31 @@ * @param eter string owner * @return string */ - public function renderGrid ($owner, $values = null) + public function renderGrid($owner, $values = null) { - $result = array (); + $result = array(); $r = 1; foreach ($values as $v) { if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; + $this->process = G::replaceDataField($this->process, $owner->values); $sShowVars = ' '; } else { $sShowVars = ''; } if ($this->mode === 'edit') { if ($this->readOnly) { - $result[] = 'htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly"/>' . $sShowVars; + $result[] = 'htmlentities($v, ENT_COMPAT, 'utf-8') . '\' readOnly="readOnly"/>' . $sShowVars; } else { - $result[] = 'htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '\' />' . $sShowVars; + $result[] = 'htmlentities($v, ENT_COMPAT, 'utf-8') . '\' />' . $sShowVars; } } elseif ($this->mode === 'view') { - if (stristr( $_SERVER['HTTP_USER_AGENT'], 'iPhone' )) { - //$result[] = '
'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'
'; - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + if (stristr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) { + $result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8'); } else { - //$result[] = '
'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'
'; - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + $result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8'); } } else { - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); + $result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8'); } $r ++; } diff --git a/workflow/engine/classes/XmlFormFieldTextPm.php b/workflow/engine/classes/XmlFormFieldTextPm.php new file mode 100644 index 000000000..20b1fbcf8 --- /dev/null +++ b/workflow/engine/classes/XmlFormFieldTextPm.php @@ -0,0 +1,120 @@ + + * @access public + * @param eter string value + * @param eter string owner + * @return string + */ + public function render($value = null, $owner = null) + { + //NOTE: string functions must be in G class + if ($this->strTo === 'UPPER') { + $value = strtoupper($value); + } + if ($this->strTo === 'LOWER') { + $value = strtolower($value); + } + + $onkeypress = G::replaceDataField($this->onkeypress, $owner->values); + if ($this->replaceTags == 1) { + $value = G::replaceDataField($value, $owner->values); + } + if ($this->showVars == 1) { + $this->process = G::replaceDataField($this->process, $owner->values); + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + return 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' readOnly="readOnly" style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars; + } else { + return 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' style="' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $sShowVars; + } + } elseif ($this->mode === 'view') { + return 'htmlentities($value, ENT_COMPAT, 'utf-8') . '\' style="display:none;' . htmlentities($this->style, ENT_COMPAT, 'utf-8') . '" onkeypress="' . htmlentities($onkeypress, ENT_COMPAT, 'utf-8') . '"/>' . $this->htmlentities($value, ENT_COMPAT, 'utf-8'); + } else { + return $this->htmlentities($value, ENT_COMPAT, 'utf-8'); + } + } + + /** + * Function renderGrid + * + * @author Julio Cesar Laura Avendano + * @access public + * @param eter array values + * @param eter string owner + * @return string + */ + public function renderGrid($values = array(), $owner) + { + $result = array(); + $r = 1; + foreach ($values as $v) { + if ($this->replaceTags == 1) { + $v = G::replaceDataField($v, $owner->values); + } + if ($this->showVars == 1) { + $this->process = G::replaceDataField($this->process, $owner->values); + $sShowVars = ' '; + } else { + $sShowVars = ''; + } + if ($this->mode === 'edit') { + if ($this->readOnly) { + $result[] = '' . $sShowVars; + } else { + $result[] = '' . $sShowVars; + } + } elseif ($this->mode === 'view') { + $result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8'); + } else { + $result[] = $this->htmlentities($v, ENT_COMPAT, 'utf-8'); + } + $r ++; + } + return $result; + } + + /** + * Function attachEvents + * + * @access public + * @param eter string $element + * @return string + */ + public function attachEvents($element) + { + return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); + myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");"; + } +} diff --git a/workflow/engine/classes/XmlFormFieldToolBar.php b/workflow/engine/classes/XmlFormFieldToolBar.php new file mode 100644 index 000000000..34ff0a56e --- /dev/null +++ b/workflow/engine/classes/XmlFormFieldToolBar.php @@ -0,0 +1,48 @@ +home = $home; + } + + /** + * Prints the ToolBar + * + * @param string $value + * @return string + */ + public function render($value) + { + $this->toolBar = new ToolBar($this->xmlfile, $this->home); + $template = PATH_CORE . 'templates/' . $this->type . '.html'; + $out = $this->toolBar->render($template, $scriptCode); + $oHeadPublisher = & headPublisher::getSingleton(); + $oHeadPublisher->addScriptFile($this->toolBar->scriptURL); + $oHeadPublisher->addScriptCode($scriptCode); + return $out; + } +} diff --git a/workflow/engine/classes/XmlForm_Field_ToolButton.php b/workflow/engine/classes/XmlFormFieldToolButton.php similarity index 83% rename from workflow/engine/classes/XmlForm_Field_ToolButton.php rename to workflow/engine/classes/XmlFormFieldToolButton.php index a686fa5b5..b5a196e76 100644 --- a/workflow/engine/classes/XmlForm_Field_ToolButton.php +++ b/workflow/engine/classes/XmlFormFieldToolButton.php @@ -1,40 +1,13 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ - -/** - * ToolBar - ToolBar -/** - * XmlForm_Field_toolButton - XmlForm_Field_toolButton class - * - * @package workflow.engine.ProcessMaker - */class XmlForm_Field_toolButton extends XmlForm_Field +class XmlFormFieldToolButton extends XmlForm_Field { - public $file = ''; public $fileAlt = ''; public $url = ''; @@ -95,8 +68,6 @@ break; case 'html': $html = '
' . $this->label . '
'; - - //$html=$this->label; break; case 'image/text': $html = 'style) ? ' style="' . $this->style . '"' : '') . '/>
' . $this->htmlentities($this->label, ENT_QUOTES, 'utf-8'); @@ -107,7 +78,6 @@ case 'dropdown': $html = ''; if (isset($this->owner->values['PRO_UID'])) { - $criteria = ProcessMap::getDynaformsCriteria($this->owner->values['PRO_UID']); $dataset = DynaformPeer::doSelectRS($criteria); if ($dataset->getRecordCount() > 0) { diff --git a/workflow/engine/classes/XmlForm_Field_TextPM.php b/workflow/engine/classes/XmlForm_Field_TextPM.php deleted file mode 100644 index 54c23914a..000000000 --- a/workflow/engine/classes/XmlForm_Field_TextPM.php +++ /dev/null @@ -1,181 +0,0 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - * @package workflow.engine.classes - **/ - - -/** - * class.xmlfield_InputPM.php - * - * @package workflow.engine.classes - * - * ProcessMaker Open Source Edition - * Copyright (C) 2004 - 2011 Colosa Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - * @package workflow.engine.classes - **/class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText -{ - public $size = 15; - public $maxLength = 64; - public $validate = 'Any'; - public $mask = ''; - public $defaultValue = ''; - public $required = false; - public $dependentFields = ''; - public $linkField = ''; - //Possible values:(-|UPPER|LOWER|CAPITALIZE) - public $strTo = ''; - public $readOnly = false; - public $sqlConnection = 0; - public $sql = ''; - public $sqlOption = array (); - //Atributes only for grids - public $formula = ''; - public $function = ''; - public $replaceTags = 0; - public $showVars = 0; - public $process = ''; - public $symbol = '@@'; - - /** - * Function render - * - * @author Julio Cesar Laura Avendano - * @access public - * @param eter string value - * @param eter string owner - * @return string - */ - public function render ($value = null, $owner = null) - { - //$this->executeSQL(); - //if (isset($this->sqlOption)) { - // reset($this->sqlOption); - // $firstElement=key($this->sqlOption); - // if (isset($firstElement)) $value = $firstElement; - //} - //NOTE: string functions must be in G class - if ($this->strTo === 'UPPER') { - $value = strtoupper( $value ); - } - if ($this->strTo === 'LOWER') { - $value = strtolower( $value ); - } - //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); - $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); - if ($this->replaceTags == 1) { - $value = G::replaceDataField( $value, $owner->values ); - } - if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } else { - $sShowVars = ''; - } - if ($this->mode === 'edit') { - if ($this->readOnly) { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; - } else { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars; - } - } elseif ($this->mode === 'view') { - return 'htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '\' style="display:none;' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); - } else { - return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); - } - } - - /** - * Function renderGrid - * - * @author Julio Cesar Laura Avendano - * @access public - * @param eter array values - * @param eter string owner - * @return string - */ - public function renderGrid ($values = array(), $owner) - { - $result = array (); - $r = 1; - foreach ($values as $v) { - if ($this->replaceTags == 1) { - $v = G::replaceDataField( $v, $owner->values ); - } - if ($this->showVars == 1) { - $this->process = G::replaceDataField( $this->process, $owner->values ); - //$sShowVars = ' ' . $this->symbol . ''; - $sShowVars = ' '; - } else { - $sShowVars = ''; - } - if ($this->mode === 'edit') { - if ($this->readOnly) { - $result[] = '' . $sShowVars; - } else { - $result[] = '' . $sShowVars; - } - } elseif ($this->mode === 'view') { - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); - } else { - $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); - } - $r ++; - } - return $result; - } - - /** - * Function attachEvents - * - * @access public - * @param eter string $element - * @return string - */ - public function attachEvents ($element) - { - return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); - myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");"; - } -} diff --git a/workflow/engine/classes/XmlForm_Field_ToolBar.php b/workflow/engine/classes/XmlForm_Field_ToolBar.php deleted file mode 100644 index 387758b8b..000000000 --- a/workflow/engine/classes/XmlForm_Field_ToolBar.php +++ /dev/null @@ -1,75 +0,0 @@ -. - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - -/** - * ToolBar - ToolBar -/** - * XmlForm_Field_ToolBar - XmlForm_Field_ToolBar class - * - * @package workflow.engine.ProcessMaker - */class XmlForm_Field_ToolBar extends XmlForm_Field -{ - - public $xmlfile = ''; - public $type = 'toolbar'; - public $toolBar; - public $home = ''; - public $withoutLabel = true; - - /** - * Constructor of the class XmlForm_Field_ToolBar - * - * @param string $xmlNode - * @param string $lang - * @param string $home - * @param string $owner - * @return void - */ - public function XmlForm_Field_ToolBar($xmlNode, $lang = 'en', $home = '', $owner = ' ') - { - parent::XmlForm_Field($xmlNode, $lang, $home, $owner); - $this->home = $home; - } - - /** - * Prints the ToolBar - * - * @param string $value - * @return string - */ - public function render($value) - { - $this->toolBar = new ToolBar($this->xmlfile, $this->home); - $template = PATH_CORE . 'templates/' . $this->type . '.html'; - $out = $this->toolBar->render($template, $scriptCode); - $oHeadPublisher = & headPublisher::getSingleton(); - $oHeadPublisher->addScriptFile($this->toolBar->scriptURL); - $oHeadPublisher->addScriptCode($scriptCode); - return $out; - } -} diff --git a/workflow/engine/classes/Zip_File.php b/workflow/engine/classes/ZipFile.php similarity index 94% rename from workflow/engine/classes/Zip_File.php rename to workflow/engine/classes/ZipFile.php index c265989ed..dbbfd677b 100644 --- a/workflow/engine/classes/Zip_File.php +++ b/workflow/engine/classes/ZipFile.php @@ -1,16 +1,17 @@ archive($name); $this->options['type'] = "zip"; From 2327ebf29b60fd278f24a0316bbf0e23e4096cc7 Mon Sep 17 00:00:00 2001 From: dante Date: Mon, 14 Aug 2017 13:56:22 -0400 Subject: [PATCH 3/3] Mapping in xmlform to classes corrected --- gulliver/system/class.xmlform.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 909198ac6..29216a0a1 100644 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -5516,11 +5516,11 @@ class XmlForm 'suggest' => XmlForm_Field_Suggest::class, 'text' => XmlForm_Field_Text::class, 'textarea' => XmlForm_Field_Textarea::class, - 'textareapm' => XmlForm_Field_TextareaPM::class, - 'textpm' => XmlForm_Field_TextPM::class, + 'textareapm' => XmlFormFieldTextareaPM::class, + 'textpm' => XmlFormFieldTextPM::class, 'title' => XmlForm_Field_Title::class, - 'toolbar' => XmlForm_Field_ToolBar::class, - 'toolbutton' => XmlForm_Field_toolButton::class, + 'toolbar' => XmlFormFieldToolBar::class, + 'toolbutton' => XmlFormFieldtoolButton::class, 'wysiwyg_editor' => XmlForm_Field_WYSIWYG_EDITOR::class, 'xmlform' => XmlForm_Field_Xmlform::class, 'xmlmenu' => XmlForm_Field_XmlMenu::class,