BUG 6593 6284 6607 6574 6338 5457 SOLVED. Related to masks and grids

This commit is contained in:
Enrique Ponce De Leon
2011-04-05 19:04:32 -04:00
parent ef969ff36f
commit 29d065f9f1
8 changed files with 2106 additions and 1902 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -94,6 +94,7 @@ var G_Grid = function(oForm, sGridName){
///////////////////////////////////////////////////////////////////////
this.setDependents = function(iRow, me, theDependentFields, sw) {
//alert('Row:' + iRow + ' me: ' + me.name + ' DP: ' + theDependentFields);
var i;
var dependentFields = theDependentFields || '';
dependentFields = dependentFields.split(',');
@@ -158,6 +159,29 @@ var G_Grid = function(oForm, sGridName){
////////////////////////////////////////////////////////////////////////
this.cloneInput = function(oNewObject){
var newField;
var txt = oNewObject.parentNode.innerHTML;
var xClass = 'module_app_input___gray';
txt = txt.replace('INPUT','');
txt = txt.replace('<','');
txt = txt.replace('/>','');
txt = txt.replace('>','');
aTxt = txt.split(' ');
newField = document.createElement('<INPUT id="' + oNewObject.id + '" name="' + oNewObject.id + '" class=' + xClass + ' >');
for (var a=0; a < aTxt.length; a++){
if (aTxt[a].indexOf('=')>0){
aVals = aTxt[a].split('=');
if (aVals[0] != 'id' && aVals[0] != 'name' && aVals[0] != 'class'){
newField.setAttribute(aVals[0], aVals[1].replace('"','').replace('"',''));
}
}
}
return newField;
};
this.addGridRow = function() {
var i, aObjects, aDatePicker;
var defaultValue = '';
@@ -186,11 +210,11 @@ var G_Grid = function(oForm, sGridName){
break;
default:
eNodeName = aCells[i].innerHTML.substring(aCells[i].innerHTML.indexOf('<')+1, aCells[i].innerHTML.indexOf(' '));
eNodeName = eNodeName.toLowerCase();
switch(eNodeName){
case 'input':
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('input');
if (aObjects){
eNodeName = eNodeName.toLowerCase();
switch(eNodeName){
case 'input':
aObjects = oNewRow.getElementsByTagName('td')[i].getElementsByTagName('input');
if (aObjects){
newID = aObjects[0].id.replace(/\[1\]/g, '\[' + currentRow + '\]');
aObjects[0].id = newID;
aObjects[0].name = newID;
@@ -226,8 +250,18 @@ var G_Grid = function(oForm, sGridName){
oNewRow.getElementsByTagName('td')[i].appendChild(a2);
//Load DatePicker Trigger
datePicker4("", newID, attributes.mask, attributes.start, attributes.end, attributes.time);
aObjects[0].value = defaultValue;
}else{
if (_BROWSER.name == 'msie'){ //Clone new input element if browser is IE
oNewOBJ = this.cloneInput(aObjects[0]);
oNewOBJ.value = defaultValue;
parentGG = aObjects[0].parentNode;
parentGG.removeChild(aObjects[0]);
parentGG.appendChild(oNewOBJ);
}else{
aObjects[0].value = defaultValue;
}
}
aObjects[0].value = defaultValue;
break;
case 'checkbox': //CHECKBOX
aObjects[0].checked = false;
@@ -604,7 +638,7 @@ var G_Grid = function(oForm, sGridName){
if (aAux[2] == nnName[2] && j <= (this.oGrid.rows.length-2)){
oAux=this.getElementByName(j, nnName[2]);
if(oAux!=null){
fTotal += parseFloat(G.cleanMask(oAux.value() || 0, oAux.mask).result.replace(/,/g, ''));
fTotal += parseFloat(G.getValue(oAux.value()));
}
j++;
}
@@ -632,7 +666,7 @@ var G_Grid = function(oForm, sGridName){
fTotal = 0;
aAux[2] = aAux[2].replace(']', '');
while (oAux = this.getElementByName(i, aAux[2])) {
fTotal += parseFloat(G.cleanMask(oAux.value() || 0, oAux.mask).result.replace(/,/g, ''));
fTotal += parseFloat(G.getValue(oAux.value()));
sMask = oAux.mask;
i++;
}

View File

@@ -52,12 +52,10 @@
}
}
}
$G_FORM=new form( $xmlFile , $sPath );
$G_FORM->id=urlDecode($_POST['form']);
//$G_FORM->values=isset($_SESSION[$G_FORM->id]) ? $_SESSION[$G_FORM->id] : array();
$newValues=($json->decode(urlDecode(stripslashes($_POST['fields']))));
if (isset($_POST['grid'])) {
$_POST['row'] = (int)$_POST['row'];
$aAux = array();
@@ -84,6 +82,7 @@
//Search dependent fields
foreach($newValues[$r] as $k => $v) {
if (!is_array($v)) {
//echo 'NoASrray';
$myDependentFields = subDependencies( $k , $G_FORM , $aux );
$_SESSION[$G_FORM->id][$k] = $v;
}
@@ -97,6 +96,7 @@
//$_SESSION[$G_FORM->id][$k] = $v;
}
}
//g::pr($myDependentFields);
$G_FORM->values=isset($_SESSION[$G_FORM->id]) ? $_SESSION[$G_FORM->id] : array();
@@ -195,9 +195,9 @@
if ($myDependentFields[$r]=="") unset($myDependentFields[$r]);
}
$mD = $myDependentFields;
foreach( $mD as $ki) {
$myDependentFields = array_merge( $myDependentFields , subDependencies( $ki , $G_FORM , $aux, $grid) );
}
// foreach( $mD as $ki) {
// $myDependentFields = array_merge( $myDependentFields , subDependencies( $ki , $G_FORM , $aux, $grid) );
// }
}
return $myDependentFields;
}

View File

@@ -39,6 +39,7 @@ class XmlForm_Field {
var $mode = '';
var $defaultValue = NULL;
var $gridFieldType = '';
var $gridLabel = '';
/*to change the presentation*/
var $enableHtml = false;
var $style = '';
@@ -668,6 +669,45 @@ class XmlForm_Field {
}
return $sValue;
}
/**
* Prepares NS Required Value
* @author Enrique Ponce de Leon <enrique@colosa.com>
* @param boolean optional (true = always show, false = show only if not empty)
* @return string
*/
function NSRequiredValue($show = false){
if (isset($this->required)){
$req = ($this->required)? '1':'0';
}else{
$req = '0';
}
$idv = 'pm:required="'.$req.'"';
if ($show){
return $idv;
}else{
return ($req != '0')? $idv : '';
}
}
/**
* Prepares NS Required Value
* @author Enrique Ponce de Leon <enrique@colosa.com>
* @param boolean optional (true = always show, false = show only if not empty)
* @return string
*/
function NSGridLabel($show = false){
$idv = 'pm:label="'.$this->label.'"';
if ($show){
return $idv;
}else{
return ($this->label != '')? $idv : '';
}
}
/**
* Prepares NS Default Text
@@ -801,11 +841,11 @@ class XmlForm_Field_SimpleText extends XmlForm_Field
$onkeypress = G::replaceDataField ( $this->onkeypress, $owner->values );
if ($this->mode === 'edit') {
if ($this->readOnly)
return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" ' . (isset ( $this->maxLength ) ? ' maxlength="' . $this->maxLength . '"' : '') . ' value=\'' . htmlentities ( $value, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly" style="' . 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 . '" ' . (isset ( $this->maxLength ) ? ' maxlength="' . $this->maxLength . '"' : '') . ' value=\'' . htmlentities ( $value, ENT_COMPAT, 'utf-8' ) . '\' '.$this->NSRequiredValue().' readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>';
else
return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" ' . (isset ( $this->maxLength ) ? ' maxlength="' . $this->maxLength . '"' : '') . ' value=\'' . htmlentities ( $value, ENT_COMPAT, 'utf-8' ) . '\' style="' . 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 . '" ' . (isset ( $this->maxLength ) ? ' maxlength="' . $this->maxLength . '"' : '') . ' value=\'' . htmlentities ( $value, ENT_COMPAT, 'utf-8' ) . '\' '.$this->NSRequiredValue().' style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>';
} elseif ($this->mode === 'view') {
return '<input class="module_app_input___gray" id="form[' . $this->name . ']" name="form[' . $this->name . ']" type ="text" size="' . $this->size . '" ' . (isset ( $this->maxLength ) ? ' maxlength="' . $this->maxLength . '"' : '') . ' value=\'' . htmlentities ( $value, ENT_COMPAT, 'utf-8' ) . '\' style="display:none;' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . 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 . '" ' . (isset ( $this->maxLength ) ? ' maxlength="' . $this->maxLength . '"' : '') . ' value=\'' . htmlentities ( $value, ENT_COMPAT, 'utf-8' ) . '\' '.$this->NSRequiredValue().' style="display:none;' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . htmlentities ( $value, ENT_COMPAT, 'utf-8' );
} else {
return $this->htmlentities ( $value, ENT_COMPAT, 'utf-8' );
}
@@ -835,18 +875,15 @@ class XmlForm_Field_SimpleText extends XmlForm_Field
// also the fields rendered in a grid needs now have an attribute required set to 0 or 1
// that it means not required or required respectively.
$this->mode = $this->modeForGrid;
if (isNewDynaform($owner)=='1'){
$values = array();
$values[] = $this->defaultValue;
}
foreach ( $values as $v ) {
if ($this->mode === 'edit' && $owner->modeGrid != 'view') {
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=\'' . htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '\' pm:required="' . $isRequired . '" readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'/>';
$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=\'' . htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '\' '.$this->NSRequiredValue().' readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridType().' '.$this->NSGridLabel().'/>';
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=\'' . htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '\' pm:requiredrequired="' . $isRequired . '"style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'/>';
$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=\'' . htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '\' '.$this->NSRequiredValue().' style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridType().' '.$this->NSGridLabel().'/>';
} elseif ($this->mode === 'view' || $owner->modeGrid === 'view') {
$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=\'' . htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '\' pm:required="' . $isRequired . '"style="display:none;' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'/>' . 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=\'' . htmlentities ( $v, ENT_COMPAT, 'utf-8' ) . '\' '.$this->NSRequiredValue().' style="display:none;' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridType().' '.$this->NSGridLabel().'/>' . htmlentities ( $v, ENT_COMPAT, 'utf-8' );
} else {
$result [] = $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' );
}
@@ -969,11 +1006,11 @@ class XmlForm_Field_Text extends XmlForm_Field_SimpleText
$v =($v!='')?$v:$this->defaultValue;
if ($this->mode === 'edit' && $owner->modeGrid != 'view') {
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' ) . '" pm:required="' . $isRequired . '" readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().'/>';
$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' ) . '" pm:required="' . $isRequired . '" readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridLabel().'/>';
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' ) . '" pm:required="' . $isRequired . '" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().'/>';
$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' ) . '" pm:required="' . $isRequired . '" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridLabel().'/>';
} elseif ($this->mode === 'view' || $owner->modeGrid === 'view') {
$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' ) . '" pm:required="' . $isRequired . '" style="display:none;' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().'/>' . 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' ) . '" pm:required="' . $isRequired . '" style="display:none;' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridLabel().'/>' . htmlentities ( $v, ENT_COMPAT, 'utf-8' );
} else {
$result [] = $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' );
}
@@ -1368,7 +1405,7 @@ class XmlForm_Field_Textarea extends XmlForm_Field {
if ($this->readOnly)
return '<textarea id="form[' . $this->name . ']" name="form[' . $this->name . ']" wrap="hard" cols="' . $this->cols . '" rows="' . $this->rows . '" style="' . $this->style . '" wrap="' . htmlentities ( $this->wrap, ENT_QUOTES, 'UTF-8' ) . '" class=" ' . $className . '" readOnly>' . $this->htmlentities ( $value, ENT_COMPAT, 'utf-8' ) . '</textarea>';
else{
$html = '<textarea id="form[' . $this->name . ']" name="form[' . $this->name . ']" wrap="hard" cols="' . $this->cols . '" rows="' . $this->rows . '" style="' . $this->style . '" wrap="' . htmlentities ( $this->wrap, ENT_QUOTES, 'UTF-8' ) . '" class=" ' . $className . '" >' . $this->htmlentities ( $value, ENT_COMPAT, 'utf-8' ) . '</textarea>';
$html = '<textarea id="form[' . $this->name . ']" name="form[' . $this->name . ']" wrap="hard" cols="' . $this->cols . '" rows="' . $this->rows . '" style="' . $this->style . '" wrap="' . htmlentities ( $this->wrap, ENT_QUOTES, 'UTF-8' ) . '" class=" ' . $className . '" '.$this->NSRequiredValue().'>' . $this->htmlentities ( $value, ENT_COMPAT, 'utf-8' ) . '</textarea>';
if($this->hint){
$html .= '<a href="#" onmouseout="hideTooltip()" onmouseover="showTooltip(event, \''.$this->hint.'\');return false;">
<image src="/images/help4.gif" width="15" height="15" border="0"/>
@@ -1400,10 +1437,7 @@ class XmlForm_Field_Textarea extends XmlForm_Field {
$isRequired = '0';
}
if (isNewDynaform($owner)==1){
$values = array();
$values[] = $this->defaultValue;
}
// Note added by Gustavo Cruz
// also the fields rendered in a grid needs now have an attribute required set to 0 or 1
// that it means not required or required respectively.
@@ -1415,9 +1449,9 @@ class XmlForm_Field_Textarea extends XmlForm_Field {
if ($this->mode === 'edit' && $owner->modeGrid != 'view') {
if (is_null($v)) $v = $this->defaultValue;
if ($this->readOnly)
$result [] = '<textarea class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" wrap="hard" rows="' . $this->rows . '"cols="'.$this->cols.'" required="' . $isRequired . '" readOnly="readOnly" '.$this->NSDefaultValue().' '.$this->NSGridType().'>'.$this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'</textarea>';
$result [] = '<textarea class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" wrap="hard" rows="' . $this->rows . '"cols="'.$this->cols.'" '.$this->NSRequiredValue().' readOnly="readOnly" '.$this->NSDefaultValue().' '.$this->NSGridType().'>'.$this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'</textarea>';
else
$result [] = '<textarea class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" wrap="hard" rows="' . $this->rows . '"cols="'.$this->cols.'" required="' . $isRequired . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'>'.$this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'</textarea>';
$result [] = '<textarea class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" wrap="hard" rows="' . $this->rows . '"cols="'.$this->cols.'" '.$this->NSRequiredValue().' '.$this->NSDefaultValue().' '.$this->NSGridType().'>'.$this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'</textarea>';
} elseif ($this->mode === 'view' || $owner->modeGrid === 'view') {
if (stristr ( $_SERVER ['HTTP_USER_AGENT'], 'iPhone' )) {
@@ -1425,7 +1459,7 @@ class XmlForm_Field_Textarea extends XmlForm_Field {
$result [] = $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' );
} else { //start add Alvaro
$varaux = '<textarea class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" wrap="hard" rows="' . $this->rows . '"cols="'.$this->cols.'" pm:required="' . $isRequired . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'>'.$this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'</textarea>';
$varaux = '<textarea class="module_app_input___gray" id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" wrap="hard" rows="' . $this->rows . '"cols="'.$this->cols.'" '.$this->NSRequiredValue().' '.$this->NSDefaultValue().' '.$this->NSGridType().'>'.$this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'</textarea>';
$result [] = $this->htmlentities ( $v, ENT_COMPAT, 'utf-8' ).'<div style="display:none;">'.$varaux.'</div>';
//end add Alvaro
}
@@ -1468,16 +1502,14 @@ class XmlForm_Field_Currency extends XmlForm_Field_SimpleText {
*/
function render( $value = NULL, $owner = NULL) {
//$this->gridFieldType = 'currency';
if (isNewDynaform($owner)==1){
$value = $this->defaultValue;
}
$onkeypress = G::replaceDataField ( $this->onkeypress, $owner->values );
if ($this->mode === 'edit') {
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_QUOTES, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'/>';
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_QUOTES, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSRequiredValue().' '.$this->NSDefaultValue().' '.$this->NSGridType().'/>';
else {
$html = '<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_QUOTES, 'utf-8' ) . '\' style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSDefaultValue().' '.$this->NSGridType().'/>';
$html = '<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_QUOTES, 'utf-8' ) . '\' style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '" '.$this->NSRequiredValue().' '.$this->NSDefaultValue().' '.$this->NSGridType().'/>';
if($this->hint){
$html .= '<a href="#" onmouseout="hideTooltip()" onmouseover="showTooltip(event, \''.$this->hint.'\');return false;">
@@ -1848,11 +1880,6 @@ class XmlForm_Field_YesNo extends XmlForm_Field
$result = array ();
$r = 1;
if (isNewDynaform($owner)==1){
$values = array();
$values[] = $this->defaultValue;
}
$this->mode = $this->modeForGrid;
foreach ( $values as $v ) {
$html = (($this->mode == 'view' || $owner->modeGrid == 'view')? ($v === '0' ? 'NO' : 'YES') : '') . '<select id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']"' . (($this->mode == 'view' || $owner->modeGrid == 'view')? ' style="display:none;"' : '') . ' '.$this->NSDefaultValue().' '.$this->NSGridType().'>';
@@ -2400,15 +2427,7 @@ class XmlForm_Field_Dropdown extends XmlForm_Field {
}
//end
if (isNewDynaform($owner)==1){
if ($this->dependentFields != ''){
$value = "";
}else{
$value = $this->defaultValue;
}
}
// added by Gustavo Cruz
// added by Gustavo Cruz
if($this->readonly == true || $this->modeGridDrop === 'view'){
$readOnlyField = "disabled";
} else $readOnlyField = "";
@@ -2845,11 +2864,22 @@ class XmlForm_Field_Grid extends XmlForm_Field
* @param $owner
* @return <Template Object>
*/
function render($values, $owner = NULL) {
function render($values, $owner = NULL){
$arrayKeys = array_keys ( $this->fields );
$emptyRow = array ();
foreach ( $arrayKeys as $key )
$emptyRow [$key] = array ('' );
foreach ( $arrayKeys as $key ){
if (isset($this->fields[$key]->defaultValue)){
$emptyValue = $this->fields[$key]->defaultValue;
if (isset($this->fields[$key]->dependentFields)){
if ($this->fields[$key]->dependentFields != ''){
$emptyValue = '';
}
}
}else{
$emptyValue = '';
}
$emptyRow [$key] = array ($emptyValue);
}
return $this->renderGrid ( $emptyRow, $owner );
}
@@ -2862,6 +2892,7 @@ class XmlForm_Field_Grid extends XmlForm_Field
*/
function renderGrid($values, $owner = NULL, $therow = -1)
{
//g::pr($values);
$this->id = $this->owner->id . $this->name;
$using_template = "grid";
@@ -2879,6 +2910,7 @@ class XmlForm_Field_Grid extends XmlForm_Field
if (! isset ( $values ) || ! is_array ( $values ) || sizeof ( $values ) == 0) {
$values = array_keys ( $this->fields );
}
$aValuekeys = array_keys ( $values );
if (count ( $aValuekeys ) > 0 && ( int ) $aValuekeys [0] == 1)
$values = $this->flipValues ( $values );
@@ -2900,6 +2932,7 @@ class XmlForm_Field_Grid extends XmlForm_Field
$this->fields [$k]->aggregate = '0';
}
}
$this->values = $values;
$this->NewLabel = G::LoadTranslation('ID_NEW');
@@ -4268,22 +4301,21 @@ class xmlformTemplate extends Smarty
}
} else {
if (isset ( $form->owner )) {
if (count ( $value ) < count ( $form->owner->values [$form->name] )) {
$i = count ( $value );
$j = count ( $form->owner->values [$form->name] );
for($i; $i < $j; $i ++) {
$value [] = '';
}
}
$aObj = $form->owner;
}else{
$aObj = $form;
}
if ($v->type == 'grid') {
$result ['form'] [$k] = $form->fields [$k]->renderGrid ( $value, $form, $therow );
} else {
if ($v->type == 'dropdown') {
@@ -4451,11 +4483,11 @@ class XmlForm_Field_Image extends XmlForm_Field
* @author Enrique Ponce de Leon <enrique@colosa.com>
* @package gulliver.system
*/
function isNewDynaform($owner){
if (isset($_SESSION['NEW_CASE'])){
$sw = ($_SESSION['NEW_CASE']=='New')? '1' : '0';
}else{
$sw = '0';
}
return $sw;
}
// function isNewDynaform($owner){
// if (isset($_SESSION['NEW_CASE'])){
// $sw = ($_SESSION['NEW_CASE']=='New')? '1' : '0';
// }else{
// $sw = '0';
// }
// return $sw;
// }

View File

@@ -216,9 +216,6 @@ function startCase() {
if (isset ( $_SESSION ['TASK'] )) unset ( $_SESSION ['TASK'] );
if (isset ( $_SESSION ['INDEX'] )) unset ( $_SESSION ['INDEX'] );
if (isset ( $_SESSION ['STEP_POSITION'] )) unset ( $_SESSION ['STEP_POSITION'] );
if (isset ( $_SESSION ['START_NEW_CASE'] )) unset ( $_SESSION ['START_NEW_CASE'] );
//echo 'Start new case<br />';
/* Process */
try {
@@ -244,8 +241,6 @@ function startCase() {
$_SESSION ['BREAKSTEP'] ['NEXT_STEP'] = $aNextStep;
$aData ['openCase'] = $aNextStep;
$aData ['NewDynaform'] = true; //Sets New Dynaform value
$aData ['status'] = 'success';
print (G::json_encode ( $aData )) ;
}

View File

@@ -42,9 +42,6 @@ if( $RBAC->userCanAccess('PM_CASES') != 1 ) {
require_once 'classes/model/AppDelay.php';
G::LoadClass('case');
//Clean NEW_CASE session variable if case isn't new.
if ($_GET['new']!='yes') $_SESSION['NEW_CASE'] = '';
$oCase = new Cases();
//cleaning the case session data
@@ -79,6 +76,8 @@ try {
//loading application data
$aFields = $oCase->loadCase($sAppUid, $iDelIndex);
// g::pr($aFields);
// die;
switch($aFields['APP_STATUS']){
case 'DRAFT':
@@ -168,8 +167,8 @@ try {
unset($_SESSION['bNoShowSteps']);
$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']);
$sPage = $aNextStep['PAGE'];
G::header('location: ' . $sPage);
} else {
//when the case have another user or current user doesnt have rights to this selfservice,

View File

@@ -46,15 +46,6 @@
if( isset($_GET['APP_UID']) && isset($_GET['DEL_INDEX'])) {
$case = $oCase->loadCase($_GET['APP_UID'], $_GET['DEL_INDEX']);
$appNum = $case['APP_TITLE'];
//Sets NEW_CASE session variable when we're starting a new case
if (isset($_GET['new'])){
if ($_GET['new']=='yes'){
$_SESSION['NEW_CASE'] = 'New';
}else{
$_SESSION['NEW_CASE'] = '';
}
}
}
if (!isset($_GET['to_revise'])){

View File

@@ -321,11 +321,7 @@ function openCaseA(n){
var res = Ext.util.JSON.decode(response.responseText);
if (res.openCase) {
if (res.NewDynaform){
window.location = res.openCase.PAGE + '&new=yes';
}else{
window.location = res.openCase.PAGE;
}
} else {
Ext.Msg.show({
title : TRANSLATIONS.ID_ERROR_CREATING_NEW_CASE, // 'Error creating a new Case',