BUG 8745 When defining Subprocess properties, grid, listbox, file and ...

- These fields are ommited when the list is generated
- An optional parameter was added, which if it is on "1" includes multiple selection fieds: such as listbox, checkgroup and grid
- File field can't be included becuase it's necessary to define first how files will be copied if we decide to include it later
This commit is contained in:
Julio Cesar Laura
2012-04-02 15:34:34 -04:00
parent 6d752a7e42
commit 1ccc82e440
3 changed files with 28 additions and 26 deletions

View File

@@ -21,10 +21,10 @@
* *
* For more information, contact Colosa Inc, 2566 Le Jeune Rd., * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
* @package workflow.engine.classes * @package workflow.engine.classes
*/ */
class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText
{ {
var $size=15; var $size=15;
@@ -48,7 +48,7 @@ class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText
var $showVars = 0; var $showVars = 0;
var $process = ''; var $process = '';
var $symbol = '@@'; var $symbol = '@@';
/** /**
* Function render * Function render
* @author Julio Cesar Laura Avendano <juliocesar@colosa.com> * @author Julio Cesar Laura Avendano <juliocesar@colosa.com>
@@ -66,9 +66,9 @@ 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 );
@@ -95,7 +95,7 @@ class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText
return $this->htmlentities( $value , ENT_COMPAT, 'utf-8'); 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>
@@ -141,7 +141,7 @@ class XmlForm_Field_TextPM extends XmlForm_Field_SimpleText
* @parameter string $element * @parameter string $element
* @return string * @return string
*/ */
function attachEvents($element) 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() . ");";
@@ -161,7 +161,7 @@ class XmlForm_Field_TextareaPM extends XmlForm_Field
var $showVars = 0; var $showVars = 0;
var $process = ''; var $process = '';
var $symbol = '@@'; var $symbol = '@@';
/** /**
* Function render * Function render
* @author Julio Cesar Laura Avendao <juliocesar@colosa.com> * @author Julio Cesar Laura Avendao <juliocesar@colosa.com>
@@ -190,7 +190,7 @@ class XmlForm_Field_TextareaPM extends XmlForm_Field
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="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>
@@ -272,9 +272,9 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
*/ */
function render( $value = NULL , $owner = NULL ) 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 );
@@ -301,7 +301,7 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
return $this->htmlentities( $value , ENT_COMPAT, 'utf-8'); 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>
@@ -347,7 +347,7 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
* @parameter string $element * @parameter string $element
* @return string * @return string
*/ */
function attachEvents($element) 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() . ");";
@@ -361,7 +361,7 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
* @parameter boolean $bSystemVars * @parameter boolean $bSystemVars
* @return array * @return array
*/ */
function getDynaformsVars($sProcessUID, $bSystemVars = true) function getDynaformsVars($sProcessUID, $bSystemVars = true, $bIncMulSelFields = false)
{ {
$aFields = array(); $aFields = array();
$aFieldsNames = array(); $aFieldsNames = array();
@@ -373,6 +373,11 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
//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');
$aMultipleSelectionFields = array('listbox', 'checkgroup', 'grid');
if (!$bIncMulSelFields) {
$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);
@@ -386,10 +391,7 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
$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 (($v->type != 'title') && ($v->type != 'subtitle') && ($v->type != 'link') && if (!in_array($v->type, $aInvalidTypes)) {
($v->type != 'file') && ($v->type != 'button') && ($v->type != 'reset') &&
($v->type != 'submit') && ($v->type != 'listbox') && ($v->type != 'checkgroup') &&
($v->type != 'grid') && ($v->type != 'javascript')) {
if (!in_array($k, $aFieldsNames)) { if (!in_array($k, $aFieldsNames)) {
$aFields[] = array('sName' => $k, $aFields[] = array('sName' => $k,
'sType' => $v->type, 'sType' => $v->type,
@@ -412,7 +414,7 @@ class XmlForm_Field_hours extends XmlForm_Field_SimpleText
* @parameter string $sProcessUID * @parameter string $sProcessUID
* @return array * @return array
*/ */
function getGridsVars($sProcessUID) function getGridsVars($sProcessUID)
{ {
$aFields = array(); $aFields = array();
$aFieldsNames = array(); $aFieldsNames = array();

View File

@@ -23,7 +23,7 @@
* *
*/ */
G::LoadClass('xmlfield_InputPM'); G::LoadClass('xmlfield_InputPM');
$aFields = getDynaformsVars($_POST['sProcess']); $aFields = getDynaformsVars($_POST['sProcess'], true, isset($_POST['bIncMulSelFields']) ? (boolean)$_POST['bIncMulSelFields'] : false);
$sHTML = '<select name="_Var_Form_" id="_Var_Form_" size="' . count($aFields) . '" style="width:100%;' . (! isset($_POST['sNoShowLeyend']) ? 'height:50%;' : '') . '" ondblclick="insertFormVar(\'' . $_POST['sFieldName'] . '\', this.value);">'; $sHTML = '<select name="_Var_Form_" id="_Var_Form_" size="' . count($aFields) . '" style="width:100%;' . (! isset($_POST['sNoShowLeyend']) ? 'height:50%;' : '') . '" ondblclick="insertFormVar(\'' . $_POST['sFieldName'] . '\', this.value);">';
foreach ( $aFields as $aField ) { foreach ( $aFields as $aField ) {

View File

@@ -89,7 +89,7 @@ var processes_subProcessSave = function(oForm) {
var grid2 = getField('grid2'); var grid2 = getField('grid2');
var SUBTITLE1 = getField('SUBTITLE1'); var SUBTITLE1 = getField('SUBTITLE1');
var SUBTITLE2 = getField('SUBTITLE2'); var SUBTITLE2 = getField('SUBTITLE2');
if(getField('SP_SYNCHRONOUS').value==1) if(getField('SP_SYNCHRONOUS').value==1)
{ showRowById('grid1'); { showRowById('grid1');
showRowById('grid2'); showRowById('grid2');
@@ -97,11 +97,11 @@ var processes_subProcessSave = function(oForm) {
showRowById('SUBTITLE2'); showRowById('SUBTITLE2');
} }
else else
{ {
hideRowById('SUBTITLE2'); hideRowById('SUBTITLE2');
hideRowById(grid2); hideRowById(grid2);
}*/ }*/
//}; //};
@@ -135,7 +135,7 @@ var showDynaformsFormVars = function(sFieldName, sAjaxServer, sProcess, sSymbol)
oRPC = new leimnud.module.rpc.xmlhttp({ oRPC = new leimnud.module.rpc.xmlhttp({
url : sAjaxServer, url : sAjaxServer,
method: 'POST', method: 'POST',
args : 'sFieldName=' + sFieldName + '&sProcess=' + sProcess + '&sSymbol=' + sSymbol + '&sNoShowLeyend=1' args : 'sFieldName=' + sFieldName + '&sProcess=' + sProcess + '&sSymbol=' + sSymbol + '&sNoShowLeyend=1&bIncMulSelFields=1'
}); });
oRPC.callback = function(oRPC) { oRPC.callback = function(oRPC) {
_oVarsPanel_.loader.hide(); _oVarsPanel_.loader.hide();
@@ -170,4 +170,4 @@ function cancel(){
} }
]]></JS> ]]></JS>
</dynaForm> </dynaForm>