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