mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 08:44:10 +02:00
Merge branch 'bugfix/logout-requires-restart-of-browser-10330'
fixes #10330
This commit is contained in:
commit
94f4c670c1
@ -38,10 +38,10 @@ class NavigationItemForm extends Form
|
|||||||
'label' => $this->translate('Target'),
|
'label' => $this->translate('Target'),
|
||||||
'description' => $this->translate('The target where to open this navigation item\'s url'),
|
'description' => $this->translate('The target where to open this navigation item\'s url'),
|
||||||
'multiOptions' => array(
|
'multiOptions' => array(
|
||||||
'_blank' => $this->translate('New Window'),
|
'new_window' => $this->translate('New Window'),
|
||||||
'_next' => $this->translate('New Column'),
|
'next_column' => $this->translate('New Column'),
|
||||||
'_main' => $this->translate('Single Column'),
|
'single_column' => $this->translate('Single Column'),
|
||||||
'_self' => $this->translate('Current Column')
|
'current_column' => $this->translate('Current Column')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -361,7 +361,7 @@ class Web extends EmbeddedWeb
|
|||||||
'logout' => array(
|
'logout' => array(
|
||||||
'label' => t('Logout'),
|
'label' => t('Logout'),
|
||||||
'priority' => 200,
|
'priority' => 200,
|
||||||
'target' => '_self',
|
'target' => 'current_window',
|
||||||
'url' => 'authentication/logout'
|
'url' => 'authentication/logout'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -36,6 +36,13 @@ class NavigationItemRenderer
|
|||||||
*/
|
*/
|
||||||
protected $internalLinkTargets;
|
protected $internalLinkTargets;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Native HTML link targets
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $htmlLinkTargets;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to escape the label
|
* Whether to escape the label
|
||||||
*
|
*
|
||||||
@ -54,7 +61,15 @@ class NavigationItemRenderer
|
|||||||
$this->setOptions($options);
|
$this->setOptions($options);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->internalLinkTargets = array('_main', '_self', '_next');
|
$this->internalLinkTargets = array(
|
||||||
|
'single_column' => '_main',
|
||||||
|
'current_column' => '_self',
|
||||||
|
'next_column' => '_next'
|
||||||
|
);
|
||||||
|
$this->htmlLinkTargets = array(
|
||||||
|
'current_window' => '_self',
|
||||||
|
'new_window' => '_blank'
|
||||||
|
);
|
||||||
$this->init();
|
$this->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +200,7 @@ class NavigationItemRenderer
|
|||||||
$url->overwriteParams($item->getUrlParameters());
|
$url->overwriteParams($item->getUrlParameters());
|
||||||
|
|
||||||
$target = $item->getTarget();
|
$target = $item->getTarget();
|
||||||
if ($url->isExternal() && (!$target || in_array($target, $this->internalLinkTargets, true))) {
|
if ($url->isExternal() && ! ($target && $this->getIcingaLinkTarget($target) === null)) {
|
||||||
$url = Url::fromPath('iframe', array('url' => $url));
|
$url = Url::fromPath('iframe', array('url' => $url));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,10 +237,43 @@ class NavigationItemRenderer
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! in_array($target, $this->internalLinkTargets, true)) {
|
$icingaTarget = $this->getIcingaLinkTarget($target);
|
||||||
return ' target="' . $this->view()->escape($target) . '"';
|
if ($icingaTarget !== null) {
|
||||||
|
return ' data-base-target="' . $icingaTarget . '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
return ' data-base-target="' . $target . '"';
|
$htmlTarget = $this->getHtmlLinkTarget($target);
|
||||||
|
return ' target="' . ($htmlTarget === null ? $this->view()->escape($target) : $htmlTarget) . '"';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If $targetName is an internal link target, return its HTML version. Otherwise, return null.
|
||||||
|
*
|
||||||
|
* @param string $targetName
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
protected function getIcingaLinkTarget($targetName)
|
||||||
|
{
|
||||||
|
if (isset($this->internalLinkTargets[$targetName])) {
|
||||||
|
return $this->internalLinkTargets[$targetName];
|
||||||
|
}
|
||||||
|
if (in_array($targetName, $this->internalLinkTargets, true)) {
|
||||||
|
return $targetName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If $targetName is an HTML link target, return its HTML version. Otherwise, return null.
|
||||||
|
*
|
||||||
|
* @param string $targetName
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
protected function getHtmlLinkTarget($targetName)
|
||||||
|
{
|
||||||
|
if (isset($this->htmlLinkTargets[$targetName])) {
|
||||||
|
return $this->htmlLinkTargets[$targetName];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user