From 132b41482fb2c17d218011ea958f768ee95041be Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Fri, 16 Feb 2018 11:42:22 +0100 Subject: [PATCH] dev #71664 replace pretty-photo by simple anchor --- VERSIONS_WIP/71664 | 1 + .../scripts/catalogue/_catalogue_row.phtml | 3 ++- .../views/scripts/catalogue/paniers.phtml | 11 +++++---- .../views/scripts/cms/_newsform_head.phtml | 4 +++- .../admin/views/scripts/feature/index.phtml | 2 +- .../views/scripts/profil/_page_row.phtml | 2 +- doc/extern_libs.org | 1 - library/Class/ScriptLoader.php | 13 ---------- .../ZendAfi/View/Helper/Accueil/Panier.php | 2 +- library/ZendAfi/View/Helper/Admin/Head.php | 3 +-- .../Helper/ListeNotices/TableauPanier.php | 2 +- library/ZendAfi/View/Helper/Panier/Table.php | 4 ++-- library/ZendAfi/View/Helper/TagPreview.php | 24 +++++++------------ library/ZendAfi/View/Helper/TagSlideshow.php | 17 ++++++------- .../controllers/CatalogueControllerTest.php | 4 ++-- .../admin/controllers/CmsControllerTest.php | 6 ++--- .../controllers/ProfilControllerIndexTest.php | 2 +- 17 files changed, 41 insertions(+), 60 deletions(-) create mode 100644 VERSIONS_WIP/71664 diff --git a/VERSIONS_WIP/71664 b/VERSIONS_WIP/71664 new file mode 100644 index 00000000000..d8aae4e1ab2 --- /dev/null +++ b/VERSIONS_WIP/71664 @@ -0,0 +1 @@ + - ticket #71664 : Accessibilité RGAA : remplacement de la visualisation en popup par l'ouverture dans un nouvel onglet. diff --git a/application/modules/admin/views/scripts/catalogue/_catalogue_row.phtml b/application/modules/admin/views/scripts/catalogue/_catalogue_row.phtml index 19c9131d641..23eb183b456 100644 --- a/application/modules/admin/views/scripts/catalogue/_catalogue_row.phtml +++ b/application/modules/admin/views/scripts/catalogue/_catalogue_row.phtml @@ -38,7 +38,8 @@ $editable = $catalog->canBeDeletedOrModifyByUser($user); 'id_catalogue' => $catalog->getId()], null, true); - echo $this->tagPreview($catalogue_url, $this->_('Visualiser le domaine : %s', $catalog->getLibelle())); + echo $this->tagPreview($catalogue_url, + $this->_('Visualiser le domaine "%s" dans un nouvel onglet', $catalog->getLibelle())); echo $this->permalink($catalogue_url); ?> diff --git a/application/modules/admin/views/scripts/catalogue/paniers.phtml b/application/modules/admin/views/scripts/catalogue/paniers.phtml index 3dc462eaa16..1f4d0643c30 100644 --- a/application/modules/admin/views/scripts/catalogue/paniers.phtml +++ b/application/modules/admin/views/scripts/catalogue/paniers.phtml @@ -4,7 +4,7 @@ $paniers = $this->catalogue->getPanierNotices(); foreach($paniers as $panier) { - $panier_url = $this->absoluteUrl(['module' => 'opac', + $panier_url = $this->absoluteUrl(['module' => 'opac', 'controller' => 'recherche', 'action' => 'simple', 'id_panier' => $panier->getId()], @@ -14,9 +14,10 @@ foreach($paniers as $panier) { echo sprintf('<li>%s %s %s %s</li>', $panier_libelle, - $this->tagPreview($panier_url, 'Visualisation du panier: '.$panier_libelle), - $this->permalink($panier_url), - $this->tagAnchor(['remove' => $panier->getId()], + $this->tagPreview($panier_url, + $this->_('Visualisation du panier "%s" dans un nouvel onglet', $panier_libelle)), + $this->permalink($panier_url), + $this->tagAnchor(['remove' => $panier->getId()], '<img src="'.URL_ADMIN_IMG.'ico/del.gif'.'" alt="Supprimer" title="Supprimer" />')); } @@ -24,4 +25,4 @@ echo $this->renderForm($this->form_paniers); ?> -</ul> \ No newline at end of file +</ul> diff --git a/application/modules/admin/views/scripts/cms/_newsform_head.phtml b/application/modules/admin/views/scripts/cms/_newsform_head.phtml index 244ea74b4ab..6d3b5e959c9 100644 --- a/application/modules/admin/views/scripts/cms/_newsform_head.phtml +++ b/application/modules/admin/views/scripts/cms/_newsform_head.phtml @@ -7,7 +7,9 @@ if (!$this->article->isNew()) { 'action' => 'articleview', 'id' => $this->article->getId()], null, true); - echo $this->tagPreview($article_url, "Visualisation de l'article: " . $this->article->getTitre()); + echo $this->tagPreview($article_url, + $this->_('Visualisation de l\'article "%s" dans un nouvel onglet', + $this->article->getTitre())); echo $this->permalink($this->absoluteUrl($article_url)); } diff --git a/application/modules/admin/views/scripts/feature/index.phtml b/application/modules/admin/views/scripts/feature/index.phtml index 12756ac7176..0b1025b4ac1 100644 --- a/application/modules/admin/views/scripts/feature/index.phtml +++ b/application/modules/admin/views/scripts/feature/index.phtml @@ -62,7 +62,7 @@ $description = (new Class_TableDescription('features')) if(!$feature->getTest()) return ''; return $this->tagPreview(Class_Url::relative($feature->getTest()), - $this->_('Essayer')); + $this->_('Essayer "%s" dans un nouvel onglet', $feature->getLabel())); }) ; diff --git a/application/modules/admin/views/scripts/profil/_page_row.phtml b/application/modules/admin/views/scripts/profil/_page_row.phtml index eba80ec0871..ef943da3574 100644 --- a/application/modules/admin/views/scripts/profil/_page_row.phtml +++ b/application/modules/admin/views/scripts/profil/_page_row.phtml @@ -31,7 +31,7 @@ $url_delete_profil = $this->url(['module' => 'admin', <?php echo $this->tagPreview($this->url(['id_profil' => $this->profil->getId()], null, true), - sprintf("Visualisation de la page '%s'", $this->profil->getLibelle())); + $this->_('Ouvrir la page "%s" dans un nouvel onglet', $this->profil->getLibelle())); ?> <a href="<?php echo $url_copy_profil ?>"> diff --git a/doc/extern_libs.org b/doc/extern_libs.org index 8898613f73e..ed85010b3ee 100644 --- a/doc/extern_libs.org +++ b/doc/extern_libs.org @@ -11,7 +11,6 @@ | Simple color picker (jQuery Plugin) | ? | X | formulaires, sélection couleur | | http://vreboton.blogspot.fr/2010/01/simple-color-picker-jquery-color-picker.html | | CkEditor | GPL/LGPL/MPL | X | CMS / Formations / bib num | | http://ckeditor.com/ | | C5 FileManager | MIT | X | CMS | X | http://labs.corefive.com/projects/filemanager/ | -| PrettyPhoto (js) | Creative C. Attribution 2.5 | X | previews, bib num | | http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/ | | Notify (jQuery plugin) | Creative Commons ? | - | module formations | | http://www.greepit.com/notify/ , http://www.greepit.com/2011/07/designing-user-friendly-websites-and-applications-with-notify/ | | Slimbox2 (jQuery plugin) | MIT-style license (?) | X | photos un peu partout | | http://www.digitalia.be | | Tooltip (jQuery plugin) | MIT/GPL | X | réseau bib | | http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ | diff --git a/library/Class/ScriptLoader.php b/library/Class/ScriptLoader.php index 6acf043a683..b81a79738ea 100644 --- a/library/Class/ScriptLoader.php +++ b/library/Class/ScriptLoader.php @@ -142,19 +142,6 @@ class Class_ScriptLoader { } - /** - * @return ScriptLoader - */ - public function loadPrettyPhoto() { - return $this - ->addStyleSheet(URL_ADMIN_JS.'prettyphoto/css/prettyPhoto') - ->addAdminScript('prettyphoto/js/jquery.prettyPhoto') - ->addJQueryReady('var new_pretty_photo_tags = $("a[data-prettyphoto=\'true\']");'. - 'new_pretty_photo_tags.each(function(){$(this).attr("rel", $(this).attr("data-rel"));});'. - '$("a[rel^=\'prettyPhoto\']").add(new_pretty_photo_tags).prettyPhoto({opacity: 0.20, social_tools: ""})'); - } - - /** * @return ScriptLoader */ diff --git a/library/ZendAfi/View/Helper/Accueil/Panier.php b/library/ZendAfi/View/Helper/Accueil/Panier.php index d155d184456..8ecbc738de8 100644 --- a/library/ZendAfi/View/Helper/Accueil/Panier.php +++ b/library/ZendAfi/View/Helper/Accueil/Panier.php @@ -47,7 +47,7 @@ class ZendAfi_View_Helper_Accueil_Panier extends ZendAfi_View_Helper_Accueil_Abo 'action' => 'simple', 'id_panier' => $this->_selection->getId(), 'retour_panier' => $this->_selection->getId()]), - $this->_('Prévisualisation du panier %s dans le résultat de recherche', $this->_selection->getLibelle())); + $this->_('Prévisualisation du panier "%s" en résultat de recherche dans un nouvel onglet', $this->_selection->getLibelle())); $html .= $this->view->permalink($this->view->absoluteUrl(['module' => 'opac', 'controller' => 'recherche', 'action' => 'simple', diff --git a/library/ZendAfi/View/Helper/Admin/Head.php b/library/ZendAfi/View/Helper/Admin/Head.php index f6cd99c2ef0..e640add368b 100644 --- a/library/ZendAfi/View/Helper/Admin/Head.php +++ b/library/ZendAfi/View/Helper/Admin/Head.php @@ -32,8 +32,7 @@ class ZendAfi_View_Helper_Admin_Head extends ZendAfi_View_Helper_BaseHelper { 'global', 'toolbar']) ->addOPACScript('subModal') - ->showNotifications() - ->loadPrettyPhoto(); + ->showNotifications(); Class_Admin_Skin::current()->renderScriptsOn($head_scripts); diff --git a/library/ZendAfi/View/Helper/ListeNotices/TableauPanier.php b/library/ZendAfi/View/Helper/ListeNotices/TableauPanier.php index 7e9e9af5d4b..df5caab8ac5 100644 --- a/library/ZendAfi/View/Helper/ListeNotices/TableauPanier.php +++ b/library/ZendAfi/View/Helper/ListeNotices/TableauPanier.php @@ -30,7 +30,7 @@ class ZendAfi_View_Helper_ListeNotices_TableauPanier extends ZendAfi_View_Helper return $this->view->tagPreview($this->view->url(['controller' => 'recherche', 'action' => 'viewnotice', 'id' => $model->getId()], null, true), - $this->_('Prévisualisation de la notice %s', $model->getTitrePrincipal())); + $this->_('Voir la notice "%s" dans un nouvel onglet', $model->getTitrePrincipal())); }, function($model) use($selection){ return $this->view->tagAnchor($this->view->url(['action' => 'delete-record', diff --git a/library/ZendAfi/View/Helper/Panier/Table.php b/library/ZendAfi/View/Helper/Panier/Table.php index 61b618b6643..1cfb00cfbd2 100644 --- a/library/ZendAfi/View/Helper/Panier/Table.php +++ b/library/ZendAfi/View/Helper/Panier/Table.php @@ -45,8 +45,8 @@ class ZendAfi_View_Helper_Panier_Table extends ZendAfi_View_Helper_BaseHelper { return $this->view->tagPreview($this->view->url(['controller' => 'recherche', 'action' => 'simple', 'id_panier' => $model->getId(), - 'retour_panier' => $model->getId()]), - $this->_('Prévisualisation du panier %s dans le résultat de recherche', $model->getLibelle())); + 'retour_panier' => $model->getId()]), + $this->_('Prévisualisation du panier "%s" en résultat de recherche dans un nouvel onglet', $model->getLibelle())); }; $permalink = function($model) { return $this->view->permalink($this->view->absoluteUrl(['module' => 'opac', diff --git a/library/ZendAfi/View/Helper/TagPreview.php b/library/ZendAfi/View/Helper/TagPreview.php index 281e09405d4..bcf51511a16 100644 --- a/library/ZendAfi/View/Helper/TagPreview.php +++ b/library/ZendAfi/View/Helper/TagPreview.php @@ -1,6 +1,6 @@ <?php /** - * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. * * BOKEH is free software; you can redistribute it and/or modify * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by @@ -18,22 +18,16 @@ * along with BOKEH; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -class ZendAfi_View_Helper_TagPreview extends ZendAfi_View_Helper_BaseHelper { - public function tagPreview($url, $libelle) { - Class_ScriptLoader::getinstance()->loadPrettyPhoto(); - $url .= '?' . http_build_query(['iframe' => 'true', - 'width' => '95%', - 'height' => '95%'], '', '&'); +class ZendAfi_View_Helper_TagPreview extends ZendAfi_View_Helper_BaseHelper { + public function tagPreview($url, $title) { $icon = Class_Admin_Skin::current()->renderActionIconOn('view', $this->view, - ['title' => $libelle, - 'alt' => $libelle]); + ['title' => $title, + 'alt' => $title]); - return - $this->view->tagAnchor($url, $icon, ['data-prettyphoto' => 'true', - 'title' => $libelle]); + return $this->view->tagAnchor($url, + $icon, + ['title' => $title]); } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/TagSlideshow.php b/library/ZendAfi/View/Helper/TagSlideshow.php index 5f8dc898613..e3712789785 100644 --- a/library/ZendAfi/View/Helper/TagSlideshow.php +++ b/library/ZendAfi/View/Helper/TagSlideshow.php @@ -121,8 +121,7 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement { $(\'%1$s\').cycle(\'next\') } ); container.find(\'.controls a\').css(\'top\', (container.parent().height()/3)+\'px\')', $selector, - json_encode($cycle_options))) - ->loadPrettyPhoto(); + json_encode($cycle_options))); return $this; } @@ -189,14 +188,12 @@ class ZendAfi_View_Helper_TagSlideshow extends Zend_View_Helper_HtmlElement { $media->getLinkTo(), $data); } else { - $datas['content'] = sprintf('<a href="%s" data-prettyphoto="true" data-rel="prettyphoto[%s]" title="%s">%s</a>', - $this->view->url(array('module' => 'opac', - 'controller' => 'bib-numerique', - 'action' => 'get-resource', - 'id' => $media->getId())), - htmlentities($media->getAlbum()->getTitre()), - $media->getTitre(), - $content); + $datas['content'] = $this->view->tagAnchor($this->view->url(['module' => 'opac', + 'controller' => 'bib-numerique', + 'action' => 'get-resource', + 'id' => $media->getId()]), + $content, + ['title' => $this->_('Accéder à la ressource "%s" dans un nouvel onglet', $media->getTitre())]); } diff --git a/tests/application/modules/admin/controllers/CatalogueControllerTest.php b/tests/application/modules/admin/controllers/CatalogueControllerTest.php index 78069dbe2e6..5557f3bf53d 100644 --- a/tests/application/modules/admin/controllers/CatalogueControllerTest.php +++ b/tests/application/modules/admin/controllers/CatalogueControllerTest.php @@ -366,7 +366,7 @@ class CatalogueControllerWithModoPortailTotalAccessIndexTest extends AdminCatalo /** @test */ public function pageShouldContainsCataloguePolitiquePreview() { - $this->assertXPath('//a[@data-prettyphoto="true"][contains(@href, "recherche/simple/id_catalogue/200")]'); + $this->assertXPath('//a[contains(@href, "recherche/simple/id_catalogue/200")]'); } @@ -1298,7 +1298,7 @@ class CatalogueControllerPaniersHistoireTest extends AdminCatalogueControllerTes /** @test */ public function pageShouldContainsPanierPreview() { - $this->assertXPath('//a[@data-prettyphoto="true"][contains(@href, "recherche/simple/id_panier/8")]'); + $this->assertXPath('//a[contains(@href, "recherche/simple/id_panier/8")]'); } } diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index 720f3cff621..c94863df67f 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -771,13 +771,13 @@ class CmsControllerArticleConcertEditActionTest extends CmsControllerWithPermiss /** @test */ function previewShouldContainsArticleUrl() { - $this->assertXPath('//a[@data-prettyphoto="true"][contains(@href, "/cms/articleview/id/4")]'); + $this->assertXPath('//a[contains(@href, "/cms/articleview/id/4")]'); } /** @test */ function previewTitleShouldBeVisualisationDeLArticle() { - $this->assertXPath('//a[@data-prettyphoto="true"][contains(@title, "Visualisation de l\'article: Erik Truffaz en concert")]'); + $this->assertXPath('//a[contains(@title, "Erik Truffaz en concert")]'); } @@ -2607,7 +2607,7 @@ class CmsControllerArticleExistingTraductionEditTest extends CmsControllerWithPe /** @test */ function previewShouldContainsArticleUrl() { - $this->assertXPath('//a[@data-prettyphoto="true"][contains(@href, "cms/articleview/id/41")]'); + $this->assertXPath('//a[contains(@href, "cms/articleview/id/41")]'); } } diff --git a/tests/application/modules/admin/controllers/ProfilControllerIndexTest.php b/tests/application/modules/admin/controllers/ProfilControllerIndexTest.php index 756218ec411..3c048ed43b8 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerIndexTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerIndexTest.php @@ -124,7 +124,7 @@ class Admin_ProfilControllerWithAdminPortailIndexTest extends Admin_ProfilContro /** @test */ function previewPageAccueilAnchorTitleShouldBeVisualisationDeLaPageAdulte() { - $this->assertXPath('//div/ul[1]//li[1]//a[@data-prettyphoto="true"][contains(@title, "Visualisation de la page \'Adulte\'")][@href="/index/index/id_profil/8?iframe=true&width=95%25&height=95%25"]'); + $this->assertXPath("//div/ul[1]//li[1]//a[contains(@title, 'Ouvrir la page \"Adulte\"')][@href='/index/index/id_profil/8']"); } -- GitLab