Revert "Merge branch 'bugfix/logout-requires-restart-of-browser-10330'"

This reverts commit 94f4c670c1, reversing
changes made to 7d5c15469e.

refs #10330
This commit is contained in:
Alexander A. Klimov 2015-12-17 18:50:51 +01:00
parent 94f4c670c1
commit 21f7af4b64
3 changed files with 10 additions and 58 deletions

View File

@ -38,10 +38,10 @@ class NavigationItemForm extends Form
'label' => $this->translate('Target'),
'description' => $this->translate('The target where to open this navigation item\'s url'),
'multiOptions' => array(
'new_window' => $this->translate('New Window'),
'next_column' => $this->translate('New Column'),
'single_column' => $this->translate('Single Column'),
'current_column' => $this->translate('Current Column')
'_blank' => $this->translate('New Window'),
'_next' => $this->translate('New Column'),
'_main' => $this->translate('Single Column'),
'_self' => $this->translate('Current Column')
)
)
);

View File

@ -361,7 +361,7 @@ class Web extends EmbeddedWeb
'logout' => array(
'label' => t('Logout'),
'priority' => 200,
'target' => 'current_window',
'target' => '_self',
'url' => 'authentication/logout'
)
)

View File

@ -36,13 +36,6 @@ class NavigationItemRenderer
*/
protected $internalLinkTargets;
/**
* Native HTML link targets
*
* @var array
*/
protected $htmlLinkTargets;
/**
* Whether to escape the label
*
@ -61,15 +54,7 @@ class NavigationItemRenderer
$this->setOptions($options);
}
$this->internalLinkTargets = array(
'single_column' => '_main',
'current_column' => '_self',
'next_column' => '_next'
);
$this->htmlLinkTargets = array(
'current_window' => '_self',
'new_window' => '_blank'
);
$this->internalLinkTargets = array('_main', '_self', '_next');
$this->init();
}
@ -200,7 +185,7 @@ class NavigationItemRenderer
$url->overwriteParams($item->getUrlParameters());
$target = $item->getTarget();
if ($url->isExternal() && ! ($target && $this->getIcingaLinkTarget($target) === null)) {
if ($url->isExternal() && (!$target || in_array($target, $this->internalLinkTargets, true))) {
$url = Url::fromPath('iframe', array('url' => $url));
}
@ -237,43 +222,10 @@ class NavigationItemRenderer
return '';
}
$icingaTarget = $this->getIcingaLinkTarget($target);
if ($icingaTarget !== null) {
return ' data-base-target="' . $icingaTarget . '"';
if (! in_array($target, $this->internalLinkTargets, true)) {
return ' target="' . $this->view()->escape($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];
}
return ' data-base-target="' . $target . '"';
}
}