]> _ Git - cubeextranet.git/commitdiff
wait #4891 @2
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 7 Dec 2021 09:09:53 +0000 (09:09 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 7 Dec 2021 09:09:53 +0000 (09:09 +0000)
18 files changed:
inc/commons/class.common.tools.php
inc/ws/Controlleur/class.ws.ajax.php
inc/ws/Controlleur/class.ws.flash.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Util/class.ws.exporter.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.chromeos.php
inc/ws/Util/packager/class.ws.packager.html.php
inc/ws/Util/packager/class.ws.packager.mac.exe.html.php
inc/ws/Util/packager/class.ws.packager.php
inc/ws/Util/packager/class.ws.packager.precompiled.php
inc/ws/Util/packager/class.ws.packager.scorm.php
inc/ws/Util/packager/class.ws.packager.sharepoint.php
inc/ws/Util/packager/class.ws.packager.win.cd.html.php
inc/ws/Util/packager/class.ws.packager.win.exe.html.php
inc/ws/Util/packager/class.ws.packager.win.inst.html.php
inc/ws/Util/packager/class.ws.packager.win.inst.silent.html.php

index 851aabdc7644528950afb69aa6d0b96be1bb02fd..67a6cc8816f0c38732a6cc7b91a8aaa589bfabfb 100644 (file)
@@ -1188,7 +1188,8 @@ class commonTools
             'ascocelda' => 'Asco & Celda',
             'wesco' => 'Wesco',
             'mopec' => 'Mopec',
-            'intex' => 'Intex'];
+            'intex' => 'Intex',
+            'grosfillex'=>'Grosfillex'];
 
         $options = array_flip($options);
         ksort($options);
index a8d099ec75f12010f84e14fe903f82801ba15243..eff68450ebb1a8398c295757765b6e1bc7e7c74e 100644 (file)
@@ -1123,7 +1123,9 @@ class wsAjax extends cubeAjax
         }
 
         $exporter = new wsExporter();
-        $exporter->export($_POST['book_id'], $x, $_POST['action'], $_POST['version'], $dest['dir'], $dest['file']);
+
+        file_put_contents(WS_CACHE . '/' . $_POST['book_id'] . '.post.options', print_r($_POST, true));
+        $exporter->export($_POST['book_id'], $x, $_POST['action'], $_POST['version'], $dest['dir'], $dest['file'], $_POST['options']);
 
         $x->addClosePopup();
     }
index 977345bad88c6fbbf943ff7160decbb47fec12b7..0bc58c2c108c2eedd710413391c5a05faa6e2f5e 100644 (file)
@@ -779,6 +779,7 @@ class wsFlash extends cubeFlashGateway
         $this->xml->addChild('title', htmlspecialchars($book->nom));
         $this->xml->addChild('date', $book->changedate);
         $this->xml->addChild('lang', $book->lang);
+        $this->xml->addChild('settings', json_encode($book->parametres->toArray()));
     }
 
     public function getBookInfos()
index d53e76a285aeb8f1a58d9c5d5ad5d9767d700016..3488e6ad6f969d09c91e675bddd258da14177bda 100644 (file)
@@ -1205,7 +1205,6 @@ class wsDAOBook extends commonDAO
 
         $this->_compileLock = WS_BOOKS . '/locks/' . $lockId . '.lock';
 
-
         while (file_exists($this->_compileLock) && filemtime($this->_compileLock) > (time() - 900)) {
             sleep(10);
         }
index 3cba98bd4e461547800f476121853bed3cff63f4..5ebbc175057860cc51722c3badce9a4b360ea0f6 100644 (file)
@@ -17,6 +17,7 @@ class wsExporter
     public $ftpPassiveMode = false;
 
     const VINCENT = "paris.cubedesigners.com";
+
     //const VINCENT = "tortuga.enhydra.fr";
 
     public function exportCollection($collectionId, $os)
@@ -287,7 +288,7 @@ class wsExporter
         $cl->execute();
     }
 
-    public function export($book_id, &$x, $action = 'download', $version = 'online', $destinationDir = null, $destinationFile = null)
+    public function export($book_id, &$x, $action = 'download', $version = 'online', $destinationDir = null, $destinationFile = null, $options = [])
     {
         global $core;
         set_time_limit(0);
@@ -322,7 +323,7 @@ class wsExporter
         $this->_saveDestination();
 
         if ($this->metaAction == 'download') {
-            $this->_download();
+            $this->_download($options);
         } else if ($this->metaAction == 'phonegap') {
             $this->_phonegap();
         } else if ($this->metaAction == 'install') {
@@ -505,9 +506,9 @@ class wsExporter
         }
     }
 
-    protected function _download()
+    protected function _download($options = [])
     {
-        $r = wsPackager::package($this->book_id, $this->version);
+        $r = wsPackager::package($this->book_id, $this->version, true, true, $options);
         $this->x->addRedirection($r);
     }
 
