diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 9832fc573..1f46d323f 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -1033,7 +1033,7 @@ HTML $this->DisplayBareRelations($oPage, $bEditMode); //$oPage->SetCurrentTab('UI:HistoryTab'); //$this->DisplayBareHistory($oPage, $bEditMode); - $oPage->AddAjaxTab(Dict::S('UI:HistoryTab'), + $oPage->AddAjaxTab('UI:HistoryTab', utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php?operation=history&class='.$sClass.'&id='.$iKey); $oPage->add(<< diff --git a/application/webpage.class.inc.php b/application/webpage.class.inc.php index da83a6006..2b8a315e2 100644 --- a/application/webpage.class.inc.php +++ b/application/webpage.class.inc.php @@ -1474,7 +1474,7 @@ class TabManager { // Sometimes people set an empty tab to force content NOT to be rendered in the previous one. We need to remove them. // Note: Look for "->SetCurrentTab('');" for examples. - if (empty($sTabCode)) + if ($sTabCode === '') { unset($aTabs['tabs'][$sTabCode]); } @@ -1604,4 +1604,4 @@ EOF } } } -} \ No newline at end of file +} diff --git a/datamodels/2.x/itop-tickets/main.itop-tickets.php b/datamodels/2.x/itop-tickets/main.itop-tickets.php index e461e6f30..612aea5bf 100755 --- a/datamodels/2.x/itop-tickets/main.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/main.itop-tickets.php @@ -279,8 +279,8 @@ class _Ticket extends cmdbAbstractObject $oPage->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/jquery.contextMenu.css'); $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.contextMenu.js'); $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/simple_graph.js'); - $oPage->AddAjaxTab(Dict::S('Ticket:ImpactAnalysis'), utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php?operation=ticket_impact&class='.get_class($this).'&id='.$this->GetKey(), true); + $oPage->AddAjaxTab('Ticket:ImpactAnalysis', utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php?operation=ticket_impact&class='.get_class($this).'&id='.$this->GetKey(), true); } } } -?> \ No newline at end of file +?> diff --git a/pages/csvimport.php b/pages/csvimport.php index 2afabc5e7..ee20baa31 100644 --- a/pages/csvimport.php +++ b/pages/csvimport.php @@ -1446,7 +1446,7 @@ EOF if (Utils::GetConfig()->Get('csv_import_history_display')) { $oPage->SetCurrentTabContainer('tabs1'); - $oPage->AddAjaxTab(Dict::S('UI:History:BulkImports'), utils::GetAbsoluteUrlAppRoot().'pages/csvimport.php?step=11', true /* bCache */); + $oPage->AddAjaxTab('UI:History:BulkImports', utils::GetAbsoluteUrlAppRoot().'pages/csvimport.php?step=11', true /* bCache */); } } diff --git a/sources/application/TwigBase/Controller/Controller.php b/sources/application/TwigBase/Controller/Controller.php index d2c89451c..379cb7e55 100644 --- a/sources/application/TwigBase/Controller/Controller.php +++ b/sources/application/TwigBase/Controller/Controller.php @@ -466,15 +466,21 @@ abstract class Controller /** * Add an AJAX tab to the current page * - * @api - * - * @param string $sLabel Label of the tab + * @param string $sCode Code of the tab * @param string $sURL URL to call when the tab is activated * @param bool $bCache If true, cache the result for the current web page + * @param string $sLabel Label of the tab (if null the code is translated) + * + * @api + * */ - public function AddAjaxTab($sLabel, $sURL, $bCache = true) + public function AddAjaxTab($sCode, $sURL, $bCache = true, $sLabel = null) { - $this->m_aAjaxTabs[] = array('label' => $sLabel, 'url' => $sURL, 'cache' => $bCache); + if (is_null($sLabel)) + { + $sLabel = Dict::S($sCode); + } + $this->m_aAjaxTabs[$sCode] = array('label' => $sLabel, 'url' => $sURL, 'cache' => $bCache); } /**