From 50e53de6e0677ac8e8d8a1c79e51be13f8189756 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 13 Nov 2013 13:51:58 +0000 Subject: [PATCH] --- fluidbook/composition.json | 1 + inc/ws/Controlleur/class.ws.url.php | 1 + inc/ws/Util/class.ws.exporter.php | 5 +++ .../html5/app/class.ws.html5.app.compiler.php | 32 +++++++++++++++---- 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 fluidbook/composition.json diff --git a/fluidbook/composition.json b/fluidbook/composition.json new file mode 100644 index 000000000..718d91e1e --- /dev/null +++ b/fluidbook/composition.json @@ -0,0 +1 @@ +[{"label":"Porter la vie","publications":[{"id":"11461","label":"Porter la vie","online":false},{"id":"11556","label":"Nieuw leven dragen","online":false}]},{"label":"Premi\u00e8re ann\u00e9e","publications":[{"id":"11558","label":"Premi\u00e8re ann\u00e9e","online":false},{"id":"11559","label":"Mijn eerste levensjaar","online":false}]},{"label":"Guide sant\u00e9","publications":[{"id":"11652","label":"Guide sant\u00e9","online":false},{"id":"11653","label":"De gezondheidsgids","online":false}]}] \ No newline at end of file diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 426797e9b..ec97bf9f6 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -305,6 +305,7 @@ class wsUrl { $res.='

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

'; $res.=''; + $res.=''; $res.=''; $res.=''; $res.=''; diff --git a/inc/ws/Util/class.ws.exporter.php b/inc/ws/Util/class.ws.exporter.php index f8f77b092..23f38e67b 100644 --- a/inc/ws/Util/class.ws.exporter.php +++ b/inc/ws/Util/class.ws.exporter.php @@ -61,6 +61,10 @@ class wsExporter { ) ); + if (isset($collection->settings['offline']) && $collection->settings['offline']) { + $phonegap->addAdditionalSource('publications', $compiler->getPublishedVersionPath($os)); + } + $ctrl = isset($_GET['ctrl']) && $_GET['ctrl'] == 'true'; $alt = isset($_GET['alt']) && $_GET['alt'] == 'true'; @@ -431,4 +435,5 @@ class wsExporter { } } + ?> 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 2ebb0de3b..cacaf46dd 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 @@ -4,7 +4,7 @@ class wsHTML5AppCompiler { public $collectionId, $collection; public $assets; - public $dir, $vdir, $wdir, $sdir; + public $dir, $vdir, $wdir, $sdir, $verdir; public $os; public $phonegapVersion; public $langs; @@ -110,8 +110,9 @@ class wsHTML5AppCompiler { $this->vdir = $this->dir = WS_COLLECTIONS . '/app/' . $this->collectionId . '/'; $this->wdir = WS_COLLECTIONS . '/working/' . $this->collectionId; $this->sdir = WS_COMPILE_ASSETS . '/_html5app/'; - - if(file_exists($this->vdir)){ + $this->verdir = WS_COLLECTIONS . '/versions/'; + + if (file_exists($this->vdir)) { } @@ -130,6 +131,17 @@ class wsHTML5AppCompiler { $config['couleurA'] = $this->collection->settings['couleurA']; $config['couleurB'] = $this->collection->settings['couleurB']; $config['couleurC'] = $this->collection->settings['couleurC']; + $config['offline'] = false; + if (isset($this->collection->settings['offline'])) { + $config['offline'] = $this->collection->settings['offline']; + } + + if ($config['offline']) { + $c = json_decode(file_get_contents('http://workshop.fluidbook.com/services/collection/' . $this->collectionId . '/' . $this->os)); + unset($c->manifest); + unset($c->manifestPub); + } + $config['collection'] = $c; file_put_contents($this->vdir . '/data/app.js', 'DATAS = ' . CubeIT_Util_Json::encode($config) . ';'); } @@ -137,10 +149,10 @@ class wsHTML5AppCompiler { } - function writeConfig(){ - $xml=new simplexml_load_string(''); + function writeConfig() { + $xml = new simplexml_load_string(''); } - + function writeStyle() { $c = array(); @@ -218,6 +230,14 @@ class wsHTML5AppCompiler { file_put_contents($this->vdir . '/data/app.css', implode("\n", $c)); } + public function getPublishedVersionPath($os) { + global $core; + $r = $core->con->select('SELECT compile_date FROM book_collection_compile WHERE collection_id=\'' . $this->collectionId . '\' AND online_' . $os . '=1'); + while ($r->fetch()) { + return WS_COLLECTIONS . '/versions/' . $this->collectionId . '/' . $r->compile_date . '/' . $os . '/'; + } + } + } ?> -- 2.39.5
' . __('Full offline') . '' . form::checkbox(array('settings[offline]', 'offline'), 1, $collection->settings['offline']) . '
' . __('Version phonegap') . '' . form::combo(array('settings[phonegap]', 'phonegap'), $phonegapVersions, $collection->settings['phonegap']) . '
' . __('Identifiant de l\'application') . '' . form::field(array('settings[namespace]', 'namespace'), 64, 64, $collection->settings['namespace']) . '
' . __('Certificat APNS') . ' Dev (' . __('Fichier .pem') . ')