]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 25 Jul 2013 14:02:59 +0000 (14:02 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 25 Jul 2013 14:02:59 +0000 (14:02 +0000)
inc/ws/Controlleur/class.ws.ajax.php
inc/ws/Controlleur/class.ws.services.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/Metier/class.ws.document.php
inc/ws/Util/html5/app/class.ws.html5.app.compiler.php

index 67cf9bbec09e831463d384216ea4968d28b72e59..b0a7dca7988c89993b619d10cf76dc46bea9fdd1 100644 (file)
@@ -1091,6 +1091,8 @@ class wsAjax extends cubeAjax {
                        self::collectionVersionPublish(array('collectionVersionPublish', $id, $time), new cubeAjax());\r
                }\r
 \r
+               self::cleanCachesCollection($id);\r
+\r
                $x->addReload();\r
        }\r
 \r
@@ -1108,17 +1110,26 @@ class wsAjax extends cubeAjax {
                $c->online = 1;\r
                $c->update('WHERE collection_id=\'' . $core->con->escape($id) . '\' AND compile_date=\'' . $core->con->escape($date) . '\'');\r
 \r
-               $caches = array(WS_COLLECTIONS . '/ws/' . $id . '.ios.json', WS_COLLECTIONS . '/ws/' . $id . '.android.json');\r
 \r
-               foreach ($caches as $cache) {\r
-                       if (file_exists($cache)) {\r
-                               unlink($cache);\r
-                       }\r
-               }\r
+               self::cleanCachesCollection($id);\r
 \r
                $x->addReload();\r
        }\r
 \r
+       protected static function cleanCachesCollection($id) {\r
+               $os = array('ios', 'android');\r
+               $files = array('json', 'update');\r
+\r
+               foreach ($os as $_os) {\r
+                       foreach ($files as $f) {\r
+                               $ff = WS_COLLECTIONS . '/ws/' . $id . '.' . $_os . '.' . $f;\r
+                               if (file_exists($ff)) {\r
+                                       unlink($ff);\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
        public static function collectionVersionDelete($args, &$x) {\r
                global $core;\r
 \r
index 1341f638fb538481dec5919541834e3319dd122b..cf923b5d56751913ac62bfffff6331489f18e675 100644 (file)
@@ -572,13 +572,16 @@ 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
-                       $composition = json_decode(file_get_contents(WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/composition.json'));\r
+                       $vcompo = WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/composition.json';\r
+                       $composition = json_decode(file_get_contents($vcompo));\r
 \r
                        $couvertures = array();\r
                        $vroot = WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/' . $os . '/';\r
@@ -600,12 +603,22 @@ class wsServices extends cubeFlashGateway {
 \r
                        $json = json_encode($d);\r
                        file_put_contents($cache, $json);\r
-                       echo $json;\r
+\r
                        file_put_contents($update, $version);\r
                } else {\r
-                       echo file_get_contents($cache);\r
+                       $d = json_decode(file_get_contents($cache), true);\r
+               }\r
+\r
+               $force = false;\r
+               if (!is_null($local)) {\r
+                       $lcompo = WS_COLLECTIONS . '/versions/' . $id . '/' . $local . '/composition.json';\r
+                       if (!file_exists($lcompo)) {\r
+                               $force = true;\r
+                       }\r
                }\r
 \r
+               $d['forceUpdate'] = $force;\r
+               echo json_encode($d);\r
                exit;\r
        }\r
 \r
index 63faf1ae296cfa40136ded78043f680218564db7..165478a926e423e9b71f15cd1cfb8a1faa017b3e 100644 (file)
@@ -305,6 +305,10 @@ class wsUrl {
                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.='<tr><td class="min nowrap">' . __('Couleur principale') . '</td><td>#' . form::field(array('settings[couleurA]', 'couleurA'), 6, 6, $collection->settings['couleurA']) . '</td></tr>';\r
+               $res.='<tr><td class="min nowrap">' . __('Couleur secondaire') . '</td><td>#' . form::field(array('settings[couleurB]', 'couleurB'), 6, 6, $collection->settings['couleurB']) . '</td></tr>';\r
+               $res.='<tr><td class="min nowrap">' . __('Couleur des textes') . '</td><td>#' . form::field(array('settings[couleurC]', 'couleurC'), 6, 6, $collection->settings['couleurC']) . '</td></tr>';\r
+\r
                $res.='</table>';\r
 \r
                $res.='<a href="#" class="submit right">' . $core->typo->Ajouter(__('Enregistrer')) . '</a>';\r
index 21d439a4f4c971eb30f9e9d2fe81db7e98b34dd8..d24dff580f8ee0af2a7b3fdd659b4943f29a05be 100644 (file)
@@ -573,6 +573,7 @@ class wsDocument extends cubeMetier {
        }\r
 \r
        public function makeSVGFile($page) {\r
+               $testFile = $this->out . '/html/s' . $page . '.svg';\r
                $svgFile = $this->out . '/html/p' . $page . '.svg';\r
                //$svgSimplified = $this->out . '/html/s' . $page . '.svg';\r
                $svgOpt = $this->out . '/html/o' . $page . '.svg';\r
@@ -588,6 +589,20 @@ class wsDocument extends cubeMetier {
                $pdftocairo->execute();\r
                $this->addToLog($pdftocairo, true, $page);\r
 \r
+               /*$pdf2svg = new cubeCommandLine('pdf2svg');\r
+               $pdf2svg->setPath(CONVERTER_PATH);\r
+               $pdf2svg->setArg(null, $this->cropped);\r
+               $pdf2svg->setArg(null, $testFile);\r
+               $pdf2svg->setArg(null, $page);\r
+               $pdf2svg->execute();\r
+               $this->addToLog($pdf2svg, true, $page);\r
+               $this->_cleanSVG($testFile);*/\r
+\r
+               $this->_cleanSVG($svgFile);\r
+               \r
+       }\r
+\r
+       protected function _cleanSVG($svgFile) {\r
                $svg = new DOMDocument();\r
                $svg->preserveWhiteSpace = false;\r
                $svg->load($svgFile);\r
index 2e930b9490df844d7604c206c778f469879b15c2..364f389c738910d29108e8395f24b2b100fa5c6f 100644 (file)
@@ -106,6 +106,9 @@ class wsHTML5AppCompiler {
        function writeScript() {
                $config = array();
                $config['id'] = $this->collectionId;
+               $config['couleurA']=$this->collection->settings['couleurA'];
+               $config['couleurB']=$this->collection->settings['couleurB'];
+               $config['couleurC']=$this->collection->settings['couleurC'];
 
                $this->copy(WS_COMPILE_ASSETS . '/_html5/js/libs/phonegap/' . $this->phonegapVersion . '/cordova-' . $this->os . '.js', $this->vdir . '/js/cordova.js');
                file_put_contents($this->vdir . '/data/app.js', 'DATAS = ' . CubeIT_Util_Json::encode($config) . ';');