فهرست منبع

CustomFields: simplified the wizard helper to cope with the edition in read-only mode (no need for the wizard helper to send the read-only/hidden values !)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3998 a333f486-631f-4898-b8df-5754b55c2be0
romainq 9 سال پیش
والد
کامیت
44e550c6ac
1فایلهای تغییر یافته به همراه27 افزوده شده و 44 حذف شده
  1. 27 44
      application/cmdbabstract.class.inc.php

+ 27 - 44
application/cmdbabstract.class.inc.php

@@ -628,61 +628,44 @@ EOF
 								}
 								else
 								{				
-									if ($iFlags & OPT_ATT_HIDDEN)
+									if ($iFlags & (OPT_ATT_READONLY|OPT_ATT_SLAVE))
 									{
-										// Attribute is hidden, add a hidden input
-										$oPage->add('<input type="hidden" id="'.$sInputId.'" name="attr_'.$sPrefix.$sAttCode.'" value="'.htmlentities($this->Get($sAttCode), ENT_QUOTES, 'UTF-8').'"/>');
-										$aFieldsMap[$sAttCode] = $sInputId;
-									}
-									else
-									{
-										if ($iFlags & (OPT_ATT_READONLY|OPT_ATT_SLAVE))
-										{
 
-											// Check if the attribute is not read-only because of a synchro...
-											$aReasons = array();
-											$sSynchroIcon = '';
-											if ($iFlags & OPT_ATT_SLAVE)
-											{
-												$iSynchroFlags = $this->GetSynchroReplicaFlags($sAttCode, $aReasons);
-												$sSynchroIcon = "&nbsp;<img id=\"synchro_$sInputId\" src=\"../images/transp-lock.png\" style=\"vertical-align:middle\"/>";
-												$sTip = '';
-												foreach($aReasons as $aRow)
-												{
-													$sTip .= "<p>Synchronized with {$aRow['name']} - {$aRow['description']}</p>";
-												}
-												$sTip = addslashes($sTip);
-												$oPage->add_ready_script("$('#synchro_$sInputId').qtip( { content: '$sTip', show: 'mouseover', hide: 'mouseout', style: { name: 'dark', tip: 'leftTop' }, position: { corner: { target: 'rightMiddle', tooltip: 'leftTop' }} } );");
-											}
-
-											// Attribute is read-only
-											$sHTMLValue = "<span id=\"field_{$sInputId}\">".$this->GetAsHTML($sAttCode);
-											$value = $this->Get($sAttCode);
-											if (is_object($value))
+										// Check if the attribute is not read-only because of a synchro...
+										$aReasons = array();
+										$sSynchroIcon = '';
+										if ($iFlags & OPT_ATT_SLAVE)
+										{
+											$iSynchroFlags = $this->GetSynchroReplicaFlags($sAttCode, $aReasons);
+											$sSynchroIcon = "&nbsp;<img id=\"synchro_$sInputId\" src=\"../images/transp-lock.png\" style=\"vertical-align:middle\"/>";
+											$sTip = '';
+											foreach($aReasons as $aRow)
 											{
-												$value = '';
+												$sTip .= "<p>Synchronized with {$aRow['name']} - {$aRow['description']}</p>";
 											}
-											$sHTMLValue .= '<input type="hidden" id="'.$sInputId.'" name="attr_'.$sPrefix.$sAttCode.'" value="'.htmlentities($value, ENT_QUOTES, 'UTF-8').'"/></span>';
-											$aFieldsMap[$sAttCode] = $sInputId;
-											$sComments = $sSynchroIcon;
+											$sTip = addslashes($sTip);
+											$oPage->add_ready_script("$('#synchro_$sInputId').qtip( { content: '$sTip', show: 'mouseover', hide: 'mouseout', style: { name: 'dark', tip: 'leftTop' }, position: { corner: { target: 'rightMiddle', tooltip: 'leftTop' }} } );");
 										}
-										else
-										{
-											$sValue = $this->Get($sAttCode);
-											$sDisplayValue = $this->GetEditValue($sAttCode);
-											$aArgs = array('this' => $this, 'formPrefix' => $sPrefix);
-											$sHTMLValue = "<span id=\"field_{$sInputId}\">".self::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $sValue, $sDisplayValue, $sInputId, '', $iFlags, $aArgs).'</span>';
-											$aFieldsMap[$sAttCode] = $sInputId;
-											
-										}
-										$val = array('label' => '<span title="'.$oAttDef->GetDescription().'">'.$oAttDef->GetLabel().'</span>', 'value' => $sHTMLValue, 'comments' => $sComments, 'infos' => $sInfos);
+
+										// Attribute is read-only
+										$sHTMLValue = "<span id=\"field_{$sInputId}\">".$this->GetAsHTML($sAttCode).'</span>';
+										$sComments = $sSynchroIcon;
+									}
+									else
+									{
+										$sValue = $this->Get($sAttCode);
+										$sDisplayValue = $this->GetEditValue($sAttCode);
+										$aArgs = array('this' => $this, 'formPrefix' => $sPrefix);
+										$sHTMLValue = "<span id=\"field_{$sInputId}\">".self::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $sValue, $sDisplayValue, $sInputId, '', $iFlags, $aArgs).'</span>';
+										$aFieldsMap[$sAttCode] = $sInputId;
+
 									}
+									$val = array('label' => '<span title="'.$oAttDef->GetDescription().'">'.$oAttDef->GetLabel().'</span>', 'value' => $sHTMLValue, 'comments' => $sComments, 'infos' => $sInfos);
 								}
 							}
 							else
 							{
 								$val = array('label' => '<span title="'.$oAttDef->GetDescription().'">'.$oAttDef->GetLabel().'</span>', 'value' => "<span id=\"field_{$sInputId}\">".$this->GetAsHTML($sAttCode)."</span>", 'comments' => $sComments, 'infos' => $sInfos);
-								$aFieldsMap[$sAttCode] = $sInputId;			
 							}
 						}
 						else