diff --git a/library/Class/Codification.php b/library/Class/Codification.php index e0700a47346510576bcf632d8ea1a14e68a7069c..70b8cdf0b03e56ca93754d8d3e44485fb2445283 100644 --- a/library/Class/Codification.php +++ b/library/Class/Codification.php @@ -318,6 +318,9 @@ class Class_Codification { if ('facettes' == $type) return $this->getCodesForFacets(); + if ('facets_closed' == $type) + return $this->getCodesForFacets(); + if ('tags' == $type) return $this->getCodesForTags(); @@ -360,6 +363,9 @@ class Class_Codification { Class_CodifTags::CODE_FACETTE, static::CODE_AVAILABILITY]; + if (! Class_Template::current()->isLegacy()) + $facets [] = Class_TypeDoc::CODE_FACETTE; + return array_merge($facets, Class_CodifThesaurus::getFacettesIndex()); } diff --git a/library/Class/CompareUrl.php b/library/Class/CompareUrl.php index f3b311f0ec9356e2f0abaabb26fbb24426041b18..ead5aeea5f272cb5c412ffca5db2787bc07e469d 100644 --- a/library/Class/CompareUrl.php +++ b/library/Class/CompareUrl.php @@ -89,7 +89,7 @@ class Class_CompareUrl { protected function _extractProfileIdFormUrl($url) { $url = Class_Url::absolute($url); - if (false === strpos($url, Class_Url::baseUrl())) + if (false === strpos($url, Class_Url::domain())) return null; if ( ! $url_request = new Zend_Controller_Request_Http($url)) diff --git a/library/Class/MoteurRecherche/Facettes.php b/library/Class/MoteurRecherche/Facettes.php index 12e96598ff37c7e73008d42b0e610ae0f1007eaa..113e4f89e1af11f924874cd973fd8948a4d10ce7 100644 --- a/library/Class/MoteurRecherche/Facettes.php +++ b/library/Class/MoteurRecherche/Facettes.php @@ -55,7 +55,11 @@ class Class_MoteurRecherche_Facettes { return []; $facet_separator = preg_match('/;/', $this->_preferences['facettes_codes']) ? ';' : ''; - $facet_codes = 'T' . $facet_separator . $this->_preferences['facettes_codes']; + + $facet_codes = $this->_preferences['facettes_codes']; + + if (Class_Template::current()->isLegacy()) + $facet_codes = 'T' . $facet_separator . $facet_codes; return $this->groupAndOrderFacets($this->_codes_count, $this->_sanitizeCodes($facet_codes), diff --git a/library/Class/Notice/RubriqueFacette.php b/library/Class/Notice/RubriqueFacette.php index 1bbfd36556f79cdaba980032d2ee887daace3726..3ac594f9f649e00e51ac2dabead90a5cefda9080 100644 --- a/library/Class/Notice/RubriqueFacette.php +++ b/library/Class/Notice/RubriqueFacette.php @@ -76,8 +76,13 @@ class Class_Notice_RubriqueFacette { protected static function settingArrayToFacet($codes) { - return array_map(function($facet) { return new static($facet); }, - $codes); + $facets = []; + foreach ($codes as $facet) { + $facet = new static($facet); + $facets [$facet->getLibelle()] = $facet; + } + + return $facets; } diff --git a/library/Class/Profil/Preferences/SearchResult.php b/library/Class/Profil/Preferences/SearchResult.php index af5a2c4bfd790ca2ee5fcf3cd59bf0044a4ce19f..7dda01e879a7f64a6faa82d8816c0b4e2c4dc49f 100644 --- a/library/Class/Profil/Preferences/SearchResult.php +++ b/library/Class/Profil/Preferences/SearchResult.php @@ -38,8 +38,10 @@ class Class_Profil_Preferences_SearchResult { 'liste_codes' => 'JTAN', // Champs a afficher dans la liste (TANECR) 'facettes_actif' => 1, // Afficher les facettes 'multi_facettes' => 1, //Autoriser les multi facettes - 'facettes_codes' => 'ADPML', // Types de facettes à afficher + 'facettes_codes' => 'TADPML', // Types de facettes à afficher 'facettes_nombre' => 3, // Nombre de facettes à afficher pour 1 rubrique + 'facets_order' => 0, // Order des rubriques pour 1 ASC + 'facets_closed_codes' => '', // Facettes à plier par défaut 'facettes_message' => $this->_('Affiner le résultat...'), // Message au dessus de la boite 'suggests_enabled' => 1, // Display search suggests 'suggests_number' => 3, // Number of suggests diff --git a/library/Class/Template.php b/library/Class/Template.php index e577bbdd40ef6bb10e2b53e5aa4c21b766d20200..c885f32466652dbc75713c8026f7468875c733ee 100644 --- a/library/Class/Template.php +++ b/library/Class/Template.php @@ -466,6 +466,9 @@ class Class_Template { $rules = explode(' ', $rules); $strategy = array_shift($rules); + if (('class' == $strategy) && (isset($params['alt']))) + unset($params['alt']); + if ('class' == $strategy) return $this->_icons_cache[$cache_key] = $view->tag('i', @@ -487,7 +490,7 @@ class Class_Template { $view->tagImg($strategy, $params); - return $this->_icons_cache[$cache_key] = $mapping[$key]; + return $this->_icons_cache[$cache_key] = implode(' ', $rules); } diff --git a/library/ZendAfi/Form/Configuration/Widget/Action/SearchResult.php b/library/ZendAfi/Form/Configuration/Widget/Action/SearchResult.php index 19b47f427aac2f9eddfd17b82326d35cb7dc474a..1f176745610b5f543beb1a2d1081a7b0cd257942 100644 --- a/library/ZendAfi/Form/Configuration/Widget/Action/SearchResult.php +++ b/library/ZendAfi/Form/Configuration/Widget/Action/SearchResult.php @@ -43,6 +43,15 @@ class ZendAfi_Form_Configuration_Widget_Action_SearchResult extends ZendAfi_Form ['label' => $this->_('Facettes à afficher'), 'field' => 'facettes']) + ->addElement('codeList', + 'facets_closed_codes', + ['label' => $this->_('Facettes à fermer par défaut'), + 'field' => 'facets_closed']) + + ->addElement('checkbox', + 'facets_order', + ['label' => $this->_('Trier les facettes [A-z]')]) + ->addElement('userfile', Class_Notice_Xsl::KEY, ['label' => $this->_('Fichier XSL'), @@ -56,7 +65,9 @@ class ZendAfi_Form_Configuration_Widget_Action_SearchResult extends ZendAfi_Form $this ->addDisplayGroup(['multi_facettes', 'facettes_nombre', - 'facettes_codes'], + 'facettes_codes', + 'facets_closed_codes', + 'facets_order'], 'facettes', ['legend' => $this->_('Facettes')]) diff --git a/library/ZendAfi/View/Helper/Facettes.php b/library/ZendAfi/View/Helper/Facettes.php index 61e7b5e0fa47c252646c41f0633a54f10de92573..a5b216e00edd00c58aff1c76da6ce7898b5da67c 100644 --- a/library/ZendAfi/View/Helper/Facettes.php +++ b/library/ZendAfi/View/Helper/Facettes.php @@ -75,16 +75,16 @@ class ZendAfi_View_Helper_Facettes extends ZendAfi_View_Helper_BaseHelper { public function listeFacettesHTML($codes, $facets, $url) { $html = ''; $rubriques = Class_Notice_RubriqueFacette::parseRubriquesFromPreferenceField($codes); - foreach($rubriques as $rubrique) { + + $rubriques = $this->_orderRubriques($rubriques); + + foreach($rubriques as $label => $rubrique) { $type = $rubrique->getCode(); if (!isset($facets[$type])) continue; - $html .= $this->_tag('li', - $this->_tag('b', $rubrique->getLibelle()) - . $this->listeFacettesElementHTML($type, $facets[$type], $url), - ['class' => 'facette_titre']); + $html .= $this->_rubriqueHTML($label, $type, $facets, $url); } $attribs = ['class' => 'multi_facets_submit bouton', @@ -103,7 +103,20 @@ class ZendAfi_View_Helper_Facettes extends ZendAfi_View_Helper_BaseHelper { } - public function listeFacettesElementHTML($type, $values, $url) { + protected function _orderRubriques($rubriques) { + return $rubriques; + } + + + protected function _rubriqueHTML($rubrique, $type, $facets, $url) { + return $this->_tag('li', + $this->_tag('b', $rubrique) + . $this->listeFacettesElementHTML($type, $facets[$type], $url), + ['class' => 'facette_titre']); + } + + + public function listeFacettesElementHTML($type, $values, $url, $closed = false) { $count = (new Class_AdminVar_UnleashedFacets())->isUnleashed($type) ? count($values) : $this->_preferences['facettes_nombre']; @@ -119,7 +132,7 @@ class ZendAfi_View_Helper_Facettes extends ZendAfi_View_Helper_BaseHelper { $html .= $this->_renderFollowingFacets($type, $following_facets, $url); return $this->_tag('ul', $html, - ['style' => 'list-style:none', + ['style' => 'list-style:none;' . ($closed ? ' display: none;' : ''), 'class' => 'facets_group']); } diff --git a/library/ZendAfi/View/Helper/LibrariesMap.php b/library/ZendAfi/View/Helper/LibrariesMap.php index 3bcf62168e053c548ac14bcda422d9a5f9b47bca..5d7dec788d7e378e38b371ecafcb1481d43f1ac4 100644 --- a/library/ZendAfi/View/Helper/LibrariesMap.php +++ b/library/ZendAfi/View/Helper/LibrariesMap.php @@ -26,6 +26,7 @@ class ZendAfi_View_Helper_LibrariesMap extends ZendAfi_View_Helper_BaseHelper { OPEN = 'open', CLOSE = 'close'; + public function librariesMap($libraries, $container_selector, $preferences = []) { if (!$libraries) return ''; @@ -68,9 +69,21 @@ class ZendAfi_View_Helper_LibrariesMap extends ZendAfi_View_Helper_BaseHelper { 'data-osm' => json_encode($datas), 'data-osm-geojson' => $geojson, 'data-osm-layer' => $osm_layer, - 'data-osm-open-url-icon' => $this->_getUrlIcon('/map/open-marker-icon.png'), - 'data-osm-close-url-icon' => $this->_getUrlIcon('/map/close-marker-icon.png'), - 'data-osm-default-url-icon' => $this->_getUrlIcon('/map/marker-icon.png')]); + 'data-osm-open-url-icon' => $this->_getMarkerOrDefault('osm_opened_marker', '/map/open-marker-icon.png'), + 'data-osm-close-url-icon' => $this->_getMarkerOrDefault('osm_closed_marker', '/map/close-marker-icon.png'), + 'data-osm-default-url-icon' => $this->_getMarkerOrDefault('osm_marker', '/map/marker-icon.png')]); + } + + + protected function _getMarkerOrDefault($key, $default) { + $current = Class_Template::current(); + + if ($current->isLegacy()) + return $this->_getUrlIcon($default); + + return ($ico = $current->getIco($this->view, $key, 'utils')) + ? json_encode($ico) + : $this->_getUrlIcon($default); } diff --git a/library/templates/Intonation/Library/FormCustomizer/Abstract.php b/library/templates/Intonation/Library/FormCustomizer/Abstract.php index 273151697512af085c812e32e6ab797e7007a2d7..0826dc9723249bd994978b40877803a089dab29a 100644 --- a/library/templates/Intonation/Library/FormCustomizer/Abstract.php +++ b/library/templates/Intonation/Library/FormCustomizer/Abstract.php @@ -90,6 +90,17 @@ class Intonation_Library_FormCustomizer_Abstract { ['label' => $this->_('Logo'), 'folder' => 'image']]); + if(!$element = $this->_form->getElement('picto')) + return $this; + + $this->_form + + ->addElement('text', + 'picto_alt', + ['label' => $this->_('Logo alt')]) + + ->addToStyleGroup(['picto_alt']); + return $this; } diff --git a/library/templates/Intonation/Library/ProfilePatcher.php b/library/templates/Intonation/Library/ProfilePatcher.php index 5d9192ebb5295ede6ed5d9ebef6c837548ea57ff..2e29bbfcb4d9460725abf0ca8d72a75b29131fab 100644 --- a/library/templates/Intonation/Library/ProfilePatcher.php +++ b/library/templates/Intonation/Library/ProfilePatcher.php @@ -82,7 +82,10 @@ class Intonation_Library_ProfilePatcher extends Class_Template_ProfilePatcher { (new Class_Profil_ModuleDefinition('recherche', 'resultat', 'simple')), - ['boite' => ['no_border']]); + ['boite' => ['no_border'], + 'facettes_codes' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', + 'facets_order' => 1, + 'facets_closed_codes' => 'ABCDEFGHIJKLMNOPQRSUVWXYZ']); return $this; } diff --git a/library/templates/Intonation/Library/Settings.php b/library/templates/Intonation/Library/Settings.php index 5fdb9ceaa0bcfb25558c15619f12018986336ca4..1abe027b39a4156c606d6ccdde72f958b748c952 100644 --- a/library/templates/Intonation/Library/Settings.php +++ b/library/templates/Intonation/Library/Settings.php @@ -266,11 +266,17 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'icons_map_utils' => ['image_place_holder' => '/library/templates/Intonation/Assets/images/image_place_holder.png', + 'osm_opened_marker' => '', + 'osm_closed_marker' => '', + 'osm_marker' => '', + 'accessibility' => 'class fas fa-low-vision', 'login' => 'class fas fa-sign-in-alt', 'previous' => 'class fas fa-chevron-left', 'next' => 'class fas fa-chevron-right', + 'below' => 'class fas fa-chevron-down', + 'above' => 'class fas fa-chevron-up', 'list' => 'class fas fa-list', 'wall' => 'class fas fa-th', diff --git a/library/templates/Intonation/Library/Widget/Image/Definition.php b/library/templates/Intonation/Library/Widget/Image/Definition.php index 3a37edf82eb4fcd19f2948065c802fc9e29397ca..1c250cd4e37c4b2603b653d2e1d6843c8affdba5 100644 --- a/library/templates/Intonation/Library/Widget/Image/Definition.php +++ b/library/templates/Intonation/Library/Widget/Image/Definition.php @@ -36,6 +36,8 @@ class Intonation_Library_Widget_Image_Definition extends Class_Systeme_ModulesAc $this->_view_helper = 'Intonation_Library_Widget_Image_View'; $this->_defaultValues = ['titre' => $this->_libelle, 'image' => '', - 'link' => '']; + 'image_alt' => '', + 'link' => '', + 'link_title' => $this->_('Accéder à %s')]; } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Image/Form.php b/library/templates/Intonation/Library/Widget/Image/Form.php index e527e09a9fc71d48764a115285b0943693b71228..9cbf59c1dc8e7df73cc82f51f9eb6f33c091922d 100644 --- a/library/templates/Intonation/Library/Widget/Image/Form.php +++ b/library/templates/Intonation/Library/Widget/Image/Form.php @@ -29,10 +29,19 @@ class Intonation_Library_Widget_Image_Form extends ZendAfi_Form_Configuration_Wi 'image', ['label' => $this->_('Sélectionner une image')]) + ->addElement('text', + 'image_alt', + ['label' => $this->_('Image attribut alt')]) + ->addElement('url', 'link', ['label' => $this->_('Lien de l\'image')]) + ->addElement('text', + 'link_title', + ['label' => $this->_('Lien attribut title'), + 'placeholder' => $this->_('Accéder à %s')]) + ->addToSelectionGroup(['image', 'link']); } diff --git a/library/templates/Intonation/Library/Widget/Image/View.php b/library/templates/Intonation/Library/Widget/Image/View.php index eb9a30c8a64e0edb53774adf573eac3bf2276765..ec5c178bde734964e64af10ae6de270ad43acf2d 100644 --- a/library/templates/Intonation/Library/Widget/Image/View.php +++ b/library/templates/Intonation/Library/Widget/Image/View.php @@ -40,11 +40,16 @@ class Intonation_Library_Widget_Image_View extends Zendafi_View_Helper_Accueil_B $img = $image ? $this->view->tagImg(Class_Url::absolute($image), - ['class' => 'image_widget']) + ['class' => 'image_widget', + 'alt' => $this->_settings->getImageAlt()]) : ''; + $title = $this->_settings->getLinkTitle(); + return ($url = trim($this->_settings->getLink())) - ? $this->view->tagAnchor($url, $img, ['title' => $this->_('Accéder à "%s"', $url)]) + ? $this->view->tagAnchor($url, + $img, + ['title' => sprintf($title, $url)]) : $img; } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Nav/View.php b/library/templates/Intonation/Library/Widget/Nav/View.php index 7ed2ab33e3edba6adc9b8137a99665f6f4240773..8e8ea0b8c34338e3bc27f171e508e4ac15e4ed6d 100644 --- a/library/templates/Intonation/Library/Widget/Nav/View.php +++ b/library/templates/Intonation/Library/Widget/Nav/View.php @@ -117,7 +117,11 @@ class Intonation_Library_Widget_Nav_View extends Zendafi_View_Helper_Accueil_Bas if ($src == 'vide.gif') return ''; - return Class_Template::current()->getIco($this->view, $src); + $alt = isset($params['picto_alt']) + ? $params['picto_alt'] + : ''; + + return Class_Template::current()->getIco($this->view, $src, '', ['alt' => $alt]); } diff --git a/library/templates/Intonation/Library/Widget/Search/View.php b/library/templates/Intonation/Library/Widget/Search/View.php index 170c465b6d461867a842f8598d6710b069c88598..99effe30272fd3eb49220b0d5069dde54a5dc054 100644 --- a/library/templates/Intonation/Library/Widget/Search/View.php +++ b/library/templates/Intonation/Library/Widget/Search/View.php @@ -121,6 +121,9 @@ abstract class IntonationSearchRenderAbstract { if ($this->_settings->getAlwaysNewSearch() && ( ! $this->_settings->getFacetsInSession())) return $this; + if ( ! $this->_settings->getFacetsInSession() && $this->_view->search_result_from_me) + return $this; + if ($this->_view->search_result) { $this->_criteria = $this->_view->search_result->getCriteresRecherche(); $this->_criteria->acceptVisitor($this); @@ -140,6 +143,7 @@ abstract class IntonationSearchRenderAbstract { $engine = Class_MoteurRecherche::getInstance(); $this->_view->search_result = new Class_MoteurRecherche_Result($engine->visitSearchSettings($this->_criteria), $this->_criteria); + $this->_view->search_result_from_me = 1; return $this; } diff --git a/library/templates/Intonation/View/OsmMap.php b/library/templates/Intonation/View/OsmMap.php index 119b29e3a426eb4f08696375c9721980817cb4be..9714c98524a7a257487031d953e5ef825bb97929 100644 --- a/library/templates/Intonation/View/OsmMap.php +++ b/library/templates/Intonation/View/OsmMap.php @@ -41,10 +41,21 @@ class Intonation_View_OsmMap extends ZendAfi_View_Helper_BaseHelper { 'data-osm' => json_encode($datas), 'data-osm-geojson' => '', 'data-osm-layer' => 1, - 'data-osm-open-url-icon' => $this->_getUrlIcon('/map/open-marker-icon.png'), - 'data-osm-close-url-icon' => $this->_getUrlIcon('/map/close-marker-icon.png'), - 'data-osm-default-url-icon' => $this->_getUrlIcon('/map/marker-icon.png')], - ' ')); + 'data-osm-open-url-icon' => $this->_getMarkerOrDefault('osm_opened_marker', '/map/open-marker-icon.png'), + 'data-osm-close-url-icon' => $this->_getMarkerOrDefault('osm_closed_marker', '/map/close-marker-icon.png'), + 'data-osm-default-url-icon' => $this->_getMarkerOrDefault('osm_marker', '/map/marker-icon.png')])); + } + + + protected function _getMarkerOrDefault($key, $default) { + $current = Class_Template::current(); + + if ($current->isLegacy()) + return $this->_getUrlIcon($default); + + return ($ico = $current->getIco($this->view, $key, 'utils')) + ? json_encode($ico) + : $this->_getUrlIcon($default); } diff --git a/library/templates/Intonation/View/Search/Facets.php b/library/templates/Intonation/View/Search/Facets.php index bb0a565612c7a1f59be57942ed0085d260fa6f61..4a15dd36cfbef86b471745ae1708264f5183d0aa 100644 --- a/library/templates/Intonation/View/Search/Facets.php +++ b/library/templates/Intonation/View/Search/Facets.php @@ -30,19 +30,51 @@ class Intonation_View_Search_Facets extends ZendAfi_View_Helper_Facettes { if (!$facets) return ''; + $this->_preferences = $preferences; + $facets = $this->_orderFacetsByAlpha($facets); $this->_criteres = (new Intonation_Library_Search_Criteria) ->from($criteres); - $this->_preferences = $preferences; - $this->_addToggleScript(); return $this->_HTMLfacets($criteres, $facets); } + protected function _rubriqueHTML($rubrique, $type, $facets, $url) { + $onclick = $this->_shouldBeClosed($type) + ? "$(this).next().slideToggle();" + : ''; + + $rubrique = $onclick + ? $rubrique . Class_Template::current()->getIco($this->view, 'below', 'utils', ['class' => 'ml-3']) + : $rubrique; + + return $this->_tag('li', + $this->_tag('b', $rubrique, ($onclick ? ['onclick' => $onclick] : '')) + . $this->listeFacettesElementHTML($type, $facets[$type], $url, (boolean) $onclick), + ['class' => 'facette_titre facet_type_' . $type]); + } + + + protected function _shouldBeClosed($type) { + $facets_closed = $this->_preferences['facets_closed_codes']; + return false !== strpos($facets_closed, $type); + } + + + protected function _orderRubriques($rubriques) { + if ( ! $this->_preferences['facets_order']) + return $rubriques; + + ksort($rubriques, SORT_NATURAL | SORT_FLAG_CASE); + + return $rubriques; + } + + protected function _moreFacetsAnchor($code) { return $this->view->tagAction(new Intonation_Library_Link(['Url' => '#', 'Text' => $this->_('Afficher plus de facettes'), @@ -94,6 +126,8 @@ class Intonation_View_Search_Facets extends ZendAfi_View_Helper_Facettes { foreach ($facets as $key => $facets_list) $ordered [$key] = $this->_orderFacets($facets_list); + ksort($ordered, SORT_NATURAL | SORT_FLAG_CASE); + return $ordered; } @@ -103,7 +137,8 @@ class Intonation_View_Search_Facets extends ZendAfi_View_Helper_Facettes { foreach ($facets as $code => $count) $labels [Class_Codification::getInstance()->getLibelleFacette($code)] = [$code => $count]; - ksort($labels); + ksort($labels, SORT_NATURAL | SORT_FLAG_CASE); + $sorted = []; foreach ($labels as $facet) diff --git a/scripts/emacs/phafi-mode.el b/scripts/emacs/phafi-mode.el index 72e3cb26b21f8df9bb77d9bf894c1e896592fd7a..bc4fadccfb3c05852d8ace52f95ea1b17d3134c5 100644 --- a/scripts/emacs/phafi-mode.el +++ b/scripts/emacs/phafi-mode.el @@ -642,6 +642,13 @@ )) ) +(defun phafi-autofocus-theme (folder) + (interactive (list (read-string "Folder name: "))) + (async-shell-command (concat + "cd " (phafi-root-dir) ";" + "autofocus theme " folder + )) + ) (defun phafi-select-db () (interactive) diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index e3743f4c4c197e6135b3220434c8f3cc18600840..3aef9a0e8bbe144aaf18930fe5d595a927411bc4 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -313,13 +313,14 @@ abstract class TemplatesIntonationTestCase extends TemplatesEnabledTestCase { 'sous_menus' => [['type_menu' => 'PROFIL', 'libelle' => 'agenda', 'picto' => 'agenda.gif', + 'picto_alt' => 'image de calendrier', 'preferences' => ['clef_profil' => '5']]]] ]]]; $home = ['modules' => ['3' => ['division' => 4, 'type_module' => 'NAV', - 'preferences' => []], + 'preferences' => ['menu' => '72-H']], '4' => ['division' => 1, 'type_module' => 'ARIANE', @@ -357,6 +358,7 @@ abstract class TemplatesIntonationTestCase extends TemplatesEnabledTestCase { '13' => ['division' => 3, 'type_module' => 'IMAGE', 'preferences' => ['image' => 'ma-banniere.jpeg', + 'image_alt' => 'photo panoramique de la médiathèque', 'link' => 'www.ma-banniere.org']], '14' => ['division' => 3, @@ -560,6 +562,12 @@ class TemplatesDispatchIntonationTest extends TemplatesIntonationTestCase { } + /** @test */ + public function navShouldContainsSearchDotGif() { + $this->assertXPath('//body//nav//img[contains(@src, "agenda.gif")][contains(@alt, "image de calendrier")]', $this->_response->getBody()); + } + + /** @test */ public function buttonClassShouldContainsBtnBtnSecondary() { $this->assertXPath('//button[contains(@class, "btn btn-secondary")]'); @@ -652,6 +660,12 @@ class TemplatesDispatchEditMenuHTest extends TemplatesIntonationTestCase { public function inputPictoTypeShouldBeText() { $this->assertXpath('//input[@name="picto"][@type="text"]'); } + + + /** @test */ + public function inputPictoAltShouldBePresent() { + $this->assertXpath('//input[@name="picto_alt"][@type="text"]'); + } } @@ -1658,8 +1672,11 @@ class TemplatesImageWidgetTest extends TemplatesIntonationTestCase { /** @test */ public function editImageWidgetShouldContainsImage() { - $this->dispatch('/admin/widget/edit-widget/id/13/id_profil/72', true); + $this->dispatch('/admin/widget/edit-widget/id/13/id_profil/72'); $this->assertXpath('//input[@name="image"][@type="text"]'); + $this->assertXpath('//input[@name="image_alt"][@type="text"]'); + $this->assertXpath('//input[@name="link"][@type="url"]'); + $this->assertXpath('//input[@name="link_title"][@type="text"]'); } @@ -1673,14 +1690,14 @@ class TemplatesImageWidgetTest extends TemplatesIntonationTestCase { /** @test */ public function dispatchFrontShouldContainsMaBanniereDotJpeg() { $this->dispatch('/opac/index/index/id_profil/72', true); - $this->assertXPath('//img[contains(@src, "ma-banniere.jpeg")]'); + $this->assertXPath('//img[contains(@src, "ma-banniere.jpeg")][contains(@alt, "photo panoramique")]'); } /** @test */ public function dispatchFrontShouldContainsWwwwMaBanniereDotOrg() { $this->dispatch('/opac/index/index/id_profil/72', true); - $this->assertXPath('//a[contains(@href, "www.ma-banniere.org")]'); + $this->assertXPath('//a[contains(@href, "www.ma-banniere.org")][contains(@title, "Accéder à www.ma-")]'); } } @@ -3849,7 +3866,7 @@ class TemplatesDispatchLibraryWidgetTest extends TemplatesIntonationTestCase { /** @test */ public function annecyCarteShouldRenderMap() { $this->dispatch('/opac/bib/carte/id/1/id_profil/72', true); - $this->assertXPath('//div', 'Carte'); + $this->assertXPath('//div' ,'Carte'); } @@ -4547,6 +4564,20 @@ class TemplatesDispatchAdminWidgetEditActionTest extends TemplatesIntonationTest } + /** @test */ + public function facetsOrderShouldBePresent() { + $this->dispatch('/admin/widget/edit-action/id/recherche_resultat_simple/id_profil/72'); + $this->assertXPath('//input[@type="checkbox"][@name="facets_order"]'); + } + + + /** @test */ + public function facetsClosedShouldBePresent() { + $this->dispatch('/admin/widget/edit-action/id/recherche_resultat_simple/id_profil/72'); + $this->assertXPath('//input[@type="hidden"][@name="facets_closed_codes"]'); + } + + /** @test */ public function pageTitleShouldBeConfigartionDeLaPageDuDocumentDeTypeBook() { $this->dispatch('/admin/widget/edit-action/id/recherche_viewnotice_1/id_profil/72'); @@ -4578,13 +4609,20 @@ class TemplatesDispatchAdminWidgetEditActionTest extends TemplatesIntonationTest /** @test */ public function customCssClassesShouldHaveBeenSaved() { $this->postDispatch('/admin/widget/edit-action/id/recherche_resultat_simple/id_profil/72', - ['boite' => 'ultra_light_widget']); + ['boite' => 'ultra_light_widget', + 'facets_closed_codes' => 'ABC']); $this->assertContains('ultra_light_widget', (new Class_Profil_Preferences())->getModulePref(Class_Profil::find(72), (new Class_Profil_ModuleDefinition('recherche', 'resultat', 'simple')))); + + $this->assertContains('ABC', + (new Class_Profil_Preferences())->getModulePref(Class_Profil::find(72), + (new Class_Profil_ModuleDefinition('recherche', + 'resultat', + 'simple')))); } @@ -4669,8 +4707,10 @@ class TemplatesSearchInSessionTest extends TemplatesIntonationTestCase { $widget->setNewDatas(['facets_in_session' => 0]); $widget->updateProfile(); + Class_Profil::clearCache(); + $this->dispatch('/opac/index/index/id_profil/72'); - $this->assertNotXPath('//input[contains(@value, "trolls de troy")]'); + $this->assertNotXPath('//div[contains(@id, "8")]//input[contains(@value, "trolls de troy")]'); } @@ -5235,4 +5275,43 @@ class TemplatesDispatchRssWidgetTest extends TemplatesIntonationTestCase { $this->dispatch('/opac/rss/render-items/id/3/id_profil/72'); $this->assertContains('onload_utils', $this->_response->getBody()); } -} \ No newline at end of file +} + + + + +class TemplatesDispatchSearchWithFacetsTest extends TemplatesIntonationTestCase { + + protected $_storm_default_to_volatile = false; + + + public function setUp() { + parent::setUp(); + (new Class_Profil_Preferences())->setModulePref(Class_Profil::find(72), + (new Class_Profil_ModuleDefinition('recherche', + 'resultat', + 'simple')), + ['facets_closed_codes' => 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', + 'facettes_codes' => 'ABCDEFGHIJKLMNOPQRSUVWXYZ']); + + $this->dispatch('/opac/recherche/simple/expressionRecherche/pomme/id_profil/72/liste_format/4/titre/Les documents', true); + } + + + /** @test */ + public function searchResultWithClosedFacetsShouldHaveOnclick() { + $this->assertXPath('//ul[contains(@class, "facet")]/li/b[contains(@onclick, ".slideToggle()")]'); + } + + + /** @test */ + public function docTypeFacetShouldNotBePresent() { + $this->assertNotXPath('//li[contains(@class, "facet_type_T")]'); + } + + + /** @test */ + public function authorFacetShouldBePresent() { + $this->assertXPath('//li[contains(@class, "facet_type_A")]'); + } +}