Prechádzať zdrojové kódy

- Align the display of "State" attributes with Enums

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@555 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 15 rokov pred
rodič
commit
005c3c79a4

+ 2 - 1
core/attributedef.class.inc.php

@@ -951,8 +951,9 @@ class AttributeEnum extends AttributeString
 	public function GetAsHTML($sValue)
 	{
 		$sLabel = Dict::S('Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue, $sValue);
+		$sDescription = Dict::S('Class:'.$this->GetHostClass().'/Attribute:'.$this->GetCode().'/Value:'.$sValue.'+', $sValue);
 		// later, we could imagine a detailed description in the title
-		return "<span title=\"\">".parent::GetAsHtml($sLabel)."</span>";
+		return "<span title=\"$sDescription\">".parent::GetAsHtml($sLabel)."</span>";
 	}
 
 	public function GetEditValue($sValue)

+ 0 - 1
core/dbobject.class.php

@@ -524,7 +524,6 @@ abstract class DBObject
 		else
 		{
 			return $this->Get($sStateAttCode);
-			return MetaModel::GetStateLabel(get_class($this), $sStateAttCode);
 		}
 	}
 

+ 3 - 1
core/metamodel.class.php

@@ -811,7 +811,9 @@ abstract class MetaModel
 	public static function GetStateLabel($sClass, $sStateValue)
 	{
 		$sStateAttrCode = self::GetStateAttributeCode($sClass);
-		return Dict::S("Class:$sClass/Attribute:$sStateAttrCode/Value:$sStateValue", $sStateValue);
+		$oAttDef = self::GetAttributeDef($sClass, $sStateAttrCode);
+		// Be consistent with what is done for enums, since states are defined as enums...
+		return Dict::S("Class:".$oAttDef->GetHostClass()."/Attribute:$sStateAttrCode/Value:$sStateValue");
 
 		// I've decided the current implementation, because I need
 		// to get the description as well -GetAllowedValues does not render the description,