]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 13 Nov 2013 13:51:58 +0000 (13:51 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 13 Nov 2013 13:51:58 +0000 (13:51 +0000)
fluidbook/composition.json [new file with mode: 0644]
inc/ws/Controlleur/class.ws.url.php
inc/ws/Util/class.ws.exporter.php
inc/ws/Util/html5/app/class.ws.html5.app.compiler.php

diff --git a/fluidbook/composition.json b/fluidbook/composition.json
new file mode 100644 (file)
index 0000000..718d91e
--- /dev/null
@@ -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
index 426797e9b95342050ee591c532bbf51ec07c8901..ec97bf9f6242684ced43fa28dd92d44a3d118136 100644 (file)
@@ -305,6 +305,7 @@ class wsUrl {
 \r
                $res.='<h3>' . __('Paramètres avancés') . '</h3>';\r
                $res.='<table class="max">';\r
+               $res.='<tr><td class="min nowrap">' . __('Full offline') . '</td><td>' . form::checkbox(array('settings[offline]', 'offline'), 1, $collection->settings['offline']) . '</td></tr>';\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.='<tr><td class="min nowrap">' . __('Identifiant de l\'application') . '</td><td>' . form::field(array('settings[namespace]', 'namespace'), 64, 64, $collection->settings['namespace']) . '</td></tr>';\r
                $res.='<tr><td class="min nowrap">' . __('Certificat APNS') . ' Dev (' . __('Fichier .pem') . ')</td><td><input type="file" name="apns_dev" /></td></tr>';\r
index f8f77b0926ffe82cbdb04438be4c53b1fcec380c..23f38e67bedd52e72999e221f01032a6dc31e4c0 100644 (file)
@@ -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 {
        }
 
 }
+
 ?>
index 2ebb0de3b92aff144ce0e6de6c4815334df02aa2..cacaf46dd8f79155ccbbbe0296f026a7846a8c7e 100644 (file)
@@ -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 . '/';
+               }
+       }
+
 }
 
 ?>