From: vincent@cubedesigners.com Date: Fri, 14 Jun 2013 18:04:20 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=767964618596638a3960b8645fee8655343654da;p=cubeextranet.git --- diff --git a/inc/commons/class.common.core.php b/inc/commons/class.common.core.php index a7809a24f..c6b67e875 100644 --- a/inc/commons/class.common.core.php +++ b/inc/commons/class.common.core.php @@ -280,7 +280,7 @@ class commonCore extends cubeCore { $db->signatures->fblink('varchar', 64, false); $db->signatures->partnercredit('varchar', 64, false); $db->signatures->partnerlink('varchar', 64, false); - $db->signatures->active('integer', 0, false,'1'); + $db->signatures->active('integer', 0, false, '1'); // Clés $db->signatures->primary('pk_signatures', 'signature_id'); // Table jeux d'icones @@ -426,16 +426,22 @@ class commonCore extends cubeCore { $db->book_collection->collection_id('integer', 0, false); $db->book_collection->nom('varchar', 64, false); $db->book_collection->datas('text', 0, false); + $db->book_collection->theme('text', 0, false); $db->book_collection->proprietaire('integer', 0, false); // Clés $db->book_collection->primary('pk_book_collection', 'collection_id'); + // Table des compilations de collection + $db->book_collection_compile->collection_id('integer', 0, false); + $db->book_collection_compile->compile_date('integer', 0, false); + $db->book_collection_compile->online('integer', 0, false); + $db->book_collection_compile->primary('book_collection_compile', 'collection_id', 'compile_date'); // Table des droits $db->ws_users_tree->utilisateur_id('integer', 0, false); $db->ws_users_tree->entreprise_id('integer', 0, false); $db->ws_users_tree->facturable_id('integer', 0, false); $db->ws_users_tree->facturable_entreprise_id('integer', 0, false); $db->ws_users_tree->administrateur_id('integer', 0, false); - // Clé + // Clé $db->ws_users_tree->primary('pk_utilisateur_id', 'utilisateur_id'); // Table des entreprises $db->ws_entreprises_tree->entreprise_id('integer', 0, false); diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index 455c7edf5..c12c1820a 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -206,8 +206,7 @@ class wsAjax extends cubeAjax { global $core; $dao = new wsDAOCollection($core->con); - $save = array('nom' => $_POST['nom'], - 'collection_id' => $_POST['collection_id']); + $save = $_POST; $datas = array(); foreach ($_POST['group'] as $gid => $group) { @@ -228,6 +227,9 @@ class wsAjax extends cubeAjax { $datas[] = $group; } + + unset($save['group']); + if (count($datas) == 0) { $datas = $dao->_emptyCollection(); } diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 213cff4f4..952ee548d 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -237,13 +237,14 @@ class wsUrl { $res.='' . __('Nom de la collection') . '' . form::field('nom', 20, 64, $collection->nom) . ''; $res.=''; - $res.='

Composition

'; + $res.='

' . __('Composition') . '

'; $res .= ''; + + $phonegapVersions = array('2.8.1' => '2.8.1'); + + $res.='

' . __('Paramètres avancés') . '

'; + $res.=''; + $res.=''; + $res.='
' . __('Version phonegap') . '' . form::combo(array('settings[phonegap]','phonegap'), $phonegapVersions, $collection->settings['phonegap']) . '
'; + + + $res.='

' . __('Thème') . '

'; + $res.=''; + $images = array('back' => __('Image de fond'), 'etagere' => __("Image de l'étagère")); + foreach ($images as $i => $label) { + $res.=''; + } + $res.='
' . $label . '
'; + + $res.='' . $core->typo->Ajouter(__('Enregistrer')) . ''; $res.=''; $res.='

'; + $res.='

' . __('Versions') . '

'; + + return $res; } @@ -777,7 +799,7 @@ html{height:100%}' . "\n"; $res.='
'; $res.='

' . __('Réimporter les liens du fichier PDF') . '

'; - $res.='Restaurer'; + $res.='Restaurer'; $res.='
'; $res.='

' . __('Historique') . '

'; diff --git a/inc/ws/DAO/class.ws.dao.collection.php b/inc/ws/DAO/class.ws.dao.collection.php index 8e7f98cff..8dcb35654 100644 --- a/inc/ws/DAO/class.ws.dao.collection.php +++ b/inc/ws/DAO/class.ws.dao.collection.php @@ -14,6 +14,16 @@ class wsDAOCollection extends commonDAO { } else { $collection->datas = $this->_emptyCollection(); } + if (CubeIT_Util_Json::isJson($r->settings)) { + $collection->settings = CubeIT_Util_Json::decode($r->settings, CubeIT_Util_Json::TYPE_ARRAY); + } else { + $collection->settings = $this->_emptySettings(); + } + if (CubeIT_Util_Json::isJson($r->theme)) { + $collection->theme = CubeIT_Util_Json::decode($r->theme, CubeIT_Util_Json::TYPE_ARRAY); + } else { + $collection->theme = $this->_emptySettings(); + } return $collection; } @@ -41,13 +51,18 @@ class wsDAOCollection extends commonDAO { public function sauve($data, $createur = null) { $c = $this->con->openCursor('book_collection'); $c->nom = $data['nom']; - if (isset($data['datas'])) { - $c->datas = CubeIT_Util_Json::encode($data['datas']); - } + if (!is_null($createur) && $data['collection_id'] == 'new') { $c->proprietaire = $createur; } + $composites = array('datas', 'settings','theme'); + foreach ($composites as $cc) { + if (isset($data[$cc])) { + $c->$cc = CubeIT_Util_Json::encode($data[$cc]); + } + } + if ($data['collection_id'] == 'new') { $r = $this->con->select('SELECT MAX(collection_id) AS collection_id FROM collections_vue'); $c->collection_id = $r->collection_id + 1; @@ -123,6 +138,14 @@ class wsDAOCollection extends commonDAO { } } + protected function _emptySettings() { + return array('phonegap' => ''); + } + + protected function _emptyTheme() { + return array('background' => '', 'etagere' => ''); + } + } ?> diff --git a/inc/ws/Metier/class.ws.collection.php b/inc/ws/Metier/class.ws.collection.php index 0ae3f7d52..b7f521d9c 100644 --- a/inc/ws/Metier/class.ws.collection.php +++ b/inc/ws/Metier/class.ws.collection.php @@ -1,12 +1,16 @@ diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index f2d4b315f..19ad74b58 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -2,7 +2,7 @@ class wsHTML5Compiler { - public static function factory($book_id, $version = 'stable', $phonegap = false, $dir = null, $standalone = false) { + public static function factory($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false) { if (is_null($version)) { global $core; $dao = new wsDAOBook($core->con); @@ -11,9 +11,9 @@ class wsHTML5Compiler { } if ($version == 'stable') { - return new wsHTML5Compiler($book_id, 'stable', $phonegap, $dir, $standalone); + return new wsHTML5Compiler($book_id, 'stable', $phonegap, $phonegapVersion, $dir, $standalone); } else { - return new wsHTML5CompilerDev($book_id, 'dev', $phonegap, $dir, $standalone); + return new wsHTML5CompilerDev($book_id, 'dev', $phonegap, $phonegapVersion, $dir, $standalone); } } @@ -136,13 +136,14 @@ class wsHTML5Compiler { protected $config = array(); protected $assets = ''; protected $phonegap = false; + protected $phonegapVersion; protected $standalone = false; protected $hiddenContents = array(); - function __construct($book_id, $version = 'stable', $phonegap = false, $dir = null, $standalone = false) { + function __construct($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false) { global $core; - + $this->phonegapVersion = $this->getPhonegapVersion($phonegapVersion); if ($version == 'stable') { $this->assets = WS_COMPILE_ASSETS . '/_html5prod'; @@ -220,6 +221,24 @@ class wsHTML5Compiler { $this->config = cubeObject::merge($this->book->parametres->toStandardObject(), $this->theme->parametres->toStandardObject()); } + public function getPhonegapVersion($v) { + if ($v != 'latest') { + return $v; + } + + $versions = array(); + + $dr = opendir(WS_COMPILE_ASSETS . '/_html5/js/libs/phonegap'); + while ($file = readdir($dr)) { + if ($file == '.' || $file == '..' || $file == 'plugins') { + continue; + } + $versions[] = $file; + } + usort($versions, 'version_compare'); + return array_pop($versions); + } + public function getCssScale() { return $this->cssScale; } @@ -517,8 +536,10 @@ class wsHTML5Compiler { $splash = ''; if ($this->theme->parametres->logoLoader) { $dim = getimagesize($this->themeRoot . '/' . $this->theme->parametres->logoLoader); - $this->copy($this->themeRoot . '/' . $this->theme->parametres->logoLoader, $this->vdir . '/data/images/' . $this->theme->parametres->logoLoader); - $splash.=''; + if ($dim !== false) { + $this->copy($this->themeRoot . '/' . $this->theme->parametres->logoLoader, $this->vdir . '/data/images/' . $this->theme->parametres->logoLoader); + $splash.=''; + } } $vars = array('titre', 'credits', 'ga', 'style', 'script', 'pagesContents', 'description', 'print', 'hiddenContents', 'splash'); @@ -714,7 +735,7 @@ class wsHTML5Compiler { $cc = $cpages[$i]; } $this->config->links[$i] = $c; - $this->config->clinks[$i] = $cc; + $this->config->clinks[$i] = $cc; } return $css; } @@ -778,7 +799,8 @@ class wsHTML5Compiler { if ($this->phonegap) { - $this->copy($this->assets . '/js/libs/phonegap/cordova-' . $this->phonegap . '.js', $this->vdir . '/data/cordova.js'); + fb($this->phonegapVersion); + $this->copy(WS_COMPILE_ASSETS . '/_html5/js/libs/phonegap/' . $this->phonegapVersion . '/cordova-' . $this->phonegap . '.js', $this->vdir . '/data/cordova.js'); } } @@ -1036,7 +1058,7 @@ class wsHTML5Compiler { $res[] = 'footer,footer a{color:' . self::colorToCSS($this->theme->parametres->creditsColor) . ';}'; // Arrows - $res[] = '#next,#previous,#down{background-color:' . self::colorToCSS($this->theme->parametres->couleurA) . ';}'; + $res[] = '#next,#previous{background-color:' . self::colorToCSS($this->theme->parametres->couleurA) . ';}'; // Book shadow $shadowColor = self::colorToCSS($this->theme->parametres->bookShadeColor); if ($shadowColor != 'transparent') { @@ -1071,13 +1093,11 @@ class wsHTML5Compiler { $res[] = '.mview{background-color:' . $menuColor->toCSS() . ';color:' . self::colorToCSS($this->theme->parametres->subTextColor) . ';}'; // Archives - if ($this->book->parametres->externalArchivesBack) { $this->copy($this->wdir . '/' . $this->book->parametres->externalArchivesBack, $this->vdir . '/data/images/' . $this->book->parametres->externalArchivesBack); $res[] = '.mview.archives{background-image:url("../images/' . $this->book->parametres->externalArchivesBack . '");}'; } - # Topbar $top = $menuColor->toCSS(); $bottom = $menuMultiply->toCSS(); diff --git a/inc/ws/Util/packager/class.ws.packager.phonegap.php b/inc/ws/Util/packager/class.ws.packager.phonegap.php index 0dffa2227..34ceffbbd 100644 --- a/inc/ws/Util/packager/class.ws.packager.phonegap.php +++ b/inc/ws/Util/packager/class.ws.packager.phonegap.php @@ -29,7 +29,7 @@ class wsPackagerPhonegap extends wsPackager { $vdir.='/' . $os; } - $compiler = wsHTML5Compiler::factory($this->book_id, null, $os, $vdir); + $compiler = wsHTML5Compiler::factory($this->book_id, null, $os, 'latest', $vdir); $compiler->compile(); unlink($vdir . '/indext.html');