]> _ Git - cubeextranet.git/commitdiff
done #2153 @2
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 14 Aug 2018 15:05:14 +0000 (15:05 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 14 Aug 2018 15:05:14 +0000 (15:05 +0000)
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Util/html5/class.ws.html5.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/packager/class.ws.packager.mac.exe.html.php
inc/ws/Util/packager/class.ws.packager.win.cd.php
inc/ws/Util/packager/class.ws.packager.win.exe.html.php

index bebf52d16ce6e2e4fc5727745f220ad6a19c05c5..febb4e3492dbc71778bbc4b28803a9bcbf8acc03 100644 (file)
@@ -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();
        }
 
index a221c296107b5745b620fccbe7b9cbaea634ee71..3db883a3572fc5bb4076ec7e74baab2ae7b3bb95 100644 (file)
@@ -4,7 +4,7 @@ class wsHTML5
 {\r
        protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', '');\r
 \r
-       public static function compilerFactory($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false)\r
+       public static function compilerFactory($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false, $book = null)\r
        {\r
                if (is_null($version)) {\r
                        global $core;\r
@@ -34,7 +34,7 @@ class wsHTML5
                        }\r
                }\r
 \r
-               return new wsHTML5Compiler($book_id, $version, $phonegap, $phonegapVersion, $dir, $standalone, $appcache, $home);\r
+               return new wsHTML5Compiler($book_id, $version, $phonegap, $phonegapVersion, $dir, $standalone, $appcache, $home, $book);\r
        }\r
 \r
        public static function getPhonegapVersion($v = 'latest')\r
index 72215cc39d30e889832f890f2878325ea5af53d5..f2a3678e7aa23ccbfa6650a4ba8b093c8d87d456 100644 (file)
@@ -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;
index 5158b699f286d5a49f3d42f5f04053b7d3ea2d9f..db67c40fe830f20163d877d9ec2caec7bd014e2b 100644 (file)
@@ -8,9 +8,6 @@ class wsPackagerMacEXEHTML extends wsPackagerWinEXEHTML {
        public function __construct($book_id) {\r
                parent::__construct($book_id);\r
                $this->version = 'mac-exe-html';\r
-               $this->book->parametres->alwaysHTML5 = true;\r
-\r
-               $this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 30));\r
        }\r
 \r
        public function makePackage($zip) {\r
index a21310e7b8d7eb15648838df54029ce671b3b79a..598c04805b88c69d1afa1ca09857c2d25b619143 100644 (file)
@@ -30,6 +30,4 @@ class wsPackagerWinCD extends wsPackagerMacEXE {
                \r
        }\r
 \r
-}\r
-\r
-?>
\ No newline at end of file
+}
\ No newline at end of file
index 144481a3e65a56e474fed8e35b7132f7e59055c0..f4894e18cb897acc061edb2c6693c735a552e4ec 100644 (file)
@@ -15,7 +15,6 @@ class wsPackagerWinEXEHTML extends wsPackager
        {\r
                parent::__construct($book_id, null, true, true);\r
                $this->version = 'win-exe-html';\r
-               $this->book->parametres->alwaysHTML5 = true;\r
                $this->appName = '';\r
                $this->appversion = '1.0.' . time();\r
                $this->_clean = false;\r
@@ -106,7 +105,16 @@ class wsPackagerWinEXEHTML extends wsPackager
 \r
        protected function compile()\r
        {\r
-               $this->daoBook->compile($this->book_id, 'html5', false, $this->book->parametres->forceCompileOnDownload);\r
+               // For exe version, force to export only the html5 version\r
+               $this->book->parametres->alwaysHTML5 = true;\r
+               // No need to export pages with texts for this version, we are certain that svg is supported if enabled\r
+               if ($this->book->parametres->mobileVersion == 'html5-desktop') {\r
+                       $this->book->parametres->mobileVersion = 'html5';\r
+               }\r
+               // No need to have the widget\r
+               $this->book->parametres->widget = false;\r
+\r
+               $this->daoBook->compile($this->book_id, 'html5', false, $this->book->parametres->forceCompileOnDownload, false, $this->book);\r
        }\r
 \r
        protected function copyFluidbookFiles()\r