CODE STYLE class.xmlfield_Image.php and class.xmlfield_InputPM.php

This commit is contained in:
Fernando Ontiveros
2012-10-09 13:43:23 -04:00
parent 264c13737d
commit f07f0d1e7d
2 changed files with 423 additions and 401 deletions

View File

@@ -1,6 +1,8 @@
<?php <?php
/** /**
* class.xmlfield_Image.php * class.xmlfield_Image.php
*
* @package workflow.engine.classes * @package workflow.engine.classes
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
@@ -26,23 +28,27 @@
// DEPRECATED this class is also part of the xmlform package this class will be also removed // DEPRECATED this class is also part of the xmlform package this class will be also removed
// in future releases of pm, its discouraged the inclusion this class in the future from a // in future releases of pm, its discouraged the inclusion this class in the future from a
// external file like this // external file like this
/** /**
*
* @package workflow.engine.classes * @package workflow.engine.classes
*/ */
class XmlForm_Field_Image extends XmlForm_Field class XmlForm_Field_Image extends XmlForm_Field
{ {
var $file = ''; public $file = '';
var $home = 'public_html'; public $home = 'public_html';
var $withoutLabel = false; public $withoutLabel = false;
function render( $value, $owner = null )
public function render ($value, $owner = null)
{ {
$url = G::replaceDataField($this->file, $owner->values); $url = G::replaceDataField( $this->file, $owner->values );
if ($this->home === "methods") $url = G::encryptlink( SYS_URI . $url ); if ($this->home === "methods") {
if ($this->home === "public_html") $url ='/' . $url ; $url = G::encryptlink( SYS_URI . $url );
return '<img src="'.htmlentities( $url, ENT_QUOTES, 'utf-8').'" '.
(($this->style)?'style="'.$this->style.'"':'')
.' alt ="'.htmlentities($value,ENT_QUOTES,'utf-8').'"/>';
} }
if ($this->home === "public_html") {
$url = '/' . $url;
} }
?> return '<img src="' . htmlentities( $url, ENT_QUOTES, 'utf-8' ) . '" ' . (($this->style) ? 'style="' . $this->style . '"' : '') . ' alt ="' . htmlentities( $value, ENT_QUOTES, 'utf-8' ) . '"/>';
}
}

View File

