diff --git a/core/dbobject.class.php b/core/dbobject.class.php
index 496282a8d..2c6fa06a7 100644
--- a/core/dbobject.class.php
+++ b/core/dbobject.class.php
@@ -964,6 +964,28 @@ abstract class DBObject implements iDisplay
return MetaModel::GetClassIcon(get_class($this), $bImgTag);
}
+ /**
+ * Get the name as defined in the dictionary
+ * @return string (empty for default name scheme)
+ */
+ public static function GetClassName($sClass)
+ {
+ $sStringCode = 'Class:'.$sClass;
+ return Dict::S($sStringCode, str_replace('_', ' ', $sClass));
+ }
+
+ /**
+ * Get the description as defined in the dictionary
+ * @param string $sClass
+ *
+ * @return string
+ */
+ final static public function GetClassDescription($sClass)
+ {
+ $sStringCode = 'Class:'.$sClass.'+';
+ return Dict::S($sStringCode, '');
+ }
+
/**
* Gets the name of an object in a safe manner for displaying inside a web page
* @return string
diff --git a/core/dict.class.inc.php b/core/dict.class.inc.php
index b792660e8..b365fb0cf 100644
--- a/core/dict.class.inc.php
+++ b/core/dict.class.inc.php
@@ -116,6 +116,22 @@ class Dict
self::$m_iErrorMode = $iErrorMode;
}
+ /**
+ * Check if a dictionary entry exists or not
+ * @param $sStringCode
+ *
+ * @return bool
+ */
+ public static function Exists($sStringCode)
+ {
+ $sImpossibleString = 'aVlHYKEI3TZuDV5o0pghv7fvhYNYuzYkTk7WL0Zoqw8rggE7aq';
+ if (static::S($sStringCode, $sImpossibleString) === $sImpossibleString)
+ {
+ return false;
+ }
+ return true;
+ }
+
/**
* Returns a localised string from the dictonary
*
diff --git a/core/metamodel.class.php b/core/metamodel.class.php
index 711074b43..004530f7a 100644
--- a/core/metamodel.class.php
+++ b/core/metamodel.class.php
@@ -320,8 +320,7 @@ abstract class MetaModel
final static public function GetName($sClass)
{
self::_check_subclass($sClass);
- $sStringCode = 'Class:'.$sClass;
- return Dict::S($sStringCode, str_replace('_', ' ', $sClass));
+ return $sClass::GetClassName($sClass);
}
/**
@@ -411,8 +410,7 @@ abstract class MetaModel
final static public function GetClassDescription($sClass)
{
self::_check_subclass($sClass);
- $sStringCode = 'Class:'.$sClass.'+';
- return Dict::S($sStringCode, '');
+ return $sClass::GetClassDescription($sClass);
}
/**
diff --git a/core/tagsetfield.class.inc.php b/core/tagsetfield.class.inc.php
index 89cd1daa3..5a29c15e3 100644
--- a/core/tagsetfield.class.inc.php
+++ b/core/tagsetfield.class.inc.php
@@ -248,6 +248,22 @@ abstract class TagSetFieldData extends cmdbAbstractObject
}
}
+ public static function GetClassName($sClass)
+ {
+ $aTagFieldInfo = TagSetFieldData::ExtractTagFieldName($sClass);
+ $sClassDesc = MetaModel::GetName($aTagFieldInfo['tag_class']);
+ $sAttDesc = MetaModel::GetAttributeDef($aTagFieldInfo['tag_class'], $aTagFieldInfo['tag_attcode'])->GetLabel();
+ if (Dict::Exists("Class:$sClass"))
+ {
+ $sName = Dict::Format("Class:$sClass", $sClassDesc, $sAttDesc);
+ }
+ else
+ {
+ $sName = Dict::Format('Class:TagSetFieldData', $sClassDesc, $sAttDesc);
+ }
+ return $sName;
+ }
+
/**
* @param $sClass
* @param $sAttCode
diff --git a/dictionaries/en.dictionary.itop.core.php b/dictionaries/en.dictionary.itop.core.php
index 15ed78cd8..24de351c1 100644
--- a/dictionaries/en.dictionary.itop.core.php
+++ b/dictionaries/en.dictionary.itop.core.php
@@ -915,13 +915,12 @@ Dict::Add('EN US', 'English', 'English', array(
// Class: TagSetFieldData
//
Dict::Add('EN US', 'English', 'English', array(
- 'Class:TagSetFieldData' => 'List of tags',
+ 'Class:TagSetFieldData' => '%2$s for class %1$s',
'Class:TagSetFieldData+' => '',
'Core:TagSetFieldData:ErrorDeleteUsedTag' => 'Used tags cannot be deleted',
'Core:TagSetFieldData:ErrorDuplicateTagCodeOrLabel' => 'Tags codes or labels must be unique',
'Core:TagSetFieldData:ErrorTagCodeSyntax' => 'Tags code should contain between 3 and 20 alphanumeric characters',
'Core:TagSetFieldData:ErrorTagLabelSyntax' => 'Tags label should not contain | nor be empty',
'Core:TagSetFieldData:ErrorCodeUpdateNotAllowed' => 'Tags code cannot be changed',
- 'Core:TagSetFieldData:FieldDescription' => '%2$s of class %1$s',
'Core:TagSetFieldData:WhereIsThisTagTab' => 'Tag usage (%1$d)',
));
diff --git a/dictionaries/fr.dictionary.itop.core.php b/dictionaries/fr.dictionary.itop.core.php
index a00f78d3f..0e16d3013 100644
--- a/dictionaries/fr.dictionary.itop.core.php
+++ b/dictionaries/fr.dictionary.itop.core.php
@@ -765,11 +765,13 @@ Opérateurs :
'Core:Validator:Mandatory' => 'Veuillez remplir ce champ',
'Core:Validator:MustBeInteger' => 'Ce champ ne peut contenir qu\'un nombre entier',
'Core:Validator:MustSelectOne' => 'Veuillez choisir une valeur',
+
+ 'Class:TagSetFieldData' => '%2$s pour la classe %1$s',
+ 'Class:TagSetFieldData+' => '',
'Core:TagSetFieldData:ErrorDeleteUsedTag' => 'Impossible de supprimer une étiquette utilisée',
'Core:TagSetFieldData:ErrorDuplicateTagCodeOrLabel' => 'Les codes et noms des étiquettes doivent être unique',
'Core:TagSetFieldData:ErrorTagCodeSyntax' => 'Le code de l\'étiquette doit contenir entre 3 et 20 caractères alphanumériques.',
'Core:TagSetFieldData:ErrorTagLabelSyntax' => 'Le nom de l\'étiquette ne doit pas être vide ni contenir le caractère \'|\'',
'Core:TagSetFieldData:ErrorCodeUpdateNotAllowed' => 'Le code de l\'étiquette ne peut pas être changé',
- 'Core:TagSetFieldData:FieldDescription' => '%2$s pour la classe %1$s',
'Core:TagSetFieldData:WhereIsThisTagTab' => 'Utilisation (%1$d)',
));
diff --git a/pages/tagadmin.php b/pages/tagadmin.php
index fc4c0bd46..5727ee1ae 100644
--- a/pages/tagadmin.php
+++ b/pages/tagadmin.php
@@ -74,12 +74,8 @@ try
{
$sClass = $sCurrentClass;
}
- $aTagFieldInfo = TagSetFieldData::ExtractTagFieldName($sCurrentClass);
- $sClassDesc = MetaModel::GetName($aTagFieldInfo['tag_class']);
- $sAttDesc = MetaModel::GetAttributeDef($aTagFieldInfo['tag_class'], $aTagFieldInfo['tag_attcode'])->GetLabel();
- $sDescription = Dict::Format('Core:TagSetFieldData:FieldDescription', $sClassDesc, $sAttDesc);
$sSelected = ($sCurrentClass == $sClass) ? " SELECTED" : "";
- $sSearchHeaderForceDropdown .= "";
+ $sSearchHeaderForceDropdown .= "";
}
$sSearchHeaderForceDropdown .= "\n";