From 07bcb3baa20914f3b454213a4c718f21e1c85c76 Mon Sep 17 00:00:00 2001
From: Ghislain Loas <ghislo@sandbox.pergame.net>
Date: Fri, 5 Jun 2015 11:33:54 +0200
Subject: [PATCH] community slider_navigation add unit to defaults.ini

---
 .../View/Helper/Admin/ImageViewersOptions.php | 20 +++++++++----------
 .../java/diaporama_navigation/defaults.ini    |  1 +
 .../controllers/AccueilControllerCmsTest.php  | 11 ++++++++--
 3 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/library/ZendAfi/View/Helper/Admin/ImageViewersOptions.php b/library/ZendAfi/View/Helper/Admin/ImageViewersOptions.php
index 236f17c1680..c2ae791a159 100644
--- a/library/ZendAfi/View/Helper/Admin/ImageViewersOptions.php
+++ b/library/ZendAfi/View/Helper/Admin/ImageViewersOptions.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
  */
 
 
@@ -26,9 +26,9 @@ class ZendAfi_View_Helper_Admin_ImageViewersOptions extends ZendAfi_View_Helper_
 	const STYLE_TYPE_FLASH= 'flash';
 
 
-	protected		
-		$_preferences, 
-		$_propertiesPath, 
+	protected
+		$_preferences,
+		$_propertiesPath,
 		$_valuesPath,
 		$_styles = [self::STYLE_TYPE_JAVA => ['diaporama' => 'Diaporama',
 																					'diaporama_navigation' => 'Diaporama avec navigation',
@@ -41,13 +41,13 @@ class ZendAfi_View_Helper_Admin_ImageViewersOptions extends ZendAfi_View_Helper_
 		$this->_preferences = $preferences;
 		$html = $this->_getComboStyles();
 		$this->_ensureOneStyle();
-		$html.= (isset($preferences['style_liste']) 
+		$html.= (isset($preferences['style_liste'])
 		 ?  (new ZendAfi_View_Helper_Admin_PropertiesReader())
 						 ->setView($this->view)
 						 ->propertiesReader($preferences['style_liste'],
 																$preferences)
 						 : '');
-		
+
 
 		return $html;
 	}
@@ -58,17 +58,17 @@ class ZendAfi_View_Helper_Admin_ImageViewersOptions extends ZendAfi_View_Helper_
 			. '<option value="none">Liste</option>'
 			. $this->_getComboTypedStyles(self::STYLE_TYPE_JAVA,
 																		$this->translate()->_('Objets java-script'))
-			. $this->_getComboTypedStyles(self::STYLE_TYPE_FLASH, 
+			. $this->_getComboTypedStyles(self::STYLE_TYPE_FLASH,
 																		$this->translate()->_('Objets flash'))
 			. '</select>'
 			. '<input type="hidden" id="styles_reload" name="styles_reload" value="0">';
 	}
 
 
-	/** 
+	/**
 	 * @param string $styleKey
 	 * @param string $groupLabel
-	 * @return string 
+	 * @return string
 	 */
 	protected function _getComboTypedStyles($styleKey, $groupLabel) {
 		$html = '';
@@ -81,7 +81,7 @@ class ZendAfi_View_Helper_Admin_ImageViewersOptions extends ZendAfi_View_Helper_
 		$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) 
+			$current = (array_key_exists('style_liste', $this->_preferences)
 									&& $this->_preferences['style_liste'] == $k);
 			$html .= '<option style="color:#666666" value="' . $k . '" ' . (($current) ? 'selected="selected"' : '') . '>' . $v . '</option>';
 		}
diff --git a/public/opac/java/diaporama_navigation/defaults.ini b/public/opac/java/diaporama_navigation/defaults.ini
index b1840be32dd..ca6e0dc6f16 100644
--- a/public/opac/java/diaporama_navigation/defaults.ini
+++ b/public/opac/java/diaporama_navigation/defaults.ini
@@ -1,4 +1,5 @@
 navigation_mode="buttons"
 navigation_window_width="350"
 navigation_window_height="250"
+navigation_unit="px"
 navigation_cycle=0
\ No newline at end of file
diff --git a/tests/application/modules/admin/controllers/AccueilControllerCmsTest.php b/tests/application/modules/admin/controllers/AccueilControllerCmsTest.php
index 940766c8d77..0b9ff8629ce 100644
--- a/tests/application/modules/admin/controllers/AccueilControllerCmsTest.php
+++ b/tests/application/modules/admin/controllers/AccueilControllerCmsTest.php
@@ -77,14 +77,21 @@ class Admin_AccueilControllerCmsTestWithDefaultDiaporamaNavigation extends Admin
 
 	/** @test */
 	public function windowWidthShouldBeSetTo350px() {
-		$this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_window_width"][@value="350px"]');
+		$this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_window_width"][@value="350"]');
 	}
 
 
 	/** @test */
 	public function windowHeightShouldBeSetTo250px() {
-		$this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_window_height"][@value="250px"]');
+		$this->assertXPath('//div[@id="objet_props"]//input[@name="op_navigation_window_height"][@value="250"]');
 	}
+
+
+	/** @test */
+	public function unitShouldBeSetToPx() {
+		$this->assertXPath('//div[@id="objet_props"]//select[@name="op_navigation_unit"]/option[@value="px"]');
+	}
+
 }
 
 
-- 
GitLab