diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index bf2c8bc8b..92f6646de 100644 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -1003,7 +1003,11 @@ class XmlForm_Field_Text extends XmlForm_Field_SimpleText $html .= $this->NSRequiredValue().' '; $html .= '/>'; }else{ //VIEW MODE - $html .= ''.$this->htmlentities($value, ENT_QUOTES, 'utf-8').''; + $html .= $this->htmlentities($value, ENT_QUOTES, 'utf-8'); + $html .= 'name . ']" '; + $html .= 'name="form[' . $this->name . ']" '; + $html .= 'type="hidden" value="'.$this->htmlentities($value, ENT_QUOTES, 'utf-8').'" />'; } $html .= $this->renderHint(); @@ -1151,12 +1155,35 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek $storeEntry = 'onchange="storeEntry(this, \''.$this->sqlConnection.'\', \''.$this->table.'\', \''.$this->primary_key.'\', \''.$this->primary_key_type.'\', \''.$this->field.'\')"'; } + $formVariableValue = ''; + $formVariableKeyValue = ''; + G::LoadClass('case'); + $oApp= new Cases(); + if ($oApp->loadCase($_SESSION['APPLICATION'])!=null){ + $aFields = $oApp->loadCase($_SESSION['APPLICATION']); + if(isset($aFields['APP_DATA'][$this->name . '_label'])){ + $formVariableValue = $aFields['APP_DATA'][$this->name . '_label']; + $formVariableKeyValue = $aFields['APP_DATA'][$this->name]; + } + } + if ($this->mode === 'edit') { if ($this->readOnly) { return 'htmlentities ( $value, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly" style="' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>'; } else { // $str = ''; - $str = ''; + if(strlen(trim($formVariableValue))>0) { + $value = $formVariableValue; + } + $str = 'NSDependentFields(true).' '; + $str .= '/>'; + $str .= 'name . ']" '; + $str .= 'name="form[' . $this->name . ']" '; + $str .= 'value="' . $this->htmlentities ( $formVariableKeyValue, ENT_COMPAT, 'utf-8' ) . '" ' ; + $str .= 'type="hidden" />'; + $str .= $this->renderHint(); if( trim($this->callback) != '' ) { $sCallBack = 'try{'.$this->callback.'}catch(e){alert("Suggest Widget call back error: "+e)}'; @@ -1164,29 +1191,61 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek $sCallBack = ''; } - $hash = str_rot13(base64_encode($this->sql.'@'.$this->sqlConnection)); + $hash = str_rot13(base64_encode($this->sql.'@|'.$this->sqlConnection)); +// $sOptions = 'script:"'.$this->ajaxServer.'?request=suggest&json=true&limit='.$this->maxresults.'&hash='.$hash.'&dependentFields='. $this->dependentFields .'&field=" + getField(\''. $this->name .'\').value + "&",'; + $sSQL = $this->sql; + $nCount = preg_match_all('/\@(?:([\@\%\#\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/', $sSQL, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE); - $sOptions = 'script:"'.$this->ajaxServer.'?request=suggest&json=true&limit='.$this->maxresults.'&hash='.$hash.'&",'; + $sResult = array(); + if($nCount){ + for($i=0; $i<$nCount; $i++){ + if (isset($match[0][$i][0]) && isset($match[2][$i][0])) { + $aResult[$match[0][$i][0]] = $match[2][$i][0]; + } + } + } + + $depValues = ''; + $i = 1; + if($aResult) { + $sResult = '"' . implode('","', $aResult) . '"'; + $aResultKeys = array_keys($aResult); + $sResultKeys = str_rot13(base64_encode(implode('|', $aResultKeys))); + + foreach($aResult as $key=>$field) { + $depValues .= 'getField(\''.$field.'\').value'; + if($i++ajaxServer.'?request=suggest&json=true&limit='.$this->maxresults.'&hash='.$hash.'&dependentFieldsKeys=' . $sResultKeys . '&dependentFieldsValue="'.$depValues.'"&input=" + getField(\''. $this->name .'_label\').value; },'; $sOptions .= 'json: true,'; $sOptions .= 'limit: '.$this->maxresults.','; - $sOptions .= 'varname: "input",'; + // $sOptions .= 'varname: "input",'; $sOptions .= 'shownoresults: '.($this->shownoresults?'true':'false').','; $sOptions .= 'maxresults: '.$this->maxresults.','; $sOptions .= 'chache: true,'; $setValue = ($this->savelabel == '1')? 'obj.value': 'obj.id'; - $sOptions .= 'callback: function(obj){'.$sCallBack.'; return false;}'; + $sOptions .= 'callback: function(obj){'.$sCallBack.'; getField("'. $this->name. '").value = obj.id; return false;}'; $str .= ''; return $str; } + } elseif ($this->mode === 'view') { + return 'htmlentities ( $value, ENT_COMPAT, 'utf-8' ) . '\' style="display:none;' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" onkeypress="' . htmlentities ( $onkeypress, ENT_COMPAT, 'utf-8' ) . '"/>' . $this->htmlentities ( $value, ENT_COMPAT, 'utf-8' ); } else { - $html = ''.$this->htmlentities($value, ENT_QUOTES, 'utf-8').''; - return $html; + return $this->htmlentities ( $value, ENT_COMPAT, 'utf-8' ); } } /** @@ -1291,6 +1350,7 @@ class XmlForm_Field_Caption extends XmlForm_Field { var $sql = ''; var $sqlOption = array (); var $saveLabel = 0; + //var $hint; /** * @param $value @@ -1389,10 +1449,12 @@ class XmlForm_Field_Password extends XmlForm_Field { $html .= $this->renderHint(); return $html; } + } elseif ($this->mode === 'view') { + $html= 'htmlentities ( $value, ENT_COMPAT, 'utf-8' ) . '\' readOnly="readOnly"/>'; + $html.= $this->htmlentities ( str_repeat ( '*', 10 ), ENT_COMPAT, 'utf-8' ); + return $html; } else { - //return $this->htmlentities ( str_repeat ( '*', 10 ), ENT_COMPAT, 'utf-8' ); - $html = ''.$this->htmlentities ( str_repeat ( '*', 10 ), ENT_COMPAT, 'utf-8' ).''; - return $html; + return $this->htmlentities ( str_repeat ( '*', 10 ), ENT_COMPAT, 'utf-8' ); } } } @@ -1449,8 +1511,15 @@ class XmlForm_Field_Textarea extends XmlForm_Field { $html .= 'class="'.$className.'" >'; $html .= $this->htmlentities($value, ENT_COMPAT, 'utf-8'); $html .= ''; - }else{ //VIEW MODE - $html .= '
' . $this->htmlentities($value, ENT_QUOTES, 'utf-8') . '
'; + }else{ //VIEW MODE + $html .= ''; } @@ -1490,11 +1559,14 @@ class XmlForm_Field_Textarea extends XmlForm_Field { $html .= $this->htmlentities($v, ENT_COMPAT, 'utf-8'); $html .= ''; }else{ //VIEW MODE - $html .= '
' . $this->htmlentities($v, ENT_QUOTES, 'utf-8') . '
'; - $html .= 'name. '][' . $r . '][' . $this->name . ']" '; - $html .= 'name="form[' . $owner->name. '][' . $r . '][' . $this->name . ']" '; - $html .= 'type="hidden" value="'.$this->htmlentities($v, ENT_QUOTES, 'utf-8').'" />'; + $html .= ''; } $result[] = $html; $r ++; @@ -1550,8 +1622,11 @@ class XmlForm_Field_Currency extends XmlForm_Field_SimpleText { $html .= $this->NSGridType().' '; $html .= '/>'; }else{ //VIEW MODE - - $html .= ''.$this->htmlentities($value, ENT_QUOTES, 'utf-8').''; + $html .= $this->htmlentities($value, ENT_COMPAT, 'utf-8'); + $html .= 'name . ']" '; + $html .= 'name="form[' . $this->name . ']" '; + $html .= 'type="hidden" value="'.$this->htmlentities($value, ENT_COMPAT, 'utf-8').'" />'; } $html .= $this->renderHint(); @@ -1615,7 +1690,11 @@ class XmlForm_Field_Percentage extends XmlForm_Field_SimpleText { $html .= $this->NSRequiredValue().' '; $html .= '/>'; }else{ //VIEW MODE - $html .= ''.$this->htmlentities($value, ENT_QUOTES, 'utf-8').''; + $html .= $this->htmlentities($value, ENT_COMPAT, 'utf-8'); + $html .= 'name . ']" '; + $html .= 'name="form[' . $this->name . ']" '; + $html .= 'type="hidden" value="'.$this->htmlentities($value, ENT_COMPAT, 'utf-8').'" />'; } $html .= $this->renderHint(); @@ -1931,7 +2010,10 @@ class XmlForm_Field_YesNo extends XmlForm_Field $html .= ''; $html .= ($value==='0') ? G::LoadTranslation('ID_NO_VALUE') : G::LoadTranslation('ID_YES_VALUE'); - $html .= ''; + $html .= 'name.']" '; + $html .= 'name="form['.$this->name.']" '; + $html .= 'type="hidden" value="'.(($value==='0')? '0':'1').'" />'; } $html .= $this->renderHint(); @@ -2011,14 +2093,7 @@ class XmlForm_Field_Link extends XmlForm_Field { $target = G::replaceDataField ( $this->target, $owner->values ); $value = G::replaceDataField ( $this->value, $owner->values ); $label = G::replaceDataField ( $this->label, $owner->values ); - if($this->mode === 'edit'){ - $html = 'htmlentities ( $link, ENT_QUOTES, 'utf-8' ) . '\'' . 'id="form[' . $this->name . ']" name="form[' . $this->name . ']"' . (($this->onclick) ? ' onclick="' . htmlentities ( $onclick, ENT_QUOTES, 'utf-8' ) . '"' : '') . (($this->target) ? ' target="' . htmlentities ( $target, ENT_QUOTES, 'utf-8' ) . '"' : '') . '>' . $this->htmlentities ( $this->value === '' ? $label : $value, ENT_QUOTES, 'utf-8' ) . ''; - } else { - $html = ""; - $html .= ''; - $html .= $this->htmlentities ( $this->value === '' ? $label : $value, ENT_QUOTES, 'utf-8' ); - $html .= ''; - } + $html = 'htmlentities ( $link, ENT_QUOTES, 'utf-8' ) . '\'' . 'id="form[' . $this->name . ']" name="form[' . $this->name . ']"' . (($this->onclick) ? ' onclick="' . htmlentities ( $onclick, ENT_QUOTES, 'utf-8' ) . '"' : '') . (($this->target) ? ' target="' . htmlentities ( $target, ENT_QUOTES, 'utf-8' ) . '"' : '') . '>' . $this->htmlentities ( $this->value === '' ? $label : $value, ENT_QUOTES, 'utf-8' ) . ''; $html .= $this->renderHint(); return $html; @@ -2040,16 +2115,7 @@ class XmlForm_Field_Link extends XmlForm_Field { $target = G::replaceDataField ( $this->target, $_aData_ ); $value = G::replaceDataField ( $this->value, $_aData_ ); $label = G::replaceDataField ( $this->label, $_aData_ ); -// $html = 'htmlentities ( $link, ENT_QUOTES, 'utf-8' ) . '\'' . 'id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']"' . (($this->onclick) ? ' onclick="' . htmlentities ( $onclick, ENT_QUOTES, 'utf-8' ) . '"' : '') . (($this->target) ? ' target="' . htmlentities ( $target, ENT_QUOTES, 'utf-8' ) . '"' : '') . '>' . $this->htmlentities ( $this->value === '' ? $label : $value, ENT_QUOTES, 'utf-8' ) . ''; - if($this->mode === 'edit'){ - $html = 'htmlentities ( $link, ENT_QUOTES, 'utf-8' ) . '\'' . 'id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']"' . (($this->onclick) ? ' onclick="' . htmlentities ( $onclick, ENT_QUOTES, 'utf-8' ) . '"' : '') . (($this->target) ? ' target="' . htmlentities ( $target, ENT_QUOTES, 'utf-8' ) . '"' : '') . '>' . $this->htmlentities ( $this->value === '' ? $label : $value, ENT_QUOTES, 'utf-8' ) . ''; - } else { - $html = $this->htmlentities ( $link, ENT_QUOTES, 'utf-8' ); - $html .= 'name . '][' . $r . '][' . $this->name . ']" '; - $html .= 'name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" '; - $html .= 'type="hidden" value="'. $this->htmlentities ( $link, ENT_QUOTES, 'utf-8' ) .'" />'; - } + $html = 'htmlentities ( $link, ENT_QUOTES, 'utf-8' ) . '\'' . 'id="form[' . $owner->name . '][' . $r . '][' . $this->name . ']" name="form[' . $owner->name . '][' . $r . '][' . $this->name . ']"' . (($this->onclick) ? ' onclick="' . htmlentities ( $onclick, ENT_QUOTES, 'utf-8' ) . '"' : '') . (($this->target) ? ' target="' . htmlentities ( $target, ENT_QUOTES, 'utf-8' ) . '"' : '') . '>' . $this->htmlentities ( $this->value === '' ? $label : $value, ENT_QUOTES, 'utf-8' ) . ''; $result [] = $html; $r ++; } @@ -2069,10 +2135,7 @@ class XmlForm_Field_Link extends XmlForm_Field { $value = G::replaceDataField ( $this->value, $owner->values ); $label = G::replaceDataField ( $this->label, $owner->values ); $aLabel = $this->htmlentities ( $this->value === '' ? $label : $value, ENT_QUOTES, 'utf-8' ); - if(isset($aLabel) && strlen($aLabel)>0) - return 'onclick) ? ' onclick="' . $onclick . '"' : '') . (($this->target) ? ' target="' . htmlentities ( $target, ENT_QUOTES, 'utf-8' ) . '"' : '') . '>' . $aLabel . ''; - else - return ''; + return 'onclick) ? ' onclick="' . $onclick . '"' : '') . (($this->target) ? ' target="' . htmlentities ( $target, ENT_QUOTES, 'utf-8' ) . '"' : '') . '>' . $aLabel . ''; } } @@ -2093,21 +2156,16 @@ class XmlForm_Field_File extends XmlForm_Field { * @return string */ function render($value = NULL) { - if ($this->mode === 'edit') { - $html = ''; - - if( isset($this->input) && $this->input != ''){ - require_once 'classes/model/InputDocument.php'; - $oiDoc = new InputDocument; - $aDoc = $oiDoc->load($this->input); - $aDoc['INP_DOC_TITLE'] = isset($aDoc['INP_DOC_TITLE'])? $aDoc['INP_DOC_TITLE']: ''; - $html .= ''; - } - } else { //VIEW MODE - $html = ""; - $html .= ''; - $html .= $this->htmlentities($value, ENT_QUOTES, 'utf-8'); - $html .= ''; + $mode = ($this->mode == 'view') ? ' disabled="disabled"' : ''; + + $html = ''; + + if( isset($this->input) && $this->input != ''){ + require_once 'classes/model/InputDocument.php'; + $oiDoc = new InputDocument; + $aDoc = $oiDoc->load($this->input); + $aDoc['INP_DOC_TITLE'] = isset($aDoc['INP_DOC_TITLE'])? $aDoc['INP_DOC_TITLE']: ''; + $html .= ''; } $html .= $this->renderHint(); @@ -2249,19 +2307,17 @@ class XmlForm_Field_Checkbox extends XmlForm_Field // $res = "" . $this->label ; return $res; - } - else { - if ($this->labelOnRight) { - $html = "" . $this->label . ''; - } - else { - $html = $this->htmlentities($value, ENT_QUOTES, 'utf-8'); - $html .= 'name . ']" '; - $html .= 'name="form[' . $this->name . ']" '; - $html .= 'type="hidden" value="'.$this->htmlentities($value, ENT_QUOTES, 'utf-8').'" />'; - } - $html .= $this->renderHint(); + } elseif ($this->mode === 'view') { + if ($this->labelOnRight) { + $html = "" . $this->label . ''; + } else { + $html = ""; + } + if($this->hint){ + $html .= ' + + '; + } return $html; } } @@ -2340,12 +2396,7 @@ class XmlForm_Field_Button extends XmlForm_Field $re = "style}\" class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='button' value=\"{$label}\" " . (($this->onclick) ? 'onclick="' . htmlentities ( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; return $re; } elseif ($this->mode === 'view') { - $html = 'name . ']" '; - $html .= 'name="form[' . $this->name . ']" '; - $html .= 'type="hidden" value="'. $this->htmlentities ( $label, ENT_QUOTES, 'utf-8' ) .'" />'; - return $html; - // return "style}\" disabled='disabled' class='module_app_button___gray module_app_buttonDisabled___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='button' value=\"{$label}\" " . (($this->onclick) ? 'onclick="' . htmlentities ( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . ' />'; + return "style}\" disabled='disabled' class='module_app_button___gray module_app_buttonDisabled___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='button' value=\"{$label}\" " . (($this->onclick) ? 'onclick="' . htmlentities ( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; } else { return $this->htmlentities ( $value, ENT_COMPAT, 'utf-8' ); } @@ -2368,19 +2419,10 @@ class XmlForm_Field_Reset extends XmlForm_Field */ function render($value = NULL, $owner) { - if ($this->mode === 'edit') { - $onclick = G::replaceDataField ( $this->onclick, $owner->values ); - $mode = ($this->mode == 'view') ? ' disabled="disabled"' : ''; - //return ''; - return "style}\" $mode class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='reset' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities ( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; - } else { - $html = 'name . ']" '; - $html .= 'name="form[' . $this->name . ']" '; - $html .= 'type="hidden" value="'. $this->htmlentities ( $this->label, ENT_QUOTES, 'utf-8' ) .'" />'; - return $html; - } - + $onclick = G::replaceDataField ( $this->onclick, $owner->values ); + $mode = ($this->mode == 'view') ? ' disabled="disabled"' : ''; + //return ''; + return "style}\" $mode class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='reset' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities ( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; } } /** @@ -2405,14 +2447,7 @@ class XmlForm_Field_Submit extends XmlForm_Field { // return 'label .'\' disabled/>'; return "style}\" class='module_app_button___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='submit' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities ( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; } elseif ($this->mode === 'view') { - $sLinkNextStep = 'window.open("' . $owner->fields['__DYNAFORM_OPTIONS']->xmlMenu->values['NEXT_STEP'] . '", "_self");'; - $html = ''; - $html .= 'name . ']" '; - $html .= 'name="form[' . $this->name . ']" '; - $html .= 'type="hidden" value="'. $this->htmlentities ( $this->label, ENT_QUOTES, 'utf-8' ) .'" />'; - return $html; - // return "style}\" disabled='disabled' class='module_app_button___gray module_app_buttonDisabled___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='submit' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities ( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; + return "style}\" disabled='disabled' class='module_app_button___gray module_app_buttonDisabled___gray {$this->className}' id=\"form[{$this->name}]\" name=\"form[{$this->name}]\" type='submit' value=\"{$this->label}\" " . (($this->onclick) ? 'onclick="' . htmlentities ( $onclick, ENT_COMPAT, 'utf-8' ) . '"' : '') . " />"; } else { return $this->htmlentities ( $value, ENT_COMPAT, 'utf-8' ); } @@ -2529,8 +2564,6 @@ class XmlForm_Field_Dropdown extends XmlForm_Field { */ function render($value = NULL, $owner = NULL, $rowId = '', $onlyValue = false, $row = -1, $therow = -1) { - //g::pr($owner->fields); - //echo $row.' - '.$therow; //Returns value from a PMTable when it is exists. if (($this->pmconnection != '') && ($this->pmfield != '') && $value == NULL) { $value = $this->getPMTableValue($owner); @@ -2546,85 +2579,57 @@ class XmlForm_Field_Dropdown extends XmlForm_Field { } $html = ''; + $displayLabel = ''; if ($this->renderMode == '') $this->renderMode = $this->mode; if (!$onlyValue){ //Render Field if not defined onlyValue if ($this->renderMode == 'edit') { //EDIT MODE - $readOnlyField = ($this->readonly == 1 || $this->readonly == '1') ? 'disabled' : ''; - $html = 'name . ']" '; + $html .= 'name="form' . $rowId . '[' . $this->name . ']" '; + if ($this->style) $html .= 'style="'. $displayStyle . $this->style.'" '; + if ($displayStyle != '') $html .= 'style="'. $displayStyle . '" '; + $html .= $this->NSRequiredValue().' '; + $html .= $this->NSDefaultValue().' '; + $html .= $this->NSGridLabel().' '; + $html .= $this->NSGridType().' '; + $html .= $this->NSDependentFields(true).' '; + $html .= '>'; + $findValue = ''; + $firstValue = ''; + foreach ($this->option as $optValue => $optName ){ + settype($optValue,'string'); + $html .= ''; + if ($optValue === $value) { + $findValue = $optValue; + $displayLabel = $optName; + } + if ($firstValue == '') $firstValue = $optValue; + } + foreach ($this->sqlOption as $optValue => $optName ){ + settype($optValue,'string'); + $html .= ''; + if ($optValue === $value) { + $findValue = $optValue; + $displayLabel = $optName; + } + if ($firstValue == '') $firstValue = $optValue; + } + $html .= ''; + if ($readOnlyField != ''){ + $html .= 'name . ']" '; $html .= 'name="form' . $rowId . '[' . $this->name . ']" '; - if ($this->style) $html .= 'style="'.$this->style.'" '; - $html .= $this->NSRequiredValue().' '; - $html .= $this->NSDefaultValue().' '; - $html .= $this->NSGridLabel().' '; - $html .= $this->NSGridType().' '; - $html .= $this->NSDependentFields(true).' '; - $html .= '>'; - $findValue = ''; - $firstValue = ''; - foreach ($this->option as $optValue => $optName ){ - settype($optValue,'string'); - $html .= ''; - if ($optValue === $value) $findValue = $optValue; - if ($firstValue == '') $firstValue = $optValue; - } - foreach ($this->sqlOption as $optValue => $optName ){ - settype($optValue,'string'); - $html .= ''; - if ($optValue === $value) $findValue = $optValue; - if ($firstValue == '') $firstValue = $optValue; - } - $html .= ''; - if ($readOnlyField != ''){ - $html .= 'name . ']" '; - $html .= 'name="form' . $rowId . '[' . $this->name . ']" '; - $html .= 'value="'.(($findValue != '') ? $findValue : $firstValue).'" />'; - } - $this->selectedValue = ($findValue != '') ? $findValue : $firstValue; - }else{ //VIEW MODE - $findValue = ''; - $firstValue = ''; - $firstName = ''; - - - foreach ($this->option as $optValue => $optName ){ - settype($optValue,'string'); - if ($optValue === $value){ - $html .= $this->htmlentities($optName, ENT_COMPAT, 'utf-8'); - $findValue = $optValue; - } - if ($firstValue == '') { - $firstValue = $optValue; - $firstName = $optName; - } - } - foreach ($this->sqlOption as $optValue => $optName ){ - settype($optValue,'string'); - if ($optValue === $value){ - $html .= $this->htmlentities($optName, ENT_COMPAT, 'utf-8'); - $findValue = $optValue; - } - if ($firstValue == '') { - $firstValue = $optValue; - $firstName = $optName; - } - } - - - if ($html == '' && $firstValue != '' && $findValue == ''){ - - $html = ''.$this->htmlentities($firstName,ENT_COMPAT, 'utf-8').''; - $findValue = $firstValue; - } - else { - $html = ''.$html.''; - } - - //$html .= 'id="form' . $rowId . '[' . $this->name . ']" '; + $html .= 'value="'.(($findValue != '') ? $findValue : $firstValue).'" />'; } + $this->selectedValue = ($findValue != '') ? $findValue : $firstValue; + }else{ //Render Field showing only value; foreach ($this->option as $optValue => $optName) { if ($optValue == $value) { @@ -2639,6 +2644,7 @@ class XmlForm_Field_Dropdown extends XmlForm_Field { } if ($this->gridFieldType == '') $html .= $this->renderHint(); + if ($displayStyle != '') $html = $displayLabel . $html; return $html; } @@ -2713,7 +2719,6 @@ class XmlForm_Field_Listbox extends XmlForm_Field $html .= $this->renderHint(); return $html; } elseif ($this->mode === 'view') { -/* $html = ''; -*/ - $html = ''; - $aInput = array(); - foreach ( $this->options as $optionName => $option ) { - if(in_array ( $optionName, $value ) ) { - $aInput [] = ''.$this->htmlentities ( $optionName, ENT_QUOTES, 'utf-8' ).''; - } - } - $sInput = implode("
", $aInput); - foreach ( $this->option as $optionName => $option ) { $html .= ''; } foreach ( $this->sqlOption as $optionName => $option ) { $html .= ''; } - - $html = ''.$sInput. ""; - //$html = $this->htmlentities ( $sInput, ENT_QUOTES, 'utf-8' ) . $html; - return $html; } else { return $this->htmlentities ( $value, ENT_COMPAT, 'utf-8' ); @@ -2823,16 +2814,12 @@ class XmlForm_Field_RadioGroup extends XmlForm_Field { return $html; } elseif ($this->mode === 'view') { $html = ''; - $sInput = ''; foreach ( $this->options as $optionName => $option ) { - // $html .= '' . $option . '
'; - if( $optionName == $value ) { - $sInput = $optionName; - } - if($optionName == $value) - $html .= ''; + $html .= '' . $option . '
'; + if($optionName == $value) + $html .= ''; } - $html = $this->htmlentities ( $sInput, ENT_QUOTES, 'utf-8' ) . $html; + return $html; } else { return $this->htmlentities ( $value, ENT_COMPAT, 'utf-8' ); @@ -2897,46 +2884,37 @@ class XmlForm_Field_CheckGroup extends XmlForm_Field * @param string owner * @return string */ - function render($value = NULL, $owner = NULL) - { - if (($this->pmconnection != '') && ($this->pmfield != '') && $value == NULL) { - $value = $this->getPMTableValue($owner); - } - $this->executeSQL ( $owner ); - if (! is_array ( $value )){ - $value = explode ( '|', $value ); - } - if ($this->mode === 'edit') { - $i=0; - $html = ''; - foreach ( $this->options as $optionName => $option ) { - $html .= '' . $option . ''; - if(++$i==count($this->options)){ - $html .= '      '.$this->renderHint(); - } - $html .= '
'; - }//fin for - return $html; - } - else { - $html = ''; - $aInput = array(); - foreach ( $this->options as $optionName => $option ) { - if(in_array ( $optionName, $value ) ) { - $aInput [] = ''.$this->htmlentities ( $optionName, ENT_QUOTES, 'utf-8' ).''; - } - } - - $sInput = implode("
", $aInput); - $html = ""; - $html .= ''; - $html .= $sInput; - $html .= ''; - return $html; - } - + function render($value = NULL, $owner = NULL) + { + if (($this->pmconnection != '') && ($this->pmfield != '') && $value == NULL) { + $value = $this->getPMTableValue($owner); } - + $this->executeSQL ( $owner ); + if (! is_array ( $value )) + $value = explode ( '|', $value ); + if ($this->mode === 'edit') { + $i=0; + $html = ''; + foreach ( $this->options as $optionName => $option ) { + $html .= '' . $option . ''; + if(++$i==count($this->options)){ + $html .= '      '.$this->renderHint(); + } + $html .= '
'; + }//fin for + return $html; + } elseif ($this->mode === 'view') { + $html = ''; + foreach ( $this->options as $optionName => $option ) { + $html .= '' . $option . '
'; + $html .= ''; + } + return $html; + } else { + return $this->htmlentities ( $value, ENT_COMPAT, 'utf-8' ); + } + + } } /* TODO: DEPRECATED */ @@ -3577,10 +3555,10 @@ class XmlForm_Field_Date extends XmlForm_Field_SimpleText //$html = "$value"; ///-- $html = 'maxLength ) ? ' maxlength="' . $this->maxLength . '"' : '') . ' value=\'' . htmlentities ( $value, ENT_COMPAT, 'utf-8' ) . '\' style="display:none;' . htmlentities ( $this->style, ENT_COMPAT, 'utf-8' ) . '" />' . htmlentities ( $value, ENT_COMPAT, 'utf-8' ); - $html = "$valueaux"; - - //$html .= ''; + $html = "$valueaux"; + $html .= ''; } + if ($this->gridFieldType == '') $html .= $this->renderHint(); return $html; @@ -3619,6 +3597,7 @@ class XmlForm_Field_Date5 extends XmlForm_Field_SimpleText public $editable; public $relativeDates; + //var $hint; /** * Verify the format of a date @@ -3903,7 +3882,12 @@ class XmlForm_Field_Date5 extends XmlForm_Field_SimpleText $html = ''; $html .= "$value"; } - +// if($this->hint){ +// $html .= ' +// +// '; +// } +//print ''; $html .= $this->renderHint(); return $html; } @@ -4165,8 +4149,6 @@ class XmlForm $field->language = $this->language; $this->fields [$field->name] = $field; } - - //echo var_dump($xmlNode [$k]->attributes["validate"]); if (isset ( $xmlNode [$k]->attributes ['required'] )) { // the fields or xml nodes with a required attribute are put in an array that is passed to the view file