N°2313 - Markup extensibility: Add support for both code AND title in admin. console tabs

This commit is contained in:
Eric
2020-01-16 09:56:22 +01:00
parent 026b7e1836
commit b370deaac9
5 changed files with 17 additions and 11 deletions

View File

@@ -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(<<<HTML
</div><!-- End of object-details -->

View File

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

View File

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

View File

@@ -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 */);
}
}

View File

@@ -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);
}
/**