- New conditional block 'itopcheck' in the templates

SVN:trunk[531]
This commit is contained in:
Denis Flaven
2010-07-02 08:28:03 +00:00
parent 90b9709b78
commit 75c1287ad1
2 changed files with 21 additions and 3 deletions

View File

@@ -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);

View File

@@ -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>