mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
New concept in the XML: HighlightScale to avoid overloading GetIcon and GetHilightClass...
SVN:trunk[3291]
This commit is contained in:
@@ -201,6 +201,23 @@
|
||||
</fields>
|
||||
<lifecycle>
|
||||
<attribute>status</attribute>
|
||||
<highlight_scale>
|
||||
<item id="approved">
|
||||
<rank>1</rank>
|
||||
<color>HIGHLIGHT_CLASS_NONE</color>
|
||||
<icon>images/change-approved.png</icon>
|
||||
</item>
|
||||
<item id="rejected">
|
||||
<rank>2</rank>
|
||||
<color>HIGHLIGHT_CLASS_NONE</color>
|
||||
<icon>images/change-rejected.png</icon>
|
||||
</item>
|
||||
<item id="closed">
|
||||
<rank>3</rank>
|
||||
<color>HIGHLIGHT_CLASS_NONE</color>
|
||||
<icon>images/change-closed.png</icon>
|
||||
</item>
|
||||
</highlight_scale>
|
||||
<stimuli>
|
||||
<stimulus id="ev_validate" xsi:type="StimulusUserAction"/>
|
||||
<stimulus id="ev_reject" xsi:type="StimulusUserAction"/>
|
||||
@@ -343,6 +360,9 @@
|
||||
<transitions/>
|
||||
</state>
|
||||
<state id="rejected">
|
||||
<highlight>
|
||||
<code>rejected</code>
|
||||
</highlight>
|
||||
<flags>
|
||||
<attribute id="ref">
|
||||
<read_only/>
|
||||
@@ -532,6 +552,9 @@
|
||||
<transitions/>
|
||||
</state>
|
||||
<state id="approved">
|
||||
<highlight>
|
||||
<code>approved</code>
|
||||
</highlight>
|
||||
<flags>
|
||||
<attribute id="ref">
|
||||
<read_only/>
|
||||
@@ -594,6 +617,9 @@
|
||||
<transitions/>
|
||||
</state>
|
||||
<state id="notapproved">
|
||||
<highlight>
|
||||
<code>rejected</code>
|
||||
</highlight>
|
||||
<flags>
|
||||
<attribute id="ref">
|
||||
<read_only/>
|
||||
@@ -657,6 +683,9 @@
|
||||
<transitions/>
|
||||
</state>
|
||||
<state id="implemented">
|
||||
<highlight>
|
||||
<code>approved</code>
|
||||
</highlight>
|
||||
<flags>
|
||||
<attribute id="ref">
|
||||
<read_only/>
|
||||
@@ -719,6 +748,9 @@
|
||||
<transitions/>
|
||||
</state>
|
||||
<state id="monitored">
|
||||
<highlight>
|
||||
<code>approved</code>
|
||||
</highlight>
|
||||
<flags>
|
||||
<attribute id="ref">
|
||||
<read_only/>
|
||||
@@ -790,6 +822,9 @@
|
||||
<transitions/>
|
||||
</state>
|
||||
<state id="closed">
|
||||
<highlight>
|
||||
<code>closed</code>
|
||||
</highlight>
|
||||
<flags>
|
||||
<attribute id="ref">
|
||||
<read_only/>
|
||||
@@ -932,63 +967,6 @@
|
||||
$this->Set('last_update', time());
|
||||
}]]></code>
|
||||
</method>
|
||||
<method id="GetIcon">
|
||||
<comment>/**
|
||||
* Get the icon representing this object
|
||||
* @param boolean $bImgTag If true the result is a full IMG tag (or an emtpy string if no icon is defined)
|
||||
* @return string Either the full IMG tag ($bImgTag == true) or just the path to the icon file
|
||||
*/</comment>
|
||||
<static>false</static>
|
||||
<access>public</access>
|
||||
<type>Overload-DBObject</type>
|
||||
<code><![CDATA[ public function GetIcon($bImgTag = true)
|
||||
{
|
||||
$sStatus = $this->Get('status');
|
||||
switch($this->GetState())
|
||||
{
|
||||
case 'approved':
|
||||
case 'implemented':
|
||||
case 'monitored':
|
||||
$sIcon = self::MakeIconFromName('change-approved.png');
|
||||
break;
|
||||
|
||||
case 'rejected':
|
||||
case 'notapproved':
|
||||
$sIcon = self::MakeIconFromName('change-rejected.png');
|
||||
break;
|
||||
|
||||
case 'closed':
|
||||
$sIcon = self::MakeIconFromName('change-closed.png');
|
||||
break;
|
||||
|
||||
default:
|
||||
$sIcon = MetaModel::GetClassIcon(get_class($this), $bImgTag);
|
||||
}
|
||||
return $sIcon;
|
||||
}]]></code>
|
||||
</method>
|
||||
<method id="MakeIconFromName">
|
||||
<static>true</static>
|
||||
<access>protected</access>
|
||||
<type>Overload-DBObject</type>
|
||||
<code><![CDATA[ protected static function MakeIconFromName($sIconName, $bImgTag = true)
|
||||
{
|
||||
$sIcon = '';
|
||||
if ($sIconName != '')
|
||||
{
|
||||
$sPath = '../env-'.utils::GetCurrentEnvironment().'/itop-change-mgmt-itil/images/'.$sIconName;
|
||||
if ($bImgTag)
|
||||
{
|
||||
$sIcon = "<img src=\"$sPath\" style=\"vertical-align:middle;\"/>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sIcon = $sPath;
|
||||
}
|
||||
}
|
||||
return $sIcon;
|
||||
}]]></code>
|
||||
</method>
|
||||
</methods>
|
||||
<presentation>
|
||||
<details>
|
||||
|
||||
Reference in New Issue
Block a user