index f9bd69c618a069b7b3e65684d7fcff80c9a5db37..033903fae50905eae19f7338bcba7a5453dbab87 100644 (file)
@@ -20,8 +20,10 @@ class wsHTML5
     {\r
         if (is_null($version)) {\r
             global $core;\r
-            $dao = new wsDAOBook($core->con);\r
-            $book = $dao->selectById($book_id);\r
+            if (null === $book) {\r
+                $dao = new wsDAOBook($core->con);\r
+                $book = $dao->selectById($book_id);\r
+            }\r
             $version = $book->parametres->mobileLVersion;\r
         }\r
 \r
index d4b4776dfa261466cb4bfb530211d508bd49167b..8e6b0e9922242fa9238b0c1e463b24691ff0e41b 100644 (file)
@@ -276,7 +276,6 @@ class wsHTML5Compiler
         }
         $this->vdir = new CubeIT_Files_VirtualDirectory($this->dir);
 
-
         $this->daoBook = new wsDAOBook($core->con);
         if (null === $book) {
             $this->book = $this->daoBook->selectById($book_id);
@@ -338,7 +337,6 @@ class wsHTML5Compiler
             $this->initMobileFirst();
         }
 
-
         $this->svgfiles = array_unique([$this->assets . '/images/symbols/interface.svg',
             WS_ICONS . '/15/interface.svg']);
         if ($this->theme->parametres->iconSet > 15) {
index 2c3b16d3af15921b3e1705360b18ecc7d0979b3c..31d667ec60577ff498aea80f820ced630f82c955 100644 (file)
@@ -2,11 +2,11 @@
 \r
 class wsPackagerChromeOS extends wsPackagerHTML\r
 {\r
-    public function __construct($book_id, $vdir = null, $whole = true)\r
+    public function __construct($book_id, $vdir = null, $whole = true, $options = [])\r
     {\r
-        parent::__construct($book_id, $vdir, $whole);\r
+        parent::__construct($book_id, $vdir, $whole, $options);\r
         $this->version = 'chromeos';\r
-        $this->cleanOnDestruct = false;\r
+        $this->cleanOnDestruct = true;\r
     }\r
 \r
     protected function preparePackage()\r
@@ -31,16 +31,16 @@ class wsPackagerChromeOS extends wsPackagerHTML
         return $res;\r
     }\r
 \r
-//    public function makePackage($zip)\r
-//    {\r
-//        $this->preparePackage();\r
-//\r
-//        $chrome = new CubeIT_CommandLine('crx3');\r
-//        $chrome->setArg('o', WS_PACKAGER . '/download/' . $this->getBaseFile() . '.crx');\r
-//        $chrome->setArg(null, $this->vdir.'/m/');\r
-//        $chrome->execute();\r
-//        $chrome->debug();\r
-//\r
-//        return $this->getURLBase('crx');\r
-//    }\r
+    public function makePackage($zip)\r
+    {\r
+        $this->preparePackage();\r
+\r
+        $chrome = new CubeIT_CommandLine('crx3');\r
+        $chrome->setArg('o', WS_PACKAGER . '/download/' . $this->getBaseFile() . '.crx');\r
+        $chrome->setArg(null, $this->vdir . '/m/');\r
+        $chrome->execute();\r
+        $chrome->debug();\r
+\r
+        return $this->getURLBase('crx');\r
+    }\r
 }
\ No newline at end of file
index 078985409d14bca99628737ffb99527a1181785c..0bc22c174923a1f2023079e58fc38f0d5fd0184b 100644 (file)
@@ -10,9 +10,9 @@ class wsPackagerHTML extends wsPackager
     protected $_disableScorm = true;
     protected $_compileOnConstruct = false;
 
-    public function __construct($book_id, $vdir = null, $whole = true)
+    public function __construct($book_id, $vdir = null, $whole = true, $options = [])
     {
-        parent::__construct($book_id, $vdir, $whole);
+        parent::__construct($book_id, $vdir, $whole, $options);
         $this->version = 'html';
     }
 
