]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 30 Jul 2013 12:46:06 +0000 (12:46 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 30 Jul 2013 12:46:06 +0000 (12:46 +0000)
inc/commons/class.common.core.php
inc/ws/Controlleur/class.ws.ajax.php
inc/ws/Controlleur/class.ws.services.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.collection.php
inc/ws/Metier/class.ws.collection.php
inc/ws/Util/html5/app/class.ws.html5.app.compiler.php

index d773398110014ad0f27af533b0fb3c0ab507b2e0..e3609d948cba2098b7a1f50fd8e57aa28c5e3931 100644 (file)
@@ -436,6 +436,7 @@ class commonCore extends cubeCore {
                $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
index b0a7dca7988c89993b619d10cf76dc46bea9fdd1..29577b3bac4cc60f66343c1e136a2a32a36f55f2 100644 (file)
@@ -226,17 +226,15 @@ class wsAjax extends cubeAjax {
                        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
@@ -1145,5 +1143,4 @@ class wsAjax extends cubeAjax {
        }\r
 \r
 }\r
-\r
 ?>
\ No newline at end of file
index 64e979fd0208c8e0b61f07184a01fcc03a5017cd..7ed417d59d76046c4ab2b9da8827165f3159e7aa 100644 (file)
@@ -556,7 +556,6 @@ class wsServices extends cubeFlashGateway {
                $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
@@ -572,14 +571,15 @@ class wsServices extends cubeFlashGateway {
                        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
@@ -598,6 +598,7 @@ class wsServices extends cubeFlashGateway {
                        $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
@@ -613,7 +614,18 @@ class wsServices extends cubeFlashGateway {
 \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
@@ -621,7 +633,6 @@ class wsServices extends cubeFlashGateway {
 \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
index 165478a926e423e9b71f15cd1cfb8a1faa017b3e..31b74814fde694061361734f7d8a599c33322cc6 100644 (file)
@@ -245,6 +245,8 @@ class wsUrl {
                $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
@@ -269,6 +271,7 @@ class wsUrl {
                                $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
@@ -286,8 +289,21 @@ class wsUrl {
                        $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
@@ -301,7 +317,7 @@ class wsUrl {
 \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
@@ -609,7 +625,7 @@ class wsUrl {
                $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
index 8dcb356548fc4eea63df6610468968e15f0a8b24..900d714c394300bfc6f628e874c95d84b32c955a 100644 (file)
@@ -9,6 +9,7 @@ class wsDAOCollection extends commonDAO {
                $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 {
@@ -24,6 +25,13 @@ class wsDAOCollection extends commonDAO {
                } 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;
        }
 
@@ -51,12 +59,12 @@ class wsDAOCollection extends commonDAO {
        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]);
@@ -138,6 +146,10 @@ class wsDAOCollection extends commonDAO {
                }
        }
 
+       protected function _emptyContents() {
+               return array();
+       }
+
        protected function _emptySettings() {
                return array('phonegap' => '');
        }
index b7f521d9ca4b30ade4104ce24e8c601f36d05866..2de01df2ea2c8811c253f2007eac2f1e1ab22880 100644 (file)
@@ -10,6 +10,7 @@ class wsCollection extends cubeMetier {
        protected $datas;
        protected $settings;
        protected $theme;
+       protected $contents;
 
 }
 
index 7882bb2cf62cad7c2ccbf0d86e29954a120076bd..ec42321b36a46b7e39f0438e4e8d905cb436f57e 100644 (file)
@@ -133,7 +133,7 @@ class wsHTML5AppCompiler {
                $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);
 
@@ -148,7 +148,8 @@ class wsHTML5AppCompiler {
                $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+ */
@@ -156,9 +157,12 @@ class wsHTML5AppCompiler {
        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)
@@ -174,9 +178,6 @@ class wsHTML5AppCompiler {
        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));
        }