diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 852e4b97a..bfb142322 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -544,11 +544,11 @@ EOF { continue; } - $oPage->AddAjaxTab($oAttDef->GetLabel(), + $oPage->AddAjaxTab($oAttDef->GetLabel(), utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php?operation=dashboard&class='.get_class($this).'&id='.$this->GetKey().'&attcode='.$oAttDef->GetCode(), true, 'Class:'.$sClass.'/Attribute:'.$sAttCode, - AjaxTab::ENUM_TAB_PLACEHOLDER_REL_PATH_DASHBOARD); + AjaxTab::ENUM_TAB_PLACEHOLDER_DASHBOARD); continue; } diff --git a/datamodels/2.x/itop-tickets/main.itop-tickets.php b/datamodels/2.x/itop-tickets/main.itop-tickets.php index 97c516855..b17a80a9e 100755 --- a/datamodels/2.x/itop-tickets/main.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/main.itop-tickets.php @@ -285,7 +285,9 @@ 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('Ticket:ImpactAnalysis', utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php?operation=ticket_impact&class='.get_class($this).'&id='.$this->GetKey(), true, null, AjaxTab::ENUM_TAB_PLACEHOLDER_REL_PATH_MISC); + $oPage->AddAjaxTab('Ticket:ImpactAnalysis', + utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php?operation=ticket_impact&class='.get_class($this).'&id='.$this->GetKey(), + true, null, AjaxTab::ENUM_TAB_PLACEHOLDER_MISC); } } } diff --git a/pages/csvimport.php b/pages/csvimport.php index 1d3ad427e..b8af93c9d 100644 --- a/pages/csvimport.php +++ b/pages/csvimport.php @@ -1440,7 +1440,8 @@ EOF if (Utils::GetConfig()->Get('csv_import_history_display')) { $oPage->SetCurrentTabContainer('tabs1'); - $oPage->AddAjaxTab('UI:History:BulkImports', utils::GetAbsoluteUrlAppRoot().'pages/csvimport.php?step=11', true /* bCache */, null, AjaxTab::ENUM_TAB_PLACEHOLDER_REL_PATH_MISC); + $oPage->AddAjaxTab('UI:History:BulkImports', utils::GetAbsoluteUrlAppRoot().'pages/csvimport.php?step=11', true /* bCache */, + null, AjaxTab::ENUM_TAB_PLACEHOLDER_MISC); } } diff --git a/sources/application/UI/Base/Layout/TabContainer/Tab/AjaxTab.php b/sources/application/UI/Base/Layout/TabContainer/Tab/AjaxTab.php index 86b5a3fa9..4601fee02 100644 --- a/sources/application/UI/Base/Layout/TabContainer/Tab/AjaxTab.php +++ b/sources/application/UI/Base/Layout/TabContainer/Tab/AjaxTab.php @@ -33,20 +33,38 @@ use utils; * @internal * @since 3.0.0 */ -class AjaxTab extends Tab { +class AjaxTab extends Tab +{ - const ENUM_TAB_PLACEHOLDER_REL_PATH_LIST = 'images/placeholders/skeleton-list.svg'; - const ENUM_TAB_PLACEHOLDER_REL_PATH_DASHBOARD = 'images/placeholders/skeleton-dashboard.svg'; - const ENUM_TAB_PLACEHOLDER_REL_PATH_OBJECT = 'images/placeholders/skeleton-object.svg'; - const ENUM_TAB_PLACEHOLDER_REL_PATH_MISC = 'images/placeholders/skeleton.svg'; + /** + * @see static::$sPlaceholderRelPath + * @var string + */ + public const ENUM_TAB_PLACEHOLDER_LIST = 'images/placeholders/skeleton-list.svg'; + /** + * @see static::$sPlaceholderRelPath + * @var string + */ + public const ENUM_TAB_PLACEHOLDER_DASHBOARD = 'images/placeholders/skeleton-dashboard.svg'; + /** + * @see static::$sPlaceholderRelPath + * @var string + */ + public const ENUM_TAB_PLACEHOLDER_OBJECT = 'images/placeholders/skeleton-object.svg'; + /** + * @see static::$sPlaceholderRelPath + * @var string + */ + public const ENUM_TAB_PLACEHOLDER_MISC = 'images/placeholders/skeleton.svg'; + + /** @var string */ + public const DEFAULT_TAB_PLACEHOLDER = self::ENUM_TAB_PLACEHOLDER_MISC; - const DEFAULT_TAB_PLACEHOLDER_REL_PATH = self::ENUM_TAB_PLACEHOLDER_REL_PATH_MISC; - // Overloaded constants public const BLOCK_CODE = 'ibo-ajax-tab'; public const TAB_TYPE = TabManager::ENUM_TAB_TYPE_AJAX; - /** @var string Placeholder displayed before tab is loaded */ + /** @var string Placeholder displayed before tab is loaded (relative path from the app. root) */ private $sPlaceholderRelPath; /** @var string The target URL to be loaded asynchronously */ private $sUrl; @@ -60,11 +78,12 @@ class AjaxTab extends Tab { * @param string $sTitle * @param string $sPlaceholderRelPath */ - public function __construct(string $sTabCode, string $sTitle, string $sPlaceholderRelPath = AjaxTab::DEFAULT_TAB_PLACEHOLDER_REL_PATH) + public function __construct(string $sTabCode, string $sTitle, string $sPlaceholderRelPath = AjaxTab::DEFAULT_TAB_PLACEHOLDER) { parent::__construct($sTabCode, $sTitle); $this->sPlaceholderRelPath = $sPlaceholderRelPath; } + /** * @param string $sUrl * diff --git a/sources/application/UI/Base/Layout/TabContainer/TabContainer.php b/sources/application/UI/Base/Layout/TabContainer/TabContainer.php index cabad41c2..7213660b3 100644 --- a/sources/application/UI/Base/Layout/TabContainer/TabContainer.php +++ b/sources/application/UI/Base/Layout/TabContainer/TabContainer.php @@ -121,7 +121,7 @@ class TabContainer extends UIContentBlock public function AddAjaxTab(string $sTabCode, string $sTitle, ?string $sPlaceholder = null): Tab { if($sPlaceholder === null){ - $sPlaceholder = AjaxTab::DEFAULT_TAB_PLACEHOLDER_REL_PATH; + $sPlaceholder = AjaxTab::DEFAULT_TAB_PLACEHOLDER; } $oTab = new AjaxTab($sTabCode, $sTitle, $sPlaceholder); $this->AddSubBlock($oTab);