@@ -248,6 +248,7 @@ class wsPackagerHTML extends wsPackager
 
     protected function _compileHTML5($bookId, $book, $dest)
     {
+
         $this->daoBook->compile($bookId, 'html5', false, $book->parametres->forceCompileOnDownload, false, $book);
 
         if (!file_exists($dest)) {
index 1b868d2c90ad326790c8a29b84ce8efa4d8ed2e0..fa19bc552bec6d27df420ae53a83b77b190d9a0b 100644 (file)
@@ -7,9 +7,9 @@ class wsPackagerMacEXEHTML extends wsPackagerWinEXEHTML
     protected $node_platform = 'mac';\r
     protected $exenameMaxlength = 28;\r
 \r
-    public function __construct($book_id)\r
+    public function __construct($book_id, $options = [])\r
     {\r
-        parent::__construct($book_id);\r
+        parent::__construct($book_id, $options);\r
         $this->version = 'mac_exe_html';\r
     }\r
 \r
index fba50a74bd654f1ec2858e6ff00c3c0d8a104448..fccc27208c6a523b5261b30d63db917b10898557 100644 (file)
@@ -16,45 +16,45 @@ class wsPackager
     protected $workingDir;
     protected $whole = true;
     protected $_clean = true;
-    protected $_compileOnConstruct = true;
+    protected $_compileOnConstruct = false;
     public $cleanOnDestruct = true;
 
-    public static function package($book_id, $version, $zip = true, $cleanOnDestruct = true)
+    public static function package($book_id, $version, $zip = true, $cleanOnDestruct = true, $options = [])
     {
         global $packager;
 
         cubePHP::neverStop();
         if ($version === 'html') {
-            $packager = new wsPackagerHTML($book_id);
+            $packager = new wsPackagerHTML($book_id, null, true, $options);
         } else if ($version === 'scorm') {
-            $packager = new wsPackagerSCORM($book_id);
+            $packager = new wsPackagerSCORM($book_id, null, true, $options);
         } else if ($version === 'sharepoint') {
-            $packager = new wsPackagerSharepoint($book_id);
+            $packager = new wsPackagerSharepoint($book_id, null, true, $options);
         } elseif ($version === 'win_html') {
-            $packager = new wsPackagerWinHTML($book_id);
+            $packager = new wsPackagerWinHTML($book_id, null, true, $options);
         } else if ($version === 'phonegap') {
-            $packager = new wsPackagerPhonegap($book_id);
+            $packager = new wsPackagerPhonegap($book_id, null, true, $options);
         } else if ($version === 'win_exe_html') {
-            $packager = new wsPackagerWinEXEHTML($book_id);
+            $packager = new wsPackagerWinEXEHTML($book_id, $options);
         } else if ($version === 'mac_exe_html') {
-            $packager = new wsPackagerMacEXEHTML($book_id);
+            $packager = new wsPackagerMacEXEHTML($book_id, $options);
         } else if ($version === 'win_ins_html') {
-            $packager = new wsPackagerWinINSTHTML($book_id);
+            $packager = new wsPackagerWinINSTHTML($book_id, $options);
         } else if ($version === 'win_inss_html') {
-            $packager = new wsPackagerWinINSTSilentHTML($book_id);
+            $packager = new wsPackagerWinINSTSilentHTML($book_id, $options);
         } else if ($version === 'win_cd_html') {
-            $packager = new wsPackagerWinCDHTML($book_id);
+            $packager = new wsPackagerWinCDHTML($book_id, $options);
         } else if ($version === 'precompiled') {
-            $packager = new wsPackagerPrecompiled($book_id);
+            $packager = new wsPackagerPrecompiled($book_id, null, true, $options);
         } else if ($version === 'chromeos') {
-            $packager = new wsPackagerChromeOS($book_id);
+            $packager = new wsPackagerChromeOS($book_id, null, true, $options);
         }
         $packager->cleanOnDestruct = $packager->cleanOnDestruct && $cleanOnDestruct;
 
         return $packager->makePackage($zip);
     }
 
-    public function __construct($book_id, $vdir = null, $whole = true)
+    public function __construct($book_id, $vdir = null, $whole = true, $options = [])
     {
 
         $this->_clean = (null === $vdir);
@@ -72,6 +72,14 @@ class wsPackager
 
         $this->daoBook = new wsDAOBook($core->con);
         $this->book = $this->daoBook->selectById($book_id);
+        $forceCompile = false;
+        if (count($options)) {
+            $options['forceCompileOnDownload'] = true;
+        }
+        foreach ($options as $k => $v) {
+            $this->book->parametres->$k = $v;
+        }
+
         $this->pages = $this->daoBook->getPagesOfBook($book_id, false);
 
         $daoTheme = new wsDAOTheme($core->con);
@@ -81,13 +89,14 @@ class wsPackager
         $this->workingDir = $this->book->getAssetDir();
 
         if ($this->_compileOnConstruct) {
-            $this->compile();
+            $this->compile($forceCompile);
         }
     }
 
-    protected function compile()
+
+    protected function compile($forceCompile = false)
     {
-        $this->daoBook->compile($this->book_id, '2', false, $this->book->parametres->forceCompileOnDownload, false, $this->book);
+        $this->daoBook->compile($this->book_id, '2', false, $this->book->parametres->forceCompileOnDownload || $forceCompile, false, $this->book);
     }
 
     protected function preparePackage()
index dc1ecce90f2e3eb1944440199a93e15c772a31d6..08a06d1f2fa7be0a3eb60ed09cfa9d083e1b709d 100644 (file)
@@ -2,9 +2,9 @@
 \r
 class wsPackagerPrecompiled extends wsPackagerHTML\r
 {\r
-    public function __construct($book_id, $vdir = null, $whole = true)\r
+    public function __construct($book_id, $vdir = null, $whole = true,$options=[])\r
     {\r
-        parent::__construct($book_id, $vdir, $whole);\r
+        parent::__construct($book_id, $vdir, $whole,$options);\r
         $this->version = 'precompiled';\r
         $this->book->parametres->embedAllLibraries = true;\r
     }\r
index 44744e5b62ce76d8896f6e5996e4ed07d62658a4..e389c4c60954a849d765a70433257d254fdbfdc8 100644 (file)
@@ -2,9 +2,9 @@
 \r
 class wsPackagerSCORM extends wsPackagerHTML\r
 {\r
-    public function __construct($book_id, $vdir = null, $whole = true)\r
+    public function __construct($book_id, $vdir = null, $whole = true, $options = [])\r
     {\r
-        parent::__construct($book_id, $vdir, $whole);\r
+        parent::__construct($book_id, $vdir, $whole, $options);\r
         $this->version = 'scorm';\r
         $this->_disableScorm = false;\r
     }\r
index 61a20532d9bfee9a83bebab208a7f493126ead1f..dfbb484e56a1ec2b5b3ff138b887a29b46a6666c 100644 (file)
@@ -2,9 +2,9 @@
 \r
 class wsPackagerSharepoint extends wsPackagerHTML\r
 {\r
-    public function __construct($book_id, $vdir = null, $whole = true)\r
+    public function __construct($book_id, $vdir = null, $whole = true, $options = [])\r
     {\r
-        parent::__construct($book_id, $vdir, $whole);\r
+        parent::__construct($book_id, $vdir, $whole, $options);\r
         $this->version = 'sharepoint';\r
         $this->book->parametres->seoVersion = false;\r
         $this->book->parametres->maxResolution = 150;\r
index 26a1d55967c5b85684bb1f80a42189094d35a9f5..6a8ad1712bfa074879b13d1397b7d5b7b10c14d8 100644 (file)
@@ -3,9 +3,9 @@
 class wsPackagerWinCDHTML extends wsPackagerMacEXEHTML\r
 {\r
 \r
-       public function __construct($book_id)\r
+       public function __construct($book_id,$options=[])\r
        {\r
-               parent::__construct($book_id);\r
+               parent::__construct($book_id,$options);\r
                $this->book->parametres->alwaysHTML5 = true;\r
                $this->version = 'win_cd_html';\r
        }\r
index 924e46fe50472ba8766056bf50a74c48132f5c24..99f30ebc1e56241b46431777c421b960880925c5 100644 (file)
@@ -11,9 +11,9 @@ class wsPackagerWinEXEHTML extends wsPackager
     protected $node_platform = 'win';\r
     protected $exenameMaxlength = 30;\r
 \r
-    public function __construct($book_id)\r
+    public function __construct($book_id, $options = [])\r
     {\r
-        parent::__construct($book_id, null, true, true);\r
+        parent::__construct($book_id, null, true, $options);\r
         $this->version = 'win_exe_html';\r
         $this->appName = '';\r
         $this->appversion = '1.0.' . time();\r
index 452958eb34f9b2f1d0b24a49172f823f8bff2be1..677d8854a4c89741d73bcb31b5ec6432992aeac2 100644 (file)
@@ -6,9 +6,9 @@ class wsPackagerWinINSTHTML extends wsPackagerWinEXEHTML
     protected $nsi;\r
     protected $nsifile = 'html';\r
 \r
-    public function __construct($book_id)\r
+    public function __construct($book_id, $options = [])\r
     {\r
-        parent::__construct($book_id);\r
+        parent::__construct($book_id, $options);\r
         $this->version = 'win_ins_html';\r
     }\r
 \r
index 877b302f1c81b57775da6aaf8c46b9f732d66d9c..37ef4f44188a39a884a1bb4622a3c100054478df 100644 (file)
@@ -1,11 +1,13 @@
 <?php\r
 \r
-class wsPackagerWinINSTSilentHTML extends wsPackagerWinINSTHTML {\r
+class wsPackagerWinINSTSilentHTML extends wsPackagerWinINSTHTML\r
+{\r
 \r
-       protected $nsifile = 'html-silent';\r
+    protected $nsifile = 'html-silent';\r
 \r
-       public function __construct($book_id) {\r
-               parent::__construct($book_id);\r
-               $this->version = 'win_inss_html';\r
-       }\r
+    public function __construct($book_id, $options = [])\r
+    {\r
+        parent::__construct($book_id, $options);\r
+        $this->version = 'win_inss_html';\r
+    }\r
 }
\ No newline at end of file