Skip to content
Snippets Groups Projects
Commit 2eb8610b authored by Ghislain Loas's avatar Ghislain Loas
Browse files

dev#13138 adding new display mode for news widget

parent 3f9a384f
Branches
Tags
3 merge requests!258Dev/13872 Orphee Allow Hold Available Items,!87Dev#13138,!72Dev#13138
......@@ -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]);
......
navigation_mode="buttons"
\ No newline at end of file
<?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;
?>
<?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
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment