From: vincent@cubedesigners.com Date: Tue, 31 Oct 2017 10:20:15 +0000 (+0000) Subject: wip #1701 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=067c387ece5d280596db4c15e9762f550684fa1b;p=cubeextranet.git wip #1701 --- diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index 2aaff30a9..f78906d51 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -1161,6 +1161,11 @@ class wsAjax extends cubeAjax { self::cleanCachesCollection($id); + if ($_GET['ctrl']) { + $_GET['ctrl'] = false; + self::exportCollection(array('exportCollection', $id, 'ios'), $x); + } + $x->addReload(); } diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index 34d01e0b2..06e317ad1 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -2,7 +2,7 @@ class wsHTML5Compiler { protected static $resolutions = array(150, 300); - protected $maxRes = 300; + public $maxRes = 300; public $jsFiles = array( 'js/libs/modernizr/modernizr.min.js', @@ -80,7 +80,7 @@ class wsHTML5Compiler { 'js/libs/cube/fb.js', 'js/libs/modernizr/modernizr.min.js', 'js/libs/modernizr/tests.js', - 'js/libs/jquery/jquery.js', + 'js/libs/jquery/jquery.min.js', 'js/libs/jquery/jquery.transit.js', 'js/widget.js' ); @@ -161,7 +161,6 @@ class wsHTML5Compiler { function __construct($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false) { global $core; - $this->phonegapVersion = wsHTML5::getPhonegapVersion($phonegapVersion); $this->appcache = $appcache; $this->multiApp = $this->home = $home; @@ -201,20 +200,6 @@ class wsHTML5Compiler { $this->book = $this->daoBook->selectById($book_id); $this->pages = $this->daoBook->getPagesOfBook($book_id); - switch ($this->book->parametres->mobileVersion) { - case 'html5-desktop': - $this->backgroundsPrefix = array('t', 'p'); - $this->svg = true; - break; - case 'html5-images': - $this->backgroundsPrefix = array('t'); - $this->svg = false; - break; - default: - $this->backgroundsPrefix = array('p'); - $this->svg = true; - break; - } $daoTheme = new wsDAOTheme($core->con); $this->theme = $daoTheme->getThemeOfBook($book_id, true); @@ -251,11 +236,14 @@ class wsHTML5Compiler { } $this->numerotation = explode(',', $this->book->numerotation); - $this->config = cubeObject::merge($this->book->parametres->toStandardObject(), $this->theme->parametres->toStandardObject()); - + $this->initConfig(); $this->log('Defined dimensions'); } + public function initConfig() { + $this->config = cubeObject::merge($this->book->parametres->toStandardObject(), $this->theme->parametres->toStandardObject()); + } + public function log($step) { $currenttime = microtime(true); if (null === $this->logfp) { @@ -276,7 +264,13 @@ class wsHTML5Compiler { } public function getResolutions() { - $res = self::$resolutions; + $res = []; + foreach (self::$resolutions as $r) { + if ($r > $this->maxRes) { + continue; + } + $res[] = $r; + } if ($this->widget) { $res = array_merge(array(36), $res); } @@ -298,7 +292,7 @@ class wsHTML5Compiler { return $p + 1; } - public function compile() { + public function compile($delete = true) { $this->log('Start compile process'); @@ -338,7 +332,7 @@ class wsHTML5Compiler { $this->log('Extras written'); $this->writeJs(); $this->log('Js written'); - $this->vdir->sync(true); + $this->vdir->sync($delete); $this->log('Files Synced'); } @@ -919,11 +913,17 @@ class wsHTML5Compiler { $tmp = cubeFiles::tempnam(); file_put_contents($tmp, $js); + unlink($minimized); + $uglify = new CubeIT_CommandLine('/usr/local/bin/uglifyjs'); $uglify->setArg('o', $minimized); $uglify->setArg(null, $tmp); $uglify->execute(); $uglify->debug(); + + if (!file_exists($minimized)) { + die('An error occured while uglifying : ' . $uglify->output); + } } $dest = 'data/' . $jsfinal . '.js'; $this->vdir->copy($minimized, $dest); @@ -1062,6 +1062,21 @@ class wsHTML5Compiler { protected function writeImages() { global $core; + switch ($this->book->parametres->mobileVersion) { + case 'html5-desktop': + $this->backgroundsPrefix = array('t', 'p'); + $this->svg = true; + break; + case 'html5-images': + $this->backgroundsPrefix = array('t'); + $this->svg = false; + break; + default: + $this->backgroundsPrefix = array('p'); + $this->svg = true; + break; + } + $thumbs = array(); foreach ($this->pages as $page => $infos) { $docdir = wsDocument::getDir($infos['document_id']); @@ -1370,6 +1385,7 @@ class wsHTML5Compiler { foreach ($res as $k => $css) { $this->stylesheets[] = 'data/style/style_' . $k . '.css'; $this->vdir->file_put_contents(sprintf($file, $k), implode("\n", $css)); + $this->log('Write CSS ' . sprintf($file, $k)); } return count($res); } diff --git a/inc/ws/Util/packager/class.ws.packager.phonegap.php b/inc/ws/Util/packager/class.ws.packager.phonegap.php index 70b85618c..7c6c4f59e 100644 --- a/inc/ws/Util/packager/class.ws.packager.phonegap.php +++ b/inc/ws/Util/packager/class.ws.packager.phonegap.php @@ -32,7 +32,11 @@ class wsPackagerPhonegap extends wsPackager { } $compiler = wsHTML5::compilerFactory($this->book_id, null, $os, 'latest', $vdir, false, !$this->ignoreCache, $this->home); - $compiler->compile(); + $compiler->book->parametres->mobileVersion = 'html5-images'; + $compiler->book->parametres->menuBreakpoint = '900px'; + $compiler->maxRes = 150; + $compiler->initConfig(); + $compiler->compile(false); unlink($vdir . '/indext.html'); unlink($vdir . '/indexu.html');