$db->signatures->fblink('varchar', 64, false);\r
$db->signatures->partnercredit('varchar', 64, false);\r
$db->signatures->partnerlink('varchar', 64, false);\r
- $db->signatures->active('integer', 0, false,'1');\r
+ $db->signatures->active('integer', 0, false, '1');\r
// Clés\r
$db->signatures->primary('pk_signatures', 'signature_id');\r
// Table jeux d'icones\r
$db->book_collection->collection_id('integer', 0, false);\r
$db->book_collection->nom('varchar', 64, false);\r
$db->book_collection->datas('text', 0, false);\r
+ $db->book_collection->theme('text', 0, false);\r
$db->book_collection->proprietaire('integer', 0, false);\r
// Clés\r
$db->book_collection->primary('pk_book_collection', 'collection_id');\r
+ // Table des compilations de collection\r
+ $db->book_collection_compile->collection_id('integer', 0, false);\r
+ $db->book_collection_compile->compile_date('integer', 0, false);\r
+ $db->book_collection_compile->online('integer', 0, false);\r
+ $db->book_collection_compile->primary('book_collection_compile', 'collection_id', 'compile_date');\r
// Table des droits\r
$db->ws_users_tree->utilisateur_id('integer', 0, false);\r
$db->ws_users_tree->entreprise_id('integer', 0, false);\r
$db->ws_users_tree->facturable_id('integer', 0, false);\r
$db->ws_users_tree->facturable_entreprise_id('integer', 0, false);\r
$db->ws_users_tree->administrateur_id('integer', 0, false);\r
- // Clé\r
+ // Clé \r
$db->ws_users_tree->primary('pk_utilisateur_id', 'utilisateur_id');\r
// Table des entreprises\r
$db->ws_entreprises_tree->entreprise_id('integer', 0, false);\r
global $core;\r
$dao = new wsDAOCollection($core->con);\r
\r
- $save = array('nom' => $_POST['nom'],\r
- 'collection_id' => $_POST['collection_id']);\r
+ $save = $_POST;\r
\r
$datas = array();\r
foreach ($_POST['group'] as $gid => $group) {\r
\r
$datas[] = $group;\r
}\r
+\r
+ unset($save['group']);\r
+\r
if (count($datas) == 0) {\r
$datas = $dao->_emptyCollection();\r
}\r
$res.='<tr><td class="min nowrap">' . __('Nom de la collection') . '</td><td>' . form::field('nom', 20, 64, $collection->nom) . '</td></tr>';\r
\r
$res.='</table>';\r
- $res.='<h3>Composition</h3>';\r
+ $res.='<h3>' . __('Composition') . '</h3>';\r
$res .= '<ul>';\r
\r
\r
$dao = new wsDAOCollection($core->con);\r
$books = $dao->getPublications($collection->collection_id);\r
\r
+\r
$datas = $collection->datas;\r
$datas['new_'] = $dao->_emptyGroup();\r
\r
$res.='</li>';\r
}\r
$res.='</ul>';\r
+\r
+ $phonegapVersions = array('2.8.1' => '2.8.1');\r
+\r
+ $res.='<h3>' . __('Paramètres avancés') . '</h3>';\r
+ $res.='<table class="max">';\r
+ $res.='<tr><td class="min nowrap">' . __('Version phonegap') . '</td><td>' . form::combo(array('settings[phonegap]','phonegap'), $phonegapVersions, $collection->settings['phonegap']) . '</td></tr>';\r
+ $res.='</table>';\r
+\r
+\r
+ $res.='<h3>' . __('Thème') . '</h3>';\r
+ $res.='<table class="max">';\r
+ $images = array('back' => __('Image de fond'), 'etagere' => __("Image de l'étagère"));\r
+ foreach ($images as $i => $label) {\r
+ $res.='<tr><td class="min nowrap">' . $label . '</td><td><input type="file" name="' . $i . '" /></td></tr>';\r
+ }\r
+ $res.='</table>';\r
+\r
+\r
$res.='<a href="#" class="submit right">' . $core->typo->Ajouter(__('Enregistrer')) . '</a>';\r
$res.='</form>';\r
$res.='<p class="clear"></p>';\r
+ $res.='<h3>' . __('Versions') . '</h3>';\r
+\r
+\r
return $res;\r
}\r
\r
$res.='<hr />';\r
\r
$res.='<h2>' . __('Réimporter les liens du fichier PDF') . '</h2>';\r
- $res.='<a class="restoreLink" rel="'.$book_id.'/pdf" href="#">Restaurer</a>';\r
+ $res.='<a class="restoreLink" rel="' . $book_id . '/pdf" href="#">Restaurer</a>';\r
$res.='<hr />';\r
\r
$res.='<h2>' . __('Historique') . '</h2>';\r
} 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;
}
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;
}
}
+ protected function _emptySettings() {
+ return array('phonegap' => '');
+ }
+
+ protected function _emptyTheme() {
+ return array('background' => '', 'etagere' => '');
+ }
+
}
?>
<?php
class wsCollection extends cubeMetier {
+
protected $collection_id;
protected $nom;
protected $proprietaire;
protected $proprietaire_nom;
protected $proprietaire_utilisateur;
protected $datas;
+ protected $settings;
+ protected $theme;
+
}
?>
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);
}
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);
}
}
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';
$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;
}
$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.='<div class="logo"><img src="data/images/' . $this->theme->parametres->logoLoader . '" width="' . $dim[0] . '" height="' . $dim[1] . '" alt="" /></div>';
+ if ($dim !== false) {
+ $this->copy($this->themeRoot . '/' . $this->theme->parametres->logoLoader, $this->vdir . '/data/images/' . $this->theme->parametres->logoLoader);
+ $splash.='<div class="logo"><img src="data/images/' . $this->theme->parametres->logoLoader . '" width="' . $dim[0] . '" height="' . $dim[1] . '" alt="" /></div>';
+ }
}
$vars = array('titre', 'credits', 'ga', 'style', 'script', 'pagesContents', 'description', 'print', 'hiddenContents', 'splash');
$cc = $cpages[$i];
}
$this->config->links[$i] = $c;
- $this->config->clinks[$i] = $cc;
+ $this->config->clinks[$i] = $cc;
}
return $css;
}
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');
}
}
$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') {
$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();
$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');