diff --git a/VERSIONS_HOTLINE/38468 b/VERSIONS_HOTLINE/38468 new file mode 100644 index 0000000000000000000000000000000000000000..3095bd7ece7cd2b4a77a96d9b5638d96430a58c3 --- /dev/null +++ b/VERSIONS_HOTLINE/38468 @@ -0,0 +1 @@ + - ticket #38468 : Version mobile : correction de l'affichage des événements calendrier \ No newline at end of file diff --git a/application/modules/opac/controllers/CmsController.php b/application/modules/opac/controllers/CmsController.php index 781ac43f7fab46d7fc54dbb0a9e74608a170275b..6caeba2e8362233d05fb1c12fa1a4c151ff07b67 100644 --- a/application/modules/opac/controllers/CmsController.php +++ b/application/modules/opac/controllers/CmsController.php @@ -288,7 +288,7 @@ class CmsController extends ZendAfi_Controller_Action { /** * @param array $preferences */ - private function _viewArticlesByPreferences($preferences) { + protected function _viewArticlesByPreferences($preferences) { $articles = Class_Article::getLoader() ->getArticlesByPreferences($preferences); @@ -312,5 +312,5 @@ class CmsController extends ZendAfi_Controller_Action { } $this->renderScript('cms/articlesview.phtml'); - } + } } \ No newline at end of file diff --git a/application/modules/telephone/controllers/CmsController.php b/application/modules/telephone/controllers/CmsController.php index 0591de5e398c92ffac2cf9c3dda7a6757957d091..bece20c172e0d2e6a68053ffa09714c7a6a200a7 100644 --- a/application/modules/telephone/controllers/CmsController.php +++ b/application/modules/telephone/controllers/CmsController.php @@ -16,7 +16,7 @@ * * 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 + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once ROOT_PATH.'application/modules/opac/controllers/CmsController.php'; diff --git a/application/modules/telephone/views/scripts/cms/articlesview.phtml b/application/modules/telephone/views/scripts/cms/articlesview.phtml new file mode 100644 index 0000000000000000000000000000000000000000..c3d17b45324cb9f93350ee274931c7d24a6b7dec --- /dev/null +++ b/application/modules/telephone/views/scripts/cms/articlesview.phtml @@ -0,0 +1,14 @@ +<?php +echo $this->toolbar($this->_('Articles'), + $this->url([], null, true)); + + +echo (0 < count($this->articles) + ? $this->tag('div', + $this->articleEventList($this->articles), + ['class' => 'liste']) + + : $this->tag('div', + $this->_('Aucun contenu'), + ['class' => 'pave'])); +?> diff --git a/application/modules/telephone/views/scripts/cms/articleviewbydate.phtml b/application/modules/telephone/views/scripts/cms/articleviewbydate.phtml index d2c75c4a1e169e02c5c16306a12e75977b57057b..2e3213be575e5b41f9e6569dae88755f8b45e55f 100644 --- a/application/modules/telephone/views/scripts/cms/articleviewbydate.phtml +++ b/application/modules/telephone/views/scripts/cms/articleviewbydate.phtml @@ -8,27 +8,8 @@ echo $this->toolbar($this->_('Articles'), <div class="liste"> <?php foreach ($this->articles as $bibliotheque => $articles) { ?> <h2><?php echo ('' == $bibliotheque) ? $this->_('Portail') : $this->libelle_bibs[$bibliotheque];?></h2> - <ul> - <?php - foreach ($articles as $article) { ?> - <li class="lien"> - <?php echo $this->tagArticleEvent($article);?> - <span><?php - echo $this->tagAnchor( - $this->url(array('cat' => $article->getIdCat())), - $article->getCategorie()->getLibelle(), - array('class' => 'calendar_event_info') - );?> - <?php - echo $this->tagAnchor( - $article->getUrl(), - $article->getTitre(), - array('class' => 'calendar_event_title') - ); ?> - </span> - </li> - <?php } ?> - </ul> - <?php } ?> + <?php echo $this->articleEventList($articles); ?> + <?php } ?> </div> <?php diff --git a/library/ZendAfi/View/Helper/Telephone/ArticleEventList.php b/library/ZendAfi/View/Helper/Telephone/ArticleEventList.php new file mode 100644 index 0000000000000000000000000000000000000000..928433acc504cfa68ab461e173e9836d56b1bb4b --- /dev/null +++ b/library/ZendAfi/View/Helper/Telephone/ArticleEventList.php @@ -0,0 +1,61 @@ +<?php +/** + * Copyright (c) 2012, 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_View_Helper_Telephone_ArticleEventList extends ZendAfi_View_Helper_BaseHelper { + public function articleEventList($articles) { + if (!$articles) + return ''; + + return $this->_tag('ul', + $this->_renderArticles($articles)); + } + + + protected function _renderArticles($articles) { + return implode('', + array_map([$this, '_renderArticle'], + $articles)); + } + + + protected function _renderArticle($article) { + return $this->_tag( + 'li', + $this->view->tagArticleEvent($article) + . $this->_tag('span', + $this->_renderArticleLinks($article) + ), + ['class' => 'lien']); + } + + + protected function _renderArticleLinks($article) { + return + $this->view->tagAnchor( + $this->view->url(['cat' => $article->getIdCat()]), + $article->getCategorie()->getLibelle(), + ['class' => 'calendar_event_info']) + . ' - ' + . $this->view->tagAnchor( + $article->getUrl(), + $article->getTitre(), + ['class' => 'calendar_event_title']); + } +} diff --git a/library/ZendAfi/View/Helper/Telephone/Library.php b/library/ZendAfi/View/Helper/Telephone/Library.php new file mode 100644 index 0000000000000000000000000000000000000000..0194af17a71cc3719d2ec462f94088a95b77b9e6 --- /dev/null +++ b/library/ZendAfi/View/Helper/Telephone/Library.php @@ -0,0 +1,22 @@ +<?php +/** + * Copyright (c) 2012, 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_View_Helper_Telephone_Library extends ZendAfi_View_Helper_Accueil_Library { +} \ No newline at end of file diff --git a/tests/application/modules/telephone/controllers/CmsControllerTest.php b/tests/application/modules/telephone/controllers/CmsControllerTest.php index c0c6b4bbea9e652884f7192c038175932567598b..9b44dbfc7b3c16bcebc29d056ebef4b4be8651b4 100644 --- a/tests/application/modules/telephone/controllers/CmsControllerTest.php +++ b/tests/application/modules/telephone/controllers/CmsControllerTest.php @@ -28,6 +28,35 @@ abstract class AbstractCmsControllerTelephoneTestCase extends TelephoneAbstractC ->newInstanceWithId(4) ->setTitre('Fete de la patate') ->setDescription('A Annecy !'); + + + Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') + ->whenCalled('getArticlesByPreferences') + ->answers([ + Class_Article::newInstanceWithId(1) + ->setTitre('La fête de la banane') + ->setContenu('Une fête qui glisse !') + ->setEventsDebut('2011-09-03') + ->setEventsFin('2011-10-03') + ->setCategorie( + Class_ArticleCategorie::newInstanceWithId(1) + ->setLibelle('Alimentaire') + ->setBib(Class_Bib::getLoader() + ->newInstanceWithId(1) + ->setLibelle('Bonlieu')) + ), + Class_Article::newInstanceWithId(1) + ->setTitre('La fête de la frite') + ->setContenu('') + ->setEventsDebut('2011-09-03') + ->setEventsFin('2011-09-03') + ->setCategorie( + Class_ArticleCategorie::newInstanceWithId(1) + ->setLibelle('Alimentaire') + ), + ]); + + } } @@ -94,38 +123,8 @@ class CmsControllerCalendarActionTest extends AbstractCmsControllerTelephoneTest class CmsControllerArticleViewByDateActionTest extends AbstractCmsControllerTelephoneTestCase { - public function setUp() { parent::setUp(); - - Storm_Test_ObjectWrapper::onLoaderOfModel('Class_Article') - ->whenCalled('getArticlesByPreferences') - ->answers(array( - Class_Article::getLoader() - ->newInstanceWithId(1) - ->setTitre('La fête de la banane') - ->setContenu('Une fête qui glisse !') - ->setEventsDebut('2011-09-03') - ->setEventsFin('2011-10-03') - ->setCategorie( - Class_ArticleCategorie::getLoader()->newInstanceWithId(1) - ->setLibelle('Alimentaire') - ->setBib(Class_Bib::getLoader() - ->newInstanceWithId(1) - ->setLibelle('Bonlieu')) - ), - Class_Article::getLoader() - ->newInstanceWithId(1) - ->setTitre('La fête de la frite') - ->setContenu('') - ->setEventsDebut('2011-09-03') - ->setEventsFin('2011-09-03') - ->setCategorie( - Class_ArticleCategorie::getLoader()->newInstanceWithId(1) - ->setLibelle('Alimentaire') - ), - )); - $this->dispatch('/telephone/cms/articleviewbydate?d=2011-10-01', true); } @@ -146,8 +145,39 @@ class CmsControllerArticleViewByDateActionTest extends AbstractCmsControllerTele /** @test */ public function feteDeLaBannaneShouldBeUnderBibBonlieu() { $this->assertXpathContentContains('//div[@class="liste"]/h2', 'Bonlieu'); - } } + + + +class CmsControllerArticleViewByDateWithModuleActionTest extends AbstractCmsControllerTelephoneTestCase { + public function setUp() { + parent::setUp(); + + Class_Profil::getCurrentProfil() + ->updateModuleConfigAccueil(2, + [ + 'division' => '1', + 'type_module' => 'NEWS', + 'preferences' => [ + 'titre' => 'last news', + 'rss_avis' => true, + 'type_aff' => 2, + 'display_order' => 'Title', + 'display_mode' => 'FullContent', + 'nb_aff' => 2, + 'nb_analyse' => 5 + ] + ]); + + $this->dispatch('/telephone/cms/articleviewbydate/id_module/2?d=2011-10-01', true); + } + + + /** @test */ + public function feteDeLaBananeShouldBePresent() { + $this->assertXpathContentContains('//ul//li//a', 'La fête de la banane'); + } +} ?> \ No newline at end of file diff --git a/tests/application/modules/telephone/controllers/IndexControllerTest.php b/tests/application/modules/telephone/controllers/IndexControllerTest.php index 31e984182cb72dc1cc5da86a07395bfc4b8338fb..b66ba5604b28f5ca4849aa77c95a9663cff352e2 100644 --- a/tests/application/modules/telephone/controllers/IndexControllerTest.php +++ b/tests/application/modules/telephone/controllers/IndexControllerTest.php @@ -69,7 +69,11 @@ abstract class AbstractIndexControllerTelephoneWithModulesTest extends Telephone '6' => ['division' => '1', 'type_module' => 'CRITIQUES', - 'preferences' => ['titre' => 'Critiques']] + 'preferences' => ['titre' => 'Critiques']], + + '7' => ['division' => '1', + 'type_module' => 'LIBRARY', + 'preferences' => ['titre' => 'Libraries']] ]]; $this->profil_adulte = $this->fixture('Class_Profil', ['id' => 2]) @@ -321,6 +325,12 @@ class IndexControllerTelephoneSimulationWithModulesTest extends AbstractIndexCon } + /** @test */ + public function libraryModuleTitleShouldBeLibraries() { + $this->assertXPathContentContains('//h2', 'Libraries'); + } + + /** @test */ function titreBoiteBibNumeriqueShouldBeMesAlbums() { $this->assertXPathContentContains('//div[contains(@class, "bib_numerique")]//div[@class="titre"]', 'Mes albums', $this->_response->getBody());