From 450b9d22c24b91742bbb03aa95f763014d9d76ce Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 30 Dec 2010 13:57:15 +0000 Subject: [PATCH] --- inc/ws/Controlleur/class.ws.droits.php | 14 +++++++++++ inc/ws/Controlleur/class.ws.flash.php | 2 +- inc/ws/DAO/_common.php | 1 + inc/ws/DAO/class.ws.dao.book.php | 11 ++++++++- inc/ws/DAO/class.ws.dao.signature.php | 28 ++++++++++++++++++++++ inc/ws/Metier/_common.php | 1 + inc/ws/Metier/class.ws.book.parametres.php | 3 ++- inc/ws/Metier/class.ws.signature.php | 11 +++++++++ 8 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 inc/ws/DAO/class.ws.dao.signature.php create mode 100644 inc/ws/Metier/class.ws.signature.php diff --git a/inc/ws/Controlleur/class.ws.droits.php b/inc/ws/Controlleur/class.ws.droits.php index 9acb02967..7e930fa4f 100644 --- a/inc/ws/Controlleur/class.ws.droits.php +++ b/inc/ws/Controlleur/class.ws.droits.php @@ -9,6 +9,20 @@ class wsDroits { $nav[__('Publications')] = 'publications'; return $nav; } + + public static function getSignatures() + { + global $core; + + $dao = new wsDAOSignature($core->con); + + $signatures = $dao->selectAll(); + $res = array(); + foreach($signatures as $signature) { + $res[$signature->nom] = $signature->signature_id; + } + return $res; + } } ?> \ No newline at end of file diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index 37d878f09..7c2eae359 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -298,7 +298,7 @@ class wsFlash extends cubeFlashGateway { $book = $dao->selectById($this->args['book_id']); fb($book->parametres->getForms()); foreach($book->parametres->getForms() as $name) { - $f = $this->xml->addChild('form', json_encode($book->parametres->getForm($name))); + $f = $this->xml->addChild('form', html::escapeHTML(json_encode($book->parametres->getForm($name)))); $f->addAttribute('name', $name); } } diff --git a/inc/ws/DAO/_common.php b/inc/ws/DAO/_common.php index c2822b216..aeb5f343f 100644 --- a/inc/ws/DAO/_common.php +++ b/inc/ws/DAO/_common.php @@ -4,5 +4,6 @@ $__autoload['wsDAODocument'] = dirname(__FILE__) . '/class.ws.dao.document.php'; $__autoload['wsDAOTheme'] = dirname(__FILE__) . '/class.ws.dao.theme.php'; $__autoload['wsDAOIcone'] = dirname(__FILE__) . '/class.ws.dao.icone.php'; $__autoload['wsDAOLang'] = dirname(__FILE__) . '/class.ws.dao.lang.php'; +$__autoload['wsDAOSignature'] = dirname(__FILE__) . '/class.ws.dao.signature.php'; ?> \ No newline at end of file diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 7747f63e8..94d57be40 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -327,7 +327,7 @@ class wsDAOBook extends extranetDAO { $parametres = $book->parametres; $new = json_decode($settings, false); foreach($new as $k => $v) { - if($k=='_empty_'){ + if ($k == '_empty_') { continue; } $parametres->$k = $v; @@ -526,6 +526,14 @@ class wsDAOBook extends extranetDAO { $daoTheme = new wsDAOTheme($this->con); $theme = $daoTheme->getThemeOfBook($book_id, true); + $daoSignature = new wsDAOSignature($this->con); + $signature = $daoSignature->selectById($book->parametres->signature); + + $exportSignature = array('main' => $signature->main, + 'mainLink' => $signature->mainLink, + 'partner' => $signature->partner, + 'partnerLink' => $signature->partnerLink); + $index = ''; $textes = ''; @@ -534,6 +542,7 @@ class wsDAOBook extends extranetDAO { $flex = new cubeFlexCompiler('FluidbookDatas', $compilerDir, 'flash.display.Sprite', explode(';', AS3_SOURCES), MXMLC_PATH); $flexLight = new cubeFlexCompiler('FluidbookDatasLight', $compilerDir, 'flash.display.Sprite', explode(';', AS3_SOURCES), MXMLC_PATH); $flex->addVariable('links', $book->links); + $flex->addVariable('signature', $exportSignature); $flexLight->addVariable('datas', $book->parametres->toStandardObject()); $flexLight->addVariable('id', $book_id, false, true, 'uint'); diff --git a/inc/ws/DAO/class.ws.dao.signature.php b/inc/ws/DAO/class.ws.dao.signature.php new file mode 100644 index 000000000..327395c8e --- /dev/null +++ b/inc/ws/DAO/class.ws.dao.signature.php @@ -0,0 +1,28 @@ +signature_id = $r->signature_id; + $signature->nom = $r->nom; + $signature->main = $r->fbcredit; + $signature->mainLink = $r->fblink; + $signature->partner = $r->partnercredit; + $signature->partnerLink = $r->partnerlink; + return $signature; + } + + public function selectById($signature_id) + { + $r = $this->con->select('SELECT * FROM signatures WHERE signature_id=\'' . $this->con->escape($signature_id) . '\''); + return $this->singleton($r); + } + + public function selectAll() + { + $r = $this->con->select('SELECT * FROM signatures ORDER BY signature_id'); + return $this->factory($r); + } +} + +?> \ No newline at end of file diff --git a/inc/ws/Metier/_common.php b/inc/ws/Metier/_common.php index 27c9ddacd..7f9d662d3 100644 --- a/inc/ws/Metier/_common.php +++ b/inc/ws/Metier/_common.php @@ -11,5 +11,6 @@ $__autoload['wsDocumentLocalInfos'] = dirname(__FILE__) . '/class.ws.document.lo $__autoload['wsBox'] = dirname(__FILE__) . '/class.ws.box.php'; $__autoload['wsIcone'] = dirname(__FILE__) . '/class.ws.icone.php'; $__autoload['wsLang'] = dirname(__FILE__) . '/class.ws.lang.php'; +$__autoload['wsSignature'] = dirname(__FILE__) . '/class.ws.signature.php'; ?> \ No newline at end of file diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index bcaec9e04..84ca2d485 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -18,8 +18,9 @@ class wsBookParametres extends wsParametres { } $this->fields['title'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Titre de la publication"), 'extra' => false, 'grade' => 1); $this->fields['url_link'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __("URL du lien de retour au site"), 'extra' => false, 'grade' => 1); + $this->fields['signature'] = array('type' => 'combo', 'default' => '1', 'editable' => true, 'label' => __('Signature'), 'extra' => false, 'grade' => 3, 'datas' => wsDroits::getSignatures()); $this->forms['important'] = array('label' => __('Description de la publication'), - 'fieldsnames' => array('title', 'url_link')); + 'fieldsnames' => array('title', 'url_link', 'signature')); // . // . $this->fields['friend'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Envoyer à un ami'), 'extra' => false, 'grade' => 1); diff --git a/inc/ws/Metier/class.ws.signature.php b/inc/ws/Metier/class.ws.signature.php new file mode 100644 index 000000000..110821ab2 --- /dev/null +++ b/inc/ws/Metier/class.ws.signature.php @@ -0,0 +1,11 @@ + \ No newline at end of file -- 2.39.5