N°5920 - Add linkset's description as corresponding tab's tooltip in object details

This commit is contained in:
Molkobain
2023-01-25 19:24:50 +01:00
parent 2a825c6ba0
commit e72ed33a40
12 changed files with 108 additions and 29 deletions

View File

@@ -170,11 +170,13 @@ class TabManager
* @param string $sTabCode
*
* @param string|null $sTabTitle
* @param string|null $sTabDescription {@see \Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab\Tab::$sDescription}
*
* @return string
* @throws \Combodo\iTop\Application\UI\Base\UIException
* @since 3.1.0 N°5920 Add $sTabDescription argument
*/
public function SetCurrentTab(string $sTabCode = '', string $sTabTitle = null): ?string
public function SetCurrentTab(string $sTabCode = '', ?string $sTabTitle = null, ?string $sTabDescription = null): ?string
{
$sPreviousTabCode = $this->m_sCurrentTab;
$this->m_sCurrentTab = $sTabCode;
@@ -182,7 +184,7 @@ class TabManager
if ($sTabCode != '') {
// Init tab to HTML tab if not existing
if (!$this->TabExists($this->GetCurrentTabContainer(), $sTabCode)) {
$this->InitTab($this->GetCurrentTabContainer(), $sTabCode, static::ENUM_TAB_TYPE_HTML, $sTabTitle);
$this->InitTab($this->GetCurrentTabContainer(), $sTabCode, static::ENUM_TAB_TYPE_HTML, $sTabTitle, null, $sTabDescription);
}
}
@@ -193,7 +195,7 @@ class TabManager
* Add a tab which content will be loaded asynchronously via the supplied URL
*
* Limitations:
* Cross site scripting is not not allowed for security reasons. Use a normal tab with an IFRAME if you want to
* Cross site scripting is not allowed for security reasons. Use a normal tab with an IFRAME if you want to
* pull content from another server. Static content cannot be added inside such tabs.
*
* @param string $sTabCode The (localised) label of the tab
@@ -202,18 +204,20 @@ class TabManager
* the tab to be reloaded upon each activation.
*
* @param string|null $sTabTitle
* @param string $sPlaceholder
* @param string|null $sPlaceholder
* @param string|null $sTabDescription {@see \Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab\Tab::$sDescription}
*
* @return string
*
* @throws \Combodo\iTop\Application\UI\Base\UIException
* @since 2.0.3
* @since 3.1.0 N°5920 Add $sTabDescription argument
*/
public function AddAjaxTab(string $sTabCode, string $sUrl, bool $bCache = true, string $sTabTitle = null, string $sPlaceholder = null): string
public function AddAjaxTab(string $sTabCode, string $sUrl, bool $bCache = true, ?string $sTabTitle = null, ?string $sPlaceholder = null, ?string $sTabDescription = null): string
{
// Set the content of the tab
/** @var \Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab\AjaxTab $oTab */
$oTab = $this->InitTab($this->m_sCurrentTabContainer, $sTabCode, static::ENUM_TAB_TYPE_AJAX, $sTabTitle, $sPlaceholder);
$oTab = $this->InitTab($this->m_sCurrentTabContainer, $sTabCode, static::ENUM_TAB_TYPE_AJAX, $sTabTitle, $sPlaceholder, $sTabDescription);
$oTab->SetUrl($sUrl)
->SetCache($bCache);
@@ -321,12 +325,14 @@ class TabManager
* @param string $sTabType
* @param string|null $sTabTitle
* @param string|null $sPlaceholder
* @param string|null $sTabDescription {@see \Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab\Tab::$sDescription}
*
* @return \Combodo\iTop\Application\UI\Base\Layout\TabContainer\Tab\Tab
* @throws \Combodo\iTop\Application\UI\Base\UIException
* @since 2.7.0
* @since 3.1.0 N°5920 Add $sTabDescription argument
*/
protected function InitTab(string $sTabContainer, string $sTabCode, string $sTabType = self::DEFAULT_TAB_TYPE, string $sTabTitle = null, string $sPlaceholder = null): Tab
protected function InitTab(string $sTabContainer, string $sTabCode, string $sTabType = self::DEFAULT_TAB_TYPE, ?string $sTabTitle = null, ?string $sPlaceholder = null, ?string $sTabDescription = null): Tab
{
$oTab = null;
if (!$this->TabExists($sTabContainer, $sTabCode)) {
@@ -340,12 +346,12 @@ class TabManager
switch ($sTabType) {
case static::ENUM_TAB_TYPE_AJAX:
$oTab = $oTabContainer->AddAjaxTab($sTabCode, $sTitle, $sPlaceholder);
$oTab = $oTabContainer->AddAjaxTab($sTabCode, $sTitle, $sPlaceholder, $sTabDescription);
break;
case static::ENUM_TAB_TYPE_HTML:
default:
$oTab = $oTabContainer->AddTab($sTabCode, $sTitle);
$oTab = $oTabContainer->AddTab($sTabCode, $sTitle, $sTabDescription);
break;
}
} else {