@@ -1,6 +1,8 @@
<?php <?php
/** /**
* class.xmlfield_InputPM.php * class.xmlfield_InputPM.php
*
* @package workflow.engine.classes * @package workflow.engine.classes
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
@@ -27,37 +29,38 @@
class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText
{ {
var $size=15; public $size = 15;
var $maxLength=64; public $maxLength = 64;
var $validate='Any'; public $validate = 'Any';
var $mask = ''; public $mask = '';
var $defaultValue=''; public $defaultValue = '';
var $required=false; public $required = false;
var $dependentFields=''; public $dependentFields = '';
var $linkField=''; public $linkField = '';
//Possible values:(-|UPPER|LOWER|CAPITALIZE) //Possible values:(-|UPPER|LOWER|CAPITALIZE)
var $strTo=''; public $strTo = '';
var $readOnly=false; public $readOnly = false;
var $sqlConnection=0; public $sqlConnection = 0;
var $sql=''; public $sql = '';
var $sqlOption=array(); public $sqlOption = array ();
//Atributes only for grids //Atributes only for grids
var $formula = ''; public $formula = '';
var $function = ''; public $function = '';
var $replaceTags = 0; public $replaceTags = 0;
var $showVars = 0; public $showVars = 0;
var $process = ''; public $process = '';
var $symbol = '@@'; public $symbol = '@@';
/** /**
* Function render * Function render
*
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com> * @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
* @access public * @access public
* @parameter string value * @param eter string value
* @parameter string owner * @param eter string owner
* @return string * @return string
*/ */
function render( $value = NULL , $owner = NULL ) public function render ($value = null, $owner = null)
{ {
//$this->executeSQL(); //$this->executeSQL();
//if (isset($this->sqlOption)) { //if (isset($this->sqlOption)) {
@@ -66,82 +69,85 @@ class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText
// if (isset($firstElement)) $value = $firstElement; // if (isset($firstElement)) $value = $firstElement;
//} //}
//NOTE: string functions must be in G class //NOTE: string functions must be in G class
if ($this->strTo==='UPPER') if ($this->strTo === 'UPPER') {
$value = strtoupper($value); $value = strtoupper( $value );
if ($this->strTo==='LOWER') }
$value = strtolower($value); if ($this->strTo === 'LOWER') {
$value = strtolower( $value );
}
//if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value);
$onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values );
if ($this->replaceTags == 1) { if ($this->replaceTags == 1) {
$value = G::replaceDataField( $value, $owner->values ); $value = G::replaceDataField( $value, $owner->values );
} }
if ($this->showVars == 1) { if ($this->showVars == 1) {
$this->process = G::replaceDataField($this->process, $owner->values ); $this->process = G::replaceDataField( $this->process, $owner->values );
//$sShowVars = '&nbsp;<a href="#" onclick="showDynaformsFormVars(\'form['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;">' . $this->symbol . '</a>'; //$sShowVars = '&nbsp;<a href="#" onclick="showDynaformsFormVars(\'form['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;">' . $this->symbol . '</a>';
$sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>'; $sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form[' . $this->name . ']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>';
} } else {
else {
$sShowVars = ''; $sShowVars = '';
} }
if ($this->mode==='edit') { if ($this->mode === 'edit') {
if ($this->readOnly) if ($this->readOnly) {
return '<input class="module_app_input___gray" id="form['.$this->name.']" name="form['.$this->name.']" type ="text" size="'.$this->size.'" maxlength="'.$this->maxLength.'" value=\''.$this->htmlentities( $value , ENT_COMPAT, 'utf-8').'\' readOnly="readOnly" style="'.htmlentities( $this->style , ENT_COMPAT, 'utf-8').'" onkeypress="'.htmlentities( $onkeypress , ENT_COMPAT, 'utf-8').'"/>' . $sShowVars; return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->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 '<input class="module_app_input___gray" id="form['.$this->name.']" name="form['.$this->name.']" type ="text" size="'.$this->size.'" maxlength="'.$this->maxLength.'" value=\''.$this->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 '<input class="module_app_input___gray" id="form['.$this->name.']" name="form['.$this->name.']" type ="text" size="'.$this->size.'" maxlength="'.$this->maxLength.'" value=\''.$this->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 { } else {
return $this->htmlentities( $value , ENT_COMPAT, 'utf-8'); return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->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 '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->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 * Function renderGrid
*
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com> * @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
* @access public * @access public
* @parameter array values * @param eter array values
* @parameter string owner * @param eter string owner
* @return string * @return string
*/ */
function renderGrid( $values=array() , $owner ) public function renderGrid ($values = array(), $owner)
{ {
$result=array(); $result = array ();
$r=1; $r = 1;
foreach($values as $v) { foreach ($values as $v) {
if ($this->replaceTags == 1) { if ($this->replaceTags == 1) {
$v = G::replaceDataField( $v, $owner->values ); $v = G::replaceDataField( $v, $owner->values );
} }
if ($this->showVars == 1) { if ($this->showVars == 1) {
$this->process = G::replaceDataField($this->process, $owner->values ); $this->process = G::replaceDataField( $this->process, $owner->values );
//$sShowVars = '&nbsp;<a href="#" onclick="showDynaformsFormVars(\'form['.$owner->name .']['.$r.']['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;">' . $this->symbol . '</a>'; //$sShowVars = '&nbsp;<a href="#" onclick="showDynaformsFormVars(\'form['.$owner->name .']['.$r.']['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;">' . $this->symbol . '</a>';
$sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form['.$owner->name .']['.$r.']['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>'; $sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form[' . $owner->name . '][' . $r . '][' . $this->name . ']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>';
} } else {
else {
$sShowVars = ''; $sShowVars = '';
} }
if ($this->mode==='edit') { if ($this->mode === 'edit') {
if ($this->readOnly) if ($this->readOnly) {
$result[] = '<input class="module_app_input___gray" id="form['. $owner->name .']['.$r.']['.$this->name.']" name="form['. $owner->name .']['.$r.']['.$this->name.']" type ="text" size="'.$this->size.'" maxlength="'.$this->maxLength.'" value="'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'" readOnly="readOnly" style="'.htmlentities( $this->style , ENT_COMPAT, 'utf-8').'"/>' . $sShowVars; $result[] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '" readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars;
else
$result[] = '<input class="module_app_input___gray" id="form['. $owner->name .']['.$r.']['.$this->name.']" name="form['. $owner->name .']['.$r.']['.$this->name.']" type ="text" size="'.$this->size.'" maxlength="'.$this->maxLength.'" value="'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'" style="'.htmlentities( $this->style , ENT_COMPAT, 'utf-8').'"/>' . $sShowVars;
} elseif ($this->mode==='view') {
$result[] = $this->htmlentities( $v , ENT_COMPAT, 'utf-8');
} else { } else {
$result[] = $this->htmlentities( $v , ENT_COMPAT, 'utf-8'); $result[] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars;
} }
$r++; } elseif ($this->mode === 'view') {
$result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' );
} else {
$result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' );
}
$r ++;
} }
return $result; return $result;
} }
/** /**
* Function attachEvents * Function attachEvents
*
* @access public * @access public
* @parameter string $element * @param eter string $element
* @return string * @return string
*/ */
function attachEvents($element) public function attachEvents ($element)
{ {
return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}');
myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");"; myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");";
@@ -153,83 +159,84 @@ class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText
*/ */
class XmlForm_Field_TextareaPM extends XmlForm_Field class XmlForm_Field_TextareaPM extends XmlForm_Field
{ {
var $rows = 12; public $rows = 12;
var $cols = 40; public $cols = 40;
var $required = false; public $required = false;
var $readOnly = false; public $readOnly = false;
var $wrap = 'OFF'; public $wrap = 'OFF';
var $showVars = 0; public $showVars = 0;
var $process = ''; public $process = '';
var $symbol = '@@'; public $symbol = '@@';
/** /**
* Function render * Function render
*
* @author Julio Cesar Laura Avendao <juliocesar@colosa.com> * @author Julio Cesar Laura Avendao <juliocesar@colosa.com>
* @access public * @access public
* @parameter string value * @param eter string value
* @parameter string owner * @param eter string owner
* @return string * @return string
*/ */
function render( $value = NULL, $owner ) public function render ($value = null, $owner)
{ {
if ($this->showVars == 1) { if ($this->showVars == 1) {
$this->process = G::replaceDataField($this->process, $owner->values ); $this->process = G::replaceDataField( $this->process, $owner->values );
$sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>'; $sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form[' . $this->name . ']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>';
} } else {
else {
$sShowVars = ''; $sShowVars = '';
} }
if ($this->mode==='edit') { if ($this->mode === 'edit') {
if ($this->readOnly) if ($this->readOnly) {
return '<textarea id="form['.$this->name.']" name="form['.$this->name.']" cols="'.$this->cols.'" rows="'.$this->rows.'" style="'.$this->style.'" wrap="'.htmlentities($this->wrap,ENT_QUOTES,'UTF-8').'" class="FormTextPM" readOnly>'.$this->htmlentities( $value ,ENT_COMPAT,'utf-8').'</textarea>' . $sShowVars; return '<textarea id="form[' . $this->name . ']" name="form[' . $this->name . ']" cols="' . $this->cols . '" rows="' . $this->rows . '" style="' . $this->style . '" wrap="' . htmlentities( $this->wrap, ENT_QUOTES, 'UTF-8' ) . '" class="FormTextPM" readOnly>' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '</textarea>' . $sShowVars;
else
return '<textarea id="form['.$this->name.']" name="form['.$this->name.']" cols="'.$this->cols.'" rows="'.$this->rows.'" style="'.$this->style.'" wrap="'.htmlentities($this->wrap,ENT_QUOTES,'UTF-8').'" class="FormTextPM" >'.$this->htmlentities( $value ,ENT_COMPAT,'utf-8').'</textarea>' . $sShowVars;
} elseif ($this->mode==='view') {
return '<textarea id="form['.$this->name.']" name="form['.$this->name.']" cols="'.$this->cols.'" rows="'.$this->rows.'" readOnly style="border:0px;backgroud-color:inherit;'.$this->style.'" wrap="'.htmlentities($this->wrap,ENT_QUOTES,'UTF-8').'" class="FormTextPM" >'.$this->htmlentities( $value ,ENT_COMPAT,'utf-8').'</textarea>';
} else { } else {
return '<textarea id="form['.$this->name.']" name="form['.$this->name.']" cols="'.$this->cols.'" rows="'.$this->rows.'" style="'.$this->style.'" wrap="'.htmlentities($this->wrap,ENT_QUOTES,'UTF-8').'" class="FormTextArea" >'.$this->htmlentities( $value ,ENT_COMPAT,'utf-8').'</textarea>'; return '<textarea id="form[' . $this->name . ']" name="form[' . $this->name . ']" cols="' . $this->cols . '" rows="' . $this->rows . '" style="' . $this->style . '" wrap="' . htmlentities( $this->wrap, ENT_QUOTES, 'UTF-8' ) . '" class="FormTextPM" >' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '</textarea>' . $sShowVars;
}
} elseif ($this->mode === 'view') {
return '<textarea id="form[' . $this->name . ']" name="form[' . $this->name . ']" cols="' . $this->cols . '" rows="' . $this->rows . '" readOnly style="border:0px;backgroud-color:inherit;' . $this->style . '" wrap="' . htmlentities( $this->wrap, ENT_QUOTES, 'UTF-8' ) . '" class="FormTextPM" >' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '</textarea>';
} else {
return '<textarea id="form[' . $this->name . ']" name="form[' . $this->name . ']" cols="' . $this->cols . '" rows="' . $this->rows . '" style="' . $this->style . '" wrap="' . htmlentities( $this->wrap, ENT_QUOTES, 'UTF-8' ) . '" class="FormTextArea" >' . $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ) . '</textarea>';
} }
} }
/** /**
* Function renderGrid * Function renderGrid
*
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com> * @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
* @access public * @access public
* @parameter string values * @param eter string values
* @parameter string owner * @param eter string owner
* @return string * @return string
*/ */
function renderGrid( $values = NULL , $owner ) public function renderGrid ($values = null, $owner)
{ {
$result=array(); $result = array ();
$r=1; $r = 1;
foreach($values as $v) { foreach ($values as $v) {
if ($this->showVars == 1) { if ($this->showVars == 1) {
$this->process = G::replaceDataField($this->process, $owner->values ); $this->process = G::replaceDataField( $this->process, $owner->values );
//$sShowVars = '&nbsp;<a href="#" onclick="showDynaformsFormVars(\'form['.$owner->name .']['.$r.']['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;">' . $this->symbol . '</a>'; //$sShowVars = '&nbsp;<a href="#" onclick="showDynaformsFormVars(\'form['.$owner->name .']['.$r.']['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;">' . $this->symbol . '</a>';
$sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form['.$owner->name .']['.$r.']['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>'; $sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form[' . $owner->name . '][' . $r . '][' . $this->name . ']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>';
} } else {
else {
$sShowVars = ''; $sShowVars = '';
} }
if ($this->mode==='edit') { if ($this->mode === 'edit') {
if ($this->readOnly) if ($this->readOnly) {
$result[] = '<input class="module_app_input___gray" id="form['. $owner->name .']['.$r.']['.$this->name.']" name="form['. $owner->name .']['.$r.']['.$this->name.']" type ="text" size="'.$this->size.'" maxlength="'.$this->maxLength.'" value=\''.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'\' readOnly="readOnly"/>' . $sShowVars; $result[] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly"/>' . $sShowVars;
else } else {
$result[] = '<input class="module_app_input___gray" id="form['. $owner->name .']['.$r.']['.$this->name.']" name="form['. $owner->name .']['.$r.']['.$this->name.']" type ="text" size="'.$this->size.'" maxlength="'.$this->maxLength.'" value=\''.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'\' />' . $sShowVars; $result[] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '\' />' . $sShowVars;
} elseif ($this->mode==='view') { }
if(stristr($_SERVER['HTTP_USER_AGENT'], 'iPhone')){ } elseif ($this->mode === 'view') {
if (stristr( $_SERVER['HTTP_USER_AGENT'], 'iPhone' )) {
//$result[] = '<div style="overflow:hidden;height:25px;padding:0px;margin:0px;">'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'</div>'; //$result[] = '<div style="overflow:hidden;height:25px;padding:0px;margin:0px;">'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'</div>';
$result[] = $this->htmlentities( $v , ENT_COMPAT, 'utf-8'); $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' );
} } else {
else{
//$result[] = '<div style="overflow:hidden;width:inherit;height:2em;padding:0px;margin:0px;">'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'</div>'; //$result[] = '<div style="overflow:hidden;width:inherit;height:2em;padding:0px;margin:0px;">'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'</div>';
$result[] = $this->htmlentities( $v , ENT_COMPAT, 'utf-8'); $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' );
} }
} else{ } else {
$result[] = $this->htmlentities( $v , ENT_COMPAT, 'utf-8'); $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' );
} }
$r++; $r ++;
} }
return $result; return $result;
} }
@@ -240,162 +247,169 @@ class XmlForm_Field_TextareaPM extends XmlForm_Field
*/ */
class XmlForm_Field_hours extends XmlForm_Field_SimpleText class XmlForm_Field_hours extends XmlForm_Field_SimpleText
{ {
var $size = 15; public $size = 15;
var $maxLength = 64; public $maxLength = 64;
var $validate = 'Any'; public $validate = 'Any';
var $mask = ''; public $mask = '';
var $defaultValue = ''; public $defaultValue = '';
var $required = false; public $required = false;
var $dependentFields= ''; public $dependentFields = '';
var $linkField = ''; public $linkField = '';
//Possible values:(-|UPPER|LOWER|CAPITALIZE) //Possible values:(-|UPPER|LOWER|CAPITALIZE)
var $strTo = ''; public $strTo = '';
var $readOnly = false; public $readOnly = false;
var $sqlConnection = 0; public $sqlConnection = 0;
var $sql = ''; public $sql = '';
var $sqlOption = array(); public $sqlOption = array ();
//Atributes only for grids //Atributes only for grids
var $formula = ''; public $formula = '';
var $function = ''; public $function = '';
var $replaceTags = 0; public $replaceTags = 0;
var $showVars = 0; public $showVars = 0;
var $process = ''; public $process = '';
var $symbol = '@@'; public $symbol = '@@';
/** /**
* Function render * Function render
*
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com> * @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
* @access public * @access public
* @parameter string value * @param eter string value
* @parameter string owner * @param eter string owner
* @return string * @return string
*/ */
function render( $value = NULL , $owner = NULL ) public function render ($value = null, $owner = null)
{ {
if ($this->strTo==='UPPER') if ($this->strTo === 'UPPER') {
$value = strtoupper($value); $value = strtoupper( $value );
if ($this->strTo==='LOWER') }
$value = strtolower($value); if ($this->strTo === 'LOWER') {
$value = strtolower( $value );
}
//if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value); //if ($this->strTo==='CAPITALIZE') $value = strtocapitalize($value);
$onkeypress = G::replaceDataField( $this->onkeypress, $owner->values ); $onkeypress = G::replaceDataField( $this->onkeypress, $owner->values );
if ($this->replaceTags == 1) { if ($this->replaceTags == 1) {
$value = G::replaceDataField( $value, $owner->values ); $value = G::replaceDataField( $value, $owner->values );
} }
if ($this->showVars == 1) { if ($this->showVars == 1) {
$this->process = G::replaceDataField($this->process, $owner->values ); $this->process = G::replaceDataField( $this->process, $owner->values );
//$sShowVars = '&nbsp;<a href="#" onclick="showDynaformsFormVars(\'form['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;">' . $this->symbol . '</a>'; //$sShowVars = '&nbsp;<a href="#" onclick="showDynaformsFormVars(\'form['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;">' . $this->symbol . '</a>';
$sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>'; $sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form[' . $this->name . ']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>';
} } else {
else {
$sShowVars = ''; $sShowVars = '';
} }
if ($this->mode==='edit') { if ($this->mode === 'edit') {
if ($this->readOnly) if ($this->readOnly) {
return '<input class="module_app_input___gray" id="form['.$this->name.']" name="form['.$this->name.']" type ="text" size="'.$this->size.'" maxlength="'.$this->maxLength.'" value=\''.$this->htmlentities( $value , ENT_COMPAT, 'utf-8').'\' readOnly="readOnly" style="'.htmlentities( $this->style , ENT_COMPAT, 'utf-8').'" onkeypress="'.htmlentities( $onkeypress , ENT_COMPAT, 'utf-8').'"/>' . $sShowVars; return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->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 '<input class="module_app_input___gray" id="form['.$this->name.']" name="form['.$this->name.']" type ="text" size="'.$this->size.'" maxlength="'.$this->maxLength.'" value=\''.$this->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 '<input class="module_app_input___gray" id="form['.$this->name.']" name="form['.$this->name.']" type ="text" size="'.$this->size.'" maxlength="'.$this->maxLength.'" value=\''.$this->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 { } else {
return $this->htmlentities( $value , ENT_COMPAT, 'utf-8'); return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->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 '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value=\'' . $this->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 * Function renderGrid
*
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com> * @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
* @access public * @access public
* @parameter array values * @param eter array values
* @parameter string owner * @param eter string owner
* @return string * @return string
*/ */
function renderGrid( $values=array() , $owner ) public function renderGrid ($values = array(), $owner)
{ {
$result=array(); $result = array ();
$r=1; $r = 1;
foreach($values as $v) { foreach ($values as $v) {
if ($this->replaceTags == 1) { if ($this->replaceTags == 1) {
$v = G::replaceDataField( $v, $owner->values ); $v = G::replaceDataField( $v, $owner->values );
} }
if ($this->showVars == 1) { if ($this->showVars == 1) {
$this->process = G::replaceDataField($this->process, $owner->values ); $this->process = G::replaceDataField( $this->process, $owner->values );
//$sShowVars = '&nbsp;<a href="#" onclick="showDynaformsFormVars(\'form['.$owner->name .']['.$r.']['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;">' . $this->symbol . '</a>'; //$sShowVars = '&nbsp;<a href="#" onclick="showDynaformsFormVars(\'form['.$owner->name .']['.$r.']['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;">' . $this->symbol . '</a>';
$sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form['.$owner->name .']['.$r.']['.$this->name.']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>'; $sShowVars = '&nbsp;<input type="button" value="' . $this->symbol . '" onclick="showDynaformsFormVars(\'form[' . $owner->name . '][' . $r . '][' . $this->name . ']\', \'../controls/varsAjax\', \'' . $this->process . '\', \'' . $this->symbol . '\');return false;"/>';
} } else {
else {
$sShowVars = ''; $sShowVars = '';
} }
if ($this->mode==='edit') { if ($this->mode === 'edit') {
if ($this->readOnly) if ($this->readOnly) {
$result[] = '<input class="module_app_input___gray" id="form['. $owner->name .']['.$r.']['.$this->name.']" name="form['. $owner->name .']['.$r.']['.$this->name.']" type ="text" size="'.$this->size.'" maxlength="'.$this->maxLength.'" value="'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'" readOnly="readOnly" style="'.htmlentities( $this->style , ENT_COMPAT, 'utf-8').'"/>' . $sShowVars; $result[] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '" readOnly="readOnly" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars;
else
$result[] = '<input class="module_app_input___gray" id="form['. $owner->name .']['.$r.']['.$this->name.']" name="form['. $owner->name .']['.$r.']['.$this->name.']" type ="text" size="'.$this->size.'" maxlength="'.$this->maxLength.'" value="'.$this->htmlentities( $v , ENT_COMPAT, 'utf-8').'" style="'.htmlentities( $this->style , ENT_COMPAT, 'utf-8').'"/>' . $sShowVars;
} elseif ($this->mode==='view') {
$result[] = '<p align="'.$this->align.'">'.$this->htmlentities( number_format($v, 2), ENT_COMPAT, 'utf-8').'</p>';
} else { } else {
$result[] = '<p align="'.$this->align.'">'.$this->htmlentities( number_format($v, 2), ENT_COMPAT, 'utf-8').'</p>'; $result[] = '<input class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" type ="text" size="' . $this->size . '" maxlength="' . $this->maxLength . '" value="' . $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ) . '" style="' . htmlentities( $this->style, ENT_COMPAT, 'utf-8' ) . '"/>' . $sShowVars;
} }
$r++; } elseif ($this->mode === 'view') {
$result[] = '<p align="' . $this->align . '">' . $this->htmlentities( number_format( $v, 2 ), ENT_COMPAT, 'utf-8' ) . '</p>';
} else {
$result[] = '<p align="' . $this->align . '">' . $this->htmlentities( number_format( $v, 2 ), ENT_COMPAT, 'utf-8' ) . '</p>';
}
$r ++;
} }
return $result; return $result;
} }
/** /**
* Function attachEvents * Function attachEvents
*
* @access public * @access public
* @parameter string $element * @param eter string $element
* @return string * @return string
*/ */
function attachEvents($element) public function attachEvents ($element)
{ {
return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}'); return "myForm.aElements[i] = new G_Text(myForm, $element,'{$this->name}');
myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");"; myForm.aElements[i].setAttributes(" . $this->getAttributes() . ");";
} }
} }
/** /**
* Function getDynaformsVars * Function getDynaformsVars
*
* @access public * @access public
* @parameter string $sProcessUID * @param eter string $sProcessUID
* @parameter boolean $bSystemVars * @param eter boolean $bSystemVars
* @return array * @return array
*/ */
function getDynaformsVars($sProcessUID, $bSystemVars = true, $bIncMulSelFields = 0) public function getDynaformsVars ($sProcessUID, $bSystemVars = true, $bIncMulSelFields = 0)
{ {
$aFields = array(); $aFields = array ();
$aFieldsNames = array(); $aFieldsNames = array ();
if ($bSystemVars) { if ($bSystemVars) {
$aAux = G::getSystemConstants(); $aAux = G::getSystemConstants();
foreach ($aAux as $sName => $sValue) { foreach ($aAux as $sName => $sValue) {
$aFields[] = array('sName' => $sName, 'sType' => 'system', 'sLabel'=> 'System variable'); $aFields[] = array ('sName' => $sName,'sType' => 'system','sLabel' => 'System variable'
);
} }
//we're adding the ping variable to the system list //we're adding the ping variable to the system list
$aFields[] = array('sName' => 'PIN', 'sType' => 'system', 'sLabel' => 'System variable'); $aFields[] = array ('sName' => 'PIN','sType' => 'system','sLabel' => 'System variable'
);
} }
$aInvalidTypes = array('title', 'subtitle', 'link', 'file', 'button', 'reset', 'submit', 'javascript'); $aInvalidTypes = array ('title','subtitle','link','file','button','reset','submit','javascript'
$aMultipleSelectionFields = array('listbox', 'checkgroup', 'grid'); );
$aMultipleSelectionFields = array ('listbox','checkgroup','grid'
);
if ($bIncMulSelFields != 0) { if ($bIncMulSelFields != 0) {
$aInvalidTypes = array_merge($aInvalidTypes, $aMultipleSelectionFields); $aInvalidTypes = array_merge( $aInvalidTypes, $aMultipleSelectionFields );
} }
require_once 'classes/model/Dynaform.php'; require_once 'classes/model/Dynaform.php';
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn(DynaformPeer::DYN_FILENAME); $oCriteria->addSelectColumn( DynaformPeer::DYN_FILENAME );
$oCriteria->add(DynaformPeer::PRO_UID, $sProcessUID); $oCriteria->add( DynaformPeer::PRO_UID, $sProcessUID );
$oCriteria->add(DynaformPeer::DYN_TYPE, 'xmlform'); $oCriteria->add( DynaformPeer::DYN_TYPE, 'xmlform' );
$oDataset = DynaformPeer::doSelectRS($oCriteria); $oDataset = DynaformPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
if (file_exists(PATH_DYNAFORM . PATH_SEP . $aRow['DYN_FILENAME'] . '.xml')) { if (file_exists( PATH_DYNAFORM . PATH_SEP . $aRow['DYN_FILENAME'] . '.xml' )) {
$G_FORM = new Form($aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG); $G_FORM = new Form( $aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG );
if (($G_FORM->type == 'xmlform') || ($G_FORM->type == '')) { if (($G_FORM->type == 'xmlform') || ($G_FORM->type == '')) {
foreach($G_FORM->fields as $k => $v) { foreach ($G_FORM->fields as $k => $v) {
if (!in_array($v->type, $aInvalidTypes)) { if (! in_array( $v->type, $aInvalidTypes )) {
if (!in_array($k, $aFieldsNames)) { if (! in_array( $k, $aFieldsNames )) {
$aFields[] = array('sName' => $k, $aFields[] = array ('sName' => $k,'sType' => $v->type,'sLabel' => ($v->type != 'grid' ? $v->label : '[ ' . G::LoadTranslation( 'ID_GRID' ) . ' ]')
'sType' => $v->type,
'sLabel'=> ($v->type != 'grid' ? $v->label : '[ ' . G::LoadTranslation('ID_GRID') . ' ]')
); );
$aFieldsNames[] = $k; $aFieldsNames[] = $k;
} }
@@ -406,32 +420,34 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
$oDataset->next(); $oDataset->next();
} }
return $aFields; return $aFields;
} }
/** /**
* Function getGridsVars * Function getGridsVars
*
* @access public * @access public
* @parameter string $sProcessUID * @param eter string $sProcessUID
* @return array * @return array
*/ */
function getGridsVars($sProcessUID) public function getGridsVars ($sProcessUID)
{ {
$aFields = array(); $aFields = array ();
$aFieldsNames = array(); $aFieldsNames = array ();
require_once 'classes/model/Dynaform.php'; require_once 'classes/model/Dynaform.php';
$oCriteria = new Criteria('workflow'); $oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn(DynaformPeer::DYN_FILENAME); $oCriteria->addSelectColumn( DynaformPeer::DYN_FILENAME );
$oCriteria->add(DynaformPeer::PRO_UID, $sProcessUID); $oCriteria->add( DynaformPeer::PRO_UID, $sProcessUID );
$oDataset = DynaformPeer::doSelectRS($oCriteria); $oDataset = DynaformPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next(); $oDataset->next();
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
$G_FORM = new Form($aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG); $G_FORM = new Form( $aRow['DYN_FILENAME'], PATH_DYNAFORM, SYS_LANG );
if ($G_FORM->type == 'xmlform') { if ($G_FORM->type == 'xmlform') {
foreach($G_FORM->fields as $k => $v) { foreach ($G_FORM->fields as $k => $v) {
if ($v->type == 'grid') { if ($v->type == 'grid') {
if (!in_array($k, $aFieldsNames)) { if (! in_array( $k, $aFieldsNames )) {
$aFields[] = array('sName' => $k, 'sXmlForm' => str_replace($sProcessUID . '/', '', $v->xmlGrid)); $aFields[] = array ('sName' => $k,'sXmlForm' => str_replace( $sProcessUID . '/', '', $v->xmlGrid )
);
$aFieldsNames[] = $k; $aFieldsNames[] = $k;
} }
} }
@@ -440,30 +456,30 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
$oDataset->next(); $oDataset->next();
} }
return $aFields; return $aFields;
} }
/** /**
* Class XmlForm_Field_CheckBoxTable * Class XmlForm_Field_CheckBoxTable
*/ */
class XmlForm_Field_CheckBoxTable extends XmlForm_Field_Checkbox class XmlForm_Field_CheckBoxTable extends XmlForm_Field_Checkbox
{ {
/** /**
* Function render * Function render
*
* @author The Answer * @author The Answer
* @access public * @access public
* @parameter string value * @param eter string value
* @parameter string owner * @param eter string owner
* @return string * @return string
*/ */
function render( $value = NULL , $owner = NULL ) public function render ($value = null, $owner = null)
{ {
//$optionName = $owner->values['USR_UID']; //$optionName = $owner->values['USR_UID'];
$optionName = $value; $optionName = $value;
$onclick = (($this->onclick)? ' onclick="' . G::replaceDataField( $this->onclick, $owner->values ) . '" ' : ''); $onclick = (($this->onclick) ? ' onclick="' . G::replaceDataField( $this->onclick, $owner->values ) . '" ' : '');
$html ='<input class="FormCheck" id="form['.$this->name.']['.$optionName.']" name="form['.$this->name. $html = '<input class="FormCheck" id="form[' . $this->name . '][' . $optionName . ']" name="form[' . $this->name . '][' . $optionName . ']" type=\'checkbox\' value="' . $value . '"' . $onclick . '> <span class="FormCheck"></span></input>';
']['.$optionName.']" type=\'checkbox\' value="'. $value . '"' . $onclick .
'> <span class="FormCheck"></span></input>';
return $html; return $html;
} }
} }
?>