From fb46f22a6dc5acd4c74130398fcc8ad7095b8d9f Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 22 Mar 2017 17:57:42 +0000 Subject: [PATCH] wip #1254 @0.5 --- inc/ws/Controlleur/class.ws.url.php | 15 ++++++--------- inc/ws/Metier/class.ws.book.parametres.php | 4 ++-- inc/ws/Metier/class.ws.parametres.php | 15 +++++++++++---- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 36e650b38..1fd96e2eb 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -131,15 +131,7 @@ class wsUrl { $res .= '' . $book->version . ''; } if ($book->version > 1 || $droits->admin) { - if ($droits->admin) { - $res .= '' . $btVoir . ''; - } else { - $viewURL = SITE_PATH . 'viewer/' . $book->book_id . '_' . $book->hash; - if ($book->parametres->version == 1) { - $viewURL = SITE_PATH . 'viewer1/' . $book->book_id . '_' . $book->hash; - } - $res .= '' . $btVoir . ''; - } + $res .= '' . $btVoir . ''; $res .= '' . $btEdit . ''; } else { $res .= ''; @@ -592,6 +584,11 @@ class wsUrl { //array('version' => 'viewerhu', 'title' => __('Widget HTML5'), 'icon' => cubeMedia::image(IMG . '/html5bug.png'), 'file' => 'widget.html', 'pattern' => '$1_$2_$3'), array('version' => 'viewer1', 'title' => __('Version 1'), 'icon' => cubeMedia::image(IMG . '/flash.png')) ); + } else { + $viewers = array(array('version' => 'viewer', 'title' => __('Version Flash'), 'icon' => cubeMedia::image(IMG . '/flash.png')), + array('version' => 'viewerh', 'title' => __('Version HTML5'), 'icon' => cubeMedia::image(IMG . '/html5.png')) + ); + } $res = '
'; diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index aea4d5fed..40bbdecbf 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -88,7 +88,7 @@ class wsBookParametres extends wsParametres { __('Mode 2D (caméra fixe et pages à plat)') => '1', __("Laisser le choix à l'utilisateur (mode 3D par défaut)") => '2', __("Laisser le choix à l'utilisateur (mode 2D par défaut)") => '3')); - $this->fields['viewMode'] = array('type' => 'combo', 'default' => '3', 'editable' => true, 'label' => __("Mode de visualisation (beta)"), + $this->fields['viewMode'] = array('type' => 'combo', 'default' => '0', 'editable' => true, 'label' => __("Mode de visualisation (beta)"), 'datas' => array(__('Classique') => '0', __("Diaporama") => '1'), 'grade' => 5); $this->fields['antialiasReading'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Amélioration de la lisibilité en mode 2D")); @@ -321,7 +321,7 @@ class wsBookParametres extends wsParametres { $this->fields['navOrderH'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Ordre des icônes dans la nav') . ' (' . __('Si différente') . ')', 'grade' => 3); - $this->fields['mobileLVersion'] = array('type' => 'combo', 'default' => 'stable', 'editable' => true, 'label' => __('Version logicielle'), 'grade' => 5, + $this->fields['mobileLVersion'] = array('type' => 'combo', 'default' => 'stable', 'editable' => true, 'label' => __('Version logicielle'), 'grade' =>1, 'datas' => array(__('Stable') => 'stable', __('En cours de développement') => 'dev') ); diff --git a/inc/ws/Metier/class.ws.parametres.php b/inc/ws/Metier/class.ws.parametres.php index 9ac085d1c..13436960f 100644 --- a/inc/ws/Metier/class.ws.parametres.php +++ b/inc/ws/Metier/class.ws.parametres.php @@ -12,6 +12,7 @@ class wsParametres extends cubeMetier implements Iterator { $this->parent = $parent; $this->initFields(); $this->datas = array(); + $this->setDefaultValues(); } public function isEmpty() { @@ -76,6 +77,14 @@ class wsParametres extends cubeMetier implements Iterator { $this->forms = array(); } + protected function setDefaultValues() { + foreach ($this->fields as $k => $f) { + if (isset($f["default"])) { + $this->set($k, $f['default']); + } + } + } + protected function set($varname, $value) { if (!$this->_isset($varname)) { throw new Exception('You are setting an attribute (' . get_class($this) . '::' . $varname . ') which not exists'); @@ -107,10 +116,8 @@ class wsParametres extends cubeMetier implements Iterator { $value = cubeMath::fill(ltrim($value, '#'), 6); break; case 'couleurAlpha': - fb($value); $value = cubeMath::fill(ltrim($value, '#'), 6); - $value = cubeMath::fill($value,8,'f'); - fb($value); + $value = cubeMath::fill($value, 8, 'f'); break; case 'date': if (!is_int($value)) { @@ -122,7 +129,7 @@ class wsParametres extends cubeMetier implements Iterator { $value = array_pop($e); break; default: - $value = (string) $value; + $value = (string)$value; break; } // switch $this->datas[$varname] = $value; -- 2.39.5