diff --git a/VERSIONS b/VERSIONS index e90eecfc0bee482730c0a26a4544c7163a57cd23..dc198d39c1a21924388947bb382b5e6db05a7cc5 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,23 @@ +30/04/2019 - v8.0.12 + + - ticket #88956 : Affichage notices Arte VOD : correction d'affichage du réalisateur. + + - ticket #86891 : Correction d'une faille de sécurité dans le moteur de recherche. + + - ticket #87127 : Administration : suppression du message de la journée communautaire Bokeh 2019. + + - ticket #90151 : Administration : correction de l'ouverture de l'éditeur CSS lorsqu'aucun fichier CSS n'est associé à la page. + + - ticket #91113 : Administration : lettre d'information : correction de l'affichage des images d'articles. + + - ticket #90677 : Administration : lettre d'information : correction de la sélection des domaines et paniers dans les notices. + + - ticket #88480 : Administration : correction de l'affichage de la liste des agendas externes. + + - ticket #82151 : Cosmogramme : correction de l'affichage des fichiers sans extension. + + + 16/04/2019 - v8.0.11 - ticket #88091 : Administration : Ajout d'informations dans le rapport d'état système diff --git a/VERSIONS_HOTLINE/82151 b/VERSIONS_HOTLINE/82151 deleted file mode 100644 index da498864a3e01d889b0b00652c32a8d672256408..0000000000000000000000000000000000000000 --- a/VERSIONS_HOTLINE/82151 +++ /dev/null @@ -1,3 +0,0 @@ - - ticket #82151 : Cosmogramme : correction de l'affichage des fichiers sans extension. - - \ No newline at end of file diff --git a/VERSIONS_HOTLINE/86891 b/VERSIONS_HOTLINE/86891 deleted file mode 100644 index 0cdb44697894cc42d65259f78d0280c0a2ef1ae1..0000000000000000000000000000000000000000 --- a/VERSIONS_HOTLINE/86891 +++ /dev/null @@ -1 +0,0 @@ - - ticket #86891 : Correction de faille de sécurité sur le moteur de recherche \ No newline at end of file diff --git a/VERSIONS_HOTLINE/88480 b/VERSIONS_HOTLINE/88480 deleted file mode 100644 index 8c5340480172e10294f7aeccabfe8a5173064427..0000000000000000000000000000000000000000 --- a/VERSIONS_HOTLINE/88480 +++ /dev/null @@ -1,2 +0,0 @@ - - ticket #88480 : Administration : correction de l'affichage de la liste des agendas externes. - \ No newline at end of file diff --git a/VERSIONS_HOTLINE/88956 b/VERSIONS_HOTLINE/88956 deleted file mode 100644 index 906919f1827b6148a53809e18c179c148dd09c3e..0000000000000000000000000000000000000000 --- a/VERSIONS_HOTLINE/88956 +++ /dev/null @@ -1 +0,0 @@ - - ticket #88956 : Affichage notices Arte VOD : correction d'affichage du réalisateur \ No newline at end of file diff --git a/VERSIONS_HOTLINE/90151 b/VERSIONS_HOTLINE/90151 deleted file mode 100644 index 1ff8aad7f5a49a1bd2fe1d6455a6059876c40203..0000000000000000000000000000000000000000 --- a/VERSIONS_HOTLINE/90151 +++ /dev/null @@ -1 +0,0 @@ - - ticket #90151 : Correction de l'ouverture de l'éditeur CSS lorsqu'aucun fichier CSS n'est associé à la page \ No newline at end of file diff --git a/VERSIONS_HOTLINE/90677 b/VERSIONS_HOTLINE/90677 deleted file mode 100644 index c7c030d76e8b35e96d69d3b37b86c64be80510c3..0000000000000000000000000000000000000000 --- a/VERSIONS_HOTLINE/90677 +++ /dev/null @@ -1 +0,0 @@ - - ticket #90677 : Lettres d'informations : correction de la sélection des domaines et paniers dans les notices \ No newline at end of file diff --git a/VERSIONS_HOTLINE/91113 b/VERSIONS_HOTLINE/91113 deleted file mode 100644 index 7f69408627ac5418d077aba84207c5277fce3295..0000000000000000000000000000000000000000 --- a/VERSIONS_HOTLINE/91113 +++ /dev/null @@ -1,2 +0,0 @@ - - ticket #91113 : Lettre d'information : correction de l'affichage des images d'articles. - \ No newline at end of file diff --git a/VERSIONS_WIP/87127 b/VERSIONS_WIP/87127 deleted file mode 100644 index 308080f06115152e4abdbcdb3692a443be050e0b..0000000000000000000000000000000000000000 --- a/VERSIONS_WIP/87127 +++ /dev/null @@ -1,2 +0,0 @@ - - ticket #87127 : Administration : suppression du message de la journée communautaire Bokeh 2019. - \ No newline at end of file diff --git a/application/modules/opac/controllers/AbonneController.php b/application/modules/opac/controllers/AbonneController.php index 67d010dc131ae014fde79c00fe422e6c2059c4a1..8cc54cb25e4452e73b1a685dc1b5af3736c14d4c 100644 --- a/application/modules/opac/controllers/AbonneController.php +++ b/application/modules/opac/controllers/AbonneController.php @@ -466,7 +466,7 @@ class AbonneController extends ZendAfi_Controller_Action { protected function _userForm($user) { $fields_to_show = Class_AdminVar::getChampsFicheUtilisateur(); - $form = new Zend_Form; + $form = new ZendAfi_Form; $form ->setAction($this->view->url(['action' => 'edit', 'id' => $user->getId()])) @@ -1446,4 +1446,48 @@ class AbonneController extends ZendAfi_Controller_Action { public function donnerDesAvisAction() { } + + + public function suivreUneRechercheAction() { + } + + + public function modifierAction() { + $form = $this->_userForm($this->_user); + $form->setAction($this->view->url()); + $this->view->form = $form; + + if (!$this->_request->isPost()) + return ; + + if (!$form->isValid($this->_request->getPost())) + return; + + $fields_to_save = Class_AdminVar::getChampsFicheUtilisateur(); + $attributes = []; + + foreach($fields_to_save as $field) + $attributes[$field] = $this->_request->getParam($field); + + $this->_user + ->updateAttributes($attributes); + + $patron = $this->_user->getEmprunteur(); + $patron->updateFromUser($this->_user); + + try { + if ($this->_user->save()) { + $patron->ensureService($this->_user)->save(); + $this->_helper->notify($this->_('Vos modifications ont bien été enregistrées')); + $this->_redirectClose('/abonne/informations'); + } + + $form->addDecorator('Errors'); + foreach($this->_user->getErrors() as $error) + $form->addError($error); + } catch(Exception $e) { + $form->addError($e->getMessage()); + $form->addDecorator('Errors'); + } + } } \ No newline at end of file diff --git a/application/modules/opac/views/scripts/abonne/modifier.phtml b/application/modules/opac/views/scripts/abonne/modifier.phtml new file mode 100644 index 0000000000000000000000000000000000000000..4bfc244568d834f029980ad63f3d963675f95203 --- /dev/null +++ b/application/modules/opac/views/scripts/abonne/modifier.phtml @@ -0,0 +1,3 @@ +<?php +echo $this->abonne_Edit($this->user, $this->form); +?> diff --git a/application/modules/opac/views/scripts/abonne/suivre-une-recherche.phtml b/application/modules/opac/views/scripts/abonne/suivre-une-recherche.phtml new file mode 100644 index 0000000000000000000000000000000000000000..c74daff822299b02ab391573bbfc4730338b18bf --- /dev/null +++ b/application/modules/opac/views/scripts/abonne/suivre-une-recherche.phtml @@ -0,0 +1,2 @@ +<?php +echo $this->abonne_FollowASearch($this->user); diff --git a/library/Class/MoteurRecherche/Facettes.php b/library/Class/MoteurRecherche/Facettes.php index 4d3369999b7bdbb1042ac74a749f5862f287c7df..12e96598ff37c7e73008d42b0e610ae0f1007eaa 100644 --- a/library/Class/MoteurRecherche/Facettes.php +++ b/library/Class/MoteurRecherche/Facettes.php @@ -30,7 +30,15 @@ class Class_MoteurRecherche_Facettes { public function buildFacetsData($preferences, $facets, $criterias) { - $this->_preferences = $preferences; + $this->_preferences = array_merge(['suggests_enabled' => '', + 'bookmarks_enabled' => '', + 'facettes_actif' => '', + 'facettes_codes' => '', + 'facettes_nombre' => '', + 'tags_actif' => '', + 'tags_codes' => '', + 'tags_nombres' => ''], + $preferences); $this->_criterias = $criterias; $this->_codes_count = $this->fetchFacetsRows($facets); @@ -58,7 +66,7 @@ class Class_MoteurRecherche_Facettes { protected function _getTags() { return !$this->_preferences['tags_actif'] ? [] : $this->extractTags($this->_sanitizeCodes($this->_preferences['tags_codes']), - $this->_preferences['tags_nombre'], + $this->_preferences['tags_nombre'], $this->_codes_count); } diff --git a/library/Class/Newsletter.php b/library/Class/Newsletter.php index 632ffeef493db4d5561b683d43f043a9bfaf37d2..1341d6fc7bc2b1ab10f612426c204d4466ed0262 100644 --- a/library/Class/Newsletter.php +++ b/library/Class/Newsletter.php @@ -90,6 +90,8 @@ class Class_Newsletter extends Storm_Model_Abstract { protected $_recipent_size = 20; protected $_default_attribute_values = ['titre' => '', 'draft' => 0, + 'id_catalogue' => '', + 'id_panier' => '', 'articles_ids' => '', 'articles_categories_ids' => '']; @@ -209,14 +211,14 @@ class Class_Newsletter extends Storm_Model_Abstract { public function getNotices() { if (!$this->getIdPanier() and !$this->getIdCatalogue()) - return array(); + return []; - $preferences = array( 'id_catalogue' => $this->getIdCatalogue(), - 'id_panier' => $this->getIdPanier(), - 'nb_notices' => $this->getNbNotices(), - 'only_img' => false, - 'aleatoire' => 0, - 'tri' => 1); + $preferences = ['id_catalogue' => $this->getIdCatalogue(), + 'id_panier' => $this->getIdPanier(), + 'nb_notices' => $this->getNbNotices(), + 'only_img' => false, + 'aleatoire' => 0, + 'tri' => 1]; return Class_Notice::getNoticesFromPreferences($preferences); } @@ -428,6 +430,17 @@ class Class_Newsletter extends Storm_Model_Abstract { return $this; } + + + public function getFirstImageUrl() { + $template = $this->newTemplate(); + $text = $template->getBodyHTML(); + + $matches = []; + return (preg_match('/< *img[^>]*src *= *["\']?([^"\'>]*)/i', $text, $matches) > 0) + ? $matches[1] + : ''; + } } diff --git a/library/Class/Notice.php b/library/Class/Notice.php index a19f11a27cbae72552be7614f571b4094646ca32..935d368fb725928297ccd84b45ae75e19e42eb6a 100644 --- a/library/Class/Notice.php +++ b/library/Class/Notice.php @@ -24,6 +24,10 @@ class NoticeLoader extends Storm_Model_Loader { public function getNoticesFromPreferences($preferences) { $requetes = Class_Catalogue::getRequetes($preferences); + + if (!isset($requetes['req_liste'])) + return []; + $notices = $this->findAll($requetes["req_liste"]); // Tirage aleatoire diff --git a/library/startup.php b/library/startup.php index ef7768e9635c90dec0ec0488d60fe51be6b83925..f088339572c720174d18be6a9f138663f36057bd 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 . '.11'); + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.12'); defineConstant('BOKEH_REMOTE_FILES', 'http://git.afi-sa.fr/afi/opacce/'); diff --git a/library/templates/Intonation/Assets/css/intonation.css b/library/templates/Intonation/Assets/css/intonation.css index df99de7e829bd644abb358c09f94a3aeddeca357..8b9225300e482e6c2b7eb193c895a47b8b5c6829 100644 --- a/library/templates/Intonation/Assets/css/intonation.css +++ b/library/templates/Intonation/Assets/css/intonation.css @@ -442,6 +442,6 @@ header.col { max-height: 300px; } -.recherche_avancee .bouton.back { +.opac .bouton.back { display: none; } \ No newline at end of file diff --git a/library/templates/Intonation/Library/View/Wrapper/Newsletter.php b/library/templates/Intonation/Library/View/Wrapper/Newsletter.php new file mode 100644 index 0000000000000000000000000000000000000000..d6ef4eddf84e18f272077f496d9dfce176e9fe6d --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/Newsletter.php @@ -0,0 +1,78 @@ +<?php +/** + * Copyright (c) 2012-2019, 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_View_Wrapper_Newsletter extends Intonation_Library_View_Wrapper_Abstract { + public function getMainTitle() { + return $this->_model->getTitre(); + } + + + public function getMainLink() { + } + + + public function getPicture() { + return $this->_model->getFirstImageUrl(); + } + + + public function getPictureAction() { + } + + + public function getSecondaryTitle() { + } + + + public function getSecondaryLink() { + } + + + public function getSecondaryIco() { + } + + + public function getActions() { + } + + + public function getDescription() { + $template = $this->_model->newTemplate(); + return $this->_view->truncate($template->getBodyHTML()); + } + + + public function getDescriptionTitle() { + } + + + public function getBadges() { + } + + + public function getDocType() { + } + + + public function getDocTypeLabel() { + } +} diff --git a/library/templates/Intonation/Library/View/Wrapper/RichContent/Section.php b/library/templates/Intonation/Library/View/Wrapper/RichContent/Section.php index 74fd27645d1ee406c21f7c4607f8999bf3a84951..5edd5c748f2e9d9a599c91140bac44d618590adf 100644 --- a/library/templates/Intonation/Library/View/Wrapper/RichContent/Section.php +++ b/library/templates/Intonation/Library/View/Wrapper/RichContent/Section.php @@ -51,7 +51,8 @@ abstract class Intonation_Library_View_Wrapper_RichContent_Section { public function beVisible() { - return $this->_visible = true; + $this->_visible = true; + return $this; } @@ -65,6 +66,12 @@ abstract class Intonation_Library_View_Wrapper_RichContent_Section { } + public function setContent($content) { + $this->_content = $content; + return $this; + } + + abstract public function getTitle(); abstract public function getContent(); abstract public function getClass(); diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent.php index 080d53a0310a26c8c88795f93775ba5dfcee155e..a464cb7839910f0a1e4d91b6862ae68be277d94a 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent.php @@ -56,6 +56,12 @@ class Intonation_Library_View_Wrapper_User_RichContent { } + public function setSections($sections) { + $this->_sections = $sections; + return $this; + } + + public function getSections() { if ($this->_sections) return $this->_sections; diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/ChangeImage.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/ChangeImage.php new file mode 100644 index 0000000000000000000000000000000000000000..f6ff76dbe5bb94a4f7d283b0f7a974d2d0eed2f7 --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/ChangeImage.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright (c) 2012-2019, 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_View_Wrapper_User_RichContent_ChangeImage extends Intonation_Library_View_Wrapper_User_RichContent_Settings { + + public function getTitle() { + return $this->_('Modifier mon image de profil'); + } + + + public function getContent() { + return $this->_content; + } + + + public function getClass() { + return 'image_user_informations'; + } + + + public function getNavUrl() { + return ['controller' => 'abonne', + 'action' => 'change-image']; + } + + + public function getNavTitle() { + return $this->_('Modifier l\'image de mon profil'); + } +} diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/EditInformations.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/EditInformations.php new file mode 100644 index 0000000000000000000000000000000000000000..a1daaea1de06bf0378b997ed6b5ec9b06122d4fb --- /dev/null +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/EditInformations.php @@ -0,0 +1,49 @@ +<?php +/** + * Copyright (c) 2012-2019, 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_View_Wrapper_User_RichContent_EditInformations extends Intonation_Library_View_Wrapper_User_RichContent_Settings { + + public function getTitle() { + return $this->_('Modifier mes informations'); + } + + + public function getContent() { + return $this->_content; + } + + + public function getClass() { + return 'form_user_informations'; + } + + + public function getNavUrl() { + return ['controller' => 'abonne', + 'action' => 'modifier']; + } + + + public function getNavTitle() { + return $this->_('Modifier les informations de mon compte'); + } +} diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Holds.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Holds.php index 656c0d77d950eaa75c135df0e2d4e65ae0e47fe6..8bea1d3e7bde2e228db18e7c3e11c52093c81bf8 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Holds.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Holds.php @@ -29,7 +29,12 @@ class Intonation_Library_View_Wrapper_User_RichContent_Holds extends Intonation_ public function getContent() { $cards = new Class_User_Cards($this->_model); - return $this->_view->abonne_Holds($cards->getHolds()); + $holds = $cards->getHolds(); + + if ($holds->isEmpty()) + return ''; + + return $this->_view->abonne_Holds($holds); } diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Informations.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Informations.php index f00903029a23aa0b9a8f0c4c8aae9143523f01bd..650d0d1919861a6377fd2a110f73768d3838d289 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Informations.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Informations.php @@ -28,7 +28,10 @@ class Intonation_Library_View_Wrapper_User_RichContent_Informations extends Into public function getContent() { - return $this->_view->User_Informations($this->_model); + if ($this->_content) + return $this->_content; + + return $this->_content = $this->_view->User_Informations($this->_model); } diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Loans.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Loans.php index 3ed2111d8dc7088591a402dbba518117fd8c62bc..7a03ae75e3127e48478d006a227e52afb1f0065f 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Loans.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Loans.php @@ -33,6 +33,10 @@ class Intonation_Library_View_Wrapper_User_RichContent_Loans extends Intonation_ $cards = new Class_User_Cards($this->_model); $loans = $cards->getLoansWithOutPNB([]); + + if ($loans->isEmpty()) + return ''; + $fiche = $this->_model->getFicheSigb(); $error = (isset($fiche['error']) && $fiche['error']) ? $fiche['error'] diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Reviews.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Reviews.php index e9938730ba856b9af8018f575f5b9028512e7741..4129a4888882c1e834b3d3c4fdf40ba1cafcc90e 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Reviews.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Reviews.php @@ -32,7 +32,7 @@ class Intonation_Library_View_Wrapper_User_RichContent_Reviews extends Intonatio return $this->_('Vous n\'avez pas encore donné d\'avis. %s !', $this->_view->tagAnchor(['controller' => 'abonne', 'action' => 'donner-des-avis'], - $this->_('Commencer dès maintenant'))); + $this->_('Commencer maintenant'))); $reviews = array_map(function($review) { return (new Intonation_Library_View_Wrapper_Review) @@ -44,7 +44,7 @@ class Intonation_Library_View_Wrapper_User_RichContent_Reviews extends Intonatio return $this->_view->cardifyHorizontal($wrapped); }; - return $this->_view->renderList(new Storm_Collection($reviews), $callback); + return $this->_view->renderTruncateList(new Storm_Collection($reviews), $callback); } diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Selections.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Selections.php index cdeb57cdd35780a00560458dad25a83a371401db..78fab35e775ea2a693ae3a87e5a30a7208e996d6 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Selections.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Selections.php @@ -31,7 +31,8 @@ class Intonation_Library_View_Wrapper_User_RichContent_Selections extends Intona return $this->_view->paniers($this->_model->getPaniers()) . $this->_view->bookmarkedSearches(Class_User_BookmarkedSearch::findAllBy(['id_user' => $this->_model->getId(), - 'order' => 'creation_date desc'])); + 'order' => 'creation_date desc'])) + . $this->_view->user_Newsletters($this->_model); } diff --git a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php index 2ccbe551c4d34fac68ae25c68c6ea4501c7004e7..66b0f2278f049e35709d544ba3404833742815a8 100644 --- a/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php +++ b/library/templates/Intonation/Library/View/Wrapper/User/RichContent/Settings.php @@ -28,7 +28,12 @@ class Intonation_Library_View_Wrapper_User_RichContent_Settings extends Intonati public function getContent() { - return $this->_view->renderForm(ZendAfi_Form_User_Settings::forUser($this->_model)); + $form = ZendAfi_Form_User_Settings::forUser($this->_model); + + if (!$form->getElements()) + return ''; + + return $this->_view->renderForm($form); } diff --git a/library/templates/Intonation/View/Abonne.php b/library/templates/Intonation/View/Abonne.php index 962b77077f92882a922acc14495fe5a2e33407c7..15ad274f627847c300c621f7483890babb0f0f4c 100644 --- a/library/templates/Intonation/View/Abonne.php +++ b/library/templates/Intonation/View/Abonne.php @@ -32,6 +32,7 @@ class Intonation_View_Abonne extends ZendAfi_View_Helper_BaseHelper { ->setView($this->view) ->setModel($user); + $this->_hookOn($rich_content); $this->_showSections($rich_content->getSections()); $wrapped->setRichContent($rich_content); @@ -40,6 +41,10 @@ class Intonation_View_Abonne extends ZendAfi_View_Helper_BaseHelper { } + protected function _hookOn($rich_content) { + } + + protected function _showSections($sections) { foreach($sections as $section) $section->beVisible(); diff --git a/library/templates/Intonation/View/Abonne/ChangeImage.php b/library/templates/Intonation/View/Abonne/ChangeImage.php index 79f9e57ff7433b6267a48e7afea4c7afe13e329f..631aae5d20eb96b82aa3e19709cbb02beb987e9f 100644 --- a/library/templates/Intonation/View/Abonne/ChangeImage.php +++ b/library/templates/Intonation/View/Abonne/ChangeImage.php @@ -20,10 +20,33 @@ */ -class Intonation_View_Abonne_ChangeImage extends ZendAfi_View_Helper_BaseHelper { +class Intonation_View_Abonne_ChangeImage extends Intonation_View_Abonne { public function abonne_ChangeImage($user) { - $this->view->titre = $this->_('Changer l\'image de mon profil'); + $html = $this->abonne($user); + $this->view->titre = $this->_('%s : Modifier mon image de profil', + $this->view->titre); + return $html; + } + + + protected function _hookOn($rich_content) { + $sections = $rich_content->getSections(); + + $sections [6] = (new Intonation_Library_View_Wrapper_User_RichContent_ChangeImage) + ->setModel($this->view->user) + ->setView($this->view) + ->setContent($this->_getContent($this->view->user)) + ->beVisible(); + + $rich_content->setSections($sections); + } + + + protected function _showSections($sections) { + } + + protected function _getContent($user) { if (!$paths = explode(';', Class_AdminVar::getValueOrDefault('USER_PROFILE_IMAGES'))) return ''; diff --git a/library/templates/Intonation/View/Abonne/Edit.php b/library/templates/Intonation/View/Abonne/Edit.php new file mode 100644 index 0000000000000000000000000000000000000000..e47ec97f451000208e6914003f670291cf6b0653 --- /dev/null +++ b/library/templates/Intonation/View/Abonne/Edit.php @@ -0,0 +1,51 @@ +<?php +/** + * Copyright (c) 2012-2019, 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_Abonne_Edit extends Intonation_View_Abonne { + public function abonne_Edit($user) { + $this->view->form->removeElement('subscriptions'); + $this->view->form->removeElement('password'); + $this->view->form->removeElement('confirm_password'); + + $html = $this->abonne($user); + $this->view->titre = $this->_('%s : Modifier mes informations', + $this->view->titre); + return $html; + } + + + protected function _hookOn($rich_content) { + $sections = $rich_content->getSections(); + + $sections [6] = (new Intonation_Library_View_Wrapper_User_RichContent_EditInformations) + ->setModel($this->view->user) + ->setView($this->view) + ->setContent($this->view->renderForm($this->view->form)) + ->beVisible(); + + $rich_content->setSections($sections); + } + + + protected function _showSections($sections) { + } +} diff --git a/library/templates/Intonation/View/Abonne/FollowASearch.php b/library/templates/Intonation/View/Abonne/FollowASearch.php new file mode 100644 index 0000000000000000000000000000000000000000..f3a0bad2890c21b62029f3336ac8731e330d9506 --- /dev/null +++ b/library/templates/Intonation/View/Abonne/FollowASearch.php @@ -0,0 +1,42 @@ +<?php +/** + * Copyright (c) 2012-2019, 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_Abonne_FollowASearch extends ZendAfi_View_Helper_BaseHelper { + public function abonne_FollowASearch($user) { + $this->view->titre = $this->_('Suivre une recherche'); + + $params = ['expressionRecherche' => 'Jean De Brunhoff', + 'multifacets' => 'T1', + 'tri' => 'annee desc']; + + $engine = Class_MoteurRecherche::getInstance(); + + $criteria = (new Class_CriteresRecherche()) + ->setParams($params); + + $search = $engine->lancerRecherche($criteria); + + return + $this->_tag('h1', $this->view->titre) + . $this->view->Search_Result($search); + } +} diff --git a/library/templates/Intonation/View/Abonne/Loans.php b/library/templates/Intonation/View/Abonne/Loans.php deleted file mode 100644 index 28d92be6582a1e1ddb011bdd850bc36d8735a0df..0000000000000000000000000000000000000000 --- a/library/templates/Intonation/View/Abonne/Loans.php +++ /dev/null @@ -1,113 +0,0 @@ -<?php -/** - * Copyright (c) 2012-2019, 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_Abonne_LoansList extends ZendAfi_View_Helper_BaseHelper { - protected - $_config, - $_extend_all, - $_preferences, - $_profile; - - - public function abonne_LoansList($config) { - $this->_config = $config; - $loans = $config->getLoans(); - $renewable_loans = $config->getRenewableLoansIds(); - $user = $config->getUser(); - $this->_profile = $profile = $config->getProfile(); - $error = $config->getError(); - $request_params = $config->getRequestParams(); - $this->_preferences = $preferences = new Class_Profil_Preferences_Loans(); - - if($error) - return ''; - - $extend_all = $renewable_loans - ? ($this->view->tagAnchor(['action' => 'prolongerPret', - 'id_pret' => $renewable_loans], - $this->_('Tout prolonger'), - ['class' => 'btn'])) - : ''; - - $pnb = ($user->hasPNB()) - ? ($this->_tag('h2', $this->_('Prêts numériques en cours')) - . $this->view->abonne_LoansPNB($user->getPNBLoans())) - : ''; - - $content = [$this->_renderTools(), - $this->render($loans), - $pnb]; - - return implode(array_filter($content)); - } - - - public function getRequestParams() { - return $this->_config->getRequestParams(); - } - - - public function getLoans() { - return $this->_config->getLoans(); - } - - - public function getRenewableLoans () { - return $this->_config->getRenewableLoansIds(); - } - - - public function setExtendAll($html) { - $this->_extend_all = $html; - } - - - protected function _renderTools() { - $tools = []; - $composition = $this->_preferences->getToolsCompositionOf($this->_profile); - $selected_tools = $composition->getSelected(); - - foreach($selected_tools as $tool) - $tools [] = $tool->renderWith($this); - - return $this->_tag('div', - implode(array_filter($tools)), - ['class' => 'tools-bar']); - } - } - - - public function render($loans) { - $loans = array_map(function($loan) - { - return (new Intonation_Library_View_Wrapper_Loan) - ->setModel($loan) - ->setView($this->view); - }, $loans->getArrayCopy()); - - $callback = function($wrapped) { - return $this->view->cardifyHorizontal($wrapped); - }; - - return $this->view->renderList(new Storm_Collection($loans), $callback); - } -} diff --git a/library/templates/Intonation/View/BookmarkedSearches.php b/library/templates/Intonation/View/BookmarkedSearches.php index e3d395ac691674be5847acfd5d78ec1005e5ee39..f2652afc714474845315594c96b2813becc8ffc8 100644 --- a/library/templates/Intonation/View/BookmarkedSearches.php +++ b/library/templates/Intonation/View/BookmarkedSearches.php @@ -34,8 +34,18 @@ class Intonation_View_BookmarkedSearches extends ZendAfi_View_Helper_BaseHelper return $this->view->cardifyOnlyDescription($wrapped); }; + $html = $this->_tag('h3', $this->_('Mes recherches suivies')); + + if (!$searches) + return + $html + . $this->_('Vous n\'avez pas encore suivis de recherche. %s !', + $this->view->tagAnchor(['controller' => 'abonne', + 'action' => 'suivre-une-recherche'], + $this->_('Commencer maintenant'))); + return - $this->_tag('h3', $this->_('Mes recherches suivies')) + $html . $this->view->renderList(new Storm_Collection($searches), $callback); } } \ No newline at end of file diff --git a/library/templates/Intonation/View/RenderTruncateList.php b/library/templates/Intonation/View/RenderTruncateList.php new file mode 100644 index 0000000000000000000000000000000000000000..e2cb9ff94856f8309c7393871158412c017d8015 --- /dev/null +++ b/library/templates/Intonation/View/RenderTruncateList.php @@ -0,0 +1,84 @@ +<?php +/** + * Copyright (c) 2012-2018, 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_RenderTruncateList extends ZendAfi_View_Helper_BaseHelper { + + public function renderTruncateList($collection, $callback) { + $html = $collection + ->injectInto('', function($html, $element) use ($callback) + { + return $html . $this->_tag('div', + $callback($element), + ['class' => 'd-none list-group-item bg-transparent border-0 px-0']); + }); + + $id = uniqid(); + + return + $this->_renderToolsIn($id, $collection->count()) + . $this->_tag('div', + $html, + ['id' => $id, + 'class' => 'list-group bg-transparent border-0']); + } + + + protected function _renderToolsIn($container_id, $size) { + $id = uniqid(); + + $size_html = $this->_tag('div', + $this->_tag( 'span' , + $this->_( '%d éléments' , $size), + ['class' => 'btn']), + ['class' => 'col-6 col-sm-3 selector_widget']); + + Class_ScriptLoader::getInstance() + ->addJQueryReady("var container = $('#" . $container_id . "');" + . "container.children().slice(0,3).removeClass('d-none');"); + + $onchange = + "var container = $('#" . $container_id . "');" + . "container.children().addClass('d-none');" + . "var value=$('#" . $id . "').val();" + . "container.children().slice(0, value).removeClass('d-none');"; + + $form = new ZendAfi_Form; + + $form + ->addElement('select', + $id, + ['label' => '', + 'onchange' => $onchange, + 'multiOptions' => ['3' => $this->_('3'), + '10' => $this->_('10'), + '10000' => $this->_('Tout')]]) + + ->addElement('submit', + md5($id), + ['class' => 'd-none']); + + return $this->view->grid($size_html + . $this->_tag('div', + $this->view->renderInlineForm($form), + ['class' => 'col-3 selector_widget'])); + } +} \ No newline at end of file diff --git a/library/templates/Intonation/View/Truncate.php b/library/templates/Intonation/View/Truncate.php index 029e77fc9569c5fd02ae89bfecd44b983a0f643e..d38cb06edfacde2828b660ee253a320353d426f7 100644 --- a/library/templates/Intonation/View/Truncate.php +++ b/library/templates/Intonation/View/Truncate.php @@ -25,6 +25,8 @@ class Intonation_View_Truncate extends ZendAfi_View_Helper_BaseHelper { if (! $text) return ''; + $text = preg_replace('/(<(script|style|link)\b[^>]*>).*?(<\/\2>)/is', "", $text); + $text = strip_tags(html_entity_decode($text)); $text = preg_replace('/(\t|\n|\v|\f|\r| |\xC2\x85|\xc2\xa0|\xe1\xa0\x8e|\xe2\x80[\x80-\x8D]|\xe2\x80\xa8|\xe2\x80\xa9|\xe2\x80\xaF|\xe2\x81\x9f|\xe2\x81\xa0|\xe3\x80\x80|\xef\xbb\xbf)+/', ' ', $text); diff --git a/library/templates/Intonation/View/User/Informations.php b/library/templates/Intonation/View/User/Informations.php index b6ea1d433e0f92db6570fbdfb699580fb2fea9c0..b99eeb9cbbc8fd20546d7abe5e2e9eb2d203719f 100644 --- a/library/templates/Intonation/View/User/Informations.php +++ b/library/templates/Intonation/View/User/Informations.php @@ -22,16 +22,8 @@ class Intonation_View_User_Informations extends ZendAfi_View_Helper_BaseHelper { public function User_Informations($user) { - $html = [$this->view->div(['class' => 'col-12'], - $this->_renderUserInfo($user)), - - $this->view->div(['class' => 'col-12 ml-3 mt-3'], - $this->view->button(new Class_Entity(['Url' => $this->view->url(['controller' => 'abonne', - 'action' => 'modifier']), - 'Text' => $this->_('Modifier'), - 'Image' => Class_Template::current()->getIco($this->view, 'edit', 'utils')])))]; - - return $this->view->grid(implode($html), [], ['class' => 'justify-content-center']); + return $this->view->grid($this->view->div(['class' => 'col-12'], + $this->_renderUserInfo($user))); } @@ -61,6 +53,14 @@ class Intonation_View_User_Informations extends ZendAfi_View_Helper_BaseHelper { return $this->view->div(['class' => 'card'], $this->view->div(['class' => 'card-body'], - $this->_tag('dl', implode($html)))); + $this->_tag('dl', implode($html))) + + . $this->view->div(['class' => 'position-absolute'], + $this->view->tagAnchor($this->view->url(['controller' => 'abonne', + 'action' => 'modifier']), + Class_Template::current()->getIco($this->view, 'edit', 'utils'), + ['class' => 'ml-1', + 'data-popup' => true, + 'title' => $this->_('Modifier mes informations')]))); } } diff --git a/library/templates/Intonation/View/User/Newsletters.php b/library/templates/Intonation/View/User/Newsletters.php new file mode 100644 index 0000000000000000000000000000000000000000..dbbd013fe7cb92dd5b4e121459f4254efc3848eb --- /dev/null +++ b/library/templates/Intonation/View/User/Newsletters.php @@ -0,0 +1,40 @@ +<?php +/** + * Copyright (c) 2012-2019, 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_User_Newsletters extends ZendAfi_View_Helper_BaseHelper { + public function user_Newsletters($user) { + $newsletters = array_map(function($newsletter) + { + return (new Intonation_Library_View_Wrapper_Newsletter) + ->setModel($newsletter) + ->setView($this->view); + }, Class_Newsletter::getPublishedNewsletters()); + + $callback = function($wrapped) { + return $this->view->cardifyHorizontal($wrapped); + }; + + return + $this->_tag('h3', $this->_('Les lettres d\'information')) + . $this->view->renderTruncateList(new Storm_Collection($newsletters), $callback); + } +} diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index 03ca64425235bd19bf48173c5ba041eb086ff3c5..af50123e70bf55a7134bdc07260af1a7a7b5c288 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -2613,6 +2613,7 @@ abstract class TemplatesIntonationAccountTestCase extends TemplatesIntonationTes $current_user = Class_Users::getIdentity(); $current_user + ->setPassword('test') ->setIdabon(123456) ->setDateFin('2020/01/01') ->setFicheSigb(['type_comm' => 2, @@ -2653,6 +2654,13 @@ abstract class TemplatesIntonationAccountTestCase extends TemplatesIntonationTes ['id' => 20090, 'clef_oeuvre' => 'PSYKO', ]); + + $newsletter = $this->fixture('Class_Newsletter', + ['id' => 45, + 'titre' => 'Les nouveautés', + 'contenu' => 'test de newsletter: http://monurl.newsletter.fr. http://mon-domain.org']); + + $current_user->setNewsletters([$newsletter]); } } @@ -2828,7 +2836,7 @@ class TemplatesDispatchAbonneReviewsTest extends TemplatesIntonationAccountTestC public function donnerDesAvisLinkShouldBeDisplay() { Class_AvisNotice::find(4)->delete(); $this->dispatch('/opac/abonne/mes-avis/id_profil/72'); - $this->assertXPathContentContains('//div//a[contains(@href, "/abonne/donner-des-avis")]', 'Commencer dès maintenant'); + $this->assertXPathContentContains('//div//a[contains(@href, "/abonne/donner-des-avis")]', 'Commencer maintenant'); } } @@ -2851,4 +2859,35 @@ class TemplatesDispatchAbonneDonnerDesAvisTest extends TemplatesIntonationAccoun $this->dispatch('/opac/abonne/donner-des-avis/id_profil/72'); $this->assertXPathContentContains('//div', 'Donner des avis'); } +} + + + + +class TemplatesDispatchAbonneSuivreUneRechercheTest extends TemplatesIntonationAccountTestCase { + /** @test */ + public function selectionMesBDShouldBeDisplay() { + $this->dispatch('/opac/abonne/suivre-une-recherche/id_profil/72'); + $this->assertXPathContentContains('//div', 'Suivre une recherche'); + } +} + + + +class TemplatesIntonationDispatchAccountEditTest extends TemplatesIntonationAccountTestCase { + /** @test */ + public function editAccountShouldContainsFormToAbonneModifier() { + $this->dispatch('/opac/abonne/modifier/id_profil/72'); + $this->assertXPath('//form[contains(@action, "/abonne/modifier")]'); + } + + + /** @test */ + public function editAccountPostNameDevShouldUpdateUser() { + Class_AdminVar::newInstanceWithId('CHAMPS_FICHE_UTILISATEUR', + ['valeur' => 'nom']); + + $this->postDispatch('/opac/abonne/modifier/id_profil/72', ['nom' => 'Dev']); + $this->assertEquals('Dev', Class_Users::getIdentity()->getNom()); + } } \ No newline at end of file