]> _ Git - cubeextranet.git/commitdiff
done #1364 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 21 Apr 2017 18:49:53 +0000 (18:49 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 21 Apr 2017 18:49:53 +0000 (18:49 +0000)
inc/ws/Controlleur/class.ws.maintenance.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Util/class.ws.util.php
inc/ws/Util/html5/class.ws.html5.compiler.php

index 8fe652b8788af6ec06eb90330263fe71d78b9e75..25478665bcb9322cc22e471dc4ba78c361f61d00 100644 (file)
@@ -1177,10 +1177,4 @@ class wsMaintenance {
                $runs = $api->batchUnsubscribe('69f69a2bb8', array_keys($unsubscribe));
                echo '<pre>' . print_r($runs, true) . '</pre>';
        }
-
-       public function excel2array() {
-
-               echo json_encode(wsUtil::excelToArray("/home/wesco/15296.xlsx"));
-       }
-
 }
index dfb010d4abe87db914b577b34d15796f893a9fca..afb60a3197fb80e0438eb97d70f4a3bef32921be 100644 (file)
@@ -1468,7 +1468,7 @@ class wsDAOBook extends commonDAO {
                        $formats = array('jpg', 'png', 'jpeg');
                        $referencesFile = self::getWorkingFile($book->parametres->basketReferences, $book_id, 'commerce');
 
-                       if (file_exists($referencesFile)) {
+                       if (file_exists($referencesFile) || CubeIT_Util_Url::isDistant($referencesFile)) {
                                $ext = CubeIT_Files::getExtension($referencesFile);
                                if ($ext == 'xml') {
                                        $xml = simplexml_load_file($referencesFile);
@@ -1531,7 +1531,7 @@ class wsDAOBook extends commonDAO {
 
 
        public static function getWorkingFile($path, $book_id, $dir = "") {
-               if (substr($path, 0, 1) == '/' && file_exists($path)) {
+               if (CubeIT_Util_Url::isDistant($path) || (substr($path, 0, 1) == '/' && file_exists($path))) {
                        return $path;
                }
 
index d72c850a3355d5b3f1839147f5e7cf1e90a4eb56..0e5198063cffbcab030e71923df4e3f0719f3a00 100644 (file)
@@ -3,6 +3,19 @@
 class wsUtil {\r
        public static function excelToArray($excelFile) {\r
                $worksheets = array();\r
+\r
+               if (CubeIT_Util_Url::isDistant($excelFile)) {\r
+                       $tmp = CubeIT_Files::tempnam();\r
+                       copy($excelFile, $tmp);\r
+\r
+                       $hash = hash_file('sha256', $tmp);\r
+                       $dest = WS_CACHE . '/xlsx2array/' . $hash . '.xlsx';\r
+\r
+                       if (!file_exists($dest)) {\r
+                               copy($tmp, $dest);\r
+                       }\r
+                       $excelFile = $dest;\r
+               }\r
                if (!file_exists($excelFile)) {\r
                        return array();\r
                }\r
index ac828ad34e33b06c30181aab1682b79706aef6fb..2a0fa221f14ea19dc89aa6fc940c41ac8a9604c8 100644 (file)
@@ -71,6 +71,7 @@ class wsHTML5Compiler {
                'js/libs/fluidbook/fluidbook.pad.js',
                'js/libs/fluidbook/fluidbook.audiodescription.js',
                'js/libs/fluidbook/fluidbook.privacy.js',
+               'js/libs/fluidbook/fluidbook.zoom.js',
                'js/libs/fluidbook/views/fluidbook.chapters.js',
                'js/libs/fluidbook/views/fluidbook.index.js',
                'js/libs/fluidbook/fluidbook.js',
@@ -184,7 +185,6 @@ class wsHTML5Compiler {
                        $this->assets = WS_COMPILE_ASSETS . '/player/' . ($location == 'git' ? 'branches' : $location) . '/' . $branch;
                }
 
-
                $this->phonegap = $phonegap;
                $this->standalone = $standalone || $this->phonegap;
                $this->appcache = $appcache;
@@ -872,7 +872,7 @@ class wsHTML5Compiler {
                        }
 
                        if (!$reminimize) {
-                               if (filemtime(__FILE__) > $mintime || filemtime(__DIR__ . 'class.ws.html5.links.php') > $mintime) {
+                               if (filemtime(__FILE__) > $mintime || filemtime(__DIR__ . '/class.ws.html5.links.php') > $mintime) {
                                        $reminimize = true;
                                }
                        }
@@ -881,7 +881,7 @@ class wsHTML5Compiler {
                                $js = '';
                                foreach ($files as $file) {
                                        $js .= file_get_contents($this->assets . '/' . $file);
-                                       $js .= "\n\n";
+                                       $js .= ";\n\n";
                                }
                                $tmp = cubeFiles::tempnam();
                                file_put_contents($tmp, $js);
@@ -894,15 +894,15 @@ class wsHTML5Compiler {
                                $uglify->execute();
                                //$uglify->debug();
                        }
-
-                       $js = file_get_contents($minimized);
-                       file_put_contents($this->vdir . '/data/' . $jsfinal . '.js', $js);
+                       $dest = $this->vdir . '/data/' . $jsfinal . '.js';
+                       copy($minimized, $dest);
                }
 
 
                if ($this->phonegap) {
                        $this->copy(WS_COMPILE_ASSETS . '/_html5/js/libs/phonegap/' . $this->phonegapVersion . '/cordova-' . $this->phonegap . '.js', $this->vdir . '/data/cordova.js');
                }
+
        }
 
        public function writeTexts() {
@@ -970,13 +970,13 @@ class wsHTML5Compiler {
                }
 
                if ($this->config->basket) {
-                       if (file_exists($this->config->basketReferences)) {
+                       if (file_exists($this->config->basketReferences) || CubeIT_Util_Url::isDistant($this->config->basketReferences)) {
                                $referencesFile = $this->config->basketReferences;
                        } else {
                                $referencesFile = $this->wdir . '/commerce/' . $this->config->basketReferences;
                        }
 
-                       if (file_exists($referencesFile)) {
+                       if (file_exists($referencesFile) || CubeIT_Util_Url::isDistant($referencesFile)) {
                                $ext = CubeIT_Files::getExtension($referencesFile);
                                if ($ext == 'xlsx') {
                                        $this->config->basketReferences = wsUtil::excelToArray($referencesFile);
@@ -1254,7 +1254,6 @@ class wsHTML5Compiler {
                $res[] = '.link a.displayArea{-webkit-tap-highlight-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';background-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.0001) . ';}';
                $res[] = '.link a.displayArea.animating {' . self::writeCSSUA('transition', 'opacity ' . $this->book->parametres->linkBlinkTime . 's ease-in') . '}';
 
-
                // Bookmarks
                if (!isset($this->book->parametres->bookmarkCornerSize)) {
                        $this->book->parametres->bookmarkCornerSize = 10;
@@ -1421,6 +1420,20 @@ class wsHTML5Compiler {
                `cp -a $source $this->vdir/$dest`;
        }
 
+       public function simpleCopyLinkFile($source, $dest, $addVdir = true) {
+               if ($addVdir) {
+                       $dest = $this->vdir . '/' . $dest;
+               }
+               if (!file_exists(dirname($dest))) {
+                       mkdir(dirname($dest), 0777, true);
+               }
+               if (file_exists($dest) && filemtime($dest) >= filemtime($source) && filesize($dest) == filesize($source)) {
+                       return;
+               }
+
+               $this->copy($source, $dest);
+       }
+
        public function copyLinkFile($source, $dest, $video = false) {
                if ($video && $this->book->parametres->mobileVideosPath != '') {
 
@@ -1447,13 +1460,7 @@ class wsHTML5Compiler {
                        $s = $origDir . $so;
                        if (file_exists($s)) {
                                $d = $this->vdir . '/' . $dest . '/' . $so;
-                               if (!file_exists(dirname($d))) {
-                                       mkdir(dirname($d), 0777, true);
-                               }
-                               if (file_exists($d) && filemtime($d) >= filemtime($s) && filesize($d) == filesize($s)) {
-                                       continue;
-                               }
-                               $this->copy($s, $d);
+                               $this->simpleCopyLinkFile($s, $d, false);
                        }
                }
        }