diff --git a/VERSIONS b/VERSIONS index d168f477bad5fa499b654ff17c6b2312785fd756..de0384df069391da2a8037cffd4c691ed3bb361b 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,26 @@ +13/05/2020 - v8.0.57 - v8.0.58 + + - ticket #105706 : Magasin de thèmes : correction des forumlaires dans IOS + + - ticket #108607 : Magasin de thèmes : automatisation de la mise à jour des thèmes lors d'ume mise à jour. + + +11/05/2020 - v8.0.56 + + - ticket #108948 : Magasin de thèmes : correction de l'affichage des horaires + + - ticket #109177 : Magasin de thèmes : correction des liens SSO pour les ressources numériques + + - ticket #109495 : SIGB Koha : correctif sur connecteur à l'API communautaire + + - ticket #108763 : SIGB Pergame : Les prêts compte lecteur ne s'affichaient plus + + +28/04/2020 - v8.0.55 + + - Magasin de thèmes : correction de l'ordre de chargement des fichiers CSS. + + 27/04/2020 - v8.0.54 - ticket #104297 : Ressources numériques : ToutApprendre : possibilité de lien (pkGroup) pointant sur des catégories spécifiques de ToutApprendre diff --git a/application/modules/admin/controllers/ProfilController.php b/application/modules/admin/controllers/ProfilController.php index ca0b78b59834a6e9898e5762bf83435384d75279..e6b1fca9bd7b9bc46111e6c2f6edfa576f4ef03e 100644 --- a/application/modules/admin/controllers/ProfilController.php +++ b/application/modules/admin/controllers/ProfilController.php @@ -321,6 +321,7 @@ class Admin_ProfilController extends ZendAfi_Controller_Action { } $enreg = $this->_updateBannerWidgets($profil, $enreg); + $enreg = $this->_updateFooterWidgets($profil, $enreg); if($profil->setCfgAccueil($enreg)->save()) { $this->_helper->notify($this->view->_('Page ' . $profil->getLibelle() . ' sauvegardée')); @@ -345,6 +346,19 @@ class Admin_ProfilController extends ZendAfi_Controller_Action { } + protected function _updateFooterWidgets($profil, $enreg) { + if(!$parent_profil = $profil->getParentProfil()) + return $this->_injectDefaultsBannerWidgets($profil, $enreg); + + $temp_profil = (new Class_Profil())->setCfgAccueil($enreg); + $parent_profil + ->setFooterBoxes($temp_profil->getFooterBoxes()) + ->save(); + + return $enreg; + } + + protected function _injectDefaultsBannerWidgets($profil, $enreg) { $required_widgets = $this->getSearchAndLoginWidget($profil->getBoitesDivision(Class_Profil::DIV_BANNIERE)); foreach( $required_widgets as $id => $module) { diff --git a/application/modules/opac/controllers/NoticeajaxController.php b/application/modules/opac/controllers/NoticeajaxController.php index b64f3349dfde591131115108842bb12ecd61079b..8529b169376914f6a57fa1db16ca6b7a23ccff41 100644 --- a/application/modules/opac/controllers/NoticeajaxController.php +++ b/application/modules/opac/controllers/NoticeajaxController.php @@ -586,9 +586,21 @@ class NoticeAjaxController extends ZendAfi_Controller_Action { ->setModel($this->notice) ->collection(); - $html = [$this->view->renderTracks($tracks), - $this->view->renderPictures($pictures), - $this->view->renderTrailers($trailers)]; + $viewer = ($viewer = (new Class_Notice_Numel($this->notice))->getViewer()) + ? $viewer + : (new Class_Notice_Gallica($this->notice))->getViewer(); + + $html = []; + + if ($viewer) + $html = [$viewer->renderOn($this->view)]; + + $html = array_merge($html, + [$this->view->renderAlbum($this->notice->getAlbum()), + $this->view->recordAlbums($this->notice), + $this->view->renderTracks($tracks), + $this->view->renderPictures($pictures), + $this->view->renderTrailers($trailers)]); $html = array_filter($html); diff --git a/cosmogramme/php/upgrade_db.php b/cosmogramme/php/upgrade_db.php index f0d6664b7719aedbf9a0265f80061699bcef1cac..b211d6af14de9f59e9d9d82f7652c55db4258531 100644 --- a/cosmogramme/php/upgrade_db.php +++ b/cosmogramme/php/upgrade_db.php @@ -1,13 +1,11 @@ <?php - $basePath = dirname(realpath(__FILE__)); require_once 'classes/classe_cosmopaths.php'; - $cosmo_path = new CosmoPaths(); define('BASE_URL', $cosmo_path->getBaseUrl()); - require_once($basePath.'/../storm_init.php'); - (new Class_Migration_ScriptPatchs())->runFrom(262); +(new Class_Migration_ScriptPatchs())->runFrom(262); +(new Class_Template_Update)->run(); ?> \ No newline at end of file diff --git a/library/Class/Profil.php b/library/Class/Profil.php index 2ff1164cd98e26581f681d66f5fdfc95609130d2..acc8547a9309ce580e6285e6cba4ea4964c5c809 100644 --- a/library/Class/Profil.php +++ b/library/Class/Profil.php @@ -613,15 +613,21 @@ class Class_Profil extends Storm_Model_Abstract { return Class_Url::absolute(''); } - protected function isModulePreferencesSharedBetweenProfils($module, $type_module) { + + protected function _isModulePreferencesSharedBetweenProfils($module, $type_module) { if (isset($module['parent_id'])) - return false; + return ''; - return ( - (isset($module['division']) && ($module['division'] == self::DIV_BANNIERE)) - || - (!isset($module['division']) && ($this->isTypeBoiteInBanniere($type_module))) - ); + if (isset($module['division']) && ($module['division'] == self::DIV_BANNIERE)) + return self::DIV_BANNIERE; + + if (isset($module['division']) && ($module['division'] == self::DIV_FOOTER)) + return self::DIV_FOOTER; + + if (!isset($module['division']) && ($this->isTypeBoiteInBanniere($type_module))) + return self::DIV_BANNIERE; + + return ''; } @@ -637,8 +643,8 @@ class Class_Profil extends Storm_Model_Abstract { $cfg_accueil['modules'][$id_module] : ['preferences' => []]; - if ($this->isModulePreferencesSharedBetweenProfils($module, $type_module)) - return $this->getModuleAccueilPreferencesByType($type_module, self::DIV_BANNIERE, $id_module); + if ($division_shared = $this->_isModulePreferencesSharedBetweenProfils($module, $type_module)) + return $this->getModuleAccueilPreferencesByType($type_module, $division_shared, $id_module); $preferences = []; if (array_isset('preferences', $module)) @@ -678,6 +684,15 @@ class Class_Profil extends Storm_Model_Abstract { return $this; } + if (isset($module_config['division']) + && (self::DIV_FOOTER == $module_config['division']) + && $this->hasParentProfil()) { + $this->getParentProfil() + ->updateModuleConfigAccueil($id_module, $module_config) + ->save(); + return $this; + } + $cfg_accueil = $this->getCfgAccueilAsArray(); $cfg_accueil['modules'][$id_module] = $module_config; $this->setCfgAccueil($cfg_accueil); @@ -755,8 +770,8 @@ class Class_Profil extends Storm_Model_Abstract { : ['type_module' => $type_module, 'preferences' => Class_Systeme_ModulesAccueil::getInstance()->getValeursParDefaut($type_module)]; - if ($this->isModulePreferencesSharedBetweenProfils($module, $type_module)) - return $this->getModuleAccueilConfigByType($type_module, self::DIV_BANNIERE); + if ($division_shared = $this->_isModulePreferencesSharedBetweenProfils($module, $type_module)) + return $this->getModuleAccueilConfigByType($type_module, $division_shared); if ($local_config = $this->getLocalModuleAccueilConfig($id_module)) return $local_config; @@ -778,6 +793,18 @@ class Class_Profil extends Storm_Model_Abstract { } + public function getFooterBoxes() { + $cfg_accueil = $this->getCfgAccueilAsArray(); + $_boxes = []; + foreach ($cfg_accueil['modules'] as $id => $module) { + if (isset($module['division']) && ($module['division'] == self::DIV_FOOTER)) + $_boxes[$id] = $module; + } + + return $_boxes; + } + + public function setBannerBoxes($widgets) { $cfg_accueil = $this->getCfgAccueilAsArray(); foreach ($cfg_accueil['modules'] as $id => $module) { @@ -793,15 +820,33 @@ class Class_Profil extends Storm_Model_Abstract { } + public function setFooterBoxes($widgets) { + $cfg_accueil = $this->getCfgAccueilAsArray(); + foreach ($cfg_accueil['modules'] as $id => $module) { + if ($module['division'] == self::DIV_FOOTER) + unset($cfg_accueil['modules'][$id]); + } + + foreach($widgets as $id => $config) + $cfg_accueil['modules'][$id] = $config; + + $this->setCfgAccueil($cfg_accueil); + return $this; + } + + /** @return array */ public function getLocalModuleAccueilConfig($id_module) { $cfg_accueil = $this->getCfgAccueilAsArray(); $banner_boxes = []; - if ($this->hasParentProfil()) + $footer_boxes = []; + if ($this->hasParentProfil()) { $banner_boxes = $this->getParentProfil()->getBannerBoxes(); + $footer_boxes = $this->getParentProfil()->getFooterBoxes(); + } - $modules_config = $cfg_accueil['modules'] + $banner_boxes; + $modules_config = $cfg_accueil['modules'] + $banner_boxes + $footer_boxes; $module = ['type_module' => null, 'preferences' => [], @@ -1570,9 +1615,15 @@ class Class_Profil extends Storm_Model_Abstract { public function hasBoiteInDivision($division, $type_module) { + $cfg_accueil = null; + if ($division == self::DIV_BANNIERE and $this->hasParentProfil()) $cfg_accueil = $this->getParentProfil()->getCfgAccueilAsArray(); - else + + if ($division == self::DIV_FOOTER and $this->hasParentProfil()) + $cfg_accueil = $this->getParentProfil()->getCfgAccueilAsArray(); + + if (!$cfg_accueil) $cfg_accueil = $this->getCfgAccueilAsArray(); $boites = $this->_filterCfgAccueilByDivision($cfg_accueil, $division); @@ -1592,6 +1643,9 @@ class Class_Profil extends Storm_Model_Abstract { if ($division == self::DIV_BANNIERE and $this->hasParentProfil()) return $this->getParentProfil()->getBoitesDivision($division); + if ($division == self::DIV_FOOTER and $this->hasParentProfil()) + return $this->getParentProfil()->getBoitesDivision($division); + if ($division == '5' && Class_AdminVar::isBoitePanierAutoEnabled()) $this->setBoitePanierInDivisionFive(); @@ -1964,10 +2018,15 @@ class Class_Profil extends Storm_Model_Abstract { if(!$this->hasParentProfil()) return; - if(!$parent_banner_modules = $this->getParentProfil()->getBoitesDivision(self::DIV_BANNIERE)) + $parent_modules = $this->getParentProfil()->getBoitesDivision(self::DIV_BANNIERE) + + $this->getParentProfil()->getBoitesDivision(self::DIV_FOOTER); + + $parent_modules = array_filter($parent_modules); + + if (!$parent_modules) return; - if(!$ids_used_by_parent_profil = array_keys($parent_banner_modules)) + if(!$ids_used_by_parent_profil = array_keys($parent_modules)) return; return $this->doNotUseIds($ids_used_by_parent_profil); diff --git a/library/Class/ScriptLoader.php b/library/Class/ScriptLoader.php index 7564ab09c5a0c191b55cbfcd50c105ad43c016a7..6bd96649ac507c5b670a0c54d92912e6ec984e7b 100644 --- a/library/Class/ScriptLoader.php +++ b/library/Class/ScriptLoader.php @@ -629,8 +629,13 @@ class Class_ScriptLoader { * @return String */ public function styleSheetsHTML() { + return implode('', $this->styleSheetsArray()); + } + + + public function styleSheetsArray() { $this->_deferredLoadAmber(); - return implode('',array_unique($this->_css_lines)); + return array_unique($this->_css_lines); } @@ -647,11 +652,16 @@ class Class_ScriptLoader { * @return String */ public function javaScriptsHTML() { + return implode('', $this->javaScriptsArray()); + } + + + public function javaScriptsArray() { $this ->_deferredLoadAmber() ->_injectJQueryReadyScripts(); - return implode('',array_unique($this->_script_lines)); + return array_unique($this->_script_lines); } diff --git a/library/Class/Systeme/Widget/Section.php b/library/Class/Systeme/Widget/Section.php index 6e14ff9bc0b313f91d836d30cd88a3926d48445e..bc47f1392c5468084eee98ce6cfa866312520ead 100644 --- a/library/Class/Systeme/Widget/Section.php +++ b/library/Class/Systeme/Widget/Section.php @@ -104,4 +104,9 @@ class Class_Systeme_Widget_Section extends Class_Systeme_Widget_Abstract { public function isMain() { return $this->getResourcesDefinition()->isMain(); } + + + public function isShared() { + return false; + } } \ No newline at end of file diff --git a/library/Class/Systeme/Widget/Section/Footer.php b/library/Class/Systeme/Widget/Section/Footer.php index 267626c065b2e553d34c68605a0476b751a232d2..65f3f63a72c3baee502406be7d768be375d5ad39 100644 --- a/library/Class/Systeme/Widget/Section/Footer.php +++ b/library/Class/Systeme/Widget/Section/Footer.php @@ -30,4 +30,9 @@ class Class_Systeme_Widget_Section_Footer extends Class_Systeme_Widget_Section { public function getResourcesDefinition() { return new Class_Systeme_ModulesAccueil_Section_Footer; } + + + public function isShared() { + return true; + } } \ No newline at end of file diff --git a/library/Class/Systeme/Widget/Section/Header.php b/library/Class/Systeme/Widget/Section/Header.php index 585cc99320a3918fa0aa8754d199a17075572196..7a2cfec0fe77fa835c550fe49e7253ddd60ade6a 100644 --- a/library/Class/Systeme/Widget/Section/Header.php +++ b/library/Class/Systeme/Widget/Section/Header.php @@ -30,4 +30,9 @@ class Class_Systeme_Widget_Section_Header extends Class_Systeme_Widget_Section { public function getResourcesDefinition() { return new Class_Systeme_ModulesAccueil_Section_Header; } + + + public function isShared() { + return true; + } } \ No newline at end of file diff --git a/library/Class/Template/Settings.php b/library/Class/Template/Settings.php index c278629ea06267cd28c5f962eb7a873bd5dca4a6..132aa7b0dca4df3179983c5a571fe7b42e3187cb 100644 --- a/library/Class/Template/Settings.php +++ b/library/Class/Template/Settings.php @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ - class Class_Template_Settings extends Storm_Model_Abstract { protected diff --git a/library/Class/Template/Update.php b/library/Class/Template/Update.php new file mode 100644 index 0000000000000000000000000000000000000000..d20d8010a9a5ff62a5f234ab96c5f54ddd3ae312 --- /dev/null +++ b/library/Class/Template/Update.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright (c) 2012-2020, 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_Template_Update { + + use Trait_EchoError; + + + public function run() { + $this->echoError("\nMise à jour des thèmes du magasin.\n"); + $templates = (new Class_Template_Loader)->getTemplates(); + array_walk($templates, + function($template) + { + $template->updateSettings(); + $this->echoError(sprintf("Mise à jour du thème %s\n", $template->getId())); + }); + $this->echoError("Mise à jour des thèmes du magasin terminée.\n"); + } +} diff --git a/library/Class/Users.php b/library/Class/Users.php index 2483d2f003b8265b06852382377bfb72880dca48..4e9cacfda163fce6986b30b8a9d6999418b91652 100644 --- a/library/Class/Users.php +++ b/library/Class/Users.php @@ -1945,6 +1945,9 @@ class Class_Users extends Storm_Model_Abstract { public function updateFromPatron() { + if (! $this->getSIGBComm() || !$this->getSIGBComm()->providesAuthentication()) + return $this; + if (!$borrower = $this->getEmprunteur()) return $this; diff --git a/library/Class/WebService/SIGB/Koha/CommunityService.php b/library/Class/WebService/SIGB/Koha/CommunityService.php index 9aec73cad17f8e14276ecfd42c5fed0677d7f157..432c50c5fd9f56786eb9f98f59ee903f277e3b83 100644 --- a/library/Class/WebService/SIGB/Koha/CommunityService.php +++ b/library/Class/WebService/SIGB/Koha/CommunityService.php @@ -58,6 +58,12 @@ class Class_WebService_SIGB_Koha_CommunityService } + protected function _getAuthForEmprunteur($emprunteur) { + return [$emprunteur->getLogin(), + $emprunteur->getPreviousPassword()]; + } + + public function providesChangePasswordService() { return true; } @@ -69,21 +75,20 @@ class Class_WebService_SIGB_Koha_CommunityService $password = $emprunteur->getPassword(); $datas = ['password' => $password, 'password_2' => $password]; - $auth_token = md5($emprunteur->getLogin(). - ":".$emprunteur->getPreviousPassword()); + + $auth = $this->_getAuthForEmprunteur($emprunteur); $response = $this->getWebClient() ->postRawDataResponse($url, - json_encode($datas), - Zend_Http_Client::ENC_URLENCODED, - ['headers' => - ['Authorization' => 'Basic '.$auth_token ]]); + json_encode($datas), + Zend_Http_Client::ENC_URLENCODED, + ['auth' => $auth]); if ($response->isError()) throw new Class_WebService_Exception($this->_('Erreur de mise à jour du mot de passe : %s', $response->getMessage())); if ($response->isSuccessful() - && '' == ($body = $response->getRawBody())) + && '""' == ($body = $response->getRawBody())) return $emprunteur; if (null === ($json = json_decode($body,TRUE))) diff --git a/library/Class/WebService/SimpleWebClient.php b/library/Class/WebService/SimpleWebClient.php index 247b85e1e34890da985d86465d969dc158518433..33c88238c60781885c8caa86f5eb873c616d0ab2 100644 --- a/library/Class/WebService/SimpleWebClient.php +++ b/library/Class/WebService/SimpleWebClient.php @@ -93,6 +93,9 @@ class Class_WebService_SimpleWebClient { if (isset($options['headers'])) $httpClient->setHeaders($options['headers']); + if (isset($options['auth'])) + $httpClient->setAuth($options['auth']['user'], $options['auth']['password']); + return $httpClient->request(); } diff --git a/library/ZendAfi/Form/Configuration/Widget/Search.php b/library/ZendAfi/Form/Configuration/Widget/Search.php index ebf29b1862c7a2c7f25845d6ffdca6cc5ad678be..7962cc04616282ea80b04df67fd4b96b357cbc3a 100644 --- a/library/ZendAfi/Form/Configuration/Widget/Search.php +++ b/library/ZendAfi/Form/Configuration/Widget/Search.php @@ -109,7 +109,6 @@ class ZendAfi_Form_Configuration_Widget_Search ['label' => $this->_('Mode de sélection des domaines'), 'multiOptions' => $simple_search->getSelectionModeOptions(), 'value' => $simple_search->getSelectionModeDefault()]); - } diff --git a/library/ZendAfi/Form/Decorator/Custom.php b/library/ZendAfi/Form/Decorator/Custom.php index a2086255a8dfcfd3d5e851763d4ad15d6bfb0b4e..8024fa02ee9e57e5bf2dcc23d7999a319e404f5c 100644 --- a/library/ZendAfi/Form/Decorator/Custom.php +++ b/library/ZendAfi/Form/Decorator/Custom.php @@ -25,6 +25,6 @@ class ZendAfi_Form_Decorator_Custom extends Zend_Form_Decorator_HtmlTag { public function render($content) { $view = $this->_element->getView(); $render = $this->_element->getAttrib('render'); - return parent::render($render()); + return parent::render($render($view)); } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Div.php b/library/ZendAfi/View/Helper/Div.php index 756c4b3869301b8696af1bae9138d7065f31fc82..3c0275e891aabf91a6488f22e2e2090c7d9aae91 100644 --- a/library/ZendAfi/View/Helper/Div.php +++ b/library/ZendAfi/View/Helper/Div.php @@ -22,6 +22,9 @@ class ZendAfi_View_Helper_Div extends ZendAfi_View_Helper_BaseHelper { public function div($attributes = [], $content = '') { + if ( null === $content) + $content = ''; + return $this->_tag('div', $content, $attributes); diff --git a/library/ZendAfi/View/Helper/FonctionsAdmin.php b/library/ZendAfi/View/Helper/FonctionsAdmin.php index d435540400d4e71ce90c8fee7c714b6851a9d588..0ade00e4b78471fb6df8026f7a7415593b93e981 100644 --- a/library/ZendAfi/View/Helper/FonctionsAdmin.php +++ b/library/ZendAfi/View/Helper/FonctionsAdmin.php @@ -226,6 +226,10 @@ class ZendAfi_View_Helper_FonctionsAdmin extends ZendAfi_View_Helper_BaseHelper && ($parent = Class_Profil::getCurrentProfil()->getParentProfil())) $id_profil = $parent->getId(); + if(Class_Profil::DIV_FOOTER == $this->division + && ($parent = Class_Profil::getCurrentProfil()->getParentProfil())) + $id_profil = $parent->getId(); + return $id_profil; } } \ No newline at end of file diff --git a/library/startup.php b/library/startup.php index 8bce4740e9bc74dbce53b64c34b5645b6c5cb9b5..3919698bd95cd530cd2ee8fb10ea81e6df44dbaa 100644 --- a/library/startup.php +++ b/library/startup.php @@ -81,7 +81,7 @@ class Bokeh_Engine { function setupConstants() { defineConstant('BOKEH_MAJOR_VERSION','8.0'); - defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.54'); + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.58'); defineConstant('BOKEH_REMOTE_FILES', 'https://git.afi-sa.net/afi/opacce/'); diff --git a/library/templates/Intonation/Assets/css/intonation.css b/library/templates/Intonation/Assets/css/intonation.css index c2db570cdb08c78be67db58e55680dc73b37f3e6..218712f4ecd193aca578d978971e9b629a6dee2b 100644 --- a/library/templates/Intonation/Assets/css/intonation.css +++ b/library/templates/Intonation/Assets/css/intonation.css @@ -88,6 +88,7 @@ div:hover > .img_as_background { i:first-child, .widget.rech_simple .dropdown-menu i:first-child, +.widget.rech_simple .criteres_recherche i:first-child, .card-link + .card-link, .badge, p > i { @@ -245,6 +246,23 @@ pre { background: none !important; } +.transparent_background .breadcrumb, +.transparent_background { + background: var(--front-transparent-background) !important; +} + +.limit_badges_10 .badge-group .badge:nth-child(n + 11) { + display: none; +} + +.limit_badges_5 .badge-group .badge:nth-child(n + 6) { + display: none; +} + +.limit_badges_3 .badge-group .badge:nth-child(n + 4) { + display: none; +} + .no_border, .no_border * { border: 0px solid rgba(0,0,0,0) !important; @@ -429,7 +447,7 @@ label[data-name=note] ~ div label.multi-element-label + br { padding: 5%; top: 0; left: 0; - background-color: var(--front-background-modale); + background-color: var(--front-background-modale) !important; z-index: 20; text-align: center; flex: 100%; @@ -437,8 +455,10 @@ label[data-name=note] ~ div label.multi-element-label + br { max-height: 100%; } -.modal_image img { - width: auto !important; +.modal_image * { + width: 100% !important; + height: 100% !important; + object-fit: contain; } .blockquote-footer { @@ -783,16 +803,10 @@ input[id^="select_record"] + * { min-width: 1px; } -.only_visible_in_viewnotice { - display: none; +.z_index_11 { + z-index: 11; } -.recherche_viewnotice .only_visible_in_viewnotice { - display: block; +.menu_buttons .button_text { + display: none !important; } - -.badge.only_visible_in_viewnotice .text-truncate { - width: auto; - max-width: none; - white-space: normal; -} \ No newline at end of file diff --git a/library/templates/Intonation/Library/FormCustomizer.php b/library/templates/Intonation/Library/FormCustomizer.php index 95dd4e1c3833f28ea704607f2979cfc5ad9dc886..fdd8d86b2de86578866e61d689c40f5a4f3c1ca6 100644 --- a/library/templates/Intonation/Library/FormCustomizer.php +++ b/library/templates/Intonation/Library/FormCustomizer.php @@ -83,7 +83,7 @@ class Intonation_Library_FormCustomizer { protected function _getStrategyFor($form) { $strategies = ['ZendAfi_Form_Configuration_Widget_Login' => 'FormStyle', - 'ZendAfi_Form_Configuration_Widget_Search' => 'FormStyle']; + 'Intonation_Library_Widget_Search_Form' => 'FormStyle']; if (!in_array(get_class($form), array_keys($strategies))) return false; diff --git a/library/templates/Intonation/Library/FormCustomizer/Abstract.php b/library/templates/Intonation/Library/FormCustomizer/Abstract.php index 461553e84ebf6037c738fb94ce0347c01f388a74..a842eaee21b25e31d2fa0077674c86cbd03ba03f 100644 --- a/library/templates/Intonation/Library/FormCustomizer/Abstract.php +++ b/library/templates/Intonation/Library/FormCustomizer/Abstract.php @@ -55,6 +55,29 @@ class Intonation_Library_FormCustomizer_Abstract { ['label' => $this->_('Classe CSS personnalisée'), 'separator' => ' ', 'multiOptions' => $css]]); + + $this->_form + ->addElement('custom', + 'classes_documentation', + ['render' => function($view) + { + $html = + $view->tagAnchor('http://wiki.bokeh-library-portal.org/index.php?title=Classes_CSS', + Class_Admin_Skin::current()->renderActionIconOn('help', $view), + ['class' => 'ardans_help', + 'style' => 'margin-left: 5px', + 'title' => $this->_('Consulter la documentation sur les classes dans le Wiki Bokeh'), + 'target' => '_blank']); + return $view->tag('script', + sprintf('$(function() {$("[data-name*=%s]").append("%s");});', + 'boite', + str_replace('"', "'", $html))); + }]); + + $this->_form + ->addToStyleGroup(['boite', + 'classes_documentation']); + return $this; } @@ -327,7 +350,7 @@ class Intonation_Library_FormCustomizer_Abstract { ->addToDisplayGroup(array_map(function($element) { return $this->_template->withNameSpace($element); - },$elements), + }, $elements), $this->_template->withNameSpace('group')); return $this; } @@ -336,7 +359,7 @@ class Intonation_Library_FormCustomizer_Abstract { ->addDisplayGroup(array_map(function($element) { return $this->_template->withNameSpace($element); - },$elements), + }, $elements), $this->_template->withNameSpace('group'), ['legend' => $this->_('Thème'), 'order' => static::FIRST]); diff --git a/library/templates/Intonation/Library/FormCustomizer/Template.php b/library/templates/Intonation/Library/FormCustomizer/Template.php index 8f13e81e5d74fc40cd0a743fddcc15cfd0df4c06..42e9af65fc3eccb962c2bbb6900ce3e26b739b33 100644 --- a/library/templates/Intonation/Library/FormCustomizer/Template.php +++ b/library/templates/Intonation/Library/FormCustomizer/Template.php @@ -82,7 +82,24 @@ class Intonation_Library_FormCustomizer_Template extends Intonation_Library_Form 'fields' => [['name' => $this->_template->withNameSpace('custom_css_class'), 'label' => $this->_('classe')]], 'values' => [$this->_template->withNameSpace('custom_css_class') => $this->_template->getCustomCssClass()], - 'deleteMessage' => $this->_('cette classe')]); + 'deleteMessage' => $this->_('cette classe')]) + + ->addElement('custom', + $this->_template->withNameSpace('classes_documentation'), + ['render' => function($view) + { + $html = + $view->tagAnchor('http://wiki.bokeh-library-portal.org/index.php?title=Classes_CSS', + Class_Admin_Skin::current()->renderActionIconOn('help', $view), + ['class' => 'ardans_help', + 'style' => 'margin-left: 5px', + 'title' => $this->_('Consulter la documentation sur les classes dans le Wiki Bokeh'), + 'target' => '_blank']); + return $view->tag('script', + sprintf('$(function() {$("[for*=%s]").append("%s");});', + $this->_template->withNameSpace('custom_css_classes'), + str_replace('"', "'", $html))); + }]); $this ->_addToTemplateGroup(['core_css', @@ -97,6 +114,7 @@ class Intonation_Library_FormCustomizer_Template extends Intonation_Library_Form 'custom_css', 'custom_js', 'nb_cols', + 'classes_documentation', 'custom_css_classes']) ->_addHydratingMappingGroupTo() ->_addResponsiveGroupTo() diff --git a/library/templates/Intonation/Library/FormCustomizer/Widget/Default.php b/library/templates/Intonation/Library/FormCustomizer/Widget/Default.php index 295b187d3fdfd33ca4b99f42cd7ae8b31aef7ec9..a462c7efeeae0350da9edc986c38978c3ad13591 100644 --- a/library/templates/Intonation/Library/FormCustomizer/Widget/Default.php +++ b/library/templates/Intonation/Library/FormCustomizer/Widget/Default.php @@ -38,6 +38,7 @@ class Intonation_Library_FormCustomizer_Widget_Default extends Intonation_Librar $this->_template->withNameSpace('show_footer'), ['label' => $this->_('Afficher le pied'), 'value' => 1]); + $this->_addCustomElement(); $this->_addToTemplateGroup($this->_getDefaultElementsNames()); diff --git a/library/templates/Intonation/Library/Settings.php b/library/templates/Intonation/Library/Settings.php index 44983d538e44bf57ad3aa23feaf5ded4ea493fcb..b440885f7d1811c89b83a2fa30f8cf43d7d5bc0d 100644 --- a/library/templates/Intonation/Library/Settings.php +++ b/library/templates/Intonation/Library/Settings.php @@ -54,9 +54,16 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'z_index_2', 'z_index_3', 'pt-3', + 'pt-5', + 'pl-2', + 'pl-md-3', + 'pr-md-3', + 'pb-3', 'px-3', 'py-3', 'm-auto', + 'ml-auto', + 'mr-auto', 'mb-3', 'mt-3', 'align-items-center', @@ -71,7 +78,18 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'text-right', 'text_small', 'text_no_transform', - 'admin_tools_invert_colors' + 'admin_tools_invert_colors', + 'border-primary', + 'border-left', + 'z_index_11', + 'transparent_background', + 'limit_badges_3', + 'limit_badges_5', + 'limit_badges_10', + 'justify-content-start', + 'justify-content-end', + 'justify-content-center', + 'menu_buttons' ], 'hydrating_mapping' => ['div id site_web_wrapper' => 'container align-self-center no_overflow', @@ -104,7 +122,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 d-flex flex-wrap align-content-start', + 'dd' => 'col-12 col-sm-9', 'dt class user_info' => 'col-12 col-sm-6', 'dd class user_info' => 'col-12 col-sm-6', 'a' => 'text-secondary', @@ -203,6 +221,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { 'more' => 'class fas fa-ellipsis-h', 'refresh' => 'class fas fa-sync-alt', 'lock' => 'class fas fa-unlock-alt', + 'eye' => 'class far fa-eye', 'email' => 'class fas fa-at', 'phone' => 'class fas fa-phone', @@ -304,7 +323,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract { protected function _mergeData($default, $data) { - $merged = array_merge($data, $default); + $merged = array_merge($default, $data); if (count(array_filter(array_keys($default), 'is_string'))) return $merged; diff --git a/library/templates/Intonation/Library/View/Wrapper/Abstract.php b/library/templates/Intonation/Library/View/Wrapper/Abstract.php index 3790e903d5b8aae97569ebec45c71589455bfa31..c176f20a2307b240dd6f567496d7d48e3f2e642f 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Abstract.php +++ b/library/templates/Intonation/Library/View/Wrapper/Abstract.php @@ -27,6 +27,7 @@ abstract class Intonation_Library_View_Wrapper_Abstract { protected $_view, $_model, + $_context, $_context_params = [], $_rich_content, $_in_js_search = false; @@ -56,8 +57,9 @@ abstract class Intonation_Library_View_Wrapper_Abstract { } - public function setContextParams($params) { - $this->_context_params = $params; + public function setContext($instance) { + $this->_context = $instance; + $this->_context_params = $instance->getLinkToAllParams(); return $this; } diff --git a/library/templates/Intonation/Library/View/Wrapper/ActivitySession.php b/library/templates/Intonation/Library/View/Wrapper/ActivitySession.php index 67ab16b06666187bc8505e5c937227b76bf76bdc..4da4dfb35368185d2486dc93392bc14094306957 100644 --- a/library/templates/Intonation/Library/View/Wrapper/ActivitySession.php +++ b/library/templates/Intonation/Library/View/Wrapper/ActivitySession.php @@ -96,7 +96,8 @@ class Intonation_Library_View_Wrapper_ActivitySession extends Intonation_Library public function getDescription() { return $this->getBadges() - . $this->_view->truncate($this->_model->getContenu()); + . $this->_view->truncate($this->_model->getContenu(), + ['class' => 'model_description_' . get_class($this->_model)]); } @@ -169,7 +170,7 @@ class Intonation_Library_View_Wrapper_ActivitySession extends Intonation_Library $main_title))); } - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Article.php b/library/templates/Intonation/Library/View/Wrapper/Article.php index d727a02a505f1a20473038dba74c1e8ed1523024..768d476bf69ff4deda05273e015d569c60e24139 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Article.php +++ b/library/templates/Intonation/Library/View/Wrapper/Article.php @@ -23,7 +23,10 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wrapper_Abstract { public function getMainTitle() { - return $this->_model->getTitre(); + return + $this->_model->getCacherTitre() + ? '' + : $this->_model->getTitre(); } @@ -76,7 +79,8 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr public function getDescription() { return $this->getBadges() - . $this->_view->truncate($this->_model->getSummary()); + . $this->_view->truncate($this->_model->getSummary(), + ['class' => 'model_description_' . get_class($this->_model)]); } @@ -106,13 +110,14 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr public function getBadges() { $badges = []; + $title = $this->_model->getTitre(); if ($this->_model->isStatusDraft()) $badges [] = ((new Intonation_Library_Badge) ->setTag('span') ->setClass('danger') ->setText($this->_('Brouillon')) - ->setTitle($this->_('Cet article "%s" est un brouillon.', $this->_model->getTitre()))); + ->setTitle($this->_('Cet article "%s" est un brouillon.', $title))); if (($library = $this->_model->getBib()) && !$library->isPortail()) $badges [] = ((new Intonation_Library_Badge) @@ -126,44 +131,24 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr 'library', 'library')) ->setText($library->getLibelle()) - ->setTitle($this->_('Bibliothèque de l\'article "%s"', $this->_model->getTitre()))); + ->setTitle($this->_('Bibliothèque de l\'article "%s"', $title))); $badges [] = ((new Intonation_Library_Badge) ->setTag('span') ->setClass('info') ->setText($this->_model->getCategorieLibelle()) - ->setTitle($this->_('Catégorie de l\'article "%s"', $this->_model->getTitre()))); + ->setTitle($this->_('Catégorie de l\'article "%s"', $title))); if ($location = $this->_model->getLieuLibelle()) $badges [] = ((new Intonation_Library_Badge) ->setTag('span') ->setClass('secondary') ->setText($location) - ->setTitle($this->_('Lieu relié à l\'article "%s"', $this->_model->getTitre()))); + ->setTitle($this->_('Lieu relié à l\'article "%s"', $title))); - if ($event_start = $this->_model->getEventsDebut()) - $badges [] = (new Intonation_Library_Badge) - ->setTag('span') - ->setClass('success') - ->setText($this->_('%s à %s', - strftime($this->_('%d/%m/%Y'), strtotime($event_start)), - strftime($this->_('%H:%M'), strtotime($event_start)))) - ->setTitle($this->_('"%s" commence le %s à %s', - $this->_model->getTitre(), - strftime($this->_('%d %B %Y'), strtotime($event_start)), - strftime($this->_('%Hh%Mm'), strtotime($event_start)))); - - if ($event_end = $this->_model->getEventsFin()) - $badges [] = (new Intonation_Library_Badge) - ->setTag('span') - ->setClass('warning') - ->setText($this->_('%s à %s', - strftime($this->_('%d/%m/%Y'), strtotime($event_end)), - strftime($this->_('%H:%M'), strtotime($event_end)))) - ->setTitle($this->_('"%s" finit le %s à %s', - $this->_model->getTitre(), - strftime($this->_('%d %B %Y'), strtotime($event_end)), - strftime($this->_('%Hh%Mm'), strtotime($event_end)))); + + $badges = (new Intonation_Library_View_Wrapper_ArticleDateTimeBadges($this->_view, $this->_model)) + ->injectInto($badges); if ($tags = $this->_model->getTags()) { foreach(array_filter(explode(';', $tags)) as $tag) { @@ -174,7 +159,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr ->setText($tag) ->setTitle($this->_('L\'étiquette "%s" de l\'article "%s".', $tag, - $this->_model->getTitre()))); + $title))); } } @@ -196,7 +181,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr $value)); } - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } @@ -273,4 +258,142 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr public function getOsmData() { return null; } +} + + + +class Intonation_Library_View_Wrapper_ArticleDateTimeBadges { + use Trait_Translator; + + protected $_view, $_model; + + + public function __construct($view, $model) { + $this->_view = $view; + $this->_model = $model; + } + + + public function injectInto($badges) { + return $this->_injectEventEnd($this->_injectEventStart($badges)); + } + + + protected function _injectEventStart($badges) { + return (new Intonation_Library_View_Wrapper_ArticleDateTimeBadges_EventStart($this->_view, $this->_model)) + ->injectInto($badges); + } + + + protected function _injectEventEnd($badges) { + return (new Intonation_Library_View_Wrapper_ArticleDateTimeBadges_EventEnd($this->_view, $this->_model)) + ->injectInto($badges); + } + + + protected function _badge($time) { + return (new Intonation_Library_Badge) + ->setTag('span') + ->setClass('success') + ->setText($this->_text($time)) + ->setTitle($this->_title($time)); + } + + + protected function _text($time) { + return $this->_model->getAllDay() + ? $this->_shortDate($time) + : $this->_('%s à %s', $this->_shortDate($time), $this->_shortTime($time)); + } + + + protected function _title($time) { + return $this->_model->getAllDay() + ? sprintf($this->_dateTitle(), + $this->_model->getTitre(), $this->_longDate($time)) + : sprintf($this->_dateTimeTitle(), + $this->_model->getTitre(), $this->_longDate($time), $this->_longTime($time)); + } + + + protected function _shortDate($time) { + return strftime($this->_('%d/%m/%Y'), $time); + } + + + protected function _shortTime($time) { + return strftime($this->_('%H:%M'), $time); + } + + + protected function _longDate($time) { + return strftime($this->_('%d %B %Y'), $time); + } + + + protected function _longTime($time) { + return strftime($this->_('%Hh%Mm'), $time); + } + + + protected function _dateTitle() { + return ''; + } + + + protected function _dateTimeTitle() { + return ''; + } +} + + + + +class Intonation_Library_View_Wrapper_ArticleDateTimeBadges_EventStart + extends Intonation_Library_View_Wrapper_ArticleDateTimeBadges { + + public function injectInto($badges) { + if (!$datetime = $this->_model->getEventsDebut()) + return $badges; + + $badges [] = $this->_badge(strtotime($datetime)); + return $badges; + } + + + protected function _dateTitle() { + return $this->_('"%s" commence le %s'); + } + + + protected function _dateTimeTitle() { + return $this->_('"%s" commence le %s à %s'); + } + +} + + + + +class Intonation_Library_View_Wrapper_ArticleDateTimeBadges_EventEnd + extends Intonation_Library_View_Wrapper_ArticleDateTimeBadges { + + public function injectInto($badges) { + if (!$datetime = $this->_model->getEventsFin()) + return $badges; + + $badges [] = $this->_badge(strtotime($datetime)); + return $badges; + } + + + protected function _dateTitle() { + return $this->_('"%s" finit le %s'); + } + + + protected function _dateTimeTitle() { + return $this->_('"%s" finit le %s à %s'); + } + } \ No newline at end of file diff --git a/library/templates/Intonation/Library/View/Wrapper/Author.php b/library/templates/Intonation/Library/View/Wrapper/Author.php index 66c354c8a0ac2069095fb222d6498dd8917b0da7..a1fb0cbe09dfae0d9a1e2599e4dac90d807f680e 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Author.php +++ b/library/templates/Intonation/Library/View/Wrapper/Author.php @@ -165,7 +165,8 @@ class Intonation_Library_View_Wrapper_Author extends Intonation_Library_View_Wra public function getDescription() { return $this->getBadges() - . $this->_view->truncate($this->getFullDescription()); + . $this->_view->truncate($this->getFullDescription(), + ['class' => 'model_description_' . get_class($this->_model)]); } @@ -198,7 +199,7 @@ class Intonation_Library_View_Wrapper_Author extends Intonation_Library_View_Wra $facet_label))); } - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Domain.php b/library/templates/Intonation/Library/View/Wrapper/Domain.php index 110ae636d58adec165340be76e1c84ba09e847bd..cf418814b87cc187faaca97124ae28c26fa2d245 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Domain.php +++ b/library/templates/Intonation/Library/View/Wrapper/Domain.php @@ -43,9 +43,14 @@ class Intonation_Library_View_Wrapper_Domain extends Intonation_Library_View_Wra public function getMainLink() { - return new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'recherche', - 'action' => 'simple', - 'id_catalogue' => $this->_model->getId()]), + $url = ['controller' => 'recherche', + 'action' => 'simple', + 'id_catalogue' => $this->_model->getId()]; + + if ($this->_context) + $url ['id_module'] = $this->_context->getId(); + + return new Intonation_Library_Link(['Url' => $this->_view->url($url), 'Image' => Class_Template::current()->getIco($this->_view, 'read-document', diff --git a/library/templates/Intonation/Library/View/Wrapper/Hold.php b/library/templates/Intonation/Library/View/Wrapper/Hold.php index 9d9256ad861c94649a71e5c8ac791fcddfe2ebb5..9edefc0758d287de86432f974c7b66476be63410 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Hold.php +++ b/library/templates/Intonation/Library/View/Wrapper/Hold.php @@ -207,7 +207,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp ->setTitle($this->_('Rang de la réservation: %s', $this->_model->getRang()))) ]; - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Item.php b/library/templates/Intonation/Library/View/Wrapper/Item.php index 2c0e802e7fa938bdac26eb66e21871e000162691..7b607fb5aa534133fc376b0949a801d54ee34e97 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Item.php +++ b/library/templates/Intonation/Library/View/Wrapper/Item.php @@ -141,7 +141,7 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp $this->_model->getCodeBarres()))) ]; - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Library.php b/library/templates/Intonation/Library/View/Wrapper/Library.php index 391383275f96902dfe403aed4b46e6cd8db8eb5c..80e62075b22bede90dbaca909fc993bebd1e7f7e 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Library.php +++ b/library/templates/Intonation/Library/View/Wrapper/Library.php @@ -85,7 +85,8 @@ class Intonation_Library_View_Wrapper_Library extends Intonation_Library_View_Wr return $this->getBadges() . $this->_view->renderLibraryOpening($this->_model) - . $this->_view->truncate($this->_model->getInscription()); + . $this->_view->truncate($this->_model->getInscription(), + ['class' => 'model_description_' . get_class($this->_model)]); } @@ -174,7 +175,7 @@ class Intonation_Library_View_Wrapper_Library extends Intonation_Library_View_Wr $value)); } - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Navigation.php b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Navigation.php index eb189377780b04166eb9a0e48e2f92db6c457c98..12072e95cf2ad1f504efbb5014e52a403021267a 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Navigation.php +++ b/library/templates/Intonation/Library/View/Wrapper/Library/RichContent/Navigation.php @@ -48,6 +48,11 @@ class Intonation_Library_View_Wrapper_Library_RichContent_Navigation { return $this->_list; $this->_list = Class_Bib::findAllBy(['order' => 'libelle']); + $this->_list = array_filter($this->_list, function($library) + { + return null !== Class_Users::findFirstBy(['id_site' => $library->getId(), + 'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB]); + }); while ((current($this->_list)->getId()) != $this->_model->getId()) next($this->_list); diff --git a/library/templates/Intonation/Library/View/Wrapper/Loan.php b/library/templates/Intonation/Library/View/Wrapper/Loan.php index b685b0959e26e214f66a9d47095cdf243da164d0..f983645a98d2a17b002fb288567f115b584f1bb8 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Loan.php +++ b/library/templates/Intonation/Library/View/Wrapper/Loan.php @@ -169,7 +169,7 @@ class Intonation_Library_View_Wrapper_Loan extends Intonation_Library_View_Wrapp ->setTitle($this->_('Exemplaire déjà prolongé'))) ]; - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Newsletter.php b/library/templates/Intonation/Library/View/Wrapper/Newsletter.php index 552f836310bdafd0e6a63e075a24b8fea7b793d7..63c4ccd9b4f97d082d13a6558f73b6ed099d13dc 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Newsletter.php +++ b/library/templates/Intonation/Library/View/Wrapper/Newsletter.php @@ -46,8 +46,7 @@ class Intonation_Library_View_Wrapper_Newsletter extends Intonation_Library_View 'Title' => $this->_view->_("Me désinscrire à la lettre d'information %s", $this->_model->getTitre()), 'Image' => Class_Template::current()->getIco($this->_view, 'selection', - 'library'), - 'Popup' => true] + 'library')] : ['Url' => $this->_view->url(['controller' => 'abonne', 'action' => 'subscribe-newsletter', 'id' => $this->_model->getId()]), @@ -55,8 +54,7 @@ class Intonation_Library_View_Wrapper_Newsletter extends Intonation_Library_View 'Title' => $this->_view->_("M'inscrire à la lettre d'information %s", $this->_model->getTitre()), 'Image' => Class_Template::current()->getIco($this->_view, 'no-selection', - 'library'), - 'Popup' => true]; + 'library')]; return new Intonation_Library_Link($params); } @@ -90,7 +88,8 @@ class Intonation_Library_View_Wrapper_Newsletter extends Intonation_Library_View public function getDescription() { $template = $this->_model->newTemplate(); - return $this->_view->truncate($template->getBodyHTML()); + return $this->_view->truncate($template->getBodyHTML(), + ['class' => 'model_description_' . get_class($this->_model)]); } diff --git a/library/templates/Intonation/Library/View/Wrapper/PNBLoan.php b/library/templates/Intonation/Library/View/Wrapper/PNBLoan.php index bf304e56c1d432399f6307c7cef6f3d19e4c0ee9..3a3622e3bb035defa6e90352c4fc548f29e02858 100644 --- a/library/templates/Intonation/Library/View/Wrapper/PNBLoan.php +++ b/library/templates/Intonation/Library/View/Wrapper/PNBLoan.php @@ -78,7 +78,7 @@ class Intonation_Library_View_Wrapper_PNBLoan extends Intonation_Library_View_Wr ->setTitle($this->_('Bibliothèque de l\'emprunt: %s', $this->_model->getBibliotheque()))), ]; - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Pro.php b/library/templates/Intonation/Library/View/Wrapper/Pro.php index a2fbf4c3232991b9ee26b6cb8efccb065572d42d..c7c4a45ab34999d15208bab17757a463e43166b5 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Pro.php +++ b/library/templates/Intonation/Library/View/Wrapper/Pro.php @@ -137,7 +137,7 @@ class Intonation_Library_View_Wrapper_Pro extends Intonation_Library_View_Wrappe $badges = $this->_addBookmarkedDomainsToBadges($bookmarked_domains, $badges); - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Record.php b/library/templates/Intonation/Library/View/Wrapper/Record.php index 784cf9c67288251d1ad01cb0f98d52ba99807a51..6b615b4f0d2c407688afa0caff715ffb1c762dd5 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record.php @@ -55,7 +55,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra 'read-document', 'library'), 'Text' => $this->_('Voir'), - 'Title' => $this->_('Voir le document "%s" de "%s" de type "%s"', + 'Title' => $this->_('Voir le document %s de %s de type %s', $this->getMainTitle(), $this->getSecondaryTitle(), $this->getDocTypeLabel())]); @@ -87,7 +87,8 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra $description = $xsl->isEnabled() && $this->getAllowXSL() ? $this->_view->Notice_Xsl($xsl) - : $this->_view->truncate($this->_model->getResume()); + : $this->_view->truncate($this->_model->getResume(), + ['class' => 'model_description_' . get_class($this->_model)]); return $this->getBadges() . $description; } @@ -100,7 +101,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra public function getDescriptionTitle() { - return $this->_('Résumé du document "%s"', $this->getMainTitle()); + return $this->_('Résumé du document %s', $this->getMainTitle()); } @@ -130,13 +131,6 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra public function getBadges() { $badges = [((new Intonation_Library_Badge) - ->setTag('div') - ->setClass(' pb-1 mb-1 px-0 card-title only_visible_in_viewnotice') - ->setText($this->_getFullTitle()) - ->setTitle($this->_('Compléments de titre pour le document %s', - $this->_model->getTitrePrincipal(' ')))), - - ((new Intonation_Library_Badge) ->setTag('a') ->setClass('warning fs_1em record_doctype') ->setUrl($this->_view->url(['controller' => 'recherche', @@ -181,7 +175,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra 'library')) : '')) ->setText($this->_model->isNouveaute() ? $this->_('Nouveauté') : '') - ->setTitle($this->_('Le document %s est nouveau dans votre bibliotèque', + ->setTitle($this->_('Le document %s est nouveau dans votre bibliothèque', $this->_model->getTitrePrincipal(' ')))); $badges = $this->_injectReviewsBadgesInto($badges); @@ -200,7 +194,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra $badges = $this->_addSerieBadges($badges); - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } @@ -402,7 +396,8 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra $actions = array_merge([$this->_addToSelectionAction()], $this->_socialNetworksActions(), [$this->_printAction()], - $this->_thumbnailActions()); + $this->_thumbnailActions(), + [$this->_addNumericResourceAction()]); $button = new Intonation_Library_Link(['Text' => $this->_('Plus'), 'Attribs' => ['class' => 'more_action'], @@ -430,6 +425,28 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra } + protected function _addNumericResourceAction() { + if ( ! Class_AdminVar::isBibNumEnabled()) + return; + + if ( ! Class_Users::isCurrentUserAdmin()) + return; + + return new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'admin', + 'controller' => 'album', + 'action' => 'link_album_to', + 'id_notice' => $this->_model->getId()]), + 'Image' => Class_Template::current()->getIco($this->_view, + 'media', + 'library'), + 'Text' => $this->_('Créer …'), + 'Attribs' => ['class' => 'menu_admin_front_anchor'], + 'Popup' => 'true', + 'Title' => $this->_('Créer un album numérique %s', + $this->_model->getTitrePrincipal(' '))]); + } + + protected function _socialNetworksActions() { return $this->_view->socialNetworksActions($this->_model); } @@ -444,7 +461,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra 'Image' => Class_Template::current()->getIco($this->_view, 'print', 'utils'), - 'Title' => $this->_('Imprimer "%s"', $this->_model->getTitrePrincipal(' ')), + 'Title' => $this->_('Imprimer %s', $this->_model->getTitrePrincipal(' ')), 'Attribs' => ['target' => '_blank']]) : ''); } @@ -476,19 +493,6 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra } - protected function _getFullTitle() { - $main = $this->getMainTitle(); - $titles = $this->_model->getChampNotice(Class_Codification::CODE_TITRE); - - $titles = array_filter($titles, function($title) use ($main) - { - return false === strpos($main, $title); - }); - - return implode(BR, $titles); - } - - public function getEmbedMedia() { return ''; } @@ -609,13 +613,13 @@ class Intonation_Library_View_Wrapper_RecordProReviewsBadge protected function _countTitle() { - return $this->_('Nombre d\'avis des professionnels sur le document "%s".', + return $this->_('Nombre d\'avis des professionnels sur le document %s.', $this->_recordTitle()); } protected function _scoreTitle() { - return $this->_('Note moyenne des avis des professionnels sur le document "%s".', + return $this->_('Note moyenne des avis des professionnels sur le document %s.', $this->_recordTitle()); } } @@ -641,13 +645,13 @@ class Intonation_Library_View_Wrapper_RecordUsersReviewsBadge protected function _countTitle() { - return $this->_('Nombre d\'avis des abonnés sur le document "%s".', + return $this->_('Nombre d\'avis des abonnés sur le document %s.', $this->_recordTitle()); } protected function _scoreTitle() { - return $this->_('Note moyenne des avis des abonnés sur le document "%s".', + return $this->_('Note moyenne des avis des abonnés sur le document %s.', $this->_recordTitle()); } } @@ -673,13 +677,13 @@ class Intonation_Library_View_Wrapper_RecordCommunityReviewsbadge protected function _countTitle() { - return $this->_('Nombre d\'avis de la communauté sur le document "%s".', + return $this->_('Nombre d\'avis de la communauté sur le document %s.', $this->_recordTitle()); } protected function _scoreTitle() { - return $this->_('Note moyenne des avis de la communauté sur le document "%s".', + return $this->_('Note moyenne des avis de la communauté sur le document %s.', $this->_recordTitle()); } } diff --git a/library/templates/Intonation/Library/View/Wrapper/Record/RichContent.php b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent.php index 000cf5ff0b3407edd93538d7e13aeb90c32cbdb5..61d33714c5f08341f20238bf0195aec64ed36a27 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record/RichContent.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent.php @@ -37,7 +37,9 @@ class Intonation_Library_View_Wrapper_Record_RichContent extends Intonation_Libr public function getActions() { return $this->_view->div(['class' => 'col-12 px-0 mt-3 record_summary'], - $this->_view->truncate($this->_model->getResume(), 50)); + $this->_view->truncate($this->_model->getResume(), + ['class' => 'model_description_' . get_class($this->_model)], + 50)); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Media.php b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Media.php index cf9d0cf3c50b4a6ac3067f9933a2cdb306d2768b..ae7e3f8bdbaff6c5a45b67195429503f3437206a 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Media.php +++ b/library/templates/Intonation/Library/View/Wrapper/Record/RichContent/Media.php @@ -34,12 +34,7 @@ class Intonation_Library_View_Wrapper_Record_RichContent_Media extends Intonatio if ($this->_content) return $this->_content; - $album = ($album = $this->_model->getAlbum() - ? $this->_view->renderAlbum($album) - : ''); - - $html = [$album, - $this->_view->renderAjax('noticeajax', 'media', [], $this->_getJsCallback())]; + $html = [$this->_view->renderAjax('noticeajax', 'media', [], $this->_getJsCallback())]; return $this->_content = $this->_view->grid(implode($html)); } diff --git a/library/templates/Intonation/Library/View/Wrapper/RendezVous.php b/library/templates/Intonation/Library/View/Wrapper/RendezVous.php index 25bc1659f4e66726c4dbf7ba2eb36f59f058a0b2..43fefe8a84907beb835609212ab216584deff716 100644 --- a/library/templates/Intonation/Library/View/Wrapper/RendezVous.php +++ b/library/templates/Intonation/Library/View/Wrapper/RendezVous.php @@ -101,7 +101,7 @@ class Intonation_Library_View_Wrapper_RendezVous extends Intonation_Library_View $badges [] = $location; - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Review.php b/library/templates/Intonation/Library/View/Wrapper/Review.php index b7737d6b646bfb1316384b964ba45ff1e8b60ab2..5f42330fea065ed2d1844a8625c3bd76672c3715 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Review.php +++ b/library/templates/Intonation/Library/View/Wrapper/Review.php @@ -123,7 +123,8 @@ class Intonation_Library_View_Wrapper_Review extends Intonation_Library_View_Wra public function getDescription() { - return $this->_view->truncate($this->_model->getAvis()); + return $this->_view->truncate($this->_model->getAvis(), + ['class' => 'model_description_' . get_class($this->_model)]); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Rss.php b/library/templates/Intonation/Library/View/Wrapper/Rss.php index 7407cff1cd20c1c4cc3467e98f03bfa67651373d..074c44961b412ea11b6f4e31792472629521b327 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Rss.php +++ b/library/templates/Intonation/Library/View/Wrapper/Rss.php @@ -92,7 +92,7 @@ class Intonation_Library_View_Wrapper_Rss extends Intonation_Library_View_Wrappe ->setText($tag) ->setTitle($this->_('Tag attribué au flux %s', $this->_model->getTitre())); - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/RssItem.php b/library/templates/Intonation/Library/View/Wrapper/RssItem.php index ac669864ef4aa936be285b40b4d2ecd557138600..c72d7277ac7ae2c5cacb19afb5c0e6cf0ca42cdf 100644 --- a/library/templates/Intonation/Library/View/Wrapper/RssItem.php +++ b/library/templates/Intonation/Library/View/Wrapper/RssItem.php @@ -86,7 +86,7 @@ class Intonation_Library_View_Wrapper_RssItem extends Intonation_Library_View_Wr ->setText($this->_model->getPubDate()) ->setTitle($this->_('Date de diffusion de %s', $this->getMainTitle()))]; - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Search.php b/library/templates/Intonation/Library/View/Wrapper/Search.php index f07b4e60a2ccd576b0e2a1ccf90d13613eb06c4b..a4c5f0e809be30499b2b65b6c3d502940bf9d1e9 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Search.php +++ b/library/templates/Intonation/Library/View/Wrapper/Search.php @@ -112,7 +112,7 @@ class Intonation_Library_View_Wrapper_Search extends Intonation_Library_View_Wra ['class' => 'badge badge-light fs_1em']))) ->setTitle($this->_('Le nombre de documents pour la recherche %s', $this->_model->getLabel())))]; - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/SearchHistory.php b/library/templates/Intonation/Library/View/Wrapper/SearchHistory.php index 2b1b8d670f6556d76c2b0679bce8618142bad40b..c44c9640d88eee17a13c49c3f81c071c32ac63b8 100644 --- a/library/templates/Intonation/Library/View/Wrapper/SearchHistory.php +++ b/library/templates/Intonation/Library/View/Wrapper/SearchHistory.php @@ -42,6 +42,6 @@ class Intonation_Library_View_Wrapper_SearchHistory extends Intonation_Library_V ->setText(date('d/m/Y H:i:s', $criterias->getTime())) ->setTitle($this->_('La date de la recherche %s', $this->_model->getLabel())))]; - return parent::getBadges() . $this->_view->renderBadges($badges); + return parent::getBadges() . $this->_view->renderBadges($badges, $this); } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/View/Wrapper/Selection.php b/library/templates/Intonation/Library/View/Wrapper/Selection.php index 1bef8c357b7149a0355e746ffaf56827b0ee5551..680e80255851d2ac89de8186a7ac6132ea1d83ee 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Selection.php +++ b/library/templates/Intonation/Library/View/Wrapper/Selection.php @@ -56,7 +56,8 @@ class Intonation_Library_View_Wrapper_Selection extends Intonation_Library_View_ return $this->getBadges() . BR . $this->_('Liste des documents : %s', - $this->_view->truncate(implode(', ', $records_title))); + $this->_view->truncate(implode(', ', $records_title), + ['class' => 'model_description_' . get_class($this->_model)])); } @@ -132,7 +133,7 @@ class Intonation_Library_View_Wrapper_Selection extends Intonation_Library_View_ ->setTitle($this->_('La date de dernière mise à jour de la sélection %s', $this->_model->getLibelle())))]; - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/Suggestion.php b/library/templates/Intonation/Library/View/Wrapper/Suggestion.php index 29a2163c7f077d92f1d9253bae3baffbe6aa72ac..a7d2188ce24af7ae24009fe3b960cf5fca885f42 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Suggestion.php +++ b/library/templates/Intonation/Library/View/Wrapper/Suggestion.php @@ -163,7 +163,7 @@ class Intonation_Library_View_Wrapper_Suggestion extends Intonation_Library_View ->setText($this->_model->getIsbn()) ->setTitle($this->_('ISBN %s', $this->_model->getIsbn()))); - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/View/Wrapper/User.php b/library/templates/Intonation/Library/View/Wrapper/User.php index fb06320c9a71d7ee194d30064645eebab5fc8e84..a8d03ac45ac45f1ef59e708bc294aca3d48d00f2 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User.php +++ b/library/templates/Intonation/Library/View/Wrapper/User.php @@ -257,7 +257,7 @@ class Intonation_Library_View_Wrapper_User extends Intonation_Library_View_Wrapp ->setTitle($this->_('Vous avez %d rendez-vous', $number_of_rendez_vous))); - return $this->_view->renderBadges($badges); + return $this->_view->renderBadges($badges, $this); } diff --git a/library/templates/Intonation/Library/Widget/Carousel/Form.php b/library/templates/Intonation/Library/Widget/Carousel/Form.php index eee8c692002471b29e3a8f4a7353886198c37f31..97451fb33aaf36cee8ec586dbc9c1abad7f20977 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Form.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Form.php @@ -26,7 +26,8 @@ class Intonation_Library_Widget_Carousel_Form extends ZendAfi_Form_Configuration parent::init(); Class_ScriptLoader::getInstance() - ->addJQueryReady('checkBoxToggleVisibilityForElement("#link_to_all", $("#all_order, #all_layout, #all_rendering").closest("tr"), true);'); + ->addJQueryReady('toggleVisibilityForElement("#link_to_all_url", $("#all_layout, #all_rendering").closest("tr"), function(element) {return ! element.val();});') + ->addJQueryReady('checkBoxToggleVisibilityForElement("#link_to_all", $("#all_layout, #all_rendering, #link_to_all_text, #link_to_all_title, #link_to_all_url, #link_to_all_to_main_title").closest("tr"), true);'); $this @@ -52,6 +53,25 @@ class Intonation_Library_Widget_Carousel_Form extends ZendAfi_Form_Configuration 'link_to_all', ['label' => $this->_('Proposer le lien vers tous les documents')]) + ->addElement('text', + 'link_to_all_text', + ['label' => $this->_('Texte du lien vers tous les documents'), + 'placeholder' => $this->_('En lire plus')]) + + ->addElement('text', + 'link_to_all_title', + ['label' => $this->_('Titre du lien vers tous les documents'), + 'placeholder' => $this->_('En lire plus sur %s')]) + + ->addElement('text', + 'link_to_all_url', + ['label' => $this->_('URL du lien vers tous les documents'), + 'placeholder' => $this->_('Automatique')]) + + ->addElement('checkbox', + 'link_to_all_to_main_title', + ['label' => $this->_('Le titre de la boite utilise le lien précédent')]) + ->addElement('checkbox', 'embeded_code', ['label' => $this->_('Proposer le code "embeded"')]) @@ -94,6 +114,10 @@ class Intonation_Library_Widget_Carousel_Form extends ZendAfi_Form_Configuration ->addToShareGroup(['rss', 'embeded_code', 'link_to_all', + 'link_to_all_text', + 'link_to_all_title', + 'link_to_all_url', + 'link_to_all_to_main_title', 'all_rendering', 'all_layout']); diff --git a/library/templates/Intonation/Library/Widget/Carousel/Record/View.php b/library/templates/Intonation/Library/Widget/Carousel/Record/View.php index 5f640aea06f267ea3137e287b78bd1ecac1ebdc8..8e2827c568dd229a877b41dfc43be1589e1e8d49 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Record/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Record/View.php @@ -80,7 +80,7 @@ class Intonation_Library_Widget_Carousel_Record_View extends Intonation_Library_ } - protected function _getLinkToAllParams() { + public function getLinkToAllParams() { $url_params = ['module' => 'opac', 'controller' => 'recherche', 'action' => 'simple', diff --git a/library/templates/Intonation/Library/Widget/Carousel/View.php b/library/templates/Intonation/Library/Widget/Carousel/View.php index 8516cd0bd13b7de01fc8e77f116728bfaefaa768..bb82c26dc6eee618afa48fd051e18cbb5fc27d6f 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/View.php @@ -30,7 +30,7 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help public function getHtml() { - $this->titre = $this->_settings->getTitre(); + $this->titre = $this->_getMainTitle(); $this->contenu = $this->_getHTML(); return $this->getHtmlArray(); @@ -113,14 +113,39 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help protected function _getTagLinkToAll() { - return $this->view->tagAction(new Intonation_Library_Link(['Text' => $this->_('En lire plus'), + return $this->view->tagAction(new Intonation_Library_Link(['Text' => $this->_getLinkToAllText(), 'Url' => $this->_getLinkToAllUrl(), 'OnlyClasses' => 'btn btn-secondary render_all_link', 'Image' => Class_Template::current() ->getIco($this->view, 'search_more', 'library'), - 'Title' => $this->_getLinkToAllTitle()])); + 'Title' => $this->_getLinkToAllTitleDb()])); + } + + + protected function _getLinkToAllText() { + $text = $this->_settings->getLinkToAllText(); + return $text + ? $text + : $this->_('En lire plus'); + } + + + protected function _getLinkToAllTitleDb() { + $title = $this->_settings->getLinkToAllTitle(); + return $title + ? sprintf($title, $this->titre) + : $this->_getLinkToAllTitle(); + } + + + protected function _getMainTitle() { + if ( ! $use_url = $this->_settings->getLinkToAllToMainTitle()) + return $this->_settings->getTitre(); + + return $this->view->tagAnchor($this->_getLinkToAllUrl(), + $this->_settings->getTitre()); } @@ -145,7 +170,7 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help return (new $wrapper) ->setView($this->view) ->setModel($element) - ->setContextParams($this->_getLinkToAllParams()); + ->setContext($this); }, $elements); } @@ -208,6 +233,9 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help protected function _getLinkToAllUrl() { + if ($url = $this->_settings->getLinkToAllUrl()) + return $url; + if ($this->_settings->getAllLayout() == Intonation_Library_Widget_Carousel_Record_Definition::SEARCH) return $this->view->url(array_filter(['module' => 'opac', 'controller' => 'recherche', @@ -243,6 +271,11 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help } + public function getLinkToAllParams() { + return []; + } + + public function getHandleLinkToAll() { return true; } diff --git a/library/templates/Intonation/Library/Widget/Login/View.php b/library/templates/Intonation/Library/Widget/Login/View.php index 67ff720dfec280e300b58edc2fb5a69c23e8c8ea..8bda83b0eaf32cae68680a45d31ebd2564c5562f 100644 --- a/library/templates/Intonation/Library/Widget/Login/View.php +++ b/library/templates/Intonation/Library/Widget/Login/View.php @@ -97,14 +97,16 @@ abstract class IntonationLoginRenderAbstract { foreach($this->_settings->toArray() as $key => $value) if (is_string($value) || is_int($value)) $options [Storm_Inflector::underscorize($key)] = $value; - $form = ZendAfi_Form_Login::newWithOptions(['data' => $options]); $action = $this->_settings->getClearAction() ? '' : $this->_view->url(['controller' => 'auth', 'action' => 'login', - 'redirect' => Class_Url::absolute()], null, true); + 'redirect' => (isset($options['redirect_url'])) + ? $options['redirect_url'] + : Class_Url::absolute()] + , null, true); $form ->setAction($action); @@ -160,6 +162,22 @@ abstract class IntonationLoginRenderAbstract { implode($html), $this->_getLinksListAttribs()); + $show_password_button = + $this->_view->tag('div', + Class_Template::current() + ->getIco($this->_view, + 'eye', + 'utils'), + ['onclick' => "$(this).parent().find('input').attr('type', function(index, attr) {return attr == 'password' ? 'text' : 'password';});", + 'class' => 'password_toggle']); + + $show_password_js = sprintf('$("#password").parent().append("%s"); $("#password").parent().attr("style", "position: relative;");', + str_replace('"', '\"', $show_password_button)); + + + Class_ScriptLoader::getInstance() + ->addJQueryReady($show_password_js); + return $this->_renderForm($form) . $html; } diff --git a/library/templates/Intonation/Library/Widget/Search/Definition.php b/library/templates/Intonation/Library/Widget/Search/Definition.php index 5d71a9849807030edaf990dfb42061f361240dda..7a5cdb798fb6b346428992710708bbe2897e1cb9 100644 --- a/library/templates/Intonation/Library/Widget/Search/Definition.php +++ b/library/templates/Intonation/Library/Widget/Search/Definition.php @@ -24,11 +24,13 @@ class Intonation_Library_Widget_Search_Definition extends Class_Systeme_ModulesA public function __construct() { parent::__construct(); $this->_view_helper = 'Intonation_Library_Widget_Search_View'; + $this->_form = 'Intonation_Library_Widget_Search_Form'; $this->_defaultValues = array_merge($this->_defaultValues, [Class_Template::current()->withNameSpace('FormStyle') => 'inline', 'search_button' => $this->_('Rechercher'), 'placeholder' => $this->_('Titre, auteur…'), - 'type_doc' => '' + 'type_doc' => '', + 'facets_in_session' => 1 ]); } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Search/Form.php b/library/templates/Intonation/Library/Widget/Search/Form.php new file mode 100644 index 0000000000000000000000000000000000000000..10a2255b80a94a0b2b31caa9d338f5d8f9a3d018 --- /dev/null +++ b/library/templates/Intonation/Library/Widget/Search/Form.php @@ -0,0 +1,42 @@ +<?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 Intonation_Library_Widget_Search_Form extends ZendAfi_Form_Configuration_Widget_Search { + public function init() { + parent::init(); + + $this + ->addElement('checkbox', + 'facets_in_session', + ['label' => $this->_('Persistance des facettes en session'), + 'multiOptions' => [1,0]]); + + } + + + public function populate(array $datas) { + parent::populate($datas); + $this->removeElement('largeur'); + $this->addToSelectionGroup(['facets_in_session']); + return $this; + } +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Search/View.php b/library/templates/Intonation/Library/Widget/Search/View.php index 7a9165f1de006a8631fdd00ab89c031728db1fbb..d2978a9e73b1ad21114b3ee125070ac37110c350 100644 --- a/library/templates/Intonation/Library/Widget/Search/View.php +++ b/library/templates/Intonation/Library/Widget/Search/View.php @@ -105,6 +105,9 @@ abstract class IntonationSearchRenderAbstract { if (!$last_search = Zend_Registry::get('session')->last_search) return $this; + if ( ! $this->_settings->getFacetsInSession()) + return $this; + $criteria = (new Class_CriteresRecherche()) ->setParams($last_search); @@ -157,7 +160,7 @@ abstract class IntonationSearchRenderAbstract { ->addElement('custom', 'custom_reset_search', - ['render' => function() + ['render' => function($view) { if (!$this->_has_facet) return ''; @@ -170,7 +173,7 @@ abstract class IntonationSearchRenderAbstract { ['Title' => $this->_('Réinitialiser la recherche'), 'type' => 'button', 'class' => 'btn btn-sm btn-warning border-dark', - 'onclick' => 'var form = $(this).closest(\'form\'); form.attr(\'action\', \'' . $this->_view->url(['controller' => 'recherche', 'action' => 'simple'], null, true) . '\'); form.find(\'.expressionRecherche\').attr(\'value\', \'\'); $(this).hide(); form.find(\'.criteres_recherche\').hide(); form.find(\'.has_facet\').removeClass(\'bg-warning\'); $.ajax(\'' . $this->_view->url(['controller' => 'recherche', 'action' => 'clear-last-search-session'], null, true) . '\');']); + 'onclick' => 'var form = $(this).closest(\'form\'); form.attr(\'action\', \'' . $this->_view->url(['controller' => 'recherche', 'action' => 'simple'], null, true) . '\'); form.find(\'.expressionRecherche\').attr(\'value\', \'\'); $(this).hide(); form.parent().find(\'.criteres_recherche\').hide(); form.parent().find(\'.has_facet\').removeClass(\'bg-warning\'); $.ajax(\'' . $this->_view->url(['controller' => 'recherche', 'action' => 'clear-last-search-session'], null, true) . '\');']); }]) ->addElement('button', @@ -321,10 +324,11 @@ class IntonationSearchRenderDefault extends IntonationSearchRenderAbstract { public function render() { + $criteria = $this->_renderCriteria(''); $html = $this->_view->renderForm($this->_getForm() - ->addUniqDisplayGroup('search_group')); + ->addUniqDisplayGroup('search_group')); - $html = $this->_renderCriteria($html); + $html .= $criteria; return $this->_isAdvancedSearchEnabled() ? $html . $this->_renderAdvancedSearch() @@ -362,7 +366,7 @@ class IntonationSearchRenderInline extends IntonationSearchRenderAbstract { if ($html = $criteria . implode($optional_form_elements) . $advanced_search) $form->addElement('custom', 'custom_advanced_search', - ['render' => function() use ($html) + ['render' => function($view) use ($html) { return $this->_renderToggle($html); }]); diff --git a/library/templates/Intonation/View/Admin/ProfileComposition.php b/library/templates/Intonation/View/Admin/ProfileComposition.php index 4f36fbc892b1dbfd5ced621b6c9cfc73615551f4..895e606ee330b0e2d3243678e410b71fb69c301d 100644 --- a/library/templates/Intonation/View/Admin/ProfileComposition.php +++ b/library/templates/Intonation/View/Admin/ProfileComposition.php @@ -47,7 +47,11 @@ class Intonation_View_Admin_ProfileComposition extends ZendAfi_View_Helper_Profi protected function _getFooterColumn() { - return $this->_getDivisionColumn(Class_Profil::DIV_FOOTER, $this->_('Division pied de page')); + return $this->_getDivisionColumn(Class_Profil::DIV_FOOTER, $this->_('Division pied de page') + . $this->view->tagImg(Class_Admin_Skin::current()->getIconUrl('actions', + 'help'), + ['title' => $this->_('Attention. Cette division est partagée entre toutes les pages du profil.'), + 'style' => 'margin:0 0 -3px 5px;cursor: help;'])); } diff --git a/library/templates/Intonation/View/Admin/TagEditSection.php b/library/templates/Intonation/View/Admin/TagEditSection.php index b7a7c6496a6626eae68cc89bd2509522101b8091..d46310572a4ee1cb93db7a25384b9815d5540264 100644 --- a/library/templates/Intonation/View/Admin/TagEditSection.php +++ b/library/templates/Intonation/View/Admin/TagEditSection.php @@ -30,7 +30,7 @@ class Intonation_View_Admin_TagEditSection extends ZendAfi_View_Helper_BaseHelpe 'controller' => 'widget', 'action' => 'edit-section', 'id' => $section->getId(), - 'id_profil' => $section->getProfile()->getId()], + 'id_profil' => $this->_getProfileId($section)], null, true); $label = $this->_('Modifier la section "%s"', $section->getTitle()); @@ -43,4 +43,16 @@ class Intonation_View_Admin_TagEditSection extends ZendAfi_View_Helper_BaseHelpe return $html; } + + + protected function _getProfileId($section) { + $profile_id = $section->getProfile()->getId(); + if ( ! $section->isShared()) + return $profile_id; + + if ( ! $section->getProfile()->hasParentProfil()) + return $profile_id; + + return $section->getProfile()->getParentProfil()->getId(); + } } \ No newline at end of file diff --git a/library/templates/Intonation/View/Author/RenderFacets.php b/library/templates/Intonation/View/Author/RenderFacets.php index 864a9671dd9bf98380e0fae409c726275fd853f1..c142807f96c3e40a7908f405ea66bc6b199261ac 100644 --- a/library/templates/Intonation/View/Author/RenderFacets.php +++ b/library/templates/Intonation/View/Author/RenderFacets.php @@ -39,6 +39,6 @@ class Intonation_View_Author_RenderFacets extends ZendAfi_View_Helper_BaseHelper $facet_label))); } - return $this->view->renderBadges($badges); + return $this->view->renderBadges($badges, $this); } } diff --git a/library/templates/Intonation/View/CardifyOnlyDescription.php b/library/templates/Intonation/View/CardifyOnlyDescription.php index ff4040d63b32789f32ff4a8e540fcc9994834439..658e93fe8f3444d2d1fe163c74a5fabf1d8966ce 100644 --- a/library/templates/Intonation/View/CardifyOnlyDescription.php +++ b/library/templates/Intonation/View/CardifyOnlyDescription.php @@ -23,6 +23,7 @@ class Intonation_View_CardifyOnlyDescription extends Intonation_View_CardHelper { public function cardifyOnlyDescription($element, $img = '') { + $element_class = get_class($element); $content = [$element->getContentForJSSearch()]; $content = $this->_addTitle($element, $content); @@ -30,20 +31,20 @@ class Intonation_View_CardifyOnlyDescription extends Intonation_View_CardHelper $content [] = $this->_tag('div', $this->view->tagAction($second_link ->setInlineText(1)), - ['class' => 'card-subtitle']); + ['class' => 'card-subtitle card_subtitle_' . $element_class]); if ($summary = $element->getDescription()) $content [] = $this->_tag('div', $element->getDescription(), ['title' => strip_tags($element->getDescriptionTitle()), - 'class' => 'card-text']); + 'class' => 'card-text card_description_' . $element_class]); $html = []; if (!empty($content)) $html [] = $this->_tag('div', implode($content), - ['class' => 'card-body']); + ['class' => 'card-body card_body_' . $element_class]); $links = []; if ($link = $element->getMainLink()) @@ -59,10 +60,10 @@ class Intonation_View_CardifyOnlyDescription extends Intonation_View_CardHelper if (!empty($links)) $html [] = $this->_tag('div', implode($links), - ['class' => 'card-footer d-flex flex-row justify-content-between ' . $hide_text_button_class]); + ['class' => 'card-footer d-flex flex-row justify-content-between ' . $hide_text_button_class . ' card_footer_' . $element_class]); return $this->_tag('div', $img . implode($html), - ['class' => 'card']); + ['class' => 'card card_' . $element_class]); } } \ No newline at end of file diff --git a/library/templates/Intonation/View/ColumnBreak.php b/library/templates/Intonation/View/ColumnBreak.php new file mode 100644 index 0000000000000000000000000000000000000000..1148029ace8326f1642e4cb482c21c3256c3f200 --- /dev/null +++ b/library/templates/Intonation/View/ColumnBreak.php @@ -0,0 +1,27 @@ +<?php +/** + * Copyright (c) 2012-2020, 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 Intonation_View_ColumnBreak extends ZendAfi_View_Helper_BaseHelper { + public function columnBreak() { + return $this->_div(['class' => 'w-100'], ''); + } +} diff --git a/library/templates/Intonation/View/Opac.php b/library/templates/Intonation/View/Opac.php index 46c26b1eab66e722cd0f286dad94f4d934dc10cb..ba390d02cd3ba52022aa8a4d4110362efdeccfb1 100644 --- a/library/templates/Intonation/View/Opac.php +++ b/library/templates/Intonation/View/Opac.php @@ -145,6 +145,8 @@ class Intonation_View_Opac extends ZendAfi_View_Helper_BaseHelper { if($this->_template->getIntonationCss()) $head_scripts->addStyleSheets([Class_Url::absolute('/library/templates/Intonation/Assets/css/intonation.css')]); + $this->_addTemplateCss($head_scripts); + if($custom_css_urls = $this->_template->getCustomCssUrl()) $head_scripts->addStyleSheets($custom_css_urls); @@ -179,15 +181,16 @@ class Intonation_View_Opac extends ZendAfi_View_Helper_BaseHelper { $this->_tag('meta', null, ['name' => 'revisit-after', 'content' => '10 days']), - $this->_tag('title', $this->view->getTitre()), + $this->_tag('title', $this->view->getTitre())]; + + $content = array_merge($content, + $head_scripts->styleSheetsArray(), + $script_loader->styleSheetsArray(), + $head_scripts->javaScriptsArray(), + $script_loader->javaScriptsArray(), + [$this->view->heartbeat()]); - $script_loader->styleSheetsHTML(), - $head_scripts->styleSheetsHTML(), - $head_scripts->javaScriptsHTML(), - $script_loader->javaScriptsHTML(), - $this->view->heartbeat(), - $this->view->headScript(), - $this->view->headLink()]; + $content = array_unique($content); return implode($content); } @@ -208,4 +211,8 @@ class Intonation_View_Opac extends ZendAfi_View_Helper_BaseHelper { $this->view->addBootstrap($script_loader); return $this; } + + + protected function _addTemplateCss($script_loader) { + } } \ No newline at end of file diff --git a/library/templates/Intonation/View/RenderBadges.php b/library/templates/Intonation/View/RenderBadges.php index 51dd2def27be667c3c6ad67d618c21d4939f8928..9b8d0b66753634a134483d9043700d7c40cf30bf 100644 --- a/library/templates/Intonation/View/RenderBadges.php +++ b/library/templates/Intonation/View/RenderBadges.php @@ -22,7 +22,7 @@ class Intonation_View_RenderBadges extends ZendAfi_View_Helper_BaseHelper { - public function renderBadges($badges) { + public function renderBadges($badges, $instance) { $badges = array_map(function($badge) { if (!$text = $badge->getText()) @@ -48,6 +48,6 @@ class Intonation_View_RenderBadges extends ZendAfi_View_Helper_BaseHelper { return $this->_tag('div', implode(array_filter($badges)), - ['class' => 'badge-group']); + ['class' => 'badge-group badge_group_' . get_class($instance)]); } } \ No newline at end of file diff --git a/library/templates/Intonation/View/RenderExpandable.php b/library/templates/Intonation/View/RenderExpandable.php index 8e9813ed49b67df55d7f5d671734f1f03914cf28..05109c7aea80c7c78521f3f44918241602169011 100644 --- a/library/templates/Intonation/View/RenderExpandable.php +++ b/library/templates/Intonation/View/RenderExpandable.php @@ -24,30 +24,35 @@ class Intonation_View_RenderExpandable extends ZendAfi_View_Helper_BaseHelper { public function renderExpandable($content, $button = '', $collapsing_class = 'navbar-expand-md') { $id = 'navbar_' . uniqid(); + $button = $this->_getButton($button, $id); + + $content = $this->view->div(['class' => 'collapse navbar-collapse', + 'id' => $id], + $content); + + return $this->view->div(['class' => 'navbar d-print p-0 m-0 ' . $collapsing_class], + $button . $content); + } + + + protected function _getButton($button, $id) { if ($button instanceof Intonation_Library_Link) - $button = $this->view->tagAction($button->setAttribs(array_merge((($attribs = $button->getAttribs()) + return $this->view->tagAction($button->setAttribs(array_merge((($attribs = $button->getAttribs()) ? $attribs : []), ['type' => 'button', 'data-toggle' => 'collapse', 'data-target' => '#' . $id]))); + $button = $button ? $button : $this->_tag('span', '', ['class' => 'navbar-toggler-icon']); - $button = $this->_tag('button', - $button, - ['class' => 'navbar-toggler navbar-light mb-2', - 'type' => 'button', - 'data-toggle' => 'collapse', - 'data-target' => '#' . $id]); - - $content = $this->view->div(['class' => 'collapse navbar-collapse', - 'id' => $id], - $content); - - return $this->view->div(['class' => 'navbar d-print p-0 m-0 ' . $collapsing_class], - $button . $content); - + return $this->_tag('button', + $button, + ['class' => 'navbar-toggler navbar-light mb-2', + 'type' => 'button', + 'data-toggle' => 'collapse', + 'data-target' => '#' . $id]); } } diff --git a/library/templates/Intonation/View/RenderGrid.php b/library/templates/Intonation/View/RenderGrid.php index 5985f399aeb23ecc40a8ba5fbc7088d9f21d99e3..f89f66e9f3caf5ca5debc72622d55497e17edd94 100644 --- a/library/templates/Intonation/View/RenderGrid.php +++ b/library/templates/Intonation/View/RenderGrid.php @@ -24,6 +24,9 @@ class Intonation_View_RenderGrid extends ZendAfi_View_Helper_BaseHelper { public function renderGrid($collection, $callback) { + if ($collection->isEmpty()) + return ''; + $html = array_filter($collection ->injectInto([], function($html, $element) use ($callback) { diff --git a/library/templates/Intonation/View/RenderHorizontalList.php b/library/templates/Intonation/View/RenderHorizontalList.php index 9d1bf495c51ec23a3c233a0e16202be783e75bca..9b61772ed5cf991c7a518793e8e41dd24a8af21d 100644 --- a/library/templates/Intonation/View/RenderHorizontalList.php +++ b/library/templates/Intonation/View/RenderHorizontalList.php @@ -23,6 +23,9 @@ class Intonation_View_RenderHorizontalList extends ZendAfi_View_Helper_BaseHelper { public function renderHorizontalList($collection, $callback) { + if ($collection->isEmpty()) + return ''; + $html = $collection ->injectInto('', function($html, $element) use ($callback) { diff --git a/library/templates/Intonation/View/RenderList.php b/library/templates/Intonation/View/RenderList.php index 2a38e95b78a36b971c173d574d71f287a52d40cb..79ec4479bd553f0b41a6a1bc76d7140206875e49 100644 --- a/library/templates/Intonation/View/RenderList.php +++ b/library/templates/Intonation/View/RenderList.php @@ -23,6 +23,9 @@ class Intonation_View_RenderList extends ZendAfi_View_Helper_BaseHelper { public function renderList($collection, $callback) { + if ($collection->isEmpty()) + return ''; + $html = $collection ->injectInto('', function($html, $element) use ($callback) { diff --git a/library/templates/Intonation/View/RenderTree.php b/library/templates/Intonation/View/RenderTree.php new file mode 100644 index 0000000000000000000000000000000000000000..f37c72952cc7421d6c7e1e63b6f26a3dc5783a4c --- /dev/null +++ b/library/templates/Intonation/View/RenderTree.php @@ -0,0 +1,78 @@ +<?php +/** + * Copyright (c) 2012-2020, 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 Intonation_View_RenderTree extends ZendAfi_View_Helper_BaseHelper { + + protected + $_parent_classes = 'col-10 col-sm-3 offset-0 mb-3 tree_view_parent border-primary border', + $_current_classes = 'col-10 col-sm-3 mb-3 offset-1 tree_view_current border-success border', + $_child_classes = 'col-9 offset-2 tree_view_child border-info border p-3'; + + + public function renderTree($parents, $current, $children, $callback) { + $html = [$this->_renderParents($parents, $callback), + $this->_renderCurrent($current, $callback), + $this->_renderChildren($children, $callback)]; + + $html = array_filter($html); + + return $this->view->grid(implode($this->view->columnBreak(), + $html), + ['class' => 'tree_view border-primary']); + + } + + + protected function _renderParents($parents, $callback) { + if ($parents->isEmpty()) + return ''; + + $html = []; + + foreach ($parents as $parent) + $html [] = $this->_div(['class' => $this->_parent_classes], + $callback($parent)); + + return implode($this->view->columnBreak(), + $html); + } + + + protected function _renderCurrent($domain, $callback) { + return $this->_div(['class' => $this->_current_classes], + $callback($domain)); + } + + + protected function _renderChildren($children, $callback) { + if ($children->isEmpty()) + return ''; + + $html = []; + + foreach ($children as $child) + $html [] = $callback($child); + + return $this->_div(['class' => $this->_child_classes], + $this->view->renderGrid($children, $callback)); + } +} diff --git a/library/templates/Intonation/View/RenderTruncateList.php b/library/templates/Intonation/View/RenderTruncateList.php index 197762018d5e2f9e50d87c0038659cb92e8d3c1c..ca259e99f3765172e06c74a684e00fd20d1f7d33 100644 --- a/library/templates/Intonation/View/RenderTruncateList.php +++ b/library/templates/Intonation/View/RenderTruncateList.php @@ -28,6 +28,9 @@ class Intonation_View_RenderTruncateList extends ZendAfi_View_Helper_BaseHelper public function renderTruncateList($collection, $callback) { + if ($collection->isEmpty()) + return ''; + $size = $collection->count(); if (50 < $size) diff --git a/library/templates/Intonation/View/RenderWall.php b/library/templates/Intonation/View/RenderWall.php index bad8b1d23ee348177963b56758e4cac280285f64..b91431df63becc2903532ab853dd6e295838b998 100644 --- a/library/templates/Intonation/View/RenderWall.php +++ b/library/templates/Intonation/View/RenderWall.php @@ -26,6 +26,9 @@ class Intonation_View_RenderWall extends ZendAfi_View_Helper_BaseHelper { public function renderWall($collection, $callback) { + if ($collection->isEmpty()) + return ''; + $this->_masonry_id = uniqid(); $this->renderHeadScriptsOn(Class_ScriptLoader::getInstance()); diff --git a/library/templates/Intonation/View/Search/DomainBrowser.php b/library/templates/Intonation/View/Search/DomainBrowser.php new file mode 100644 index 0000000000000000000000000000000000000000..e42debb4fd226ecd3ce5629e9781bc10016bcc55 --- /dev/null +++ b/library/templates/Intonation/View/Search/DomainBrowser.php @@ -0,0 +1,95 @@ +<?php +/** + * Copyright (c) 2012-2020, 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 Intonation_View_Search_DomainBrowser extends ZendAfi_View_Helper_BaseHelper { + public function Search_DomainBrowser($criteria) { + if ( ! $id_module = $criteria->getIdModule()) + return ''; + + if ( ! $config = Class_Profil::getCurrentProfil()->getLocalModuleAccueilConfig($id_module)) + return ''; + + if(!isset($config['type_module'])) + return ''; + + if($config['type_module'] != 'DOMAIN_BROWSER') + return ''; + + $preferences = $config['preferences']; + $root_id = $preferences['root_domain_id']; + + $current = ($current = $criteria->getCatalogue()) + ? $current + : Class_Catalogue::getRoot(); + + return $this->view->renderTree($this->_getParents($current, $root_id), + $this->_getCurrent($current), + $this->_getChildren($current), + function($wrapper) + { + return $this->view->cardify($wrapper); + }); + } + + + protected function _getParents($current, $root_id) { + $parents = $current->getParentsUntil($root_id); + array_pop($parents); + + $parents = array_map(function($domain) + { + return $this->_wrapDomain($domain); + }, + $parents); + return new Storm_Collection($parents); + } + + + protected function _getCurrent($current) { + return $this->_wrapDomain($current); + } + + + protected function _getChildren($current) { + $children = $current->getChildren(); + + $children = array_map(function($domain) + { + return $this->_wrapDomain($domain); + }, + $children); + + return new Storm_Collection($children); + } + + + protected function _wrapDomain($domain) { + return (new Intonation_Library_View_Wrapper_Domain) + ->setModel($domain) + ->setView($this->view); + } + + + protected function _childSeparator() { + return Class_Template::current()->getIco($this->view, 'tree-child', 'utils'); + } +} diff --git a/library/templates/Intonation/View/Search/HtmlCriteria.php b/library/templates/Intonation/View/Search/HtmlCriteria.php index 548e734d0c9df3dc2af353567a6d4b4b300aa895..cefa3acbdd46bed064580d61cf60ec21fbf519f3 100644 --- a/library/templates/Intonation/View/Search/HtmlCriteria.php +++ b/library/templates/Intonation/View/Search/HtmlCriteria.php @@ -24,14 +24,15 @@ class Intonation_View_Search_HtmlCriteria extends ZendAfi_View_Helper_TagCritere protected $_cache, - $_domain; + $_domain, + $_criteria; public function search_HtmlCriteria($criteres_recherche) { if ($this->_cache) return $this->_cache; - $criteres_recherche = (new Intonation_Library_Search_Criteria) + $this->_criteria = $criteres_recherche = (new Intonation_Library_Search_Criteria) ->from($criteres_recherche); $this->visitCriteresRecherche($criteres_recherche); @@ -69,6 +70,13 @@ class Intonation_View_Search_HtmlCriteria extends ZendAfi_View_Helper_TagCritere } + public function visitPanier($panier) { + return $this + ->htmlAppend($this->getSuppressionImgUrlForLibelle($panier->getLibelle(), + $this->_criteres_recherche->getUrlCriteresWithoutElement('id_panier'))); + } + + public function visitNouveaute($months_delay) { return $this->_domain ? $this : parent::visitNouveaute($months_delay); } diff --git a/library/templates/Intonation/View/Search/Result.php b/library/templates/Intonation/View/Search/Result.php index 75f8f6c5dc5fe6ee1869c6a610c431fdb22c9326..2d3e2987ae1655018a9955a87fd91b16a519864a 100644 --- a/library/templates/Intonation/View/Search/Result.php +++ b/library/templates/Intonation/View/Search/Result.php @@ -65,6 +65,13 @@ class Intonation_View_Search_Result extends ZendAfi_View_Helper_BaseHelper { : $title_from_url)), strtolower($text_criteria)); + $domain_browser = ((($domain_browser = $this->view->Search_DomainBrowser($criteria)) + ? $this->_div(['class' => 'col-12 pt-2 mb-2 search_domain_browser'], + $this->view->renderExpandable($domain_browser, + $this->_tag('span', '', ['class' => 'navbar-toggler-icon']) + . $this->_tag('span', $this->_('Arborescence'), ['class' => 'ml-3 text-dark']))) + : '')); + $tools = $records ? $this->_div(['class' => 'col-12 border-top border-bottom pt-2 mb-2 search_tools'], $this->_renderTools($search, $criteria)) @@ -89,6 +96,8 @@ class Intonation_View_Search_Result extends ZendAfi_View_Helper_BaseHelper { $tools, + $domain_browser, + ($records ? $this->_div(['class' => 'col-12 col-md-3'], $facets) diff --git a/library/templates/Intonation/View/Search/TextCriteria.php b/library/templates/Intonation/View/Search/TextCriteria.php index 41763d9083c490b117f315bbbd64ff7c7089a558..cb3f577af1956f4a13e5213899200df76cc8d29e 100644 --- a/library/templates/Intonation/View/Search/TextCriteria.php +++ b/library/templates/Intonation/View/Search/TextCriteria.php @@ -34,7 +34,15 @@ class Intonation_View_Search_TextCriteria extends Intonation_View_Search_HtmlCri public function visitCatalogue($catalogue) { $this->_domain = $catalogue; - return $this; + + return $this->htmlAppend($this->view->_('dans %s', $catalogue->getLibelle())); + } + + + public function visitPanier($panier) { + return $this->_criteria->hasExpressionRecherche() + ? $this->htmlAppend($this->view->_('dans la sélection %s', $panier->getLibelle())) + : $this; } diff --git a/library/templates/Intonation/View/Truncate.php b/library/templates/Intonation/View/Truncate.php index 2824d2e2a4fc3a13817ba3f723d30ada4bc41698..4dd548413f60c3a103f552c8b955a448e468ec8d 100644 --- a/library/templates/Intonation/View/Truncate.php +++ b/library/templates/Intonation/View/Truncate.php @@ -21,7 +21,7 @@ class Intonation_View_Truncate extends ZendAfi_View_Helper_BaseHelper { - public function truncate($text, $size = '20', $tag = 'p', $attribs = []) { + public function truncate($text, $attribs = [], $size = '20', $tag = 'p') { if (! $text) return ''; diff --git a/library/templates/Intonation/View/User/Informations.php b/library/templates/Intonation/View/User/Informations.php index 62cb26b9f7191a4f8f2668ad1364af492a397f90..85a1f539072b0ec6327ab02779b454d3077098a7 100644 --- a/library/templates/Intonation/View/User/Informations.php +++ b/library/templates/Intonation/View/User/Informations.php @@ -58,7 +58,7 @@ class Intonation_View_User_Informations extends ZendAfi_View_Helper_BaseHelper { 'Image' => Class_Template::current()->getIco($this->view, 'edit', 'utils'), 'Text' => $this->_('Modifier mes informations'), 'Title' => $this->_('Modifier les informations me concernant'), - 'Class' => 'btn btn-sm btn-success', + 'Class' => 'btn btn-sm btn-success mr-3', 'InlineText' => 1]); $edit_password = @@ -67,7 +67,7 @@ class Intonation_View_User_Informations extends ZendAfi_View_Helper_BaseHelper { 'Image' => Class_Template::current()->getIco($this->view, 'lock', 'utils'), 'Text' => $this->_('Changer mon mot de passe'), 'Title' => $this->_('Changer le mot de passe de mon compte.'), - 'Class' => 'btn btn-sm btn-secondary ml-3', + 'Class' => 'btn btn-sm btn-secondary', 'InlineText' => 1]); return @@ -88,7 +88,7 @@ class Intonation_View_User_Informations extends ZendAfi_View_Helper_BaseHelper { 'action' => 'en-lire-plus', 'id' => $library->getId()]), $library->getLibelle(), - ['title' => $this->_('En lire plus au sur %s', + ['title' => $this->_('En lire plus sur %s', $library->getLibelle())]); } } diff --git a/library/templates/Intonation/View/Widget/Login.php b/library/templates/Intonation/View/Widget/Login.php index 8da12474ac76a03f26555a3d1bc557630811191b..d80b4e79e5ff33de18b99fe427b401e1c6dfd37e 100644 --- a/library/templates/Intonation/View/Widget/Login.php +++ b/library/templates/Intonation/View/Widget/Login.php @@ -24,7 +24,12 @@ class Intonation_View_Widget_Login extends ZendAfi_View_Helper_BaseHelper { public function Widget_Login($settings) { $preferences = $settings->getPreferences(); $preferences[Class_Template::current()->withNameSpace('form_style')] = ''; - $login = (new Intonation_Library_Widget_Login_View($this->view->id_module, $preferences)) + $login = (new Intonation_Library_Widget_Login_View($this->view->id_module, + array_merge( + $preferences, + ($settings->getFormOptions() && isset($settings->getFormOptions()['data'])) + ? $settings->getFormOptions()['data'] + :[]))) ->setView($this->view); $login->getHtml(); return $login->getContent(); diff --git a/library/templates/Muscle/Assets/css/muscle.css b/library/templates/Muscle/Assets/css/muscle.css index 83697caefb2a874f34f7fdd2df969a4546f9c90b..c01a854be846163b666d6c962180f9116d64294e 100644 --- a/library/templates/Muscle/Assets/css/muscle.css +++ b/library/templates/Muscle/Assets/css/muscle.css @@ -72,10 +72,6 @@ header { display: flex; } -.menu_buttons .button_text { - display: none !important; -} - .menu_buttons .nav-link, .menu_buttons .nav-link:hover { color: var(--muscle-black) !important; diff --git a/library/templates/Muscle/Library/Settings.php b/library/templates/Muscle/Library/Settings.php index 116aa8e1899107bf2f8d58a9f56fe42e700f775a..d615f70b4332cb66fb680906f412ef7b4415000a 100644 --- a/library/templates/Muscle/Library/Settings.php +++ b/library/templates/Muscle/Library/Settings.php @@ -30,32 +30,8 @@ class Muscle_Library_Settings extends Intonation_Library_Settings { $custom_css_classes = $settings[$this->_template->withNameSpace('custom_css_class')]; - $custom_css_classes = ['position_fixed_bottom', - 'position_fixed_bottom_left', - 'position_fixed_bottom_right', - 'position_fixed_top', - 'position_fixed_top_left', - 'position_fixed_top_right', - 'position_fixed_mid_left', - 'position_fixed_mid_right', - 'pt-3', - 'pt-5', - 'pb-3', - 'pl-2', - 'pl-md-3', - 'pr-md-3', - 'no_border', - 'no_border_radius', - 'no_shadow', - 'm-auto', - 'ml-auto', - 'mr-auto', - 'align-items-center', - 'auto_col', - 'justify-content-start', - 'justify-content-end', - 'justify-content-center', - 'menu_buttons']; + $custom_css_classes = array_merge($custom_css_classes, + []); $settings[$this->_template->withNameSpace('custom_css_class')] = $custom_css_classes; diff --git a/library/templates/Muscle/View/Opac.php b/library/templates/Muscle/View/Opac.php index a86115252dda1ab21971adf24332f7c5650c01aa..821776e0f98cd6d5b01912eb85b655cb672214a9 100644 --- a/library/templates/Muscle/View/Opac.php +++ b/library/templates/Muscle/View/Opac.php @@ -21,9 +21,8 @@ class Muscle_View_Opac extends Intonation_View_Opac { - protected function _headContent() { - Class_ScriptLoader::getInstance() - ->addStyleSheet(Class_Url::absolute('/library/templates/Muscle/Assets/css/muscle.css')); - return parent::_headContent(); + protected function _addTemplateCss($script_loader) { + if ($this->_template->getMuscleCss()) + $script_loader->addStyleSheet(Class_Url::absolute('/library/templates/Muscle/Assets/css/muscle.css')); } } diff --git a/library/templates/MyBibApp/View/Opac.php b/library/templates/MyBibApp/View/Opac.php index 215d36df956de1c24f2c315b16d92f7b164e2bda..c059fe24801347c87e8b8e4ae81198e5a3710a46 100644 --- a/library/templates/MyBibApp/View/Opac.php +++ b/library/templates/MyBibApp/View/Opac.php @@ -21,9 +21,8 @@ class MyBibApp_View_Opac extends Intonation_View_Opac { - protected function _headContent() { - Class_ScriptLoader::getInstance() - ->addStyleSheet(Class_Url::absolute('/library/templates/MyBibApp/Assets/css/mybibapp.css')); - return parent::_headContent(); + protected function _addTemplateCss($script_loader) { + if ($this->_template->getMybibappCss()) + $script_loader->addStyleSheet(Class_Url::absolute('/library/templates/MyBibApp/Assets/css/mybibapp.css')); } } diff --git a/library/templates/Polygone/Assets/css/polygone.css b/library/templates/Polygone/Assets/css/polygone.css index e2b5207037346777ec0f88bde8c2ab21de0b0aba..dd841405d39e6f05ca3291d2cb87e8cc88659a2b 100644 --- a/library/templates/Polygone/Assets/css/polygone.css +++ b/library/templates/Polygone/Assets/css/polygone.css @@ -69,10 +69,6 @@ header { display: flex; } -.menu_buttons .button_text { - display: none !important; -} - .ui-state-active, .btn:active, a:active, diff --git a/library/templates/Polygone/Library/Settings.php b/library/templates/Polygone/Library/Settings.php index 675f19ac81fffe6b27827b7ec5c1212236495bad..159a76c4ddc74e669aad6c4dd3ddd1a393e5d70d 100644 --- a/library/templates/Polygone/Library/Settings.php +++ b/library/templates/Polygone/Library/Settings.php @@ -27,41 +27,14 @@ class Polygone_Library_Settings extends Intonation_Library_Settings { $custom_css_classes = $settings[$this->_template->withNameSpace('custom_css_class')]; - $custom_css_classes = ['position_fixed_bottom', - 'position_fixed_bottom_left', - 'position_fixed_bottom_right', - 'position_fixed_top', - 'position_fixed_top_left', - 'position_fixed_top_right', - 'position_fixed_mid_left', - 'position_fixed_mid_right', - 'pt-3', - 'pt-5', - 'pb-3', - 'pl-2', - 'pl-md-3', - 'pr-md-3', - 'no_background', - 'no_border', - 'no_border_radius', - 'no_shadow', - 'm-auto', - 'ml-auto', - 'mr-auto', - 'align-items-center', - 'auto_col', - 'justify-content-start', - 'justify-content-end', - 'justify-content-center', - 'menu_buttons', - 'polygone_big_menu_buttons', - 'polygone_widget', - 'polygone_simple_widget', - 'no_card_footer', - 'no_badges', - 'scroll_search', - 'flying_widget', - 'z-index-11']; + $custom_css_classes = array_merge($custom_css_classes, + ['polygone_big_menu_buttons', + 'polygone_widget', + 'polygone_simple_widget', + 'no_card_footer', + 'no_badges', + 'scroll_search', + 'flying_widget']); $settings[$this->_template->withNameSpace('custom_css_class')] = $custom_css_classes; diff --git a/library/templates/Polygone/View/Opac.php b/library/templates/Polygone/View/Opac.php index 29fae39bf826503f8cae0bf9e36c912a30b6680c..745f18e7270706be135bbed164b43f5e45e14166 100644 --- a/library/templates/Polygone/View/Opac.php +++ b/library/templates/Polygone/View/Opac.php @@ -21,12 +21,12 @@ class Polygone_View_Opac extends Intonation_View_Opac { - protected function _headContent() { + protected function _addTemplateCss($script_loader) { + if ($this->_template->getPolygoneCss()) + $script_loader->addStyleSheet(Class_Url::absolute('/library/templates/Polygone/Assets/css/polygone.css')); + Class_ScriptLoader::getInstance() - ->addStyleSheet(Class_Url::absolute('/library/templates/Polygone/Assets/css/polygone.css')) ->addScript(Class_Url::absolute('/library/templates/Polygone/Assets/js/scroll_search.js')) ->addJQueryReady('$(".scroll_search").scroll_search();'); - - return parent::_headContent(); } } diff --git a/library/templates/TerreDuMilieu/Assets/css/terredumilieu.css b/library/templates/TerreDuMilieu/Assets/css/terredumilieu.css index 3afcdab16e3ae9ba6bf6663cfaba0eda49ae1587..d001c68304a92993f2624e9080e9ab148c71ac72 100644 --- a/library/templates/TerreDuMilieu/Assets/css/terredumilieu.css +++ b/library/templates/TerreDuMilieu/Assets/css/terredumilieu.css @@ -410,10 +410,6 @@ footer .tdm_social_network_widget .nav-item:first-child { text-align: center; } -.z_index_11 { - z-index: 11; -} - .tdm_flying_widget.position_fixed_top_right { top: 80px !important; } diff --git a/library/templates/TerreDuMilieu/Library/Settings.php b/library/templates/TerreDuMilieu/Library/Settings.php index 2f239c2d386e0dd1c366c74f86500e8865e5ee06..c2296aacdde6d1f0789f357eaa4562ddfe365b29 100644 --- a/library/templates/TerreDuMilieu/Library/Settings.php +++ b/library/templates/TerreDuMilieu/Library/Settings.php @@ -27,30 +27,12 @@ class TerreDuMilieu_Library_Settings extends Intonation_Library_Settings { $custom_css_classes = $settings[$this->_template->withNameSpace('custom_css_class')]; - $custom_css_classes = ['position_fixed_bottom', - 'position_fixed_bottom_left', - 'position_fixed_bottom_right', - 'position_fixed_top', - 'position_fixed_top_left', - 'position_fixed_top_right', - 'position_fixed_mid_left', - 'position_fixed_mid_right', - 'pt-3', - 'pb-3', - 'no_border', - 'no_border_radius', - 'no_shadow', - 'm-auto', - 'align-items-center', - 'auto_col', - 'tdm_widget', - 'tdm_flying_widget', - 'tdm_search_widget', - 'tdm_social_network_widget', - 'tdm_main_nav_widget', - 'border-primary', - 'border-left', - 'z_index_11']; + $custom_css_classes = array_merge($custom_css_classes, + ['tdm_widget', + 'tdm_flying_widget', + 'tdm_search_widget', + 'tdm_social_network_widget', + 'tdm_main_nav_widget']); $settings[$this->_template->withNameSpace('custom_css_class')] = $custom_css_classes; diff --git a/library/templates/TerreDuMilieu/View/Opac.php b/library/templates/TerreDuMilieu/View/Opac.php index a786e3b8e9a957145de3af394d00ebbdfabf0cce..43bc19d3e6daac65202603cfdc67cf83b5151e1f 100644 --- a/library/templates/TerreDuMilieu/View/Opac.php +++ b/library/templates/TerreDuMilieu/View/Opac.php @@ -21,9 +21,8 @@ class TerreDuMilieu_View_Opac extends Intonation_View_Opac { - protected function _headContent() { - Class_ScriptLoader::getInstance() - ->addStyleSheet(Class_Url::absolute('/library/templates/TerreDuMilieu/Assets/css/terredumilieu.css')); - return parent::_headContent(); + protected function _addTemplateCss($script_loader) { + if ($this->_template->getTerredumilieuCss()) + $script_loader->addStyleSheet(Class_Url::absolute('/library/templates/TerreDuMilieu/Assets/css/terredumilieu.css')); } } diff --git a/public/admin/js/global.js b/public/admin/js/global.js index d8a5aa96f1db3027f42315ebdb7227a3021a369a..79455f89ae3a50d97ac3784f7732fb200b0c470e 100644 --- a/public/admin/js/global.js +++ b/public/admin/js/global.js @@ -220,7 +220,7 @@ function toggleVisibilityForElement(eventSourceSelector, objectToShowSelector, t : objectToShow.fadeOut(); } - sourceObject.change(function(event) { + sourceObject.on('change input', function(event) { return toggleVisibility($(event.target)); }); diff --git a/public/admin/skins/bokeh74/form.css b/public/admin/skins/bokeh74/form.css index 47c94588503e4d5d536d53dbdf9ac26a4497b756..adbb21ef957ab1c3478789c2f4e06a9db4af4e75 100644 --- a/public/admin/skins/bokeh74/form.css +++ b/public/admin/skins/bokeh74/form.css @@ -47,7 +47,7 @@ } .admin-form [size] { - width: auto !important; + width: auto; } .admin-form tr { diff --git a/public/opac/css/core.css b/public/opac/css/core.css index 83a3be32a2acd7700d56489165e80dd198e22b1a..0a0b4159c6bd6b2d13ae4706c34b0b0b243a9745 100644 --- a/public/opac/css/core.css +++ b/public/opac/css/core.css @@ -139,4 +139,62 @@ ol.breadcrumb li { [data-spambots] { margin-left: -5000px; +} + +.tree_view .card-footer { + display: none !important; +} + +.tree_view .card-body { + padding: 0.5rem; +} + +.tree_view .card-columns { + column-gap: 0.5rem; +} + +.tree_view .card-title { + margin: 0; +} + +.tree_view_current:not(:last-child)::before, +.tree_view_parent::before { + display: block; + content: ''; + position: absolute; + border-width: 0; + border-color: inherit; + border-style: solid; + border-left-width: 2px; + height: 1rem; + left: 50%; + width: 100%; + bottom: calc(-1rem - 1px); + z-index: 0; +} + +.tree_view_current:not(:last-child)::before { + bottom: calc(-1rem - 3px); +} + +.tree_view .card { + z-index-1; +} + +.tree_view_current { + border-width: 3px !important; +} + +.password_toggle { + position: absolute; + right: 10px; + top: 5px; +} + +.password_toggle i { + color: var(--front-background-modale) !important; +} + +input.form-control[type=text] { + display:unset; } \ No newline at end of file diff --git a/scripts/upgrade_db.php b/scripts/upgrade_db.php index 2ce3a6f3e263594c015c30028e2099dfbf2329e8..f292f93e5644632ee7ebaf75a65aa03cd1536235 100644 --- a/scripts/upgrade_db.php +++ b/scripts/upgrade_db.php @@ -10,4 +10,5 @@ if (262 < (int)Class_CosmoVar::getValueOf('patch_level')) $force = $argc>1 && $argv[1]=='--force'; (new Class_Migration_ScriptPatchs())->run($force); +(new Class_Template_Update)->run(); ?> \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/AbonneControllerChangePasswordTest.php b/tests/application/modules/opac/controllers/AbonneControllerChangePasswordTest.php index 9bb78275ac2dff2672a2a247e2e908d5eb14e8ad..dcf21e85d72e3795f44e4f0d617799337635386d 100644 --- a/tests/application/modules/opac/controllers/AbonneControllerChangePasswordTest.php +++ b/tests/application/modules/opac/controllers/AbonneControllerChangePasswordTest.php @@ -159,7 +159,9 @@ class AbonneControllerChangePasswordOnKohaWithCommunityServiceTest public function setUp() { parent::setUp(); - $auth_token=md5($this->_patron->getLogin().":".$this->_patron->getPassword()); + $auth = [$this->_patron->getLogin(), + $this->_patron->getPassword()]; + $this->_web_client ->whenCalled('open_url') ->with('http://plage.com/cgi-bin/koha/ilsdi.pl?service=AuthenticatePatron&username=ml34&password=achanger') @@ -170,8 +172,7 @@ class AbonneControllerChangePasswordOnKohaWithCommunityServiceTest json_encode(['password' => 'Ce1bnm2p', 'password_2' => 'Ce1bnm2p']), Zend_Http_Client::ENC_URLENCODED, - ['headers' => - ['Authorization' => 'Basic ' . $auth_token]]) + ['auth' => $auth ]) ->answers(new Zend_Http_Response(200,[],'')) ->whenCalled('postRawDataResponse') @@ -180,8 +181,7 @@ class AbonneControllerChangePasswordOnKohaWithCommunityServiceTest json_encode(['password' => 'test', 'password_2' => 'test']), Zend_Http_Client::ENC_URLENCODED, - ['headers' => - ['Authorization' => 'Basic ' . $auth_token]]) + ['auth' => $auth ]) ->answers(new Zend_Http_Response(200, [], json_encode(['error' => 'Password length (4) is shorter than required (5)']))) @@ -191,8 +191,7 @@ class AbonneControllerChangePasswordOnKohaWithCommunityServiceTest json_encode(['password' => 'testingsimple', 'password_2' => 'testingsimple']), Zend_Http_Client::ENC_URLENCODED, - ['headers' => - ['Authorization' => 'Basic ' . $auth_token]]) + ['auth' => $auth ]) ->answers(new Zend_Http_Response(200, [], json_encode(['error' => '[Passwords is too weak]']))) diff --git a/tests/library/Class/Systeme/PergameServiceTest.php b/tests/library/Class/Systeme/PergameServiceTest.php index 3c8b5b2c8df197fe0020c7af8e107318f4e943b1..6943f8662feb5a688f70139446c56c5161a01bcf 100644 --- a/tests/library/Class/Systeme/PergameServiceTest.php +++ b/tests/library/Class/Systeme/PergameServiceTest.php @@ -32,9 +32,21 @@ abstract class PergameServiceTestCase extends ModelTestCase { 'login' => 'gaz', 'password' => 'toto', 'idabon' => 'A-01', + 'id_sigb' => '3000', + 'id_int_bib' => 2, + 'id_site' => 2, 'ordreabon' => 2]); $this->pergame = new Class_Systeme_PergameService($user); + + $data = 'a:8:{s:26:"Autoriser_docs_disponibles";s:1:"1";s:13:"Max_par_carte";s:1:"3";s:16:"Max_par_document";s:1:"4";s:23:"Autoriser_prolongations";s:0:"";s:24:"Interdire_si_reservation";s:0:"";s:23:"Nombre_max_par_document";s:0:"";s:14:"Duree_en_jours";s:0:"";s:24:"Anteriorite_max_en_jours";s:0:"";}'; + + $this->mock_sql + ->whenCalled('fetchOne') + ->answers($data); + + $this->fixture('Class_IntBib', ['id' => 2, 'comm_params'=> $data, 'comm_sigb' => Class_IntBib::SIGB_PERGAME]); + $this->time_source = new PergameServiceTestingTimeSource(); Class_Systeme_PergameService::setTimeSource($this->time_source); } @@ -97,6 +109,12 @@ class PergameServiceUserTest extends PergameServiceTestCase { } + /** @test */ + public function updateFromPatronShouldNotUpdateUser() { + $this->assertEquals('A-01', Class_Users::find(3)->updateFromPatron()->getIdabon()); + } + + /** @test */ public function getReservationsShouldReturnResa() { $this->assertEquals([], $this->pergame->getReservations()); diff --git a/tests/library/Class/WebService/SIGB/KohaCommunityTest.php b/tests/library/Class/WebService/SIGB/KohaCommunityTest.php index 5f99ec03cd4c04bbb2dd52cb2dbcbcdf4d987455..5a3a0b4bfbecbb7b6a863298dda880f6a15f2f73 100644 --- a/tests/library/Class/WebService/SIGB/KohaCommunityTest.php +++ b/tests/library/Class/WebService/SIGB/KohaCommunityTest.php @@ -82,14 +82,15 @@ class KohaCommunityServiceChangePasswordWSTest extends KohaCommunityTestCase { public function setParamsAndResponse($password,$http_response) { - $auth_token=md5($this->user->getLogin().":".$this->user->getPassword()); + $auth=[$this->user->getLogin(), + $this->user->getPassword()]; + $this->mock_web_client ->whenCalled('postRawDataResponse') ->with('http://cat-aficg55.biblibre.com/api/v1/patrons/96138/password', json_encode(['password' => $password, 'password_2' => $password]), Zend_Http_Client::ENC_URLENCODED, - ['headers' => - ['Authorization' => 'Basic ' . $auth_token]]) + ['auth'=> $auth]) ->answers($http_response) ->whenCalled('open_url') ->with('http://cat-aficg55.biblibre.com/cgi-bin/koha/ilsdi.pl?service=GetPatronInfo&patron_id=96138&show_contact=1&show_loans=0&show_holds=1') @@ -106,7 +107,7 @@ class KohaCommunityServiceChangePasswordWSTest extends KohaCommunityTestCase { /** @test */ public function userValidPasswordShouldBeUpdated() { - $http_response = new Zend_Http_Response(200,[],''); + $http_response = new Zend_Http_Response(200,[],'""'); $this->setParamsAndResponse('7estIng!',$http_response); $this->assertEquals('7estIng!',$this->user->getPassword()); } @@ -152,7 +153,7 @@ class KohaCommunityServiceChangePasswordWSTest extends KohaCommunityTestCase { /** @test */ public function kohaShouldHaveBeenCalled() { - $http_response = new Zend_Http_Response(200,[],''); + $http_response = new Zend_Http_Response(200,[],'""'); $this->setParamsAndResponse('7estIng!',$http_response); $this->assertTrue($this->mock_web_client->methodHasBeenCalled('postRawDataResponse')); } diff --git a/tests/scenarios/MultiCards/MultiCardsTest.php b/tests/scenarios/MultiCards/MultiCardsTest.php index 4d9e5eef0ea8885e2fd49a2e03bd1e049744c31f..1a5f0d8d0516bffc42cc00b05b3ccf1de9555e77 100644 --- a/tests/scenarios/MultiCards/MultiCardsTest.php +++ b/tests/scenarios/MultiCards/MultiCardsTest.php @@ -39,7 +39,8 @@ abstract class Scenario_AbonneMultiCardsTestCase extends AbstractControllerTestC 'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB, 'idabon' => '12345', 'date_fin' => '2016-12-25', - 'bib' => $death_star]); + 'bib' => $death_star, + ]); $e_wok = $this->fixture('Class_Users', ['id' => 666, @@ -56,7 +57,8 @@ abstract class Scenario_AbonneMultiCardsTestCase extends AbstractControllerTestC 'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB, 'idabon' => '6789', 'date_fin' => '2016-11-01', - 'bib' => $death_star]); + 'bib' => $death_star + ]); Class_Users::clearCache(); } @@ -444,10 +446,17 @@ abstract class Scenario_AbonneMultiCardsAccountOfEwokTestCase extends Scenario_A public function setUp() { parent::setUp(); - Class_CommSigb::setInstance($this->_comm = $this->mock()); + Class_CommSigb::setInstance($this->_comm = $this->mock() + ->whenCalled('providesAuthentication') + ->answers(true)); ZendAfi_Auth::getInstance()->logUser(Class_Users::find(666)); + $int_death_star = $this->fixture('Class_IntBib', ['id' => 23, 'comm_params'=> ['url_serveur' => 'http://localhost:8080'], 'comm_sigb' => Class_IntBib::COM_NANOOK]); + + Class_Users::find(666)->setIntBib($int_death_star)->save(); + Class_Users::find(2)->setIntBib($int_death_star)->save(); + $potter = new Class_WebService_SIGB_Emprunt('12', new Class_WebService_SIGB_Exemplaire(123)); $potter ->setDateRetour('01/01/1974') diff --git a/tests/scenarios/Templates/MuscleTemplateTest.php b/tests/scenarios/Templates/MuscleTemplateTest.php index b01e10e5b0d7b1bd1b08a582044cf5ab00901548..5650b031c8045733b110ccaf2df94b65b45cbd6f 100644 --- a/tests/scenarios/Templates/MuscleTemplateTest.php +++ b/tests/scenarios/Templates/MuscleTemplateTest.php @@ -31,8 +31,18 @@ abstract class MuscleTemplateTestCase extends Admin_AbstractControllerTestCase { $profile = $this->fixture('Class_Profil', ['id' => 23]); - (new Muscle_Template)->tryOn($profile); - (new Class_Profil_Promoter)->promote($profile); + $settings = $this->fixture('Class_Template_Settings', + ['id' => 1, + 'template' => 'MUSCLE']); + + $settings + ->updateAttributes(['MuscleCustomCssUrl' => ['custom_template.css']]) + ->save(); + + $id = (new Muscle_Template)->tryOn($profile); + (new Class_Profil_Promoter)->promote(Class_Profil::find($id)); + + Class_Profil::find(1)->setHeaderCss('live_editor.css')->save(); } @@ -115,6 +125,19 @@ class MuscleTemplateProfilePatcherTest extends MuscleTemplateTestCase { public function addNewArticleInWidgetShouldBePresent() { $this->assertXPathContentContains('//a[contains(@href, "admin/cms/add")]', 'Ajouter un nouvel article'); } + + + /** @test */ + public function cssFilesOrderShouldContainsIntonationThenMuscleThenCustomCssThenProfileCss() { + $this->assertXPath('//link[1][contains(@href, "jquery-ui.min.css")]'); + $this->assertXPath('//link[2][contains(@href, "all.min.css")]'); + $this->assertXPath('//link[3][contains(@href, "bootstrap.min.css")]'); + $this->assertXPath('//link[4][contains(@href, "core.css")]'); + $this->assertXPath('//link[5][contains(@href, "intonation.css")]'); + $this->assertXPath('//link[6][contains(@href, "muscle.css")]'); + $this->assertXPath('//link[7][contains(@href, "custom_template.css")]'); + $this->assertXPath('//link[8][contains(@href, "live_editor.css")]'); + } } @@ -187,7 +210,7 @@ class MuscleTemplateOpacAdvancedSearchTest extends MuscleTemplateTestCase { /** @test */ public function advancedSearchSettingsShouldContainsCustomForm() { - $this->dispatch('/admin/widget/edit-action/id/recherche_avancee/id_profil/24'); + $this->dispatch('/admin/widget/edit-action/id/recherche_avancee/id_profil/1'); $this->assertXPath('//input[@id="forms"]'); } } @@ -310,4 +333,194 @@ class MuscleTemplateIndexFormulaireContactTest extends MuscleTemplateTestCase { $this->dispatch('/index/formulairecontact'); $this->assertXPath('//form[contains(@action, "formulairecontact")]'); } +} + + + + +class MuscleTemplateUpdateSettingsTest extends MuscleTemplateTestCase { + public function setUp() { + parent::setUp(); + $muscle_settings = Class_Template_Settings::findFirstBy(['template' => 'MUSCLE']); + + $muscle_settings_instance = $muscle_settings->getSettingsInstance(); + $muscle_settings_instance->setMuscleIconsMapLibrary(['new_icon_key' => 'class far fa-new-ico']); + + $muscle_settings->setSettings(serialize($muscle_settings_instance->toArray()))->save(); + $updader = (new Class_Template_Update); + $updader->setEcho(true); + $updader->run(); + $muscle_settings->clearCache(); + } + + + /** @test */ + public function bgDarkShouldBePresentInCustomCssClassAfterUpdate() { + $settings = (new Muscle_Template)->getSettingsInstance(); + $icons_map_library = $settings->getMuscleIconsMapLibrary(); + $this->assertContains('class far fa-new-ico', $icons_map_library); + $this->assertContains('class fas fa-user', $icons_map_library); + } +} + + + + +class MuscleTemplateAdminNewPageTest extends MuscleTemplateTestCase { + + public function setUp() { + parent::setUp(); + $this->dispatch('/admin/profil/newpage/id_profil/1'); + } + + /** @test */ + public function shouldRedirectToProfile26() { + $this->assertRedirectTo('/admin/profil/accueil/id_profil/26'); + } + + + /** @test */ + public function profile26FooterShouldContainsScroll() { + $this->assertTrue(Class_Profil::find(26)->hasBoiteInDivision(Class_Profil::DIV_FOOTER, 'SCROLL')); + } +} + + + +class MuscleTemplateNewPageEditDispatchTest extends MuscleTemplateTestCase { + + + public function setUp() { + parent::setUp(); + $newpage = Class_Profil::getLoader() + ->newInstance() + ->setParentProfil(Class_Profil::getPortail()) + ->setLibelle('** nouvelle page **'); + $newpage->save(); + $this->dispatch('/admin/profil/accueil/id_profil/' . $newpage->getId()); + } + + + /** @test */ + public function linkToEditScrollShouldContainsProfile1() { + $this->assertXPath('//div//a[contains(@href, "admin/widget/edit-widget/id/13/id_profil/1")]'); + } + + + /** @test */ + public function linkToEditFooterShouldContainsProfile1() { + $this->assertXPath('//div//a[contains(@href, "admin/widget/edit-section/id/6/id_profil/1")]'); + } + + + /** @test */ + public function linkToEditMainDivisionShouldContainsProfile26() { + $this->assertXPath('//div//a[contains(@href, "admin/widget/edit-section/id/2/id_profil/26")]'); + } +} + + + +class MuscleTemplateSearchResultWithDomainBrowserTest extends MuscleTemplateTestCase { + public function setUp() { + parent::setUp(); + + $this->fixture('Class_CodifAuteur', + ['id' => 43, + 'libelle' => 'Pomme d\'API']); + + $records = [$this->fixture('Class_Notice', + ['id' => 89, + 'titre_principal' => 'Tintin e i picaros']), + $this->fixture('Class_Notice', + ['id' => 99, + 'titre_principal' => 'Tintin au Tibet'])]; + + $result = $this->mock(); + + $result + ->whenCalled('setDuration') + ->answers($result) + + ->whenCalled('setSettings') + ->answers($result) + + ->whenCalled('getSettings') + ->answers(['facettes' => '']) + + ->whenCalled('fetchFacetsAndTags') + ->answers(['facettes' => '', + 'suggests' => [['id' => 'M87', + 'label' => 'Pomme (sujet)'], + + ['id' => 'A43', + 'label' => 'Pomme d\'API (auteur)']]]) + + ->whenCalled('getRecordsCount') + ->answers(2) + + ->whenCalled('isError') + ->answers(false) + + ->whenCalled('getCriteresRecherche') + ->answers((new Intonation_Library_Search_Criteria)->setParams(['expressionRecherche' => '', + 'id_module' => 78, + 'id_catalogue' => 3, + 'id_profil' => 1, + 'liste_format' => 4])) + + ->whenCalled('fetchRecords') + ->answers($records) + + ->whenCalled('fetchAllRecordsIds') + ->answers([89, 99]); + + $engine = $this->mock() + + ->whenCalled('lancerRecherche') + ->answers($result); + + Class_MoteurRecherche::setInstance($engine); + + $this->fixture('Class_Catalogue', + ['id' => 1, + 'libelle' => 'Nouveauté']); + + $this->fixture('Class_Catalogue', + ['id' => 2, + 'libelle' => 'BD', + 'parent_id' => 1]); + + $this->fixture('Class_Catalogue', + ['id' => 3, + 'libelle' => 'Romans', + 'parent_id' => 1]); + + $preferences = array_merge(Class_Systeme_ModulesAccueil::getInstance() + ->getModuleByCode('DOMAIN_BROWSER') + ->getDefaultValues(), + ['root_domain_id' => 1]); + + + $profile = Class_Profil::getPortail()->updateModuleConfigAccueil(78, + ['type_module' => 'DOMAIN_BROWSER', + 'division' => 2, + 'preferences' => $preferences]); + + $profile->save(); + + $this->dispatch('/recherche/simple/id_module/78/id_catalogue/3'); + } + + + /** @test */ + public function domainBrowserShouldContainsNovelty() { + $this->assertXPathContentContains('//div[contains(@class, "tree_view_parent")]', 'Nouveauté'); + } + + + /** @test */ + public function domainBrowserShouldContainsRomans() { + $this->assertXPathContentContains('//div[contains(@class, "tree_view_current")]', 'Romans'); + } } \ No newline at end of file diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index c2e61e0874c24cac094887d70cda77aeb8788d5b..28187e49fb5d335aa96fab8c0db5f08e78d32d41 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -199,18 +199,19 @@ class TemplatesControllerUpdateIntonationTest extends TemplatesEnabledTestCase { 'IntonationCustomCssClass' => ['bg-dark', 'align-items-center']])->save(); - $this->dispatch('/admin/template/update/template/INTONATION', true); } /** @test */ public function shouldRedirectToReferer() { + $this->dispatch('/admin/template/update/template/INTONATION', true); $this->assertRedirect(); } /** @test */ public function bgDarkShouldBePresentInCustomCssClass() { + $this->dispatch('/admin/template/update/template/INTONATION', true); $settings = Class_Template::current()->getSettings(); $custom_css_class = $settings->getIntonationCustomCssClass(); $this->assertContains('bg-dark', @@ -220,6 +221,7 @@ class TemplatesControllerUpdateIntonationTest extends TemplatesEnabledTestCase { /** @test */ public function alignItemsCenterBePresentInCustomCssClass() { + $this->dispatch('/admin/template/update/template/INTONATION', true); $settings = Class_Template::current()->getSettings(); $settings->updateSettings(); $custom_css_class = $settings->getIntonationCustomCssClass(); @@ -230,6 +232,7 @@ class TemplatesControllerUpdateIntonationTest extends TemplatesEnabledTestCase { /** @test */ public function alignItemsCenterShouldBePresentInCustomCssClassOnce() { + $this->dispatch('/admin/template/update/template/INTONATION', true); $settings = Class_Template::current()->getSettings(); $settings->updateSettings(); $custom_css_class = $settings->getIntonationCustomCssClass(); @@ -1072,6 +1075,12 @@ class TemplatesEditTest extends TemplatesEnabledTestCase { public function hydratingMappingShouldContainsSiteWebWrapper() { $this->assertXPathContentContains('//script[contains(text(), "IntonationHydratingMapping")]', 'site_web_wrapper'); } + + + /** @test */ + public function linkToCssClassesDocumentationShouldBePresent() { + $this->assertXPathContentContains('//script', 'http://wiki.bokeh-library-portal.org/index.php?title=Classes_CSS'); + } } @@ -1396,7 +1405,7 @@ class TemplatesSearchWidgetSettingsFormTest extends TemplatesIntonationTestCase public function setUp() { parent::setUp(); - $this->dispatch('/admin/widget/edit-widget/id/8/id_profil/72', true); + $this->dispatch('/admin/widget/edit-widget/id/8/id_profil/72'); } @@ -1955,21 +1964,47 @@ class TemplatesCmsListActionTest extends TemplatesIntonationTestCase { class TemplatesCmsArticleViewTest extends TemplatesIntonationTestCase { - - /** @test */ - public function dispatchShouldRenderParlerVousFrançais() { + public function setUp() { + parent::setUp(); $this->fixture('Class_Article', ['id' => 7, 'titre' => 'Parlez-vous français ?', - 'contenu' => '<p>Une b...</p>']); + 'contenu' => '<p>Une b...</p>', + 'events_debut' => '2020-03-13 00:00:00', + 'events_fin' => '2020-07-31 00:00:00', + 'all_day' => 1]); + + $this->dispatch('/opac/cms/articleview/id/7/id_profil/72'); + } + - $this->dispatch('/opac/cms/articleview/id/7/id_profil/72', true); + /** @test */ + public function parlerVousFrançaisShouldBePresent() { $this->assertXPathContentContains('//main//div', 'Parlez-vous français ?'); } + + + /** @test */ + public function timeOfEventShouldNotBePresent() { + $this->assertNotXPathContentContains('//span', '00:00'); + } + + + /** @test */ + public function eventStartShouldNotBePresent() { + $this->assertXPathContentContains('//span', '13/03/2020'); + } + + + /** @test */ + public function eventEndShouldNotBePresent() { + $this->assertXPathContentContains('//span', '31/07/2020'); + } } + class TemplatesViewRecordTest extends TemplatesIntonationTestCase { public function setUp() { parent::setUp(); @@ -2468,7 +2503,7 @@ class TemplatesDispatchNoticeAjaxTrailerTest extends TemplatesIntonationTestCase 'player' => '<iframe src="https://www.super-trailers.org/?media=18397590" style="width:500px; height:400px" frameborder="0"></iframe>'])); Class_WebService_AllServices::setHttpClient($mock); - } + } /** @test */ @@ -2485,7 +2520,7 @@ class TemplatesDispatchNoticeAjaxTrailerTest extends TemplatesIntonationTestCase } - /** @test */ + /** @test */ public function shouldRenderEditTrailer() { $this->dispatch('/noticeajax/media/id/34/id_profil/72'); $this->assertXPath('//button[contains(@onclick, "/admin/records/trailer/id/34")]'); @@ -4575,7 +4610,22 @@ class TemplatesSearchInSessionTest extends TemplatesIntonationTestCase { } - /** @test */ + + /** @test */ + public function searchWidgetShouldNotContainsTrollDeTroy() { + $widget = (new Class_Systeme_Widget_Widget) + ->setId(8) + ->setProfileId(72) + ->load(); + $widget->setNewDatas(['facets_in_session' => 0]); + $widget->updateProfile(); + + $this->dispatch('/opac/index/index/id_profil/72'); + $this->assertNotXPath('//input[contains(@value, "trolls de troy")]'); + } + + + /** @test */ public function searchSessionShouldBeEmpty() { $this->dispatch('/opac/recherche/clear-last-search-session'); $this->assertEquals(null, Zend_Registry::get('session')->last_search); @@ -4852,6 +4902,28 @@ class TemplatesDispatchIntonationAuthLoginTest extends TemplatesIntonationTestCa +class TemplatesDispatchIntonationAuthLoginWithRedirectTest extends TemplatesIntonationTestCase { + + public function setUp() { + parent::setUp(); + ZendAfi_Auth::getInstance()->clearIdentity(); + $this->dispatch('/opac/auth/login/id_profil/72?redirect='.urlencode('http://mybib/modules/skilleos')); + } + + + /** @test */ + public function formActionShouldContainsRedirectUrlMyBib() { + $this->assertXPath('//form[contains(@action, "/auth/login/redirect/'.urlencode("http://mybib/modules/skilleos").'")]', $this->_response->getBody()); + } + + + /** @test */ + public function inputTypeHiddenShouldContainsRedirectUrlMyBib() { + $this->assertXPath('//input[@type="hidden"][@name="redirect"][@value="http://mybib/modules/skilleos"]', $this->_response->getBody()); + } +} + + class TemplatesDispatchNewsletterWidgetTest extends TemplatesIntonationTestCase { /** @test */ @@ -5091,7 +5163,7 @@ class TemplatesDispatchRssWidgetTest extends TemplatesIntonationTestCase { /** @test */ public function rssNoticeajaxResourcesShouldRenderRenderItems() { $this->dispatch('/opac/noticeajax/resources/id/' . $this->_record_id); - $this->assertXPath('//div'); + $this->assertContains('onload_utils', $this->_response->getBody()); } @@ -5112,6 +5184,6 @@ class TemplatesDispatchRssWidgetTest extends TemplatesIntonationTestCase { /** @test */ public function loadRssItemShouldRenderHtml() { $this->dispatch('/opac/rss/render-items/id/3/id_profil/72'); - $this->assertXpath('//div'); + $this->assertContains('onload_utils', $this->_response->getBody()); } } \ No newline at end of file