";
- $sTip .= "
Synchronized with {$aRow['name']}
";
- $sTip .= "
$sDescription
";
- }
- $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' }} } );");
- $sComments = $sSynchroIcon;
- }
-
- // Attribute is read-only
- $sHTMLValue = "
".$this->GetAsHTML($sAttCode).'';
+ // State attribute is always read-only from the UI
+ $sHTMLValue = $this->GetStateLabel();
+ $val = array('label' => '
', 'value' => $sHTMLValue, 'comments' => $sComments, 'infos' => $sInfos, 'attcode' => $sAttCode);
}
else
{
- $sValue = $this->Get($sAttCode);
- $sDisplayValue = $this->GetEditValue($sAttCode);
- $aArgs = array('this' => $this, 'formPrefix' => $sPrefix);
- $sHTMLValue = "".self::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $sValue, $sDisplayValue, $sInputId, '', $iFlags, $aArgs).'';
+ if ($iFlags & (OPT_ATT_READONLY | OPT_ATT_SLAVE))
+ {
+ // Check if the attribute is not read-only because of a synchro...
+ if ($iFlags & OPT_ATT_SLAVE)
+ {
+ $aReasons = array();
+ $iSynchroFlags = $this->GetSynchroReplicaFlags($sAttCode, $aReasons);
+ $sSynchroIcon = "

";
+ $sTip = '';
+ foreach($aReasons as $aRow)
+ {
+ $sDescription = htmlentities($aRow['description'], ENT_QUOTES, 'UTF-8');
+ $sDescription = str_replace(array("\r\n", "\n"), "
", $sDescription);
+ $sTip .= "
";
+ $sTip .= "
Synchronized with {$aRow['name']}
";
+ $sTip .= "
$sDescription
";
+ }
+ $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' }} } );");
+ $sComments = $sSynchroIcon;
+ }
+
+ // Attribute is read-only
+ $sHTMLValue = "
".$this->GetAsHTML($sAttCode).'';
+ }
+ else
+ {
+ $sValue = $this->Get($sAttCode);
+ $sDisplayValue = $this->GetEditValue($sAttCode);
+ $aArgs = array('this' => $this, 'formPrefix' => $sPrefix);
+ $sHTMLValue = "".self::GetFormElementForField($oPage, $sClass, $sAttCode, $oAttDef, $sValue, $sDisplayValue, $sInputId, '', $iFlags, $aArgs).'';
+ }
+ $aFieldsMap[$sAttCode] = $sInputId;
+ $val = array('label' => '
'.$oAttDef->GetLabel().'', 'value' => $sHTMLValue, 'comments' => $sComments, 'infos' => $sInfos, 'attcode' => $sAttCode);
}
+ }
+ else
+ {
+ $val = array(
+ 'label' => '
'.$oAttDef->GetLabel().'',
+ 'value' => "
".$this->GetAsHTML($sAttCode)."",
+ 'comments' => $sComments,
+ 'infos' => $sInfos,
+ 'attcode' => $sAttCode
+ );
$aFieldsMap[$sAttCode] = $sInputId;
- $val = array('label' => '
'.$oAttDef->GetLabel().'', 'value' => $sHTMLValue, 'comments' => $sComments, 'infos' => $sInfos, 'attcode' => $sAttCode);
+ }
+
+ // Checking how the field should be rendered
+ // Note: For view mode, this is done in cmdbAbstractObject::GetFieldAsHtml()
+ // Note 2: Shouldn't this be a property of the AttDef instead an array that we have to maintain?
+ if (in_array($oAttDef->GetEditClass(), array('Text', 'HTML', 'CaseLog', 'CustomFields', 'OQLExpression')))
+ {
+ $val['layout'] = 'large';
+ }
+ else
+ {
+ $val['layout'] = 'small';
}
}
else
{
- $val = array('label' => '
'.$oAttDef->GetLabel().'', 'value' => "
".$this->GetAsHTML($sAttCode)."", 'comments' => $sComments, 'infos' => $sInfos, 'attcode' => $sAttCode);
- $aFieldsMap[$sAttCode] = $sInputId;
+ $val = null; // Skip this field
}
- // Checking how the field should be rendered
- // Note: For view mode, this is done in cmdbAbstractObject::GetFieldAsHtml()
- // Note 2: Shouldn't this be a property of the AttDef instead an array that we have to maintain?
- if(in_array($oAttDef->GetEditClass(), array('Text', 'HTML', 'CaseLog', 'CustomFields', 'OQLExpression')))
- {
- $val['layout'] = 'large';
- }
- else
- {
- $val['layout'] = 'small';
- }
- }
- else
- {
- $val = null; // Skip this field
- }
-
-
-
-
}
else
{
@@ -781,10 +784,10 @@ EOF
if ($val != null)
{
- // The field is visible, add it to the current column
+ // The field is visible, add it to the current column
$aDetails[$sTab][$sColIndex][] = $val;
$iInputId++;
- }
+ }
}
}
if (!empty($sPreviousLabel))
@@ -801,6 +804,7 @@ EOF
}
$oPage->add('