]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 16 Mar 2010 18:26:43 +0000 (18:26 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 16 Mar 2010 18:26:43 +0000 (18:26 +0000)
inc/ws/Controlleur/class.ws.flash.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/DAO/class.ws.dao.theme.php
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Metier/class.ws.parametres.php
inc/ws/Metier/class.ws.theme.parametres.php

index cb7a8a5bd96baeaae199b0f91e65e0a0009aba8a..0b2b58a86279b4026cff59cfb219d1df58869dd1 100644 (file)
@@ -38,6 +38,20 @@ class wsFlash extends cubeFlashGateway {
                $_SESSION['conversionSession'][] = $document->document_id;\r
        }\r
 \r
+       public function uploadThemeFile()\r
+       {\r
+               foreach($_FILES as $varname => $infos) {\r
+                       if ($infos['error']) {\r
+                               continue;\r
+                       }\r
+                       $fname = cubeFiles::tidyName($infos['name']);\r
+                       $dest = '/themes/' . $this->args['theme_id'] . '/' . $fname;\r
+                       move_uploaded_file($infos['tmp_name'], ROOT . $dest);\r
+                       $this->xml->addChild('file', $fname);\r
+                       return;\r
+               }\r
+       }\r
+\r
        public function testDocuments()\r
        {\r
                $toload = $this->xml->addChild('toLoad');\r
@@ -151,15 +165,20 @@ class wsFlash extends cubeFlashGateway {
                }\r
        }\r
 \r
-       public function getForms()\r
+       public function getThemeForms()\r
        {\r
                global $core;\r
                $dao = new wsDAOTheme($core->con);\r
-               $theme = $dao->getThemeOfBook($this->args['book_id']);\r
+               $theme = $dao->selectById($this->args['theme_id']);\r
                foreach($theme->parametres->getForms() as $name) {\r
                        $f = $this->xml->addChild('form', json_encode($theme->parametres->getForm($name)));\r
                        $f->addAttribute('name', $name);\r
                }\r
+       }\r
+\r
+       public function getFluidbookForm()\r
+       {\r
+               global $core;\r
                $dao = new wsDAOBook($core->con);\r
                $book = $dao->selectById($this->args['book_id']);\r
                foreach($book->parametres->getForms() as $name) {\r
index 5b4952fe45d5f91496a3375837d9312a70c0c395..5e4eb1749c975b2019e59f147f6c797c639937e8 100644 (file)
@@ -20,10 +20,11 @@ class wsDAOBook extends extranetDAO {
 \r
                $p = unserialize($r->parametres);\r
                if (!$p) {\r
-                       $p = new wsBookParametres();\r
+                       $p = new wsBookParametres($book);\r
+               }else{\r
+                       $p->setParent($book);\r
                }\r
                $book->parametres = $p;\r
-\r
                return $book;\r
        }\r
 \r
index 0c5936c2827d94a0edc37ffa3300fea938dce5a8..4ae1659e3422b89801658d424145a648452e7c83 100644 (file)
@@ -11,13 +11,21 @@ class wsDAOTheme extends extranetDAO {
                $theme->icones = $r->icones;\r
                $p = unserialize($r->parametres);\r
                if (!$p) {\r
-                       $p = new wsThemeParametres();\r
+                       $p = new wsThemeParametres($theme);\r
+               }else{\r
+                       $p->setParent($theme);\r
                }\r
                $theme->parametres = $p;\r
 \r
                return $theme;\r
        }\r
 \r
+       public function selectById($theme_id)\r
+       {\r
+               $r = $this->con->select('SELECT * FROM themes WHERE theme_id=\'' . $this->con->escape($theme_id) . '\' LIMIT 1');\r
+               return $this->singleton($r);\r
+       }\r
+\r
        public function getThemeOfBook($book_id)\r
        {\r
                $r = $this->con->select('SELECT * FROM themes WHERE theme_id IN (SELECT theme FROM books WHERE book_id=\'' . $this->con->escape($book_id) . '\') LIMIT 1');\r
index 14ee0753af9711422050952e45f66b8cf65d13cf..f912fb93a530a5b67b43d80d9f8e8cd8cca9e247 100644 (file)
@@ -1,13 +1,16 @@
 <?php\r
 class wsBookParametres extends wsParametres {\r
-       public function __construct()\r
+       public function __construct($parent)\r
        {\r
-               parent::__construct();\r
+               parent::__construct($parent);\r
        }\r
 \r
        protected function initFields()\r
        {\r
                parent::initFields();\r
+               if (is_null($this->parent)) {\r
+                       return;\r
+               }\r
                // .\r
                $this->fields['general'] = __('Informations générales');\r
                $this->fields['pages'] = array('type' => 'integer', 'default' => '', 'editable' => false, 'label' => __('Nombre de pages'), 'extra' => false, 'grade' => 0);\r
index 4d5caf530d86230c38c16511f09fe5b3b6f707af..b6586d427fc0d0c18bea2be499822f30bfd0e8fd 100644 (file)
@@ -3,13 +3,21 @@ class wsParametres extends cubeMetier implements Iterator {
        protected $datas;\r
        protected $fields;\r
        protected $forms;\r
+       protected $parent;\r
        // Magic functions\r
-       public function __construct()\r
+       public function __construct($parent)\r
        {\r
+               $this->parent = $parent;\r
                $this->initFields();\r
                $this->datas = array();\r
        }\r
 \r
+       public function setParent($parent)\r
+       {\r
+               $this->parent = $parent;\r
+               $this->initFields();\r
+       }\r
+\r
        public function __set($varname, $value)\r
        {\r
                $this->set($varname, $value);\r
@@ -135,7 +143,8 @@ class wsParametres extends cubeMetier implements Iterator {
                return $f;\r
        }\r
 \r
-       public function getForms(){\r
+       public function getForms()\r
+       {\r
                return array_keys($this->forms);\r
        }\r
 \r
index dedff46695ac519c6308dc045a64dce77a32e7a2..8c20ef702ca82047dbd51a198fdc90387491a94b 100644 (file)
@@ -1,12 +1,15 @@
 <?php\r
 class wsThemeParametres extends wsParametres {\r
-       public function __construct()\r
+       public function __construct($parent)\r
        {\r
-               parent::__construct();\r
+               parent::__construct($parent);\r
        }\r
 \r
        public function initFields()\r
        {\r
+               if (is_null($this->parent)) {\r
+                       return;\r
+               }\r
                parent::initFields();\r
                $this->fields['couleurA'] = array('type' => 'couleur', 'default' => '', 'editable' => true,\r
                        'label' => __("Couleur principale (boutons, liens)"), 'extra' => false, 'grade' => 3);\r
@@ -20,6 +23,10 @@ class wsThemeParametres extends wsParametres {
                        'label' => __("Couleur des icônes"), 'extra' => false, 'grade' => 3);\r
                $this->fields['backgroundColor'] = array('type' => 'couleur', 'default' => 'ffffff', 'editable' => true,\r
                        'label' => __("Couleur du fond"), 'extra' => false, 'grade' => 3);\r
+               $this->fields['backgroundImage'] = array('type' => 'file', 'default' => 'backgroundImg.jpg', 'editable' => true,\r
+                       'label' => __('Image de fond'), 'extra' => false, 'grade' => 3,\r
+                       'path' => 'themes/' . $this->parent->theme_id,\r
+                       'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id);\r
                $this->fields['repeat'] = array('type' => 'combo',\r
                        'datas' => array(__('Etirer') => wsTheme::STRETCH,\r
                                __('Etirer le fond en conservant les proportions') => wsTheme::RATIO,\r
@@ -28,13 +35,26 @@ class wsThemeParametres extends wsParametres {
                        'default' => 0, 'editable' => true, 'label' => __('Affichage du fond'), 'grade' => 3);\r
                $this->fields['shadeOnMenu'] = array('type' => 'boolean', 'default' => true, 'editable' => true,\r
                        'label' => __('Ombre portée sous la barre du menu'), 'extra' => true, 'grade' => 4);\r
+               $this->fields['menuImage'] = array('type' => 'file', 'default' => 'menu_back.png', 'editable' => true,\r
+                       'label' => __('Image de fond'), 'extra' => false, 'grade' => 3,\r
+                       'path' => 'themes/' . $this->parent->theme_id,\r
+                       'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id);\r
+               $this->fields['logo'] = array('type' => 'file', 'default' => 'menu_clientLogo.png', 'editable' => true,\r
+                       'label' => __('Image'), 'extra' => false, 'grade' => 3,\r
+                       'path' => 'themes/' . $this->parent->theme_id,\r
+                       'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id);\r
+               $this->fields['logoLoader'] = array('type' => 'file', 'default' => 'logoLoader.png', 'editable' => true,\r
+                       'label' => __('Logo affiché au chargement'), 'extra' => false, 'grade' => 3,\r
+                       'path' => 'themes/' . $this->parent->theme_id,\r
+                       'uploadURL' => SITE_PATH . 'flash/uploadThemeFile/?theme_id=' . $this->parent->theme_id);\r
                $this->fields['pagesBar'] = array('type' => 'boolean', 'default' => true, 'editable' => true,\r
                        'label' => __("Afficher la barre d'accès rapide aux pages"), 'extra' => true, 'grade' => 4);\r
                $this->fields['shadeAlpha'] = array('type' => 'integer', 'default' => 100, 'editable' => true,\r
-                       'label' => __('Transparence des ombres sur les pages (100 : maximale - 0 : invisible)'), 'extra' => true, 'grade' => 4);\r
+                       'label' => __('Transparence des ombres sur les pages (100 : maximale - 0 : invisible)'), 'extra' => true, 'grade' => 4,\r
+                       'min' => 0, 'max' => 100);\r
                $this->fields['usePageEdges'] = array('type' => 'boolean', 'default' => true, 'editable' => true,\r
                        'label' => __("Afficher la bordure des pages"), 'extra' => true, 'grade' => 4);\r
-               $this->fields['arrowsColor'] = array('type' => 'color', 'default' => 'ffffff', 'editable' => true,\r
+               $this->fields['arrowsColor'] = array('type' => 'couleur', 'default' => 'ffffff', 'editable' => true,\r
                        'label' => __('Couleur des flèches des boutons de navigation (page suivante, page précédente)'), 'extra' => true, 'grade' => 4);\r
                $this->fields['pagesBarTxtColor'] = array('type' => 'color', 'default' => 'ffffff', 'editable' => true,\r
                        'label' => __("Couleur des numéros de page de la barre d'accès rapide aux pages"), 'extra' => true, 'grade' => 4);\r
@@ -45,16 +65,17 @@ class wsThemeParametres extends wsParametres {
                $this->fields['displayPageNumber'] = array('type' => 'boolean', 'default' => true, 'editable' => true,\r
                        'label' => __('Afficher les numéros de page'), 'extra' => false, 'grade' => 1);\r
 \r
-               $this->forms['background'] = array('label' => __('Personnalisation du fond'), 'fieldsnames' => array('backgroundColor', 'repeat'));\r
+               $this->forms['background'] = array('label' => __('Personnalisation du fond'), 'fieldsnames' => array('backgroundImage', 'backgroundColor', 'repeat'));\r
                $this->forms['bouton'] = array('label' => __('Personnalisation des boutons'), 'fieldsnames' => array('couleurA', 'arrowsColor'));\r
                $this->forms['icones'] = array('label' => __('Personnalisation des icônes'), 'fieldsnames' => array('couleurI'));\r
                $this->forms['pagebar'] = array('label' => __('Personnalisation de la barre des pages'),\r
                        'fieldsnames' => array('pagesBar', 'sections', 'pagesBarTxtColor'));\r
                $this->forms['book'] = array('label' => __('Personnalisation du fluidbook'),\r
                        'fieldsnames' => array('displayPageNumber', 'shadeAlpha', 'usePageEdges'));\r
-               $this->forms['menubar'] = array('label' => __('Personnalisation de la barre de menu'), 'fieldsnames' => array('shadeOnMenu'));\r
-               $this->forms['menu'] = array('label' => __('Personnalisation des menus'), 'fieldsnames' => array('couleurB', 'couleurS'));\r
-               $this->forms['loader'] = array('label' => __('Personnalisation du loader'), 'fieldsnames' => array('couleurL'));\r
+               $this->forms['menubar'] = array('label' => __('Personnalisation de la barre de menu'), 'fieldsnames' => array('shadeOnMenu', 'menuImage', 'couleurS'));\r
+               $this->forms['menu'] = array('label' => __('Personnalisation des menus'), 'fieldsnames' => array('couleurB'));\r
+               $this->forms['loader'] = array('label' => __('Personnalisation du loader'), 'fieldsnames' => array('couleurL', 'logoLoader'));\r
+               $this->forms['logo'] = array('label' => __('Personnalisation du logo'), 'fieldsnames' => array('logo','shadeAlpha'));\r
        }\r
 }\r
 \r