diff --git a/VERSIONS b/VERSIONS index b32f471177745367c5e37a8faa1f21115abd6c13..fb0eec8fc9506c9b28f7e6c2541f9684f5bc9d71 100644 --- a/VERSIONS +++ b/VERSIONS @@ -1,3 +1,13 @@ +28/07/2020 - v8.0.71 + + - ticket #115131 : Magasin de thèmes : Par défaut la boîte agenda affiche les prochains évènements des prochains mois + + - ticket #108325 : Magasin de thèmes : Le paramètre "Titre caché" des articles cache aussi l'auteur + + - ticket #115136 : Magasin de thèmes : Correction de la disparition de la configuration de la section principale de certains écrans + + + 20/07/2020 - v8.0.70 - ticket #108849 : Ressources numériques : Changement de logo pour les documents Cafeyn diff --git a/library/ZendAfi/View/Helper/Widget/Section/Main.php b/library/ZendAfi/View/Helper/Widget/Section/Main.php index d24ce0df8a55e9666fae7264d23a8b5a05bfffed..f30ed2d48c1feec6aa2a0cdcddde35fd3c43ffcc 100644 --- a/library/ZendAfi/View/Helper/Widget/Section/Main.php +++ b/library/ZendAfi/View/Helper/Widget/Section/Main.php @@ -21,15 +21,12 @@ class ZendAfi_View_Helper_Widget_Section_Main extends ZendAfi_View_Helper_Widget_Section { - - public function getAdminTools() { - return $this->view->fonctionsAdmin(0, - false, - null, - [function() - { - return $this->view->tagEditSection($this->_section); - }]); + public function getActionAdminTools() { + return $this->_tag('div', + $this->view->tagEditSection($this->_section) + . $this->view->tagConfigAction($this->_section), + ['class' => 'section_configuration', + 'style' => 'text-align:right']); } @@ -44,7 +41,7 @@ class ZendAfi_View_Helper_Widget_Section_Main extends ZendAfi_View_Helper_Widget $content [] = $this->_isActionRendering() ? $this->view->div(['class' => 'section_wrapper action_rendering'], - $this->getAdminTools() + $this->getActionAdminTools() . $this->view->div(['class' => 'section_content_wrapper'], $this->view->grid($this->view->div($this->_getHTMLAttribs(), $this->view->render($this->view->actionScript))))) diff --git a/library/startup.php b/library/startup.php index d1484f7c43e2b7bed67c54f99ed5cf3b6a36c6c4..ddab01306479cc9e5750cd24296c547f48eda9f7 100644 --- a/library/startup.php +++ b/library/startup.php @@ -82,7 +82,7 @@ class Bokeh_Engine { function setupConstants() { defineConstant('BOKEH_MAJOR_VERSION','8.0'); - defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.70'); + defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.71'); defineConstant('BOKEH_REMOTE_FILES', 'https://git.afi-sa.net/afi/opacce/'); diff --git a/library/templates/Intonation/Library/View/Wrapper/Article.php b/library/templates/Intonation/Library/View/Wrapper/Article.php index 3ac221b8f4696057fee53b77a826346494ded770..9cb489107c5827d3f3653d23f8af1bec6670ee05 100644 --- a/library/templates/Intonation/Library/View/Wrapper/Article.php +++ b/library/templates/Intonation/Library/View/Wrapper/Article.php @@ -23,15 +23,19 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wrapper_Abstract { public function getMainTitle() { - return - $this->_model->getCacherTitre() - ? '' - : $this->_model->getTitre(); + return $this->_whenTitleIsNotHidden($this->_model->getTitre()); } public function getSecondaryTitle() { - return $this->_model->getAuthorName(); + return $this->_whenTitleIsNotHidden($this->_model->getAuthorName()); + } + + + protected function _whenTitleIsNotHidden($value) { + return $this->_model->getCacherTitre() + ? '' + : $value; } diff --git a/library/templates/Intonation/Library/Widget/Carousel/Agenda/View.php b/library/templates/Intonation/Library/Widget/Carousel/Agenda/View.php index 993893776ff11e61df84533f26ffd8915f82b868..af087ae6510568b1cbead2994b44e586445f8f62 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Agenda/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Agenda/View.php @@ -35,7 +35,7 @@ class Intonation_Library_Widget_Carousel_Agenda_View extends Intonation_Library_ protected function _findElements() { $this->_initCalendar(); - return $this->_calendar->getArticles($fill_with_following_months = false); + return $this->_calendar->getArticles(); } diff --git a/library/templates/Intonation/View/FonctionsAdmin.php b/library/templates/Intonation/View/Admin/TagConfigAction.php similarity index 53% rename from library/templates/Intonation/View/FonctionsAdmin.php rename to library/templates/Intonation/View/Admin/TagConfigAction.php index 52c1ae6afdc6421b11b6e4197c0f6cc9f6f9ae01..20ededee376f703e29a6925299b4288219a54410 100644 --- a/library/templates/Intonation/View/FonctionsAdmin.php +++ b/library/templates/Intonation/View/Admin/TagConfigAction.php @@ -1,6 +1,6 @@ <?php /** - * Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved. + * 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 @@ -20,12 +20,35 @@ */ -class Intonation_View_FonctionsAdmin extends ZendAfi_View_Helper_FonctionsAdmin { +class Intonation_View_Admin_TagConfigAction extends ZendAfi_View_Helper_BaseHelper { - public function fonctionsAdmin($id_module = 0, $type_module = false, $division = null, $extended_actions = []) { - return Class_Users::isCurrentUserCanAccesBackend() - ? parent::fonctionsAdmin($id_module, $type_module, $division, $extended_actions) - : ''; + public function tagConfigAction($section) { + if (!Class_Users::isCurrentUserAllowedToEditProfile($section->getProfile())) + return ''; + + $this->_id_profil = $section->getProfile()->getId(); + $this->_current_skin = Class_Admin_Skin::current(); + + return $this->_config(); + } + + + protected function _config() { + if (!$url_params = $this->getPopupUrlParams()) + return ''; + + return $this->_properties($url_params) + . $this->_extension($url_params); + } + + + protected function _extension($url_params) { + $url_params['controller'] = 'modules'; + $url_params['action'] = 'apply-to'; + + return $this->_renderActionLink('copy_module', + $this->_('Étendre le paramétrage'), + Class_Url::assemble($url_params)); } @@ -40,7 +63,7 @@ class Intonation_View_FonctionsAdmin extends ZendAfi_View_Helper_FonctionsAdmin 'controller' => 'widget', 'action' => 'edit-action', 'id' => $id, - 'id_profil' => $this->id_profil]; + 'id_profil' => $this->_id_profil]; } @@ -51,4 +74,14 @@ class Intonation_View_FonctionsAdmin extends ZendAfi_View_Helper_FonctionsAdmin $this->view->_current_module['action']), $this->view->url($url_params), null, true); } -} \ No newline at end of file + + + protected function _renderActionLink($icon, $label, $url) { + return $this->view->tagAnchor($url, + $this->_current_skin->renderActionIconOn($icon, + $this->view, + ['alt' => $label]), + ['data-popup' => 'true', + 'title' => $label]); + } +} diff --git a/library/templates/Intonation/View/RenderArticle.php b/library/templates/Intonation/View/RenderArticle.php index e6bed48b09f929fe6b332d633e46d26a3849cb29..2ea11a75da10ac5620778af61efdafbd98c3666e 100644 --- a/library/templates/Intonation/View/RenderArticle.php +++ b/library/templates/Intonation/View/RenderArticle.php @@ -31,12 +31,11 @@ class Intonation_View_RenderArticle extends ZendAfi_View_Helper_BaseHelper { ? '' : $this->_tag('h2', $article->getTitre(), - ['class' => 'card-title']), - - $this->_tag('p', - $article->getAuthorName(), - ['title' => $this->_('Auteur de l\'article "%s".', $article->getAuthorName()), - 'class' => 'card-subtitle text-muted']), + ['class' => 'card-title']) + . $this->_tag('p', + $article->getAuthorName(), + ['title' => $this->_('Auteur de l\'article "%s".', $article->getAuthorName()), + 'class' => 'card-subtitle text-muted']), $this->_badges($wrapper), diff --git a/tests/scenarios/Templates/TemplatesArticlesTest.php b/tests/scenarios/Templates/TemplatesArticlesTest.php index d179351ec744eed9d1503e707704440bd0abb1c1..afe8d109367ed6065a753b3e0d60f58b970ced2e 100644 --- a/tests/scenarios/Templates/TemplatesArticlesTest.php +++ b/tests/scenarios/Templates/TemplatesArticlesTest.php @@ -76,7 +76,7 @@ class TemplatesArticlesWidgetTest extends TemplatesIntonationTestCase { -class TemplatesCmsListActionTest extends TemplatesIntonationTestCase { +class TemplatesArticlesCmsListActionTest extends TemplatesIntonationTestCase { /** @test */ public function dispatchShouldRenderSprechenSieDeutsh() { $this->fixture('Class_Article', @@ -97,7 +97,7 @@ class TemplatesCmsListActionTest extends TemplatesIntonationTestCase { -class TemplatesCmsArticleViewTest extends TemplatesIntonationTestCase { +class TemplatesArticlesCmsArticleViewTest extends TemplatesIntonationTestCase { public function setUp() { parent::setUp(); $this->fixture('Class_Article', @@ -139,7 +139,7 @@ class TemplatesCmsArticleViewTest extends TemplatesIntonationTestCase { -class TemplatesCmsArticleViewWithHiddenTitleTest extends TemplatesIntonationTestCase { +class TemplatesArticlesCmsArticleViewWithHiddenTitleTest extends TemplatesIntonationTestCase { public function setUp() { parent::setUp(); $this->fixture('Class_Article', @@ -149,7 +149,11 @@ class TemplatesCmsArticleViewWithHiddenTitleTest extends TemplatesIntonationTest 'contenu' => '<p>Une b...</p>', 'events_debut' => '2020-03-13 00:00:00', 'events_fin' => '2020-07-31 00:00:00', - 'all_day' => 1]); + 'all_day' => 1, + 'auteur' => $this->fixture('Class_Users', + ['id' => 88393, + 'login' => 'Harlock', + 'password' => 'Arc4di4 for 3v3r'])]); $this->dispatch('/opac/cms/articleview/id/7/id_profil/72'); } @@ -159,12 +163,18 @@ class TemplatesCmsArticleViewWithHiddenTitleTest extends TemplatesIntonationTest public function titleH2ParlerVousFrançaisShouldNotBePresent() { $this->assertNotXPath('//main//div//h2[@class="card-title"]'); } + + + /** @test */ + public function authorShouldNotBePresent() { + $this->assertNotXPathContentContains('//div', 'Harlock'); + } } -class TemplatesCmsArticleViewWithLocationTest extends TemplatesIntonationTestCase { +class TemplatesArticlesCmsArticleViewWithLocationTest extends TemplatesIntonationTestCase { public function setUp() { parent::setUp(); $annecy = $this->fixture('Class_Lieu', diff --git a/tests/scenarios/Templates/TemplatesSectionTest.php b/tests/scenarios/Templates/TemplatesSectionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..336a01fa5e8b46394933236b02eb4eefd66e2eff --- /dev/null +++ b/tests/scenarios/Templates/TemplatesSectionTest.php @@ -0,0 +1,36 @@ +<?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 + */ + +require_once 'TemplatesTest.php'; + +/** @see http://forge.afi-sa.fr/issues/115136 */ +class TemplatesSectionAdminToolsTest extends TemplatesIntonationTestCase { + + /** @test */ + public function withMenuAtPositionZeroShouldDisplaySectionAdminTools() { + Class_Profil::find(72)->addMenu(['menus' => [], + 'type_menu' => '']); + + $this->dispatch('/opac/index/index'); + + $this->assertXPath('//div[@class=\'section_configuration\']//img[@alt=\'Modifier la section "Division principale"\']'); + } +} diff --git a/tests/scenarios/Templates/TemplatesWidgetTest.php b/tests/scenarios/Templates/TemplatesWidgetTest.php index 48e5008d3e9ac9d67986be17e35c97fe9fde9a44..891b9a21118a436a7e0e8d1e46fefd180fcfdc46 100644 --- a/tests/scenarios/Templates/TemplatesWidgetTest.php +++ b/tests/scenarios/Templates/TemplatesWidgetTest.php @@ -812,7 +812,7 @@ class TemplatesDispatchLibraryWidgetTest extends TemplatesIntonationTestCase { -class TemplatesDispatchAgendaWidgetTest extends TemplatesIntonationTestCase { +class TemplatesWidgetCalendarTest extends TemplatesIntonationTestCase { protected $_vacances; public function setUp() { @@ -825,29 +825,26 @@ class TemplatesDispatchAgendaWidgetTest extends TemplatesIntonationTestCase { 'preferences' => ['id_categorie' => 22]]]]) ->assertSave(); - ZendAfi_View_Helper_CalendarContent::setTimeSource(new TimeSourceForTest('2020-04-12 23:34:00')); + Intonation_View_CalendarContent::setTimeSource(new TimeSourceForTest('2020-04-12 23:34:00')); $this->_vacances = $this->fixture('Class_Article', ['id' => 78, 'titre' => 'Les vacances', 'contenu' => 'À la mer']); - $this - ->onLoaderOfModel('Class_Article') - ->whenCalled('getAllArticles') - ->answers([$this->_vacances]); + $this->onLoaderOfModel('Class_Article'); } /** @test */ - public function editAgendaWidgetInputTitreTypeShouldBeText() { + public function editWidgetShouldContainTitreTextInput() { $this->dispatch('/admin/widget/edit-widget/id/21/id_profil/72', true); $this->assertXpath('//input[@name="titre"][@type="text"]'); } /** @test */ - public function boiteAgendaShouldBePresent() { + public function calendarWithoutFiltersShouldBePresentAndQueryAllFuturEvents() { Class_Article::getLoader() ->whenCalled('getArticlesByPreferences') ->with(['display_order' => 'EventDebut', @@ -872,6 +869,20 @@ class TemplatesDispatchAgendaWidgetTest extends TemplatesIntonationTestCase { 'event_end_after' => '2020-04-12']) ->answers([$this->_vacances]) + ->whenCalled('getArticlesByPreferences') + ->with(['display_order' => 'EventDebut', + 'id_categorie' => '22', + 'events_only' => true, + 'event_date' => '', + 'id_bib' => 0, + 'id_lieu' => '', + 'custom_fields' => [], + 'published' => true, + 'event_start_after' => '2020-04', + 'event_end_after' => '', + 'limit' => 9]) + ->answers([$this->_vacances]) + ->beStrict(); $this->dispatch('/opac/index/index/id_profil/72'); @@ -880,7 +891,7 @@ class TemplatesDispatchAgendaWidgetTest extends TemplatesIntonationTestCase { /** @test */ - public function cmsCalendarShouldRenderFilters() { + public function ajaxCmsCalendarActionShouldRenderFilters() { $this->dispatch('/opac/cms/calendar/id_profil/72/id_module/21/render/ajax'); $this->assertXPathContentContains('//div[contains(@class, "filters")]//a[contains(@href, "/cms/calendar/")]', 'Janvier'); @@ -888,7 +899,7 @@ class TemplatesDispatchAgendaWidgetTest extends TemplatesIntonationTestCase { /** @test */ - public function cmsCalendarShouldRenderSelectedDayInFilterTitle() { + public function ajaxCmsCalendarActionWithDayShouldRenderItInFilters() { $this->dispatch('/opac/cms/calendar/id_profil/72/id_module/21/day/2019-06-01/render/ajax'); $this->assertXPathContentContains('//div[contains(@class, "filters")]//button/span', '01/06/2019'); @@ -896,7 +907,7 @@ class TemplatesDispatchAgendaWidgetTest extends TemplatesIntonationTestCase { /** @test */ - public function cmsCalendarShouldRenderSelectedMonthInFilterTitle() { + public function ajaxCmsCalendarActionWithMonthShouldRenderItInFilters() { $this->dispatch('/opac/cms/calendar/id_profil/72/id_module/21/day/2019-06/render/ajax', true); $this->assertXPathContentContains('//div[contains(@class, "filters")]//button/span', '06/2019');