]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 12 Jul 2013 16:52:58 +0000 (16:52 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 12 Jul 2013 16:52:58 +0000 (16:52 +0000)
inc/ws/Controlleur/class.ws.ajax.php
inc/ws/Controlleur/class.ws.services.php
inc/ws/Util/class.ws.exporter.php
inc/ws/Util/html5/class.ws.html5.compiler.php

index e45e840b9afbb89615087bcdcbb952a6033656fb..bc5a7354fff04e25b26b0fa0dbc1555c5975f72d 100644 (file)
@@ -804,8 +804,6 @@ class wsAjax extends cubeAjax {
                $dao->setLinksAndRulers($book_id, json_encode($nlinks), json_encode($nrulers), 'Restore links from ' . date('Y-m-d H:i:s', $time), $core->user->utilisateur_id);\r
        }\r
 \r
-\r
-\r
        public static function importLinksAsExcel($args) {\r
                global $core;\r
                $book_id = $args[1];\r
@@ -1083,12 +1081,18 @@ class wsAjax extends cubeAjax {
 \r
                file_put_contents(WS_COLLECTIONS . '/versions/' . $id . '/' . $time . '/composition.json', json_encode($compiler->collection->datas));\r
 \r
+\r
+\r
                $c = $core->con->openCursor('book_collection_compile');\r
                $c->collection_id = $id;\r
                $c->compile_date = $time;\r
                $c->online = 0;\r
                $c->insert();\r
 \r
+               if (true) {\r
+                       self::collectionVersionPublish(array('collectionVersionPublish', $id, $time), new cubeAjax());\r
+               }\r
+\r
                $x->addReload();\r
        }\r
 \r
@@ -1129,4 +1133,5 @@ class wsAjax extends cubeAjax {
        }\r
 \r
 }\r
+\r
 ?>
\ No newline at end of file
index 4547dfed59fbcdcf009da2f754da45557d530cb2..2658b5fe0c20f5e540413f50e466cb3babf9dcf6 100644 (file)
@@ -553,12 +553,21 @@ class wsServices extends cubeFlashGateway {
        public function collection() {\r
                global $core;\r
                $id = $this->callArgs[0];\r
+               $local = (isset($this->callArgs[1])) ? $this->callArgs[1] : null;\r
+\r
                $this->outputXML = false;\r
                header('Content-type: application/json');\r
 \r
                $cache = WS_COLLECTIONS . '/ws/' . $id . '.json';\r
-               $limit = TIME - 7200;\r
-               if (!file_exists($cache) || filemtime($cache) < $limit) {\r
+               $update = WS_COLLECTIONS . '/ws/' . $id . '.update';\r
+\r
+               if (!is_null($local) && file_exists($update) && file_get_contents($update) == $local) {\r
+                       echo 'false';\r
+                       exit;\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
@@ -581,6 +590,7 @@ class wsServices extends cubeFlashGateway {
                        $json = json_encode($d);\r
                        file_put_contents($cache, $json);\r
                        echo $json;\r
+                       file_put_contents($update, $version);\r
                } else {\r
                        echo file_get_contents($cache);\r
                }\r
index d8983693f56b3b0d536f046bf1936cf970c10a60..eef918287ddd06e1be5cfda4ec382cc7683cf917 100644 (file)
@@ -76,7 +76,6 @@ class wsExporter {
 
                        // Transfert
                        `sudo /usr/local/bin/remountmac`;
-
                        $this->_rsync(WS_COLLECTIONS . '/resources/' . $collection->collection_id . '/' . $os, "/mnt/macbox" . $this->_iosProjectDir($collection->settings['namespace']) . '/' . CubeIT_Text::str2URL($collection->nom) . '/Resources', false);
                }
        }
index f46ded7ec3771583b43662265291940251c5b1c6..5355fd0839d9ba1d1672c3e0c94d74ccbc896a20 100644 (file)
@@ -359,10 +359,6 @@ class wsHTML5Compiler {
                        return;
                }
 
-               $videosExtensions = $this->getVideosFormats(false);
-               foreach ($videosExtensions as $e) {
-                       $videos[$e] = array();
-               }
 
                $cacheFile = $this->vdir . '/cache.appcache';
 
@@ -385,62 +381,27 @@ class wsHTML5Compiler {
                $lines[] = 'index.html* index.html';
                $lines[] = '';
                $lines[] = 'CACHE:';
-               $assets = array('images', 'style', 'swf', 'data/style', 'data/images', 'data/fluidbook.js', 'data/datas.js');
-
-               $pages = $this->book->parametres->pages + 1;
-
-               for ($i = 0; $i <= $pages; $i++) {
-                       $assets[] = 'data/background/150/' . $this->backgroundsPrefix . $i . '.jpg';
-                       $assets[] = 'data/contents/p' . $i . '.svg';
-               }
-               $assets[] = 'data/thumbnails';
-               $assets[] = 'data/links';
 
-               foreach ($assets as $a) {
-                       $ap = $dest . '/' . $a;
-
-                       if (!file_exists($ap)) {
+               $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dest), RecursiveIteratorIterator::SELF_FIRST);
+               
+               $exclude=array('index.html','indexu.html','widget.html','indext.html');
+               
+               foreach ($iterator as $path) {
+                       if (!$path->isFile()) {
                                continue;
                        }
-                       if (is_file($ap)) {
-                               $lines[] = str_replace($dest . '/', '', $ap);
-                       } else if (is_dir($ap)) {
-                               $iterator = new RecursiveDirectoryIterator($ap);
-                               foreach ($iterator as $path) {
-                                       if (!$path->isFile()) {
-                                               continue;
-                                       }
-                                       $p = str_replace($dest . '/', '', $path);
-                                       $lines[] = $p;
-                               }
+                       
+                       $p = str_replace($dest . '/', '', $path);
+                       if (in_array($p, $exclude)) {
+                               continue;
                        }
+                       $lines[] = $p;
                }
 
                $lines[] = '';
                $lines = array_merge($lines, $network);
 
                file_put_contents($cacheFile, implode("\n", $lines));
-
-               foreach ($videos as $format => $v) {
-                       if (!count($v)) {
-                               continue;
-                       }
-                       $cacheFile = $dest . '/data/links/video.' . $format . '.appcache';
-                       $htmlFile = $dest . '/data/links/video.' . $format . '.html';
-
-                       $html = '<!DOCTYPE html><html manifest="video.' . $format . '.appcache"><head></head><body></body></html>';
-                       file_put_contents($htmlFile, $html);
-
-                       $lines = array();
-                       $lines[] = 'CACHE MANIFEST';
-                       $lines[] = '# ' . date('Y-m-d H:i:s');
-                       $lines[] = '';
-                       $lines[] = 'CACHE:';
-                       foreach ($v as $video) {
-                               $lines[] = $video;
-                       }
-                       file_put_contents($cacheFile, implode("\n", $lines));
-               }
        }
 
        protected function writeIndex($numCSS) {