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
@@ -27,22 +29,26 @@
// 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.'"':'') if ($this->home === "public_html") {
.' alt ="'.htmlentities($value,ENT_QUOTES,'utf-8').'"/>'; $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
* @param eter string value * @param eter string value
* @param eter 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,10 +69,12 @@ 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') }
if ($this->strTo === 'LOWER') {
$value = strtolower( $value ); $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) {
@@ -79,18 +84,17 @@ class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText
$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 } 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; 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') { } 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').'"/>' . 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' );
$this->htmlentities( $value , ENT_COMPAT, 'utf-8');
} else { } else {
return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' );
} }
@@ -98,13 +102,14 @@ class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText
/** /**
* Function renderGrid * Function renderGrid
*
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com> * @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
* @access public * @access public
* @param eter array values * @param eter array values
* @param eter 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;
@@ -116,15 +121,15 @@ class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText
$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 } 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; $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') { } elseif ($this->mode === 'view') {
$result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' ); $result[] = $this->htmlentities( $v, ENT_COMPAT, 'utf-8' );
} else { } else {
@@ -137,11 +142,12 @@ class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText
/** /**
* Function attachEvents * Function attachEvents
*
* @access public * @access public
* @param eter 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,37 +159,38 @@ 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
* @param eter string value * @param eter string value
* @param eter 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 } 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; 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') { } 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>'; 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 {
@@ -193,13 +200,14 @@ class XmlForm_Field_TextareaPM extends XmlForm_Field
/** /**
* Function renderGrid * Function renderGrid
*
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com> * @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
* @access public * @access public
* @param eter string values * @param eter string values
* @param eter 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;
@@ -208,21 +216,20 @@ class XmlForm_Field_TextareaPM extends XmlForm_Field
$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') { } elseif ($this->mode === 'view') {
if (stristr( $_SERVER['HTTP_USER_AGENT'], 'iPhone' )) { 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' );
} }
@@ -240,42 +247,45 @@ 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
* @param eter string value * @param eter string value
* @param eter 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') }
if ($this->strTo === 'LOWER') {
$value = strtolower( $value ); $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) {
@@ -285,18 +295,17 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
$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 } 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; 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') { } 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').'"/>' . 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' );
$this->htmlentities( $value , ENT_COMPAT, 'utf-8');
} else { } else {
return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' ); return $this->htmlentities( $value, ENT_COMPAT, 'utf-8' );
} }
@@ -304,13 +313,14 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
/** /**
* Function renderGrid * Function renderGrid
*
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com> * @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
* @access public * @access public
* @param eter array values * @param eter array values
* @param eter 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;
@@ -322,15 +332,15 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
$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 } 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; $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') { } elseif ($this->mode === 'view') {
$result[] = '<p align="' . $this->align . '">' . $this->htmlentities( number_format( $v, 2 ), ENT_COMPAT, 'utf-8' ) . '</p>'; $result[] = '<p align="' . $this->align . '">' . $this->htmlentities( number_format( $v, 2 ), ENT_COMPAT, 'utf-8' ) . '</p>';
} else { } else {
@@ -343,11 +353,12 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
/** /**
* Function attachEvents * Function attachEvents
*
* @access public * @access public
* @param eter 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() . ");";
@@ -356,25 +367,30 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
/** /**
* Function getDynaformsVars * Function getDynaformsVars
*
* @access public * @access public
* @param eter string $sProcessUID * @param eter string $sProcessUID
* @param eter 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 );
} }
@@ -393,9 +409,7 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
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;
} }
@@ -410,11 +424,12 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
/** /**
* Function getGridsVars * Function getGridsVars
*
* @access public * @access public
* @param eter 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 ();
@@ -431,7 +446,8 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
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;
} }
} }
@@ -447,23 +463,23 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
*/ */
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
* @param eter string value * @param eter string value
* @param eter 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;
} }
} }
?>