From: vincent@cubedesigners.com Date: Tue, 30 Jul 2013 12:46:06 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=ecc1142b8d894c0a1f87b10521cfb92734817acc;p=cubeextranet.git --- diff --git a/inc/commons/class.common.core.php b/inc/commons/class.common.core.php index d77339811..e3609d948 100644 --- a/inc/commons/class.common.core.php +++ b/inc/commons/class.common.core.php @@ -436,6 +436,7 @@ class commonCore extends cubeCore { $db->book_collection->nom('varchar', 64, false); $db->book_collection->datas('text', 0, false); $db->book_collection->theme('text', 0, false); + $db->book_collection->contents('text', 0, false); $db->book_collection->settings('text', 0, false); $db->book_collection->proprietaire('integer', 0, false); // Clés diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index b0a7dca79..29577b3ba 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -226,17 +226,15 @@ class wsAjax extends cubeAjax { move_uploaded_file($_FILES['apns_prod']['tmp_name'], $dir . '/apns_prod.pem'); } - $theme = array('back', 'etagere', 'icon', 'splash'); - foreach ($theme as $t) { - if (isset($_FILES[$t]) && !$_FILES[$t]['error']) { + foreach ($_FILES as $t => $f) { + + if (!$_FILES[$t]['error']) { $ext = CubeIT_Files::getExtension($_FILES[$t]['name']); move_uploaded_file($_FILES[$t]['tmp_name'], $wdir . '/' . $t . '.' . $ext); $save['theme'][$t] = $t . '.' . $ext; } } - - foreach ($_POST['group'] as $gid => $group) { if ($gid && $gid == 'new_') { continue; @@ -1145,5 +1143,4 @@ class wsAjax extends cubeAjax { } } - ?> \ No newline at end of file diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index 64e979fd0..7ed417d59 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -556,7 +556,6 @@ class wsServices extends cubeFlashGateway { $os = $this->callArgs[1]; $local = (isset($this->callArgs[2])) ? $this->callArgs[2] : null; - $this->outputXML = false; header('Content-type: application/json'); @@ -572,14 +571,15 @@ class wsServices extends cubeFlashGateway { exit; } - - $limit = TIME - 72000; if (!file_exists($cache) || !file_exists($update) || filemtime($cache) < $limit) { $r = $core->con->select('SELECT * FROM book_collection_compile WHERE online=1 AND collection_id=\'' . $core->con->escape($id) . '\''); $r->fetch(); $version = $r->compile_date; + $daoCollection = new wsDAOCollection($core->con); + $collection = $daoCollection->selectById($id); + $vcompo = WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/composition.json'; $composition = json_decode(file_get_contents($vcompo)); @@ -598,6 +598,7 @@ class wsServices extends cubeFlashGateway { $daoBook = new wsDAOBook($core->con); $books = $daoBook->selectByIds($publications); + $langsnames = array(); foreach ($composition as $k => $g) { foreach ($g->publications as $l => $p) { $book = $books[$p->id]; @@ -613,7 +614,18 @@ class wsServices extends cubeFlashGateway { $langs = array_unique($langs); - $d = array('id' => $id, 'langs' => $langs, 'time' => $version, 'datas' => $composition, 'couvertures' => $couvertures); + foreach ($langs as $lang) { + $langsnames[$lang] = cubeLang::getNameByCode($lang); + } + + + $traductions = array(); + $r = $core->con->select('SELECT traductions,lang_id FROM langues WHERE lang_id IN(\'' . implode('\',\'', $langs) . '\')'); + while ($r->fetch()) { + $traductions[$r->lang_id] = json_decode($r->traductions); + } + + $d = array('id' => $id, 'langs' => $langs, 'langnames' => $langsnames, 'time' => $version, 'datas' => $composition, 'couvertures' => $couvertures, 'traductions' => $traductions, 'contents' => $collection->contents); $d = array_merge($d, $this->_getManifest($publications, '/fluidbook/collections/versions/' . $id . '/' . $version . '/' . $os, $books)); $dao = new wsDAOCollection($core->con); @@ -621,7 +633,6 @@ class wsServices extends cubeFlashGateway { $json = json_encode($d); file_put_contents($cache, $json); - file_put_contents($update, $version); } else { $d = json_decode(file_get_contents($cache), true); diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 165478a92..31b74814f 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -245,6 +245,8 @@ class wsUrl { $datas = $collection->datas; $datas['new_'] = $dao->_emptyGroup(); + $langs = array(); + foreach ($datas as $gid => $group) { $class = 'group'; if ($gid && $gid == 'new_') { @@ -269,6 +271,7 @@ class wsUrl { $res.='
  • '; if (isset($books[$publication['id']])) { $book = $books[$publication['id']]; + $langs[] = $book->lang; } else { $book = new stdClass(); $book->lang = ''; @@ -286,8 +289,21 @@ class wsUrl { $res.=''; $res.='
  • '; } + + $langs = array_unique($langs); + $res.=''; + foreach ($langs as $l) { + $res.='

    ' . __('Contenus') . ' [' . $l . ']

    '; + $res.=''; + $res.=''; + $res.=''; + //'splash' => + $res.=''; + $res.='
    ' . __('Titre') . '' . form::field(array('contents[' . $l . '][titre]', 'contents_' . $l . '_titre'), 64, 64, $collection->contents[$l]['titre']) . '
    ' . __('A propos') . '' . form::textarea(array('contents[' . $l . '][apropos]', 'contents_' . $l . '_apropos'), 60, 10, $collection->contents[$l]['apropos']) . '
    ' . __('Ecran de lancement') . ' (2048x2048px)' . form::hidden(array('theme[splash' . $l . ']', 'splash_' . $l), $collection->theme['splash_' . $l]) . '
    '; + } + $v = wsHTML5Compiler::getPhonegapVersions(); $phonegapVersions = array_combine($v, $v); @@ -301,7 +317,7 @@ class wsUrl { $res.='

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

    '; $res.=''; - $images = array('back' => __('Image de fond'), 'etagere' => __("Image de l'étagère"), 'icon' => __("Icône de l'application") . ' (1024x1024px)', 'splash' => __('Ecran de lancement') . ' (2048x2048px)'); + $images = array('back' => __('Image de fond'), 'etagere' => __("Image de l'étagère"), 'icon' => __("Icône de l'application") . ' (1024x1024px)'); foreach ($images as $i => $label) { $res.=''; } @@ -609,7 +625,7 @@ class wsUrl { $res .= commonPage::bf(); $res .= commonPage::bh(); - $res .= cubeLang::translationForm(array(PLAYER_SOURCES, WS_COMPILE_ASSETS . '/_html5'), $lang_id, null, 'liste', array(), '' . $core->typo->Ajouter(__('Enregistrer')) . '', $lang->traductions); + $res .= cubeLang::translationForm(array(__('Version Flash') => PLAYER_SOURCES, __('Version HTML5') => WS_COMPILE_ASSETS . '/_html5', __('Application') => WS_COMPILE_ASSETS . '/_html5app'), $lang_id, null, 'liste', array(), '' . $core->typo->Ajouter(__('Enregistrer')) . '', $lang->traductions); $res .= commonPage::bf(); $res .= ''; return $res; diff --git a/inc/ws/DAO/class.ws.dao.collection.php b/inc/ws/DAO/class.ws.dao.collection.php index 8dcb35654..900d714c3 100644 --- a/inc/ws/DAO/class.ws.dao.collection.php +++ b/inc/ws/DAO/class.ws.dao.collection.php @@ -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' => ''); } diff --git a/inc/ws/Metier/class.ws.collection.php b/inc/ws/Metier/class.ws.collection.php index b7f521d9c..2de01df2e 100644 --- a/inc/ws/Metier/class.ws.collection.php +++ b/inc/ws/Metier/class.ws.collection.php @@ -10,6 +10,7 @@ class wsCollection extends cubeMetier { protected $datas; protected $settings; protected $theme; + protected $contents; } diff --git a/inc/ws/Util/html5/app/class.ws.html5.app.compiler.php b/inc/ws/Util/html5/app/class.ws.html5.app.compiler.php index 7882bb2cf..ec42321b3 100644 --- a/inc/ws/Util/html5/app/class.ws.html5.app.compiler.php +++ b/inc/ws/Util/html5/app/class.ws.html5.app.compiler.php @@ -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)); }
    ' . $label . '' . form::hidden(array('theme[' . $i . ']', 'theme_' . $i), $collection->theme[$i]) . '