diff --git a/business/itop.business.class.inc.php b/business/itop.business.class.inc.php index 9dcc74944..5d6c9b8ac 100644 --- a/business/itop.business.class.inc.php +++ b/business/itop.business.class.inc.php @@ -35,7 +35,7 @@ define('STANDARD_STATUSES', 'production,implementation,obsolete'); /** * Relation graphs */ -MetaModel::RegisterRelation("impacts", array("description"=>"objects being functionaly impacted", "verb_down"=>"impacts", "verb_up"=>"is impacted by")); +MetaModel::RegisterRelation("impacts"); //////////////////////////////////////////////////////////////////////////////////// /** diff --git a/business/test_farm.class.inc.php b/business/test_farm.class.inc.php index 4b3cefd5f..dbb9b70fe 100644 --- a/business/test_farm.class.inc.php +++ b/business/test_farm.class.inc.php @@ -27,7 +27,7 @@ // Business implementation demo /////////////////////////////////////////////////////////////////////////////// -//todo MetaModel::RegisterRelation("Potes", array("description"=>"ceux dont l'email ressemble au mien", "verb_down"=>"est pote de", "verb_up"=>"est pote de")); +//todo MetaModel::RegisterRelation("Potes"); //todo MetaModel::RegisterZList("list1", array("description"=>"une premiere list, just for fun", "type"=>"attributes")); diff --git a/core/metamodel.class.php b/core/metamodel.class.php index f8c775117..dd7d829a5 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -711,12 +711,19 @@ abstract class MetaModel return self::$m_aRelationInfos[$sRelCode]; } - final static public function GetRelationProperty($sRelCode, $sProperty) + final static public function GetRelationDescription($sRelCode) { - MyHelpers::CheckKeyInArray('relation code', $sRelCode, self::$m_aRelationInfos); - MyHelpers::CheckKeyInArray('relation property', $sProperty, self::$m_aRelationInfos[$sRelCode]); - - return self::$m_aRelationInfos[$sRelCode][$sProperty]; + return Dict::S("Relation:$sRelCode/Description"); + } + + final static public function GetRelationVerbUp($sRelCode) + { + return Dict::S("Relation:$sRelCode/VerbUp"); + } + + final static public function GetRelationVerbDown($sRelCode) + { + return Dict::S("Relation:$sRelCode/VerbDown"); } public static function EnumRelationQueries($sClass, $sRelCode) @@ -844,23 +851,10 @@ abstract class MetaModel self::$m_aListInfos[$sListCode] = $aListInfo; } - public static function RegisterRelation($sRelCode, $aRelationInfo) + public static function RegisterRelation($sRelCode) { - // Check mandatory params - $aMandatParams = array( - "description" => "detailed (though one line) description of the list", - "verb_down" => "e.g.: 'impacts'", - "verb_up" => "e.g.: 'is impacted by'", - ); - foreach($aMandatParams as $sParamName=>$sParamDesc) - { - if (!array_key_exists($sParamName, $aRelationInfo)) - { - throw new CoreException("Declaration of relation $sRelCode - missing parameter $sParamName"); - } - } - - self::$m_aRelationInfos[$sRelCode] = $aRelationInfo; + // Each item used to be an array of properties... + self::$m_aRelationInfos[$sRelCode] = $sRelCode; } // Must be called once and only once... diff --git a/dictionaries/dictionary.itop.model.php b/dictionaries/dictionary.itop.model.php index 840286d03..96bdd7969 100644 --- a/dictionaries/dictionary.itop.model.php +++ b/dictionaries/dictionary.itop.model.php @@ -23,6 +23,17 @@ * @license http://www.opensource.org/licenses/gpl-3.0.html LGPL */ +////////////////////////////////////////////////////////////////////// +// Relations +////////////////////////////////////////////////////////////////////// +// + +Dict::Add('EN US', 'English', 'English', array( + 'Relation:impacts/Description' => 'functionaly impacted by', + 'Relation:impacts/VerbUp' => 'impacts', + 'Relation:impacts/VerbDown' => 'is impacted by', +)); + // Dictionnay conventions // Class: diff --git a/pages/schema.php b/pages/schema.php index 3f92140ba..5ff26f348 100644 --- a/pages/schema.php +++ b/pages/schema.php @@ -42,10 +42,8 @@ function MakeClassHLink($sClass) */ function MakeRelationHLink($sRelCode) { - $sDec = MetaModel::GetRelationProperty($sRelCode, 'description'); - //$sVerbDown = MetaModel::GetRelationProperty($sRelCode, 'verb_down'); - //$sVerbUp = MetaModel::GetRelationProperty($sRelCode, 'verb_up'); - return "".$sRelCode.""; + $sDesc = MetaModel::GetRelationDescription($sRelCode); + return "".$sRelCode.""; } /** @@ -305,10 +303,9 @@ function DisplayClassesList($oPage) { $oPage->add("
  • ".MakeRelationHLink($sRelCode)."\n"); $oPage->add("\n"); $oPage->add("
  • \n"); } @@ -454,9 +451,9 @@ function DisplayClassDetails($oPage, $sClass) */ function DisplayRelationDetails($oPage, $sRelCode) { - $sDesc = MetaModel::GetRelationProperty($sRelCode, 'description'); - $sVerbDown = MetaModel::GetRelationProperty($sRelCode, 'verb_down'); - $sVerbUp = MetaModel::GetRelationProperty($sRelCode, 'verb_up'); + $sDesc = MetaModel::GetRelationDescription($sRelCode); + $sVerbDown = MetaModel::GetRelationVerbDown($sRelCode); + $sVerbUp = MetaModel::GetRelationVerbUp($sRelCode); $oPage->add("

    ".Dict::Format('UI:Schema:Relation_Code_Description', $sRelCode, $sDesc)."

    "); $oPage->p(Dict::Format('UI:Schema:RelationDown_Description', $sVerbDown)); $oPage->p(Dict::Format('UI:Schema:RelationUp_Description', $sVerbUp));