diff --git a/library/Class/Systeme/ModulesAccueil/Action/AdvancedSearch.php b/library/Class/Systeme/ModulesAccueil/Action/AdvancedSearch.php new file mode 100644 index 0000000000000000000000000000000000000000..6dceaeb75d761a1383245c0ec8c02baa407dd872 --- /dev/null +++ b/library/Class/Systeme/ModulesAccueil/Action/AdvancedSearch.php @@ -0,0 +1,28 @@ +<?php +/** + * Copyright (c) 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 + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +class Class_Systeme_ModulesAccueil_Action_AdvancedSearch extends Class_Systeme_ModulesAccueil_Action { + + public function __construct() { + parent::__construct(); + $this->_form = 'ZendAfi_Form_Configuration_Widget_Action_AdvancedSearch'; + } +} \ No newline at end of file diff --git a/library/Class/Systeme/Widget/Action/AdvancedSearch.php b/library/Class/Systeme/Widget/Action/AdvancedSearch.php new file mode 100644 index 0000000000000000000000000000000000000000..44849c29afd3eed4cf95cce5f904c97968e3a248 --- /dev/null +++ b/library/Class/Systeme/Widget/Action/AdvancedSearch.php @@ -0,0 +1,32 @@ +<?php +/** + * 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 + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class Class_Systeme_Widget_Action_AdvancedSearch extends Class_Systeme_Widget_Action { + public function getResourcesDefinition() { + return new Class_Systeme_ModulesAccueil_Action_AdvancedSearch; + } + + + public function _getTitle() { + return $this->_('Configuration de la page de recherche avancée'); + } +} \ No newline at end of file diff --git a/library/Class/Systeme/Widget/ActionLoader.php b/library/Class/Systeme/Widget/ActionLoader.php index 608d47f04d60cb2e356cdb7a12d6cf72c3a859f9..016fc2ffdb87d95df53c9e61fbab8495999c0d86 100644 --- a/library/Class/Systeme/Widget/ActionLoader.php +++ b/library/Class/Systeme/Widget/ActionLoader.php @@ -23,6 +23,7 @@ class Class_Systeme_Widget_ActionLoader { public function find($id) { $actions = $this->_getActions(); + if (!isset($actions[$id])) return (new Class_Systeme_Widget_Action)->setId($id); @@ -36,6 +37,7 @@ class Class_Systeme_Widget_ActionLoader { $actions = ['recherche_resultat_simple' => 'Class_Systeme_Widget_Action_SearchResult', 'recherche_viewnotice' => 'Class_Systeme_Widget_Action_Record', + 'recherche_avancee' => 'Class_Systeme_Widget_Action_AdvancedSearch', 'abonne_fiche' => 'Class_Systeme_Widget_Action_User', 'author_view' => 'Class_Systeme_Widget_Action_Author', 'bib_en-lire-plus' => 'Class_Systeme_Widget_Action_Library']; diff --git a/library/ZendAfi/Controller/Plugin/DefineURLs.php b/library/ZendAfi/Controller/Plugin/DefineURLs.php index 812b5ea6fd42a1d030e2b40e7d50bdcfe1f01049..f6534b2fc786e2971758c37cfa307189309e1171 100644 --- a/library/ZendAfi/Controller/Plugin/DefineURLs.php +++ b/library/ZendAfi/Controller/Plugin/DefineURLs.php @@ -66,8 +66,7 @@ class ZendAfi_Controller_Plugin_DefineURLs extends Zend_Controller_Plugin_Abstra } $detector = new ZendAfi_Controller_Plugin_DefineURLs_ProfileDetector(); - Class_Profil::setCurrentProfil($detector->detectFrom($request)); - $profil = Class_Profil::getCurrentProfil(); + $profil = Class_Profil::setCurrentProfil($detector->detectFrom($request)); Class_Template::setCurrentFrom($request->getParam('id_profil', $request->getParam('profile_id', $profil->getId()))); @@ -241,7 +240,7 @@ class ZendAfi_Controller_Plugin_DefineURLs_ProfileDetector { } if ($request->getModuleName() !== ZendAfi_Controller_Plugin_DefineURLs::PHONE - && ($profil = Class_Profil::find((int)$session->id_profil))) + && ($profil = Class_Profil::find((int) $session->id_profil))) return $profil; if ($this->shouldSelectTelephone($request) diff --git a/library/ZendAfi/Form/Configuration/Widget/Action/AdvancedSearch.php b/library/ZendAfi/Form/Configuration/Widget/Action/AdvancedSearch.php new file mode 100644 index 0000000000000000000000000000000000000000..58986c799fa1339e38098de59f3874814ea2e0a8 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/Widget/Action/AdvancedSearch.php @@ -0,0 +1,43 @@ +<?php +/** + * 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 + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class ZendAfi_Form_Configuration_Widget_Action_AdvancedSearch extends ZendAfi_Form_Configuration_Widget_Action { + public function init() { + parent::init(); + if (Class_AdminVar::isCustomSearchFormEnabled()) + $this->addElement('sortableConnectLists', + 'forms', + ['label' => $this->_('Formulaires à afficher'), + 'displayInline' => true, + 'selectedLabel' => $this->_('Affichés'), + 'availableLabel' => $this->_('Disponibles'), + 'multiOptions' => Class_SearchForm::getMultiOptions()]); + } + + + public function initDisplayGroups() { + $this->addDisplayGroup(['forms'], + 'custom_forms', + ['Legend' => $this->_('Formulaires personnalisés')]); + parent::initDisplayGroups(); + } +} \ No newline at end of file diff --git a/library/ZendAfi/Form/Configuration/Widget/Action/Record.php b/library/ZendAfi/Form/Configuration/Widget/Action/Record.php index 2d2182fc17c397f99183267db5dd1610784e32b1..2e8678ce1dec654e8925551036972c357d3a68f8 100644 --- a/library/ZendAfi/Form/Configuration/Widget/Action/Record.php +++ b/library/ZendAfi/Form/Configuration/Widget/Action/Record.php @@ -21,6 +21,25 @@ class ZendAfi_Form_Configuration_Widget_Action_Record extends ZendAfi_Form_Configuration_Widget_Action_Tabs { + + + public function init() { + parent::init(); + $this + ->addElement('userfile', + Class_Notice_Xsl::KEY, + ['label' => $this->_('Fichier XSL'), + 'allowEmpty' => true, + 'validators' => [(new Zend_Validate_Regex('/^.*\.xsl$/i')) + ->setMessage($this->_('Le fichier doit être de type "xsl"'))]]); + } + + + public function initDisplayGroups() { + $this->addToDisplaySettingsGroup([Class_Notice_Xsl::KEY]); + parent::initDisplayGroups(); + } + protected function _getRichContentInstance() { return (new Intonation_Library_View_Wrapper_Record_RichContent) ->setView(new Class_Entity) diff --git a/library/ZendAfi/Form/Configuration/Widget/Action/SearchResult.php b/library/ZendAfi/Form/Configuration/Widget/Action/SearchResult.php index c7b87d34cd629946ec021fd6be70619e06e003e1..19b47f427aac2f9eddfd17b82326d35cb7dc474a 100644 --- a/library/ZendAfi/Form/Configuration/Widget/Action/SearchResult.php +++ b/library/ZendAfi/Form/Configuration/Widget/Action/SearchResult.php @@ -41,7 +41,14 @@ class ZendAfi_Form_Configuration_Widget_Action_SearchResult extends ZendAfi_Form ->addElement('codeList', 'facettes_codes', ['label' => $this->_('Facettes à afficher'), - 'field' => 'facettes']); + 'field' => 'facettes']) + + ->addElement('userfile', + Class_Notice_Xsl::KEY, + ['label' => $this->_('Fichier XSL'), + 'allowEmpty' => true, + 'validators' => [(new Zend_Validate_Regex('/^.*\.xsl$/i')) + ->setMessage($this->_('Le fichier doit être de type "xsl"'))]]); } @@ -51,7 +58,9 @@ class ZendAfi_Form_Configuration_Widget_Action_SearchResult extends ZendAfi_Form 'facettes_nombre', 'facettes_codes'], 'facettes', - ['legend' => $this->_('Facettes')]); + ['legend' => $this->_('Facettes')]) + + ->addToDisplaySettingsGroup([Class_Notice_Xsl::KEY]); parent::initDisplayGroups(); Class_Template::current()->customActionForm($this); diff --git a/library/templates/Intonation/Assets/css/intonation.css b/library/templates/Intonation/Assets/css/intonation.css index 1a50278ca453d45cea942ae023c4d0898379cd0b..d5aaf6fb5198e3784476a462a6c51a01735b1353 100644 --- a/library/templates/Intonation/Assets/css/intonation.css +++ b/library/templates/Intonation/Assets/css/intonation.css @@ -417,6 +417,11 @@ label[data-name=note] ~ div label.multi-element-label + br { font-size: 1.5em; } +.jumbotron .nav-link div { + font-size: 11px; + max-width: 100px; +} + .modal_image { position: fixed; width: 100%; @@ -544,6 +549,11 @@ dl.row { display: none !important; } +.card-footer > a.card-link:first-child:last-child .button_text, +.card_action:first-child:last-child .button_text { + display: inline !important; +} + .dropdown-menu .button_text { display: inline-block !important; } @@ -669,11 +679,6 @@ dl.row { color: var(--front-text); } -.card-footer > a.card-link:first-child:last-child .button_text, -.card_action:first-child:last-child .button_text { - display: inline-block !important; -} - @media (min-width: 576px) { .auto_col .card-columns { -webkit-column-count: 2; @@ -729,4 +734,8 @@ dl.row { .card-img-overlay .text-left { text-align: center !important; +} + +.menu_admin_front a[class*="deactivate"][style*="inline"] { + display: block !important; } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Settings.php b/library/templates/Intonation/Library/Settings.php index e227002fdb812968da0007ea8777a919f2eecfb9..7a7d69b9177f286375a3ce36f2ed507af8b366a2 100644 --- a/library/templates/Intonation/Library/Settings.php +++ b/library/templates/Intonation/Library/Settings.php @@ -104,7 +104,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'img class img-thumbnail' => '', 'dl' => 'row', 'dt' => 'col-12 col-sm-3', - 'dd' => 'col-12 col-sm-9', + 'dd' => 'col-12 col-sm-9 d-flex flex-wrap align-content-start', 'dt class user_info' => 'col-12 col-sm-6', 'dd class user_info' => 'col-12 col-sm-6', 'a' => 'text-secondary', diff --git a/library/templates/Intonation/Library/View/Wrapper/Item.php b/library/templates/Intonation/Library/View/Wrapper/Item.php index 4696146ebaf5b8312f507060b68da181ba50e7c2..5f6cd047fe6330b3a0fa447291be4287d0205101 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Item.php +++ b/library/templates/Intonation/Library/View/Wrapper/Item.php @@ -80,9 +80,13 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp ? $this->_('Réserver un exemplaire du document: %s', $this->_model->getTitrePrincipal()) : $this->_('Réservation non disponible, l\'exemplaire est %s.', strtolower(strip_tags($secondary_title))); + $text = $hold_link + ? $this->_('Réserver') + : $this->_('Non réservable'); + return new Intonation_Library_Link(['Url' => $hold_link, 'Class' => $hold_link ? '' : 'text-black-50', - 'Text' => $secondary_title, + 'Text' => $text, 'Title' => $title, 'Popup' => true]); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Record.php b/library/templates/Intonation/Library/View/Wrapper/Record.php index 64687285ad1d8db523708a1f21835ecd70501fd4..fbae409139cbd432e43b2e3758a740cd5a236050 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record.php @@ -78,8 +78,13 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra public function getDescription() { - return $this->getBadges() - . $this->_view->truncate($this->_model->getResume()); + $xsl = (new Class_Notice_Xsl($this->_model, Class_Profil::getCurrentProfil())) + ->beSearchResult(); + + return $xsl->isEnabled() + ? $this->_view->Notice_Xsl($xsl) + : ($this->getBadges() + . $this->_view->truncate($this->_model->getResume())); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Details.php b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Details.php index 4ba6a60caffebff36bf8fb3e40ec895e94ac2470..863ccd56db0a0d2079b3696a0ee770934bdc707a 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Details.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Details.php @@ -31,6 +31,10 @@ class Intonation_Library_View_Wrapper_Record_RichContent_Details extends Intonat if ($this->_content) return $this->_content; + $xsl = (new Class_Notice_Xsl($this->_model, Class_Profil::getCurrentProfil())); + if ($xsl->isEnabled()) + return $this->_content = $this->_view->Notice_Xsl($xsl); + return $this->_content = $this->_model->isPeriodique() ? $this->_view->Notice_Articles($this->_model) : $this->_view->Notice_Entete($this->_model, ['entete' => Class_Codification::CHAMPS]); diff --git a/library/templates/Intonation/Library/Widget/Nav/View.php b/library/templates/Intonation/Library/Widget/Nav/View.php index b67805e4e21df020866fb0491a2823aaf6c3664f..826b96c28514287a0941e3ebba5053994fe8817a 100644 --- a/library/templates/Intonation/Library/Widget/Nav/View.php +++ b/library/templates/Intonation/Library/Widget/Nav/View.php @@ -97,8 +97,8 @@ class Intonation_Library_Widget_Nav_View extends Zendafi_View_Helper_Accueil_Bas protected function _renderLogo($params) { - $thumb = ($src = $params['picto']) - ? $this->view->tagImg($src) + $thumb = (isset($params['picto']) && $params['picto']) + ? $this->_renderPicto($params) : $this->_tag('span', '', ['class' => 'glyphicon glyphicon-globe']); return $this->_tag('span', diff --git a/library/templates/Intonation/Library/Widget/Search/View.php b/library/templates/Intonation/Library/Widget/Search/View.php index 41cee016c8a7b2a745e4d8f02dc09e2fb31820e0..e275ac2275eed6586e470cc53e3a61e2409cae2f 100644 --- a/library/templates/Intonation/Library/Widget/Search/View.php +++ b/library/templates/Intonation/Library/Widget/Search/View.php @@ -178,7 +178,7 @@ abstract class IntonationSearchRenderAbstract { ->addElement('button', uniqid() . 'search_submit', ['content' => $this->_renderPicto($this->_settings->getSearchButton()), - 'title' => $this>_('Rechercher'), + 'title' => $this->_('Rechercher'), 'type' => 'submit', 'escape' => false, 'onclick' => '$(this).parents(\'form\').submit()', diff --git a/library/templates/Intonation/View/CardifyOnlyDescription.php b/library/templates/Intonation/View/CardifyOnlyDescription.php index 46b6037f77c9e31f0617ec80f7438d1ac4357c02..f5eec79900d65a0961348aa1edd93e0ac71950a7 100644 --- a/library/templates/Intonation/View/CardifyOnlyDescription.php +++ b/library/templates/Intonation/View/CardifyOnlyDescription.php @@ -52,10 +52,14 @@ class Intonation_View_CardifyOnlyDescription extends Intonation_View_CardHelper foreach($element->getActions() as $action) $links [] = $this->view->tagAction($action); + $hide_text_button_class = ( 2 >= count($links)) + ? '' + : 'button_text_d_none'; + if (!empty($links)) $html [] = $this->_tag('div', implode($links), - ['class' => 'card-footer d-flex flex-row justify-content-between button_text_d_none']); + ['class' => 'card-footer d-flex flex-row justify-content-between ' . $hide_text_button_class]); return $this->_tag('div', $img . implode($html), diff --git a/library/templates/Intonation/View/Jumbotron.php b/library/templates/Intonation/View/Jumbotron.php index 04108f036f80ce72a1b670dcad2cf02bc538615e..2c2a2e7e83faf2a66b3d232767b28e356f386d56 100644 --- a/library/templates/Intonation/View/Jumbotron.php +++ b/library/templates/Intonation/View/Jumbotron.php @@ -157,10 +157,10 @@ class Intonation_View_Jumbotron extends ZendAfi_View_Helper_BaseHelper { $this->_tag('li', $this->view->tagAnchor(array_merge($item->getNavUrl(), ['id' => $id]), - Class_Template::current()->getIco($this->view, $item->getDBNavIco()). $this->view->div(['class' => 'button_text d-none'], $item->getDBTitle()), + Class_Template::current()->getIco($this->view, $item->getDBNavIco()). $this->view->div(['class' => 'button_text d-none d-xl-block text-truncate'], $item->getDBTitle()), $params), ['class' => 'nav-item']); - } + } protected function _renderContent() { diff --git a/library/templates/Intonation/View/TagAction.php b/library/templates/Intonation/View/TagAction.php index 8bdd9c73b6c352ee295840bed2e1e21a044fc502..08e92e01172ce99543deacd2a1d404718c7af518 100644 --- a/library/templates/Intonation/View/TagAction.php +++ b/library/templates/Intonation/View/TagAction.php @@ -86,6 +86,6 @@ class Intonation_View_TagAction extends ZendAfi_View_Helper_BaseHelper { if (!$img) return $this->_tag('div', $text, ['class' => ' d-inline button_text text-left']); - return $this->_tag('div', $text, ['class' => 'd-none d-sm-inline text-left button_text']); + return $this->_tag('div', $text, ['class' => 'd-none d-md-inline text-left button_text']); } } \ No newline at end of file diff --git a/library/templates/Muscle/Assets/css/muscle.css b/library/templates/Muscle/Assets/css/muscle.css index 8e83c17548d91c98d5eabea03ef326dba5a04ab3..83697caefb2a874f34f7fdd2df969a4546f9c90b 100644 --- a/library/templates/Muscle/Assets/css/muscle.css +++ b/library/templates/Muscle/Assets/css/muscle.css @@ -55,12 +55,12 @@ header { } .widget.justify-content-end * { - justify-content: end; + justify-content: flex-end; text-align: right; } .widget.justify-content-start * { - justify-content: start; + justify-content: flex-start; text-align: left; } diff --git a/library/templates/TerreDuMilieu/Assets/css/terredumilieu.css b/library/templates/TerreDuMilieu/Assets/css/terredumilieu.css index bf79f9fe020a5830ab44c1c1f29a03fc6829734d..5bb0048f1bbdfbd7b3c9dd784750448c0ff18b74 100644 --- a/library/templates/TerreDuMilieu/Assets/css/terredumilieu.css +++ b/library/templates/TerreDuMilieu/Assets/css/terredumilieu.css @@ -295,6 +295,7 @@ nav .nav-link { text-align: center; background-color: var(--tdm-main-background); transform: translate3d(0px, 45px, 0px) !important; + box-shadow: 0 5px 5px var(--tdm-link-color); } .widget.login .dropdown-menu.show > * { @@ -318,6 +319,7 @@ nav .nav-link { z-index: 2; background-position: top center; padding-bottom: 45px; + min-width: 120px; } .widget.login .btn.dropdown-toggle:after { diff --git a/tests/scenarios/Templates/MuscleTemplateTest.php b/tests/scenarios/Templates/MuscleTemplateTest.php index 255655c827fcf71da504eb4eeb5d7d57fd06dde5..e646b043756134fc82261cdf2288590b254c65f0 100644 --- a/tests/scenarios/Templates/MuscleTemplateTest.php +++ b/tests/scenarios/Templates/MuscleTemplateTest.php @@ -20,7 +20,7 @@ */ -abstract class MuscleTemplateTestCase extends AbstractControllerTestCase { +abstract class MuscleTemplateTestCase extends Admin_AbstractControllerTestCase { protected $_storm_default_to_volatile = true; public function setUp() { @@ -32,8 +32,7 @@ abstract class MuscleTemplateTestCase extends AbstractControllerTestCase { ['id' => 23]); (new Muscle_Template)->tryOn($profile); - (new Class_Profil_Promoter())->promote($profile); - + (new Class_Profil_Promoter)->promote($profile); } @@ -159,4 +158,16 @@ class MuscleTemplateEditTemplateTest extends Admin_AbstractControllerTestCase { public function customCssShouldContainsClassMenuButtons() { $this->assertContains('"menu_buttons"', $this->_response->getBody()); } +} + + + + +class MuscleTemplateOpacAdvancedSearchTest extends MuscleTemplateTestCase { + + /** @test */ + public function advancedSearchSettingsShouldContainsCustomForm() { + $this->dispatch('/admin/widget/edit-action/id/recherche_avancee/id_profil/24'); + $this->assertXPath('//input[@id="forms"]'); + } } \ No newline at end of file diff --git a/tests/scenarios/Templates/TerreDuMilieuTemplateTest.php b/tests/scenarios/Templates/TerreDuMilieuTemplateTest.php index a71b9ff93bbf6461fac0b6daabbf3b63e0467c76..9d10aff82e587d7160f4022ea1e7ee28bc023590 100644 --- a/tests/scenarios/Templates/TerreDuMilieuTemplateTest.php +++ b/tests/scenarios/Templates/TerreDuMilieuTemplateTest.php @@ -171,4 +171,101 @@ class TerreDuMilieuTemplateEditTemplateTest extends Admin_AbstractControllerTest public function customCssShouldContainsClassTdmWidget() { $this->assertContains('"tdm_widget"', $this->_response->getBody()); } +} + + + +class TerreDuMilieuTemplateXSLTTest extends TerreDuMilieuTemplateTestCase { + public function setUp() { + parent::setUp(); + + Storm_Cache::beVolatile(); + (new Storm_Cache)->clean(); + Class_MoteurRecherche::resetInstance(); + + Zend_Registry::set('sql', $this->mock() + ->whenCalled('fetchAll') + ->answers([[5], ['T1']])); + + $disk = $this->mock() + ->whenCalled('directoryAt') + ->answers(null) + + ->whenCalled('fileAt') + ->answers((new Class_FileManager) + ->setRealpath('tests/scenarios/Xsl/search_result.xsl')); + + Class_FileManager::setFileSystem($disk); + + $php_command = $this->mock() + ->whenCalled('extension_loaded') + ->answers(true) + + ->whenCalled('unlink') + ->answers(true) + + ->whenCalled('libxml_use_internal_errors') + ->answers(true) + + ->whenCalled('libxml_get_errors') + ->answers([]); + + Class_Notice_Xsl::setPhpCommand($php_command); + + $dom_document = $this->mock() + ->whenCalled('load') + ->answers(true); + + Class_Notice_Xsl::setDomDocument($dom_document); + + $xslt_processor = $this->mock() + ->whenCalled('importStylesheet') + ->answers(true) + + ->whenCalled('transformToXml') + ->answers('<li><strong>Numéro de notice Koha : </strong>2774</li><br><li>'); + + Class_Notice_Xsl::setXSLTProcessor($xslt_processor); + + $profile = Class_Profil::getCurrentProfil(); + + $profile->setCfgModulesPreferences(['xslt' => '/tests/scenarios/Xsl/search_result.xsl'], + 'recherche', + 'resultat', + 'simple'); + + $profile->setCfgModulesPreferences(['xslt' => '/tests/scenarios/Xsl/record_description.xsl'], + 'recherche', + 'viewnotice', + Class_TypeDoc::PERIODIQUE); + $this->fixture('Class_Notice', + ['id' => 5, + 'type_doc' => 1, + 'unimarc' => "01185nam0 2200217 450 0010005000000100031000050350016000360900009000520990038000611000041000991010008001402000036001482100013001842150011001973300660002083330010008686760006008787000028008848010026009129020029009382774 a2-84563-280-0d19,90 Euros aALOES355754 a2774 c2017-12-11d2018-03-16tLIVREx12 a20171211 frey50 afre aSeras-tu là ?fGuillaume Musso cXOd2012 a301 p. aUn seul geste aurait suffi pour tout changer. Qui n'a jamais rêvé de revenir à cet instant décisif où le bonheur était possible ? San Francisco. Elliott, médecin passionné, ne s'est jamais consolé de la disparition d'Ilena, la femme qu'il aimait, morte il y a trente ans. Un jour, par une circonstance extraordinaire, il est ramené en arrière et rencontre le jeune homme qu'il était, trente ans plus tôt. Il est revenu à l'instant décisif où un geste de lui peut sauver Ilena. Et modifier l'implacable destin qui a figé son sort à jamais. Un stupéfiant face-à -face, Une histoire d'amour bouleversante, Un suspense à couper le souffle. aAG 14 aR aMussobGuillaume960415 aFRbCALUIREc20060516 981440aroman francophone"]); + } + + + /** @test */ + public function searchResultShouldLoadTerreDuMilieuCss() { + $this->dispatch('/opac/recherche/simple'); + $this->assertXPath('//head/link[contains(@href, "/templates/TerreDuMilieu/Assets/css/terredumilieu.css")]'); + } + + + /** @test */ + public function searchResultDisplayMarcWithXslt() { + $this->dispatch('/opac/recherche/simple'); + $this->assertContains('<strong>Numéro de notice Koha : </strong>2774</li><br><li>', $this->_response->getBody()); + } + + + /** @test */ + public function recordDetailshouldDisplayMarcWithXslt() { + Class_Notice::find(5) + ->setTypeDoc(Class_TypeDoc::PERIODIQUE) + ->assertSave(); + + $this->dispatch('/opac/record/description/id/5'); + $this->assertContains('<strong>Numéro de notice Koha : </strong>2774</li><br><li>', $this->_response->getBody()); + } } \ No newline at end of file