From 53bb579ff96800ea4b5fa15e03c891021bff16af Mon Sep 17 00:00:00 2001 From: lbrun <lbrun@afi-sa.fr> Date: Tue, 13 Oct 2015 17:07:22 +0200 Subject: [PATCH] * VERSIONS_HOTLINE/30015: target _blank on filemanager and cosmogramme access + tests --- VERSIONS_HOTLINE/30015 | 1 + .../View/Helper/Admin/MenuGaucheAdmin.php | 22 ++++++++++++------- .../View/Helper/Admin/MenuGaucheAdminTest.php | 12 ++++++++++ 3 files changed, 27 insertions(+), 8 deletions(-) create mode 100644 VERSIONS_HOTLINE/30015 diff --git a/VERSIONS_HOTLINE/30015 b/VERSIONS_HOTLINE/30015 new file mode 100644 index 00000000000..1ca6e686ed3 --- /dev/null +++ b/VERSIONS_HOTLINE/30015 @@ -0,0 +1 @@ + - ticket #30015 : Pas de lien de retour vers le front ou vers le back office depuis l'explorateur de fichiers \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Admin/MenuGaucheAdmin.php b/library/ZendAfi/View/Helper/Admin/MenuGaucheAdmin.php index 36cba89c7f8..42ac2b99803 100644 --- a/library/ZendAfi/View/Helper/Admin/MenuGaucheAdmin.php +++ b/library/ZendAfi/View/Helper/Admin/MenuGaucheAdmin.php @@ -78,11 +78,11 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdmin extends ZendAfi_View_Helper_Base .$this->addMenu("moderation_16.png", $this->translate()->_("Modération"), "/admin/modo/", $this->filterAll($this->user), - $nb_moderations) + ['extra_infos' => $nb_moderations]) .$this->addMenu("demande_inscri_16.png", $this->translate()->_("Demandes d'inscription"), "/admin/modo/membreview", $this->filterAll($this->user), - $demandes_inscription) + ['extra_infos' => $demandes_inscription]) .$this->addMenu("lettres_16.png", $this->translate()->_("Lettres d'information"), "/admin/newsletter", $this->filterAdmin($this->user) || $this->user->hasRightToAccess(Class_UserGroup::RIGHT_USER_SITOTHEQUE)) @@ -234,7 +234,8 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdmin extends ZendAfi_View_Helper_Base $this->openBoite($this->translate()->_("Système")) .$this->addMenu("database.png", $this->translate()->_("Accès à Cosmogramme"), Class_AdminVar::get("URL_COSMOGRAMME"), - $this->filterAdminPortail($this->user)) + $this->filterAdminPortail($this->user), + ['target' => '_blank']) .$this->addMenu("batch_16.png", $this->translate()->_("Batchs"), "/admin/batch", $this->filterAdminPortail($this->user)) @@ -263,7 +264,8 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdmin extends ZendAfi_View_Helper_Base .$this->addMenu("file_browser.png", $this->translate()->_("Explorateur de fichiers"), 'http://' . $_SERVER['SERVER_NAME'].CKBASEURL."core_five_filemanager/index.html?ServerPath=".USERFILESURL, - $this->filterAdminPortail($this->user)) + $this->filterAdminPortail($this->user), + ['target' => '_blank']) .$this->addMenu('proprietes.gif', $this->translate()->_('Champs personnalisés'), @@ -331,17 +333,21 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdmin extends ZendAfi_View_Helper_Base return($html); } - function addMenu($img,$titre,$lien, $access_allowed, $extra_infos='') { + function addMenu($img,$titre,$lien, $access_allowed, $options=[]) { if (!$access_allowed) return ''; if(!preg_match('^http://^',$lien)) $lien = BASE_URL.$lien; + $target = isset($options['target']) + ? ' target="' . $options['target'] . '"' + : ''; + $ico = '<img src="'.URL_ADMIN_IMG.'picto/'.$img.'" alt="'.$titre.'" />'; - $url= ['START'=>'<a href="'.$lien.'">', + $url= ['START'=>'<a href="'.$lien.'"'.$target.'>', 'END'=>'</a>']; - $extra_infos = !empty($extra_infos) - ? "<span class='menu_info'>$extra_infos</span>" + $extra_infos = isset($options['extra_infos']) + ? '<span class="menu_info">' . $options['extra_infos'] . '</span>' : ''; $class_selected = ''; diff --git a/tests/library/ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php b/tests/library/ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php index 157adc362f3..3f5a727d3a7 100644 --- a/tests/library/ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php +++ b/tests/library/ZendAfi/View/Helper/Admin/MenuGaucheAdminTest.php @@ -112,6 +112,18 @@ class ZendAfi_View_Helper_Admin_MenuGaucheAdminVariableAsAdminTest extends ZendA public function menuGaucheAdminShouldContainsJamendo() { $this->assertXPath($this->html, '//a[contains(@href, "/admin/harvest/jamendo-browse")]'); } + + + /** @test */ + public function fileExplorerShouldHaveTargetBlank() { + $this->assertXPath($this->html, '//a[contains(@href, "/ckeditor/core_five_filemanager")][@target="_blank"]'); + } + + + /** @test */ + public function cosmogrammeAccessShouldHaveTargetBlank() { + $this->assertXPathContentContains($this->html, '//a[@target="_blank"]', utf8_encode('Accès à Cosmogramme')); + } } -- GitLab