diff --git a/library/ZendAfi/View/Helper/Admin/ImageViewersOptions.php b/library/ZendAfi/View/Helper/Admin/ImageViewersOptions.php index fe1e0fdec2f7013374397d31f8b96cac620fdfdf..ebc59c1eef046123e4e9863295596099e25a569c 100644 --- a/library/ZendAfi/View/Helper/Admin/ImageViewersOptions.php +++ b/library/ZendAfi/View/Helper/Admin/ImageViewersOptions.php @@ -18,35 +18,28 @@ * 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 ZendAfi_View_Helper_Admin_ImageViewersOptions extends ZendAfi_View_Helper_BaseHelper { const STYLE_TYPE_JAVA = 'java'; const STYLE_TYPE_FLASH= 'flash'; - /** @var array */ - private $_styles = array(self::STYLE_TYPE_JAVA => array( - 'diaporama' => 'Diaporama', - 'booklet' => 'Livre')); - - /** @var array */ - private $_preferences; - /** @var string */ - private $_propertiesPath; + protected + $_preferences, + $_propertiesPath, + $_valuesPath, + $_styles = [self::STYLE_TYPE_JAVA => ['diaporama' => 'Diaporama', + 'diaporama_navigation' => 'Diaporama avec navigation', + 'booklet' => 'Livre']]; - /** @var string */ - private $_valuesPath; - /** - * @param array $preferences - * @return string - */ public function imageViewersOptions($preferences) { Class_ScriptLoader::getInstance()->loadJQueryUI(); $this->_preferences = $preferences; - $html = $this->_getComboStyles(); - $this->_ensureOneStyle(); $html .= $this->_getProperties(); @@ -54,8 +47,7 @@ class ZendAfi_View_Helper_Admin_ImageViewersOptions extends ZendAfi_View_Helper_ } - /** @return string */ - private function _getComboStyles() { + protected function _getComboStyles() { return '<select name="style_liste" onchange="getId(\'styles_reload\').value=\'1\';document.forms[0].submit();">' . '<option value="none">Liste</option>' . $this->_getComboTypedStyles(self::STYLE_TYPE_JAVA, @@ -72,7 +64,7 @@ class ZendAfi_View_Helper_Admin_ImageViewersOptions extends ZendAfi_View_Helper_ * @param string $groupLabel * @return string */ - private function _getComboTypedStyles($styleKey, $groupLabel) { + protected function _getComboTypedStyles($styleKey, $groupLabel) { $html = ''; if (!array_key_exists($styleKey, $this->_styles) @@ -93,7 +85,7 @@ class ZendAfi_View_Helper_Admin_ImageViewersOptions extends ZendAfi_View_Helper_ /** @return bool */ - private function _hasProperties() { + protected function _hasProperties() { $defaultsValues = $this->_preferences['style_liste'] . '/defaults.ini'; $defaultsProperties = $this->_preferences['style_liste'] . '/properties.phtml'; @@ -114,7 +106,7 @@ class ZendAfi_View_Helper_Admin_ImageViewersOptions extends ZendAfi_View_Helper_ /** @return string */ - private function _getProperties() { + protected function _getProperties() { $html = ''; if (!$this->_hasProperties()) { return $html; @@ -151,7 +143,7 @@ class ZendAfi_View_Helper_Admin_ImageViewersOptions extends ZendAfi_View_Helper_ } - private function _ensureOneStyle() { + protected function _ensureOneStyle() { if (!array_key_exists('style_liste', $this->_preferences) || ('' == $this->_preferences['style_liste'])) { $keys = array_keys($this->_styles[self::STYLE_TYPE_JAVA]); diff --git a/public/opac/java/diaporama_navigation/defaults.ini b/public/opac/java/diaporama_navigation/defaults.ini new file mode 100644 index 0000000000000000000000000000000000000000..1ae0068e516f26a14f5a8952acbef16f37c81656 --- /dev/null +++ b/public/opac/java/diaporama_navigation/defaults.ini @@ -0,0 +1 @@ +navigation_mode="buttons" \ No newline at end of file diff --git a/public/opac/java/diaporama_navigation/properties.phtml b/public/opac/java/diaporama_navigation/properties.phtml new file mode 100644 index 0000000000000000000000000000000000000000..695f89a7d8eafe9686cdc75d472706800ba3c8b3 --- /dev/null +++ b/public/opac/java/diaporama_navigation/properties.phtml @@ -0,0 +1,10 @@ +<?php +$form = new ZendAfi_Form(); +$form->addElement('select', + 'op_navigation_mode', + ['label' => $form->getView()->_('Mode de navigation'), + 'value' => $this->preferences['op_navigation_mode'], + 'multiOptions' => ['buttons' => $this->_('Un bouton pour chaque élément'), + 'next_previous' => $this->_('Boutons précédent et suivant')]]); +echo $form; +?> diff --git a/tests/application/modules/admin/controllers/AccueilControllerCmsTest.php b/tests/application/modules/admin/controllers/AccueilControllerCmsTest.php new file mode 100644 index 0000000000000000000000000000000000000000..2bf22c1018e38c019df50582a434b5d1e403eb4d --- /dev/null +++ b/tests/application/modules/admin/controllers/AccueilControllerCmsTest.php @@ -0,0 +1,64 @@ +<?php +/** + * Copyright (c) 2012-2014, 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 Admin_AccueilControllerCmsTest extends Admin_AbstractControllerTestCase{ + public function setUp() { + parent::setUp(); + + + $this->fixture('Class_Profil', + ['id' => 1, + 'libelle' => 'Afibre']) + ->updateModuleConfigAccueil(1, ['type_module' => 'NEWS', + 'division' => 1, + 'id_module' => 1, + 'preferences' => ['style_liste' => 'diaporama_navigation']]) + ->beCurrentProfil(); + + $this->dispatch('admin/accueil/news?config=accueil&id_profil=1&id_module=1&type_module=NEWS', true); + } + + + /** @test */ + public function selectShouldContainsSlideShow() { + $this->assertXPathContentContains('//select/optgroup[@label="Objets java-script"]/option', 'Diaporama avec navigation'); + } + + + /** @test */ + public function diaporamaNavigationShouldBeSelected() { + $this->assertXPathContentContains('//select/optgroup[@label="Objets java-script"]/option[@value="diaporama_navigation"][@selected="selected"]', 'Diaporama avec navigation', $this->_response->getBody()); + } + + + /** @test */ + public function navigationModeShouldBeDisplay() { + $this->assertXPath('//div[@id="objet_props"]//select[@name="op_navigation_mode"]'); + } + + + /** @test */ + public function navigationModeShouldBeSetToButtons() { + $this->assertXPathContentContains('//div[@id="objet_props"]//select[@name="op_navigation_mode"]/option[@value="buttons"][@selected="selected"]', 'Un bouton pour chaque élément', $this->_response->getBody()); + } +} +?> \ No newline at end of file