mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 16:48:42 +02:00
Localized strings for relations (e.g. "impacts")
SVN:trunk[438]
This commit is contained in:
@@ -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");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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...
|
||||
|
||||
@@ -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:<class_name>
|
||||
|
||||
@@ -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 "<a href=\"?operation=details_relation&relcode=$sRelCode\" title=\"$sDec\">".$sRelCode."</a>";
|
||||
$sDesc = MetaModel::GetRelationDescription($sRelCode);
|
||||
return "<a href=\"?operation=details_relation&relcode=$sRelCode\" title=\"$sDesc\">".$sRelCode."</a>";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -305,10 +303,9 @@ function DisplayClassesList($oPage)
|
||||
{
|
||||
$oPage->add("<li>".MakeRelationHLink($sRelCode)."\n");
|
||||
$oPage->add("<ul>\n");
|
||||
foreach (MetaModel::EnumRelationProperties($sRelCode) as $sProp => $sValue)
|
||||
{
|
||||
$oPage->add("<li>$sProp: ".htmlentities($sValue)."</li>\n");
|
||||
}
|
||||
$oPage->add("<li>Description: ".htmlentities(MetaModel::GetRelationDescription($sRelCode))."</li>\n");
|
||||
$oPage->add("<li>Verb up: ".htmlentities(MetaModel::GetRelationVerbUp($sRelCode))."</li>\n");
|
||||
$oPage->add("<li>Verb down: ".htmlentities(MetaModel::GetRelationVerbDown($sRelCode))."</li>\n");
|
||||
$oPage->add("</ul>\n");
|
||||
$oPage->add("</li>\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("<h1>".Dict::Format('UI:Schema:Relation_Code_Description', $sRelCode, $sDesc)."</h1>");
|
||||
$oPage->p(Dict::Format('UI:Schema:RelationDown_Description', $sVerbDown));
|
||||
$oPage->p(Dict::Format('UI:Schema:RelationUp_Description', $sVerbUp));
|
||||
|
||||
Reference in New Issue
Block a user