From fd2ff210ca232be01cb06dab696f07430bf5181e Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 14 Aug 2018 15:05:14 +0000 Subject: [PATCH] done #2153 @2 --- inc/ws/DAO/class.ws.dao.book.php | 8 +++++--- inc/ws/Util/html5/class.ws.html5.php | 4 ++-- .../Util/html5/master/class.ws.html5.compiler.php | 15 ++++++++++----- .../packager/class.ws.packager.mac.exe.html.php | 3 --- inc/ws/Util/packager/class.ws.packager.win.cd.php | 4 +--- .../packager/class.ws.packager.win.exe.html.php | 12 ++++++++++-- 6 files changed, 28 insertions(+), 18 deletions(-) diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index bebf52d16..febb4e349 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -1146,7 +1146,7 @@ class wsDAOBook extends commonDAO } } - public function compile($book_id, $version = 'all', $complete = false, $force = false, $dev = false) + public function compile($book_id, $version = 'all', $complete = false, $force = false, $dev = false, $book = null) { if (is_null($book_id) || !$book_id) { return; @@ -1164,7 +1164,9 @@ class wsDAOBook extends commonDAO $html5 = true; } - $book = $this->selectById($book_id); + if (null === $book) { + $book = $this->selectById($book_id); + } $pages = $this->getPagesOfBook($book_id); if (!$force) { @@ -1749,7 +1751,7 @@ class wsDAOBook extends commonDAO $version = 'dev'; } - $htmlCompiler = wsHTML5::compilerFactory($book_id, $version); + $htmlCompiler = wsHTML5::compilerFactory($book_id, $version, false, 'latest', null, false, false, false, $book); $htmlCompiler->compile(); } diff --git a/inc/ws/Util/html5/class.ws.html5.php b/inc/ws/Util/html5/class.ws.html5.php index a221c2961..3db883a35 100644 --- a/inc/ws/Util/html5/class.ws.html5.php +++ b/inc/ws/Util/html5/class.ws.html5.php @@ -4,7 +4,7 @@ class wsHTML5 { protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', ''); - public static function compilerFactory($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false) + public static function compilerFactory($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false, $book = null) { if (is_null($version)) { global $core; @@ -34,7 +34,7 @@ class wsHTML5 } } - return new wsHTML5Compiler($book_id, $version, $phonegap, $phonegapVersion, $dir, $standalone, $appcache, $home); + return new wsHTML5Compiler($book_id, $version, $phonegap, $phonegapVersion, $dir, $standalone, $appcache, $home, $book); } public static function getPhonegapVersion($v = 'latest') 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 72215cc39..f2a3678e7 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -170,7 +170,7 @@ class wsHTML5Compiler public $seo = null; - function __construct($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false) + function __construct($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false, $book = null) { global $core; @@ -191,7 +191,6 @@ class wsHTML5Compiler $this->phonegap = $phonegap; $this->standalone = $standalone || $this->phonegap; $this->appcache = $appcache; - $this->widget = !$this->phonegap; cubePHP::set_memory('4G'); @@ -210,11 +209,17 @@ class wsHTML5Compiler $this->wdir = WS_BOOKS . '/working/' . $this->book_id . '/'; $this->daoBook = new wsDAOBook($core->con); - $this->book = $this->daoBook->selectById($book_id); + if (null === $book) { + $this->book = $this->daoBook->selectById($book_id); + } else { + $this->book = $book; + } + + $this->widget = !$this->phonegap && $this->book->parametres->widget; + $this->pages = $this->daoBook->getPagesOfBook($book_id); $this->maxRes = min(300, $this->book->parametres->maxResolution); - $daoTheme = new wsDAOTheme($core->con); $this->theme = $daoTheme->getThemeOfBook($book_id, true); $this->themeRoot = WS_THEMES . '/' . $this->theme->theme_id . '/'; @@ -1261,6 +1266,7 @@ class wsHTML5Compiler { global $core; + switch ($this->book->parametres->mobileVersion) { case 'html5-desktop': $this->backgroundsPrefix = array('t', 'p'); @@ -1303,7 +1309,6 @@ class wsHTML5Compiler } } - foreach ($this->getResolutions() as $r) { foreach ($this->backgroundsPrefix as $backgroundsPrefix) { $srcPrefix = $backgroundsPrefix; diff --git a/inc/ws/Util/packager/class.ws.packager.mac.exe.html.php b/inc/ws/Util/packager/class.ws.packager.mac.exe.html.php index 5158b699f..db67c40fe 100644 --- a/inc/ws/Util/packager/class.ws.packager.mac.exe.html.php +++ b/inc/ws/Util/packager/class.ws.packager.mac.exe.html.php @@ -8,9 +8,6 @@ class wsPackagerMacEXEHTML extends wsPackagerWinEXEHTML { public function __construct($book_id) { parent::__construct($book_id); $this->version = 'mac-exe-html'; - $this->book->parametres->alwaysHTML5 = true; - - $this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 30)); } public function makePackage($zip) { diff --git a/inc/ws/Util/packager/class.ws.packager.win.cd.php b/inc/ws/Util/packager/class.ws.packager.win.cd.php index a21310e7b..598c04805 100644 --- a/inc/ws/Util/packager/class.ws.packager.win.cd.php +++ b/inc/ws/Util/packager/class.ws.packager.win.cd.php @@ -30,6 +30,4 @@ class wsPackagerWinCD extends wsPackagerMacEXE { } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/inc/ws/Util/packager/class.ws.packager.win.exe.html.php b/inc/ws/Util/packager/class.ws.packager.win.exe.html.php index 144481a3e..f4894e18c 100644 --- a/inc/ws/Util/packager/class.ws.packager.win.exe.html.php +++ b/inc/ws/Util/packager/class.ws.packager.win.exe.html.php @@ -15,7 +15,6 @@ class wsPackagerWinEXEHTML extends wsPackager { parent::__construct($book_id, null, true, true); $this->version = 'win-exe-html'; - $this->book->parametres->alwaysHTML5 = true; $this->appName = ''; $this->appversion = '1.0.' . time(); $this->_clean = false; @@ -106,7 +105,16 @@ class wsPackagerWinEXEHTML extends wsPackager protected function compile() { - $this->daoBook->compile($this->book_id, 'html5', false, $this->book->parametres->forceCompileOnDownload); + // For exe version, force to export only the html5 version + $this->book->parametres->alwaysHTML5 = true; + // No need to export pages with texts for this version, we are certain that svg is supported if enabled + if ($this->book->parametres->mobileVersion == 'html5-desktop') { + $this->book->parametres->mobileVersion = 'html5'; + } + // No need to have the widget + $this->book->parametres->widget = false; + + $this->daoBook->compile($this->book_id, 'html5', false, $this->book->parametres->forceCompileOnDownload, false, $this->book); } protected function copyFluidbookFiles() -- 2.39.5