diff --git a/.gitattributes b/.gitattributes index dd5750617751750f8d4dccf2bdcb5908a9140243..f1f7c1803a28f307c42db8ffb932586b8eaf5f9e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -335,6 +335,7 @@ application/modules/admin/views/scripts/accueil/news.phtml -text application/modules/admin/views/scripts/accueil/prets.phtml -text application/modules/admin/views/scripts/accueil/rechguidee.phtml -text application/modules/admin/views/scripts/accueil/rechsimple.phtml -text +application/modules/admin/views/scripts/accueil/reservations.phtml -text application/modules/admin/views/scripts/accueil/rss.phtml -text application/modules/admin/views/scripts/accueil/sitotheque.phtml -text application/modules/admin/views/scripts/accueil/tags.phtml -text @@ -1860,6 +1861,7 @@ library/Class/Systeme/ModulesAccueil/Null.php -text library/Class/Systeme/ModulesAccueil/Prets.php -text library/Class/Systeme/ModulesAccueil/RechercheGuidee.php -text library/Class/Systeme/ModulesAccueil/RechercheSimple.php -text +library/Class/Systeme/ModulesAccueil/Reservations.php -text library/Class/Systeme/ModulesAccueil/Rss.php -text library/Class/Systeme/ModulesAccueil/Sitotheque.php -text library/Class/Systeme/ModulesAccueil/Tags.php -text @@ -4594,6 +4596,7 @@ tests/library/ZendAfi/View/Helper/Accueil/LangueTest.php -text tests/library/ZendAfi/View/Helper/Accueil/MenuVerticalTest.php -text tests/library/ZendAfi/View/Helper/Accueil/NewsTest.php -text tests/library/ZendAfi/View/Helper/Accueil/PretsTest.php -text +tests/library/ZendAfi/View/Helper/Accueil/ReservationsTest.php -text tests/library/ZendAfi/View/Helper/Accueil/RssTest.php -text tests/library/ZendAfi/View/Helper/Accueil/SitoTest.php -text tests/library/ZendAfi/View/Helper/Accueil/TagsTest.php -text diff --git a/application/modules/admin/controllers/AccueilController.php b/application/modules/admin/controllers/AccueilController.php index aa2674737a8e536ab6bdb90a84e5057826595a40..eb92ac65bd74ccdbbc2f30c01ae0172895793db1 100644 --- a/application/modules/admin/controllers/AccueilController.php +++ b/application/modules/admin/controllers/AccueilController.php @@ -140,6 +140,10 @@ class Admin_AccueilController extends Zend_Controller_Action { $this->_simpleAction(); } + public function reservationsAction() { + $this->_simpleAction(); + } + public function bibliothequeNumeriqueAction() { if (1 == $this->_getParam('styles_reload')) { $this->view->preferences = $this->_request->getPost(); diff --git a/application/modules/admin/views/scripts/accueil/reservations.phtml b/application/modules/admin/views/scripts/accueil/reservations.phtml new file mode 100644 index 0000000000000000000000000000000000000000..d042e2a15925c0d48ad99ff1cbbd7f41fe840285 --- /dev/null +++ b/application/modules/admin/views/scripts/accueil/reservations.phtml @@ -0,0 +1,24 @@ +<center> +<h1>Propriétés du module Réservations</h1><br> +<div class="formTable"> + <form method="post" action="<?php echo $this->url ?>"> + + <fieldset> + <legend>Affichage</legend> + <table cellspacing="2"> + + <tr> + <td class="droite">Style de boite </td> + <td class="gauche"><?php echo $this->combo_templates ?></td> + </tr> + <tr> + <td class="droite">Titre de la boite </td> + <td class="gauche"><input type="text" name="titre" size="52" value="<?php print($this->preferences["titre"]); ?>"></td> + </tr> + + </table> + </fieldset> + + <?php echo $this->formSubmit("Valider","Valider",array("class" => "bouton")) ?> + </form> + </div> diff --git a/categories.org b/categories.org index d49fc2cc7fced8ed05bdf0c033feaef5a3db7874..70db40af12bf2d570b0bf33a75e56d1ef42f9c96 100644 --- a/categories.org +++ b/categories.org @@ -217,3 +217,6 @@ var openDialogExemplaires = function() { <span id="bloc_reserver"><a href="#" onclick="openDialogExemplaires();return false"> » <?php echo $this->_('Réserver') ?></a></span> #+END_SRC * Boites +** Affichage "propriétés de la boite" +[[file:application/modules/admin/controllers/AccueilController.php::public%20function%20reservationsAction()%20{][Action Mes reservations]] +[[file:application/modules/admin/views/scripts/accueil/reservations.phtml][Html de la boite propriete]] diff --git a/library/Class/Systeme/ModulesAccueil.php b/library/Class/Systeme/ModulesAccueil.php index aa330195a26594440d2518edd074da770506d26b..e8a785eedfbbbe466843ddbd190d9c7c19f4eaaf 100644 --- a/library/Class/Systeme/ModulesAccueil.php +++ b/library/Class/Systeme/ModulesAccueil.php @@ -117,6 +117,7 @@ class Class_Systeme_ModulesAccueil extends Class_Systeme_ModulesAbstract { 'COMPTEURS' => new Class_Systeme_ModulesAccueil_Compteurs, 'LANGUE' => new Class_Systeme_ModulesAccueil_Langue, 'BIB_NUMERIQUE' => new Class_Systeme_ModulesAccueil_BibliothequeNumerique, + 'RESERVATIONS' => new Class_Systeme_ModulesAccueil_Reservations, 'PRETS' => new Class_Systeme_ModulesAccueil_Prets ]; } diff --git a/library/Class/Systeme/ModulesAccueil/Reservations.php b/library/Class/Systeme/ModulesAccueil/Reservations.php new file mode 100644 index 0000000000000000000000000000000000000000..5714070869412ef4e7d214d1155be362ab99badc --- /dev/null +++ b/library/Class/Systeme/ModulesAccueil/Reservations.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * AFI-OPAC 2.0 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). + * + * AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +class Class_Systeme_ModulesAccueil_Reservations extends Class_Systeme_ModulesAccueil_Null{ + /** @var string */ + protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO; + + /** @var string */ + protected $_libelle = 'Réservations'; + + /** @var string */ + protected $_action = 'reservations'; + + /** @var int */ + protected $_popupWidth = 570; + + /** @var int */ + protected $_popupHeight = 400; + + /** @var array */ + protected $_defaultValues = array( + 'titre' => "Mes réservations", // Titre de la boite + ); + +} +?> \ No newline at end of file diff --git a/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php b/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php index a2ba0539246ce5f36ac43486b67cef2609878c3a..6236aaf2fa064ab01cde6cc2f76812a2a0bb6aee 100644 --- a/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php +++ b/tests/application/modules/admin/controllers/ProfilControllerPageAccueilTest.php @@ -39,6 +39,10 @@ abstract class Admin_ProfilControllerJeunessePageAccueilTestCase extends Admin_A 'type_module' => 'CRITIQUES', 'preferences' => array()), + '8' => array('division' => 1, + 'type_module' => 'RESERVATIONS', + 'preferences' => array()), + '9' => array('division' => 1, 'type_module' => 'PRETS', 'preferences' => array()), @@ -93,6 +97,17 @@ class Admin_ProfilControllerJeunessePageAccueilTest extends Admin_ProfilControll } + /** @test */ + public function boiteReservationsShouldBeAvailable() { + $this->assertXPathContentContains('//ul[@id="allItems"]/li[@id="RESERVATIONS"]','Réservations',$this->_response->getBody()); + } + + /** @test */ + public function boiteReservationsShouldBeInDivisionOne() { + $this->assertXPath('//ul[@id="box1"]/li[@id="RESERVATIONS"][@id_module="8"]//img[contains(@onclick,"accueil/reservations")]'); + } + + /** @test */ public function boiteNewsShouldBeInDivisionOne() { $this->assertXPath('//ul[@id="box1"]/li[@id="NEWS"][@id_module="2"]'); @@ -346,4 +361,52 @@ class Admin_ProfilControllerJeunessePageAccueilConfigEmptyPretTest extends Admin $this->assertXPath('//input[@name="titre"][@value="Mes prêts"]'); } } + + +class Admin_ProfilControllerJeunessePageAccueilConfigReservationsTest extends Admin_ProfilControllerJeunessePageAccueilTestCase { + public function setup() { + parent::setup(); + $this->dispatch('admin/accueil/reservations?config=admin&id_profil=7&type_module=RESERVATIONS&id_module=8&proprietes=boite=/titre=Mes reservations/',true); + } + + /** @test */ + public function actionShouldBeReservations() { + $this->assertAction('reservations'); + } + + /** @test */ + public function titleShouldBeProprieteDuModuleReservations() { + $this->assertXPathContentContains('//h1','Propriétés du module Réservations'); + } + + + /** @test */ + public function comboBoiteShouldBePresent() { + $this->assertXPath('//select[@name="boite"]/option[@value="boite_de_la_division_droite"]'); + } + + + /** @test */ + public function titreInputShouldHaveValueMesReservations() { + $this->assertXPath('//input[@name="titre"][@value="Mes reservations"]'); + } + +} + + + +class Admin_ProfilControllerJeunessePageAccueilConfigEmptyReservationTest extends Admin_ProfilControllerJeunessePageAccueilTestCase { + + public function setup() { + parent::setup(); + $this->dispatch('admin/accueil/reservations?config=admin&id_profil=7&type_module=RESERVATIONS&id_module=8',true); + + } + + /** @test */ + public function titreInputShouldHaveValueMesReservations() { + $this->assertXPath('//input[@name="titre"][@value="Mes réservations"]',$this->html); + } +} + ?> \ No newline at end of file diff --git a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php index 3f84bcad368c4602db4a26bfd8e82b522c739471..551ddde4f81df040993c4bf428ea13192e0122d7 100644 --- a/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php +++ b/tests/application/modules/opac/controllers/ProfilOptionsControllerTest.php @@ -272,6 +272,10 @@ abstract class ProfilOptionsControllerProfilJeunesseWithPagesJeuxMusiqueTestCase '4' => ['division' => '1', 'type_module' => 'NEWS'], + '8' => ['division' => '2', + 'type_module' => 'RESERVATIONS', + 'preferences' => ['titre' => 'Mes réservations']], + '9' => ['division' => '2', 'type_module' => 'PRETS', 'preferences' => ['titre' => 'Mes documents'] @@ -487,6 +491,13 @@ class ProfilOptionsControllerViewProfilJeunesseAccueilTest extends ProfilOptions } + + /** @test */ + public function boiteMesReservationsShouldBeVisibleInProfilJeunesse() { + $this->assertXPath("//div[@class='boite_reservations']"); + } + + /** @test */ public function boiteNewsShouldBeVisibleInProfilJeunesse() { $this->assertXPathContentContains("//a[contains(@href, 'articleviewselection')]",'Articles'); diff --git a/tests/library/ZendAfi/View/Helper/Accueil/ReservationsTest.php b/tests/library/ZendAfi/View/Helper/Accueil/ReservationsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..d9cafdafecd1d854882e71f86feef21ffebeff76 --- /dev/null +++ b/tests/library/ZendAfi/View/Helper/Accueil/ReservationsTest.php @@ -0,0 +1,123 @@ +<?php +/** + * Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved. + * + * AFI-OPAC 2.0 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). + * + * AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ +require_once 'library/ZendAfi/View/Helper/ViewHelperTestCase.php'; + + +class ReservationsTestWithConnectedUser extends ViewHelperTestCase { + public function setUp() { + parent::setUp(); + + $helper = new ZendAfi_View_Helper_Accueil_Reservations(2, [ + 'type_module'=>'RESERVATIONS', + 'division' => '1', + 'preferences' => [ + 'titre' => 'Mes reservations']]); + $account = new StdClass(); + $account->ID_USER = '123456'; + ZendAfi_Auth::getInstance()->getStorage()->write($account); + $user=Class_Users::newInstanceWithId('123456',['nom'=>'Estelle']); + $propaganda = new Class_WebService_SIGB_Reservation('13', new Class_WebService_SIGB_Exemplaire(456)); + $propaganda->getExemplaire() + ->setTitre('Propaganda') + ->setNoticeOPAC(Class_Notice::newInstanceWithId(1234)); + + $propaganda->setEtat('Pas disponible'); + + $en_suivant_emma = new Class_WebService_SIGB_Reservation('13', new Class_WebService_SIGB_Exemplaire(456)); + $en_suivant_emma->getExemplaire() + ->setTitre('En suivant Emma') + ->setNoticeOPAC(Class_Notice::newInstanceWithId(333)); + + $en_suivant_emma->setEtat('Disponible'); + $emprunteur = new Class_WebService_SIGB_Emprunteur('1234', 'Estelle'); + $user->setFicheSigb(['fiche'=>$emprunteur]); + + $emprunteur->reservationsAddAll(array( $propaganda,$en_suivant_emma)); + $this->html = $helper->getBoite(); + } + + + /** @test */ + public function h1ShouldContainsMesReservations () { + $this->assertXPathContentContains($this->html,'//h1','Mes reservations'); + } + + + /** @test */ + public function listShouldDisplayPropagandaNotice() { + $this->assertXPathContentContains($this->html,'//ul//li','Propaganda'); + } + + /** @test */ + public function listShouldDisplayEnSuivantEmmaNotice() { + $this->assertXPathContentContains($this->html,'//ul//li','En suivant Emma'); + } + + + /** @test */ + public function etatPasDisponibleShouldBeDisplayed () { + $this->assertXPathContentContains($this->html,'//ul//li','Pas disponible'); + } + + + /** @test */ + public function titlePropagandaShouldBeLinkedToNotice () { + $this->assertXPath($this->html,'//ul//li//a[contains(@href,"/recherche/viewnotice/clef//id/1234")]',$this->html); + } + + + + /** @test */ + public function titleShouldBeLinkedToAbonneReservations () { + $this->assertXPath($this->html,'//h1//a[contains(@href,"/abonne/reservations")]',$this->html); + } + + +} + + +class ReservationsTestWithNonConnectedUser extends ViewHelperTestCase { + public function setUp() { + parent::setUp(); + + $this->helper = new ZendAfi_View_Helper_Accueil_Reservations(2, [ + 'type_module'=>'RESERVATIONS', + 'division' => '1', + 'preferences' => ['titre' => 'Mes reservations']] + ); + $this->html = $this->helper->getBoite(); + } + + + /** @test */ + public function boiteReservationsShouldNotBeDisplayed () { + $this->assertEmpty($this->html); + } + + + /** @test */ + public function boiteReservationsShouldNotCacheContents () { + $this->assertFalse($this->helper->shouldCacheContent()); + } + +} + +?> \ No newline at end of file