mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 02:28:44 +02:00
- New conditional block 'itopcheck' in the templates
SVN:trunk[531]
This commit is contained in:
@@ -35,7 +35,7 @@ class DisplayTemplate
|
||||
|
||||
public function __construct($sTemplate)
|
||||
{
|
||||
$this->m_aTags = array('itopblock', 'itoptabs', 'itoptab', 'itoptoggle', 'itopstring');
|
||||
$this->m_aTags = array('itopblock', 'itopcheck', 'itoptabs', 'itoptab', 'itoptoggle', 'itopstring');
|
||||
$this->m_sTemplate = $sTemplate;
|
||||
}
|
||||
|
||||
@@ -168,6 +168,20 @@ class DisplayTemplate
|
||||
$oPage->SetCurrentTabContainer('');
|
||||
break;
|
||||
|
||||
case 'itopcheck':
|
||||
$sClassName = $aAttributes['class'];
|
||||
if (MetaModel::IsValidClass($sClassName))
|
||||
{
|
||||
$oTemplate = new DisplayTemplate($sContent);
|
||||
$oTemplate->Render($oPage, array()); // no params to apply, they have already been applied
|
||||
}
|
||||
else
|
||||
{
|
||||
// Leave a trace for those who'd like to understand why nothing is displayed
|
||||
$oPage->add("<!-- class $sClassName does not exist, skipping some part of the template -->\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case 'itoptab':
|
||||
$oPage->SetCurrentTab(Dict::S(str_replace('_', ' ', $aAttributes['name'])));
|
||||
$oTemplate = new DisplayTemplate($sContent);
|
||||
|
||||
@@ -38,12 +38,16 @@ display: list-item;
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="dashboard2">
|
||||
<itopcheck class="ServiceCall">
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;"><itopstring>UI:WelcomeMenu:MyCalls</itopstring></p>
|
||||
<itopblock BlockClass="DisplayBlock" type="list" asynchronous="false" encoding="text/oql">SELECT bizServiceCall AS i WHERE i.caller_id = :current_contact_id</itopblock>
|
||||
<itopblock BlockClass="DisplayBlock" type="list" asynchronous="false" encoding="text/oql">SELECT ServiceCall AS i WHERE i.caller_id = :current_contact_id</itopblock>
|
||||
</itopcheck>
|
||||
</td>
|
||||
<td class="dashboard2">
|
||||
<itopcheck class="IncidentTicket">
|
||||
<p style="text-align:left; font-family:Verdana, Arial, sans-serif; font-size:16px;"><itopstring>UI:WelcomeMenu:MyIncidents</itopstring></p>
|
||||
<itopblock BlockClass="DisplayBlock" type="list" asynchronous="false" encoding="text/oql">SELECT bizIncidentTicket AS i WHERE i.caller_id = :current_contact_id</itopblock>
|
||||
<itopblock BlockClass="DisplayBlock" type="list" asynchronous="false" encoding="text/oql">SELECT IncidentTicket AS i WHERE i.caller_id = :current_contact_id</itopblock>
|
||||
</itopcheck>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user