diff --git a/VERSIONS_HOTLINE/64747 b/VERSIONS_HOTLINE/64747 new file mode 100644 index 0000000000000000000000000000000000000000..e77bd740cc5c0a90ebfc4b1c8e6b9154c75f9d20 --- /dev/null +++ b/VERSIONS_HOTLINE/64747 @@ -0,0 +1 @@ + - ticket #64747 : correction du paramétrage de la boîte articles en backoffice \ No newline at end of file diff --git a/VERSIONS_WIP/39361 b/VERSIONS_WIP/39361 new file mode 100644 index 0000000000000000000000000000000000000000..1e864361db2185024ac66eb46cc357b0bef5b8bb --- /dev/null +++ b/VERSIONS_WIP/39361 @@ -0,0 +1 @@ + - ticket #39361 : boîtes articles et calendrier: ajout d'un mode d'affichage à la pinterest \ No newline at end of file diff --git a/library/Class/Systeme/ModulesAccueil/Calendrier.php b/library/Class/Systeme/ModulesAccueil/Calendrier.php index 1ed496f6c05d8c2eea1b82fa1b393416af57fef8..f4f04b97c4093e463b370346c4c0e3f2e4c9fa63 100644 --- a/library/Class/Systeme/ModulesAccueil/Calendrier.php +++ b/library/Class/Systeme/ModulesAccueil/Calendrier.php @@ -45,6 +45,7 @@ class Class_Systeme_ModulesAccueil_Calendrier extends Class_Systeme_ModulesAccue 'nb_events' => '3', 'display_calendar' => '1', 'mode-affichage' => 'simple', + 'layout' => 'grid', 'event_filter' => 'none', 'enabled_filters' => '']; } diff --git a/library/Class/Systeme/ModulesAccueil/News.php b/library/Class/Systeme/ModulesAccueil/News.php index 3c32dd1ec7dffeb6d1dd4f7a82df0afeafd97034..d0a9fb8c18d882c2b16a7597c02df6642c00cdb6 100644 --- a/library/Class/Systeme/ModulesAccueil/News.php +++ b/library/Class/Systeme/ModulesAccueil/News.php @@ -53,6 +53,7 @@ class Class_Systeme_ModulesAccueil_News extends Class_Systeme_ModulesAccueil_Nul 'display_titles_only' => false, 'rss_avis' => false, 'op_largeur_img' => 200, + 'layout' => 'grid', 'op_hauteur_boite' => 400]; } diff --git a/library/ZendAfi/Form/Configuration/WallImagesViewer.php b/library/ZendAfi/Form/Configuration/WallImagesViewer.php new file mode 100644 index 0000000000000000000000000000000000000000..819dc495c4359e8abd5818a51f36ee91d0ffeb99 --- /dev/null +++ b/library/ZendAfi/Form/Configuration/WallImagesViewer.php @@ -0,0 +1,36 @@ +<?php +/** + * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved. + * + * BOKEH is free software; you can redistribute it and/or modify + * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by + * the Free Software Foundation. + * + * There are special exceptions to the terms and conditions of the AGPL as it + * is applied to this software (see README file). + * + * BOKEH is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE + * along with BOKEH; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +class ZendAfi_Form_Configuration_WallImagesViewer extends ZendAfi_Form { + public function init() { + parent::init(); + + $this + ->addElement('radio', + 'layout', + ['label' => $this->_('Disposition'), + 'separator' => ' ', + 'multiOptions' => ['grid' => $this->_('grille'), + 'fluid' => $this->_('fluide')] + ]); + } +} diff --git a/library/ZendAfi/View/Helper/Accueil/Calendar.php b/library/ZendAfi/View/Helper/Accueil/Calendar.php index 57240f40e75b9ce841d37c98c28db86242c09800..642d04ba66ea4431f2ebafdcb9424542b4a1ea88 100644 --- a/library/ZendAfi/View/Helper/Accueil/Calendar.php +++ b/library/ZendAfi/View/Helper/Accueil/Calendar.php @@ -66,6 +66,7 @@ class ZendAfi_View_Helper_Accueil_Calendar extends ZendAfi_View_Helper_Accueil_B $param['EVENT_FILTER'] = array_isset('event_filter', $this->preferences) ? $this->preferences['event_filter'] : ''; $param['ENABLED_FILTERS'] = $this->preferences['enabled_filters']; $param['DISPLAY_FULL_PAGE'] = $this->preferences['display_full_page']; + $param['LAYOUT'] = $this->preferences['layout']; $this->contenu = $this->view->calendarContent($param); diff --git a/library/ZendAfi/View/Helper/Accueil/News.php b/library/ZendAfi/View/Helper/Accueil/News.php index 98bb114ef5267e314ceb9dd29fad9390a144a7d5..d9cd50a6ab38ff298891cc6badcf564fc32fbca2 100644 --- a/library/ZendAfi/View/Helper/Accueil/News.php +++ b/library/ZendAfi/View/Helper/Accueil/News.php @@ -28,10 +28,10 @@ class ZendAfi_View_Helper_Accueil_News extends ZendAfi_View_Helper_Accueil_Base ['width' => $this->preferences['op_largeur_img'], 'height' => $this->preferences['op_hauteur_boite']]); - if($this->isDisplayDiaporamaNavigation()) + if ($this->isDisplayDiaporamaNavigation()) $this->renderScriptForDiaporameNavigation($this->preferences); - if($this->isDisplayAccordionList()) + if ($this->isDisplayAccordionList()) $this->renderScriptForAccordionList(); } @@ -57,10 +57,14 @@ class ZendAfi_View_Helper_Accueil_News extends ZendAfi_View_Helper_Accueil_Base $this->_articles = Class_Article::getArticlesByPreferences($this->preferences); + $content_class = 'news-' . $this->id_module . ' news'; + if ($this->isDisplayWall()) + $content_class .= ' liste_mur layout_' . $this->preferences['layout']; + $this->contenu .= $this ->_tag('div', $this->getArticles(Class_Article::filterByLocaleAndWorkflow($this->_articles, $this->preferences['status'])), - ['class' => 'news-' . $this->id_module . ' news']); + ['class' => $content_class]); $this->titre = $this->getHtmlTitre(); @@ -140,7 +144,9 @@ class ZendAfi_View_Helper_Accueil_News extends ZendAfi_View_Helper_Accueil_Base return $this->view->tag('ul', implode('', $htmls), ['class' => 'accordion_widget']); if( $this->isDisplayListe()) { - $sep_class = $this->preferences["display_titles_only"] ? "article_only_title_separator" : "article_full_separator"; + $sep_class = $this->preferences["display_titles_only"] + ? "article_only_title_separator" + : "article_full_separator"; $html_separator = sprintf('<div class="%s"> </div>', $sep_class); } @@ -154,6 +160,9 @@ class ZendAfi_View_Helper_Accueil_News extends ZendAfi_View_Helper_Accueil_Base $this->view->tag('h3', $article->getTitre()) . $this->view->tag('div', $this->view->article_RenderFullContent($article)), ['data-role' => 'collapsible']); + if ($this->isDisplayWall()) + return $this->view->article_RenderWall($article); + return $this->preferences["display_titles_only"] ? $this->view->article_RenderTitleOnly($article) : $this->view->article_RenderSummary($article); diff --git a/library/ZendAfi/View/Helper/Admin/ImageViewersOptions.php b/library/ZendAfi/View/Helper/Admin/ImageViewersOptions.php index 69e95f3b6bbee8df4394bc21cc8b6dbe979de33c..44ab81908c9fe9ecd100acb6054fc935062546ed 100644 --- a/library/ZendAfi/View/Helper/Admin/ImageViewersOptions.php +++ b/library/ZendAfi/View/Helper/Admin/ImageViewersOptions.php @@ -41,6 +41,7 @@ class ZendAfi_View_Helper_Admin_ImageViewersOptions ['diaporama' => $this->_('Diaporama'), 'accordion_list' => $this->_('Liste en accordéon'), 'diaporama_navigation' => $this->_('Diaporama avec navigation'), + 'wall' => $this->_('Mur'), 'booklet' => $this->_('Livre')]]; } @@ -98,8 +99,6 @@ class ZendAfi_View_Helper_Admin_ImageViewersOptions return $html; } - $html .= '<optgroup label="' . $groupLabel . '" style="font-style:normal;color:#FF6600">'; - foreach ($this->_styles[$styleKey] as $k => $v) { $current = (array_key_exists('style_liste', $this->_preferences) && $this->_preferences['style_liste'] == $k); diff --git a/library/ZendAfi/View/Helper/CalendarContent.php b/library/ZendAfi/View/Helper/CalendarContent.php index e2217ec39a21e84fa56acd6e377f7f79fe1b2d64..5881801870bbcece7ce912aa09e0c2bc63a49757 100644 --- a/library/ZendAfi/View/Helper/CalendarContent.php +++ b/library/ZendAfi/View/Helper/CalendarContent.php @@ -149,7 +149,9 @@ class ZendAfi_View_Helper_CalendarContent extends Zend_View_Helper_HtmlElement { foreach($articles as $article){ $html.=$this->view->article_RenderWall($article); } - return $this->view->tag('div', $html, [ 'class' => 'liste_mur']); + return $this->view->tag('div', + $html, + [ 'class' => 'liste_mur layout_' . $this->param['LAYOUT'] ]); } diff --git a/public/opac/css/global.css b/public/opac/css/global.css index ae7e3ca57362bc24cf5b53f5b29e8e0fdd6b7dde..1c0db0c547c9386e16aa1eb55ebff604370b3a06 100644 --- a/public/opac/css/global.css +++ b/public/opac/css/global.css @@ -1662,6 +1662,18 @@ body.abonne_multimedia-hold-view .actions a { width: 100%; } + +.liste_mur.layout_fluid { + display: block; + column-width: 200px; + column-gap: 20px; +} + +.liste_mur article img { + max-width: 100%; +} + + .liste_mur .article_wrapper { display: inline-block; vertical-align: top; @@ -1682,6 +1694,13 @@ body.abonne_multimedia-hold-view .actions a { } +.calendar .liste_mur.layout_fluid article, +.liste_mur.layout_fluid .article_wrapper { + width: 100%; + margin: 0 0 10px 0; +} + + .domains.liste_mur > div { clear: both; text-align: center; diff --git a/public/opac/java/wall/defaults.ini b/public/opac/java/wall/defaults.ini new file mode 100644 index 0000000000000000000000000000000000000000..ba9704d783d1b1b1e36625bfd2fa2958f30feb4f --- /dev/null +++ b/public/opac/java/wall/defaults.ini @@ -0,0 +1 @@ +layout="grid" diff --git a/public/opac/java/wall/properties.phtml b/public/opac/java/wall/properties.phtml new file mode 100644 index 0000000000000000000000000000000000000000..4973d4ed63ac6a815a90ef639e41455dab0aae02 --- /dev/null +++ b/public/opac/java/wall/properties.phtml @@ -0,0 +1,5 @@ +<?php +$form = new ZendAfi_Form_Configuration_WallImagesViewer(); +$form->removeDecorator('form'); +$form->populate($this->preferences); +echo $form; diff --git a/tests/application/modules/admin/controllers/WidgetControllerTest.php b/tests/application/modules/admin/controllers/WidgetControllerTest.php index 90cb79a7f4ded853060599c0840047518a13ac1e..483993042a56be7bdbeb2e0200d1d1c70697f638 100644 --- a/tests/application/modules/admin/controllers/WidgetControllerTest.php +++ b/tests/application/modules/admin/controllers/WidgetControllerTest.php @@ -246,8 +246,65 @@ class WidgetControllerKioquePostTest extends WidgetControllerPostDispatchWidgetC -class WidgetControllerCalendarTest extends WidgetControllerDispatchWidgetConfigurationTestCase { +class WidgetControllerCalendarWallModeTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'CALENDAR'; + $this->_preferences = ['nb_events' => 3, + 'rss_avis' => 0, + 'display_calendar' => 1, + 'mode-affichage' => 'wall', + 'op_navigation_mode' => 'next_previous', + 'display_event_info' => 'bib', + 'display_mode' => 'Summary', + 'display_order' => 'EventDebut', + 'display_cat_select' => '', + 'enabled_filters' => 'date;place;custom_field_1', + 'id_categorie' => '', + 'event_filter' => 'none']; + parent::setUp(); + } + + /** @test */ + public function wallGridLayoutRadioButtonShouldBeChecked() { + $this->assertXPath('//div[@id="objet_props"]//input[@id="layout-grid"][@type="radio"][@checked="checked"]'); + } + + + /** @test */ + public function wallFluidLayoutRadioButtonShouldNotBeChecked() { + $this->assertXPath('//div[@id="objet_props"]//input[@id="layout-fluid"][@type="radio"][not(@checked)]'); + } +} + + + + +class WidgetControllerArticlesWithWallDisplayTest extends WidgetControllerDispatchWidgetConfigurationTestCase { + public function setUp() { + $this->_type_module = 'NEWS'; + $this->_preferences = ['style_liste' => 'wall', + 'layout' => 'fluid']; + parent::setUp(); + } + + + /** @test */ + public function wallGridLayoutRadioButtonShouldNotBeChecked() { + $this->assertXPath('//div[@id="objet_props"]//input[@id="layout-grid"][@type="radio"][not(@checked)]'); + } + + + /** @test */ + public function wallFluidLayoutRadioButtonShouldBeChecked() { + $this->assertXPath('//div[@id="objet_props"]//input[@id="layout-fluid"][@type="radio"][@checked="checked"]'); + } +} + + + + +class WidgetControllerCalendarTest extends WidgetControllerDispatchWidgetConfigurationTestCase { public function setUp() { $this->_type_module = 'CALENDAR'; $this->_preferences = ['nb_events' => 3, @@ -401,19 +458,19 @@ class WidgetControllerArticlesDispatchTest extends WidgetControllerDispatchWidge /** @test */ public function selectShouldContainsSlideShow() { - $this->assertXPathContentContains('//select/optgroup[@label="Objets java-script"]/option', 'Diaporama avec navigation'); + $this->assertXPathContentContains('//select/option', 'Diaporama avec navigation'); } /** @test */ public function selectShouldContainsAcordionList() { - $this->assertXPathContentContains('//select/optgroup[@label="Objets java-script"]/option', 'Liste en accordéon', $this->_response->getBody()); + $this->assertXPathContentContains('//select/option', 'Liste en accordéon', $this->_response->getBody()); } /** @test */ public function diaporamaNavigationShouldBeSelected() { - $this->assertXPathContentContains('//select/optgroup[@label="Objets java-script"]/option[@value="diaporama_navigation"][@selected="selected"]', 'Diaporama avec navigation', $this->_response->getBody()); + $this->assertXPathContentContains('//select/option[@value="diaporama_navigation"][@selected="selected"]', 'Diaporama avec navigation', $this->_response->getBody()); } diff --git a/tests/application/modules/opac/controllers/CmsControllerTest.php b/tests/application/modules/opac/controllers/CmsControllerTest.php index dd7dd6ef21e68fce1ce8de1f0c9e62b89980021c..11b4bee3008b7b065fde441bff98b254ec75490b 100644 --- a/tests/application/modules/opac/controllers/CmsControllerTest.php +++ b/tests/application/modules/opac/controllers/CmsControllerTest.php @@ -109,7 +109,8 @@ class CmsControllerdCalendarRssWithProfileAndArticleTest 'id_module' => 1, 'event_end_after' => "2014-12-01", 'events_only' => true, - 'published' => true]) + 'published' => true, + 'layout' => 'grid']) ->answers([$fete, $fete_frite ]) diff --git a/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php b/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php index 47a714702f7fc152216121e30af3f5e98e8e3e51..128118d3f9d5c0d5639875f74f27764024041a15 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/CalendarTest.php @@ -1036,6 +1036,12 @@ class CalendarHelperWithWallNavigationModeTest extends CalendarHelperDisplayMode public function divCalendarFiltersShouldNotBePresent() { $this->assertNotXPath($this->html, '//ul[contains(@class, "filters")]'); } + + + /** @test */ + public function articleContainerShouldHaveClassesListeMurLayoutGrid() { + $this->assertXPath($this->html, '//div[@class="liste_mur layout_grid"]//article'); + } } diff --git a/tests/library/ZendAfi/View/Helper/Accueil/NewsTest.php b/tests/library/ZendAfi/View/Helper/Accueil/NewsTest.php index fd20dea40a653a7f63bf5f744209fb3778e32f07..09cd0607f75e23542aee5d4575f1dcfbe6bbb428 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/NewsTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/NewsTest.php @@ -742,4 +742,37 @@ class NewsHelperWithThreeArticlesInAccordionListTest extends NewsHelperWithThree public function scriptAccordionShouldBeLoaded() { $this->assertContains('$(function(){$("#boite_12 .accordion_widget").accordion({collapsible: true, active: false});});', Class_ScriptLoader::getInstance()->html()); } +} + + + + +class NewsHelperWithThreeArticlesInWallModeTest extends NewsHelperWithThreeArticlesTestCase { + protected function _renderWall($layout) { + $params = ['type_module' => 'NEWS', + 'division' => 2, + 'preferences' => ['titre' => 'Another brick', + 'rss_avis' => false, + 'display_titles_only' => false, + 'style_liste' => 'wall', + 'layout' => $layout]]; + + $helper = new ZendAfi_View_Helper_Accueil_News(12, $params); + $helper->setView(new ZendAfi_Controller_Action_Helper_View()); + return $helper->getBoite(); + } + + + /** @test */ + public function divListeMurShouldHaveClassLayoutFluid() { + $this->assertXPath($this->_renderWall('fluid'), + '//div[@class="news-12 news liste_mur layout_fluid"]/article[contains(@class, "article_wrapper")]'); + } + + + /** @test */ + public function divListeMurShouldHaveClassLayoutGrid() { + $this->assertXPath($this->_renderWall('grid'), + '//div[@class="news-12 news liste_mur layout_grid"]/article'); + } } \ No newline at end of file