$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->contents('text', 0, false);\r
$db->book_collection->settings('text', 0, false);\r
$db->book_collection->proprietaire('integer', 0, false);\r
// Clés\r
move_uploaded_file($_FILES['apns_prod']['tmp_name'], $dir . '/apns_prod.pem');\r
}\r
\r
- $theme = array('back', 'etagere', 'icon', 'splash');\r
- foreach ($theme as $t) {\r
- if (isset($_FILES[$t]) && !$_FILES[$t]['error']) {\r
+ foreach ($_FILES as $t => $f) {\r
+\r
+ if (!$_FILES[$t]['error']) {\r
$ext = CubeIT_Files::getExtension($_FILES[$t]['name']);\r
move_uploaded_file($_FILES[$t]['tmp_name'], $wdir . '/' . $t . '.' . $ext);\r
$save['theme'][$t] = $t . '.' . $ext;\r
}\r
}\r
\r
-\r
-\r
foreach ($_POST['group'] as $gid => $group) {\r
if ($gid && $gid == 'new_') {\r
continue;\r
}\r
\r
}\r
-\r
?>
\ No newline at end of file
$os = $this->callArgs[1];\r
$local = (isset($this->callArgs[2])) ? $this->callArgs[2] : null;\r
\r
-\r
$this->outputXML = false;\r
header('Content-type: application/json');\r
\r
exit;\r
}\r
\r
-\r
-\r
$limit = TIME - 72000;\r
if (!file_exists($cache) || !file_exists($update) || filemtime($cache) < $limit) {\r
$r = $core->con->select('SELECT * FROM book_collection_compile WHERE online=1 AND collection_id=\'' . $core->con->escape($id) . '\'');\r
$r->fetch();\r
$version = $r->compile_date;\r
\r
+ $daoCollection = new wsDAOCollection($core->con);\r
+ $collection = $daoCollection->selectById($id);\r
+\r
$vcompo = WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/composition.json';\r
$composition = json_decode(file_get_contents($vcompo));\r
\r
$daoBook = new wsDAOBook($core->con);\r
$books = $daoBook->selectByIds($publications);\r
\r
+ $langsnames = array();\r
foreach ($composition as $k => $g) {\r
foreach ($g->publications as $l => $p) {\r
$book = $books[$p->id];\r
\r
$langs = array_unique($langs);\r
\r
- $d = array('id' => $id, 'langs' => $langs, 'time' => $version, 'datas' => $composition, 'couvertures' => $couvertures);\r
+ foreach ($langs as $lang) {\r
+ $langsnames[$lang] = cubeLang::getNameByCode($lang);\r
+ }\r
+\r
+\r
+ $traductions = array();\r
+ $r = $core->con->select('SELECT traductions,lang_id FROM langues WHERE lang_id IN(\'' . implode('\',\'', $langs) . '\')');\r
+ while ($r->fetch()) {\r
+ $traductions[$r->lang_id] = json_decode($r->traductions);\r
+ }\r
+\r
+ $d = array('id' => $id, 'langs' => $langs, 'langnames' => $langsnames, 'time' => $version, 'datas' => $composition, 'couvertures' => $couvertures, 'traductions' => $traductions, 'contents' => $collection->contents);\r
$d = array_merge($d, $this->_getManifest($publications, '/fluidbook/collections/versions/' . $id . '/' . $version . '/' . $os, $books));\r
\r
$dao = new wsDAOCollection($core->con);\r
\r
$json = json_encode($d);\r
file_put_contents($cache, $json);\r
-\r
file_put_contents($update, $version);\r
} else {\r
$d = json_decode(file_get_contents($cache), true);\r
$datas = $collection->datas;\r
$datas['new_'] = $dao->_emptyGroup();\r
\r
+ $langs = array();\r
+\r
foreach ($datas as $gid => $group) {\r
$class = 'group';\r
if ($gid && $gid == 'new_') {\r
$res.='<li class="publication" data-publication="' . $pid . '"><div>';\r
if (isset($books[$publication['id']])) {\r
$book = $books[$publication['id']];\r
+ $langs[] = $book->lang;\r
} else {\r
$book = new stdClass();\r
$book->lang = '';\r
$res.='</ul>';\r
$res.='</li>';\r
}\r
+\r
+ $langs = array_unique($langs);\r
+\r
$res.='</ul>';\r
\r
+ foreach ($langs as $l) {\r
+ $res.='<h3>' . __('Contenus') . ' [' . $l . ']</h3>';\r
+ $res.='<table class="max">';\r
+ $res.='<tr><td class="min nowrap">' . __('Titre') . '</td><td>' . form::field(array('contents[' . $l . '][titre]', 'contents_' . $l . '_titre'), 64, 64, $collection->contents[$l]['titre']) . '</td></tr>';\r
+ $res.='<tr><td class="min nowrap">' . __('A propos') . '</td><td>' . form::textarea(array('contents[' . $l . '][apropos]', 'contents_' . $l . '_apropos'), 60, 10, $collection->contents[$l]['apropos']) . '</td></tr>';\r
+ //'splash' => \r
+ $res.='<tr><td class="min nowrap">' . __('Ecran de lancement') . ' (2048x2048px)</td><td><input type="file" name="splash_' . $l . '" />' . form::hidden(array('theme[splash' . $l . ']', 'splash_' . $l), $collection->theme['splash_' . $l]) . '</td></tr>';\r
+ $res.='</table>';\r
+ }\r
+\r
$v = wsHTML5Compiler::getPhonegapVersions();\r
$phonegapVersions = array_combine($v, $v);\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"), 'icon' => __("Icône de l'application") . ' (1024x1024px)', 'splash' => __('Ecran de lancement') . ' (2048x2048px)');\r
+ $images = array('back' => __('Image de fond'), 'etagere' => __("Image de l'étagère"), 'icon' => __("Icône de l'application") . ' (1024x1024px)');\r
foreach ($images as $i => $label) {\r
$res.='<tr><td class="min nowrap">' . $label . '</td><td><input type="file" name="' . $i . '" />' . form::hidden(array('theme[' . $i . ']', 'theme_' . $i), $collection->theme[$i]) . '</td></tr>';\r
}\r
$res .= commonPage::bf();\r
\r
$res .= commonPage::bh();\r
- $res .= cubeLang::translationForm(array(PLAYER_SOURCES, WS_COMPILE_ASSETS . '/_html5'), $lang_id, null, 'liste', array(), '<a href="#" class="submit">' . $core->typo->Ajouter(__('Enregistrer')) . '</a>', $lang->traductions);\r
+ $res .= cubeLang::translationForm(array(__('Version Flash') => PLAYER_SOURCES, __('Version HTML5') => WS_COMPILE_ASSETS . '/_html5', __('Application') => WS_COMPILE_ASSETS . '/_html5app'), $lang_id, null, 'liste', array(), '<a href="#" class="submit">' . $core->typo->Ajouter(__('Enregistrer')) . '</a>', $lang->traductions);\r
$res .= commonPage::bf();\r
$res .= '</form>';\r
return $res;\r
$collection->proprietaire = $r->proprietaire;
$collection->proprietaire_nom = $r->proprietaire_nom;
$collection->proprietaire_utilisateur = $r->proprietaire_utilisateur;
+
if (CubeIT_Util_Json::isJson($r->datas)) {
$collection->datas = CubeIT_Util_Json::decode($r->datas, CubeIT_Util_Json::TYPE_ARRAY);
} else {
} else {
$collection->theme = $this->_emptySettings();
}
+
+ if (CubeIT_Util_Json::isJson($r->contents)) {
+ $collection->contents = CubeIT_Util_Json::decode($r->contents, CubeIT_Util_Json::TYPE_ARRAY);
+ } else {
+ $collection->contents = $this->_emptyContents();
+ }
+
return $collection;
}
public function sauve($data, $createur = null) {
$c = $this->con->openCursor('book_collection');
$c->nom = $data['nom'];
-
+
if (!is_null($createur) && $data['collection_id'] == 'new') {
$c->proprietaire = $createur;
}
- $composites = array('datas', 'settings','theme');
+ $composites = array('datas', 'settings', 'theme', 'contents');
foreach ($composites as $cc) {
if (isset($data[$cc])) {
$c->$cc = CubeIT_Util_Json::encode($data[$cc]);
}
}
+ protected function _emptyContents() {
+ return array();
+ }
+
protected function _emptySettings() {
return array('phonegap' => '');
}
protected $datas;
protected $settings;
protected $theme;
+ protected $contents;
}
$c[] = '#shelves{background-image:url("images/' . $this->collection->theme['etagere'] . '");}';
// Menus
- $menuColor = new CubeIT_Graphics_Color($this->collection->settings['couleurB']);
+ $menuColor = new CubeIT_Graphics_Color($this->collection->settings['couleurA']);
$textColor = new CubeIT_Graphics_Color($this->collection->settings['couleurC']);
$menuColor->setAlpha(1);
$bottom = $menuMultiply->toCSS();
$border = $menuMultiply2->setAlpha(0.6)->toCSS();
- $caption = ".mview .caption{
+ $caption = ".mview .caption, #bar{
+
background-image: -moz-linear-gradient(top, $top 0%, $bottom 100%); /* FF3.6+ */
background-image: -webkit-linear-gradient(top, $top 0%,$bottom 100%); /* Chrome10+,Safari5.1+ */
background-image: -o-linear-gradient(top, $top 0%,$bottom 100%); /* Opera 11.10+ */
background-image: linear-gradient(top bottom, $top 0%,$bottom 100%); /* W3C */
}";
+ $caption.='#bar,.mview{color:' . $textColor->toCSS() . '}';
$caption.=".mview .caption a{
border:1px solid $border;
}";
+
+ $caption.="#bar{border-bottom:1px solid " . $border . "}";
$c[] = $caption;
# Chapters (menu lists)
background-image: linear-gradient(top bottom, $top 0%,$bottom 100%); /* W3C */
border-bottom:1px solid $border;
}";
-
-
-
file_put_contents($this->vdir . '/data/app.css', implode("\n", $c));
}