]> _ Git - cubeextranet.git/commitdiff
fix #2438 @3
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 4 Jan 2019 19:39:14 +0000 (19:39 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 4 Jan 2019 19:39:14 +0000 (19:39 +0000)
fluidbook/icones/15/interface.svg
inc/commons/class.common.ajax.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Util/html5/3dflip/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.links.php
inc/ws/Util/html5/master/class.ws.html5.seo.php
index.php

index dbceb7ea43e06c6a1443f3aba433efa629889e87..419ed9b3391d484a3f2dd7122f069270497ab06d 100644 (file)
@@ -1,10 +1,10 @@
 <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">\r
 \r
     <symbol id="nav-home" viewBox="0 0 25 25">\r
-        <path class="st0" d="M19.3,23h-4.8c-0.4,0-0.7-0.3-0.7-0.7v-4.9h-2.6v4.9c0,0.4-0.3,0.7-0.7,0.7H5.7c-0.4,0-0.7-0.3-0.7-0.7v-8\r
+        <path d="M19.3,23h-4.8c-0.4,0-0.7-0.3-0.7-0.7v-4.9h-2.6v4.9c0,0.4-0.3,0.7-0.7,0.7H5.7c-0.4,0-0.7-0.3-0.7-0.7v-8\r
                c0-0.4,0.3-0.7,0.7-0.7s0.7,0.3,0.7,0.7v7.3h3.4v-4.9c0-0.4,0.3-0.7,0.7-0.7h4c0.4,0,0.7,0.3,0.7,0.7v4.9h3.4v-6.9\r
                c0-0.4,0.3-0.7,0.7-0.7s0.7,0.3,0.7,0.7v7.6C20.1,22.7,19.7,23,19.3,23z"/>\r
-        <path class="st0" d="M21.8,14.6c-0.2,0-0.4-0.1-0.5-0.2l-8.7-8.7l-8.7,8.7c-0.3,0.3-0.7,0.3-1,0s-0.3-0.7,0-1L12,4.1\r
+        <path d="M21.8,14.6c-0.2,0-0.4-0.1-0.5-0.2l-8.7-8.7l-8.7,8.7c-0.3,0.3-0.7,0.3-1,0s-0.3-0.7,0-1L12,4.1\r
                c0.3-0.3,0.7-0.3,1,0l9.3,9.3c0.3,0.3,0.3,0.7,0,1C22.1,14.5,21.9,14.6,21.8,14.6z"/>\r
     </symbol>\r
 \r
index af147addc5e2e92deba950d2b0ac7b6d6fe2120f..5a12774520709936274421a5e2c968ea3e9ebd8f 100644 (file)
@@ -476,6 +476,7 @@ Mot de passe : $password";
        {
                global $core;
 
+
                $e = explode('.', $_FILES['file']['name']);
                $ext = array_pop($e);
                new PHPExcel();
@@ -483,23 +484,32 @@ Mot de passe : $password";
                $phpexcel = $reader->load($_FILES['file']['tmp_name']);
                $sheet = $phpexcel->getSheet(0);
                $maxRow = $sheet->getHighestRow(0);
-               for ($i = 0; $i < $maxRow; $i++) {
-
+               for ($i = 1; $i <= $maxRow; $i++) {
                        $ref = trim($sheet->getCellByColumnAndRow(0, $i));
                        $url = trim($sheet->getCellByColumnAndRow(1, $i)->getOldCalculatedValue());
+
+                       if ($ref == '') {
+                               $ref = trim($sheet->getCellByColumnAndRow(0, $i)->getFormattedValue());
+                       }
+                       if ($url == '') {
+                               $url = trim($sheet->getCellByColumnAndRow(1, $i)->getFormattedValue());
+                       }
+
                        if ($url == '' || $ref == '') {
                                continue;
                        }
 
+                       $fref = self::_formatWsReferenceRef($ref, $_POST['type']);
+                       $furl = self::_formatWsReferenceUrl($url, $_POST['type']);
+
+                       $delete = "DELETE FROM wsref WHERE ref='" . $core->con->escape($fref) . "' AND type='" . $core->con->escape($_POST['type']) . "'";
+                       $core->con->execute($delete);
+
                        $c = $core->con->openCursor('wsref');
                        $c->type = $_POST['type'];
-                       $c->ref = self::_formatWsReferenceRef($ref, $_POST['type']);
-                       $c->url = self::_formatWsReferenceUrl($url, $_POST['type']);
-                       try {
-                               $c->insert();
-                       } catch (Exception $e) {
-                               $c->update("WHERE ref='" . $core->con->escape($ref) . "' AND type='" . $core->con->escape($_POST['type']) . "'");
-                       }
+                       $c->ref = $fref;
+                       $c->url = $furl;
+                       $c->insert();
                }
        }
 
index a9f8e945d2bd8e4d14b0d44f950e5feaedae0929..f19b1c8be702d68f89d32f00a5add607086b746a 100644 (file)
@@ -1105,15 +1105,15 @@ html{height:100%}' . "\n";
                        }
                }
 
-               $dao->compile($book_id, 'html5');
-               $time = self::getHTML5CacheTime($book_id);
-
-               if (count($e) == 2 /*|| $e[2] <= $time - 10*/) {
+               $time = TIME;
+               if (count($e) == 2) {
                        $e[2] = $time;
                        http::redirect(SITE_PATH . 'viewerh/' . implode('_', $e) . '/');
                        exit;
                }
 
+               $dao->compile($book_id, 'html5', false, false, false, null, false);
+
                $book_id = $e[0];
                $hash = $e[1];
                self::commonHTML5Viewer($book_id, $hash);
@@ -1149,7 +1149,7 @@ html{height:100%}' . "\n";
                }
 
                $dao->compile($book_id, 'html5');
-               $time = self::getHTML5CacheTime($book_id);
+               $time = TIME;
 
                if (count($e) == 2 || $e[2] <= $time - 10) {
                        $e[2] = $time;
@@ -1162,16 +1162,6 @@ html{height:100%}' . "\n";
                self::commonHTML5Viewer($book_id, $hash, '', ['<head>' => '<head><script type="text/javascript">var FORCE_SCORM=true;</script>']);
        }
 
-
-       public static function getHTML5CacheTime($book_id)
-       {
-               $cacheFile = WS_BOOKS . '/html5/' . $book_id . '/cache.appcache';
-               if (file_exists($cacheFile)) {
-                       return filemtime($cacheFile);
-               }
-               return TIME;
-       }
-
        public static function commonHTML5Viewer($book_id, $hash, $version = '', $replace = [])
        {
                global $core;
index 21e334a53f3da4b85304726f953383c33f77ffdf..c578ee54783d78bd0e2c86410ead4eae98e4520f 100644 (file)
@@ -1148,7 +1148,7 @@ class wsDAOBook extends commonDAO
                }
        }
 
-       public function compile($book_id, $version = 'all', $complete = false, $force = false, $dev = false, $book = null)
+       public function compile($book_id, $version = 'all', $complete = false, $force = false, $dev = false, $book = null, $delete = true)
        {
                if (is_null($book_id) || !$book_id) {
                        return;
@@ -1194,7 +1194,7 @@ class wsDAOBook extends commonDAO
                }
                if ($html5) {
                        fb(time(), 'Compile HTML5');
-                       $res .= $this->compileHTML5($book_id, $book, $dev);
+                       $res .= $this->compileHTML5($book_id, $book, $dev, $delete);
                        $this->touchCompile($book_id, 'html5');
                }
                if ($v1 || $v2) {
@@ -1744,7 +1744,7 @@ class wsDAOBook extends commonDAO
                }
        }
 
-       public function compileHTML5($book_id, $book, $dev = false)
+       public function compileHTML5($book_id, $book, $dev = false, $delete = true)
        {
                $version = $book->parametres->mobileLVersion;
                if ($dev) {
@@ -1752,7 +1752,7 @@ class wsDAOBook extends commonDAO
                }
 
                $htmlCompiler = wsHTML5::compilerFactory($book_id, $version, false, 'latest', null, false, false, false, $book);
-               $htmlCompiler->compile();
+               $htmlCompiler->compile($delete);
        }
 
        /* public function indexPDF($book, $pages) {
index 08993ddedf33e3944205bde833865780d492f6c5..d60307dab94d4683205aad7856223b30fa344250 100644 (file)
@@ -391,8 +391,9 @@ class wsBookParametres extends wsParametres
                $this->fields['inlineSlideshowDuration'] = array('type' => 'float', 'default' => 7, 'editable' => true, 'label' => __('Temps d\'attente des diaporamas intégrés aux pages (s)'));
                $this->fields['textPopupStylesheet'] = ['type' => 'freefile', 'default' => '', 'editable' => true, 'label' => __('Feuille de style des popups de texte'), 'fileFilter' => $cssFilter];
                $this->fields['textPopupWidth'] = ['type' => 'integer', 'default' => '600', 'editable' => true, 'label' => __('Largeur optimale des popups')];
+               $this->fields['iframePopupMaxWidth'] = ['type' => 'integer', 'default' => '0', 'editable' => true, 'label' => __('Largeur maximale des popups iframe')];
                $this->forms['multimedia'] = array('label' => __('Liens et multimédia'),
-                       'fieldsnames' => array('permanentLinks', 'linkBlinkTime', 'customLinkClass', 'ignoreLinksTypes', 'linkTooltipManager', 'linkCornerSize', 'linkTooltipMaxWidth', '|', 'linkTracker', 'linkTrackerRegexp', '|', 'linkFilePrefix', '|', 'linkMultimediaPerformanceMode', 'linkMultimediaQuality', '|', 'inlineSlideshowTransitionDuration', 'inlineSlideshowDuration', '|', 'videoReset', 'videoBigPlay', '|', 'brightcovePlayerId', 'brightcovePlayerSecret', '|', 'textPopupWidth', 'textPopupStylesheet'));
+                       'fieldsnames' => array('permanentLinks', 'linkBlinkTime', 'customLinkClass', 'ignoreLinksTypes', 'linkTooltipManager', 'linkCornerSize', 'linkTooltipMaxWidth', '|', 'linkTracker', 'linkTrackerRegexp', '|', 'linkFilePrefix', '|', 'linkMultimediaPerformanceMode', 'linkMultimediaQuality', '|', 'inlineSlideshowTransitionDuration', 'inlineSlideshowDuration', '|', 'videoReset', 'videoBigPlay', '|', 'brightcovePlayerId', 'brightcovePlayerSecret', '|', 'textPopupStylesheet', 'textPopupWidth', '|', 'iframePopupMaxWidth'));
                //.
                $this->fields['externalArchives'] = array('type' => 'freefile', 'default' => '', 'editable' => true,
                        'label' => __('Archives'), 'grade' => 3, 'fileFilter' => $imageFilter);
index 7d2f907440096e63a8c0c3667216f8314987379a..423a6a4aace4e369b1e8c29cfa80570f443ec9af 100644 (file)
@@ -510,7 +510,7 @@ class wsHTML5Compiler
                $this->writeExtras();
                $this->log('Extras written');
                $this->populateConfig();
-               $this->writeCSS('data/style/style_%d.css', $linksCSS);
+               $this->writeCSS($linksCSS);
                $this->log('CSS written');
                $this->writeIndex();
                $this->log('Index written');
@@ -1581,7 +1581,7 @@ class wsHTML5Compiler
                return $val ? 'true' : 'false';
        }
 
-       protected function writeCSS($file, $links)
+       protected function writeCSS($links)
        {
                $res = array();
 
@@ -1788,16 +1788,14 @@ class wsHTML5Compiler
                # ZoomPopup close button background
                $res[] = '.zoomPopupClose {background-color:' . wsHTML5::colorToCSS($this->theme->parametres->couleurB) . ';}';
 
+               if ($this->book->parametres->textPopupStylesheet) {
+                       $res[] = file_get_contents($this->wdir . '/' . $this->book->parametres->textPopupStylesheet);
+               }
 
                $this->_writeLess($lessVariables, $lessContents);
-
-               $res = array_chunk($res, 3500);
-               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);
+               $this->stylesheets[] = 'data/style/style.css';
+               $this->vdir->file_put_contents('data/style/style.css', implode("\n", $res));
+               $this->log('Write CSS');
        }
 
        protected function _writeLess($variables, $lessContents = '')
index c3f5d27f9d84a902b354309ed7b39247e7e1b416..17baa231345f57f27d62e37c036281354bfbd08a 100644 (file)
@@ -503,7 +503,7 @@ class wsHTML5Compiler
                }
                $this->writeJs();
                $this->log('Js written');
-               $this->vdir->sync($delete);
+               $this->vdir->sync($delete, $this);
                $this->log('Files Synced');
        }
 
@@ -600,25 +600,22 @@ class wsHTML5Compiler
 
        protected function _writeIndex($page)
        {
-
                if (!isset($this->seo->pages[$page])) {
                        return;
                }
                $seo = $this->seo->pages[$page];
                $html = $seo->getHTML();
 
-               $iv = $this->getIndexVars();
-
-               foreach ($iv as $k => $v) {
-                       $html = str_replace($k, $v, $html);
-               }
-
                if ($this->book->parametres->seoVersion) {
                        $seo->writePage($html, $this->vdir);
                }
                if ($page == 1) {
                        $seo->writePage($html, $this->vdir, 'index.html');
                }
+
+               if ($page % 10 == 0) {
+                       $this->log('Written page ' . $page);
+               }
        }
 
        public function getIndexVars()
@@ -774,6 +771,10 @@ class wsHTML5Compiler
 
        protected function writeIndex()
        {
+               $iv = $this->getIndexVars();
+               foreach ($iv as $k => $v) {
+                       $this->seo->html = str_replace($k, $v, $this->seo->html);
+               }
                if ($this->book->parametres->seoVersion) {
                        foreach ($this->pages as $page => $infos) {
                                $this->_writeIndex($page);
@@ -1484,7 +1485,9 @@ class wsHTML5Compiler
                                $this->_makeCover($docdir . 'html/t36-' . $infos['document_page'] . '.jpg');
                        }
 
-                       $this->log('Copied image ' . $page);
+                       if ($page % 10 == 0) {
+                               $this->log('Copied image ' . $page);
+                       }
                }
 
 
index 1946d631e166330ed6883129328aab580bbd58dd..09a4c7364c3a4edf190b1fe89813b8f5e5f0ba85 100644 (file)
@@ -87,7 +87,7 @@ class wsHTML5Link
                                        case 'AtlanticDownloadLink':
                                                return new atlanticDownloadLink($id, $init, $compiler);
                                        default :
-                                               return new customLink($id, $init, $compiler);
+                                               return customLink::getCustomInstance($id, $init, $compiler);
                                }
                                break;
                        case 8:
@@ -1567,12 +1567,22 @@ class haguenauManifLink extends internalLink
 
 class customLink extends wescoLink
 {
-       public function getURL()
+       public static function getCustomInstance($id, $init, &$compiler)
+       {
+               $e = explode(':', $init['to']);
+               if ($e[0] == '10doigts') {
+                       $init['to'] = self::_getURL($init['to']);
+                       return new iframePopupLink($id, $init, $compiler);
+               }
+               return new customLink($id, $init, $compiler);
+       }
+
+       public static function _getURL($to)
        {
                global $core;
-               $e = explode(':', $this->to, 2);
+               $e = explode(':', $to, 2);
                if (!count($e) == 1) {
-                       return 'https://workshop.fluidbook.com/services/wsref?ref=' . urlencode($this->to);
+                       return 'https://workshop.fluidbook.com/services/wsref?ref=' . urlencode($to);
                }
                $type = trim($e[0]);
                $ref = trim($e[1]);
@@ -1584,6 +1594,11 @@ class customLink extends wescoLink
                return 'https://workshop.fluidbook.com/services/wsref?ref=' . urlencode($type . '|' . $ref);
        }
 
+       public function getURL()
+       {
+               return self::_getURL($this->to);
+       }
+
        public function getDefaultTooltip()
        {
                return 'click to open the link';
@@ -1868,7 +1883,7 @@ class iframePopupLink extends normalLink
 
        public function keep()
        {
-               return true;
+               return false;
        }
 
 }
index c094021bba22c6deae17510e76b37da20e19b4b8..f184c849ef769443b680dee4f620eab88669d9bf 100644 (file)
@@ -7,6 +7,7 @@ class wsHTML5Seo
         */\r
        public $compiler;\r
        public $pages;\r
+       public $html;\r
        protected $_nav = null;\r
 \r
 \r
@@ -67,6 +68,8 @@ class wsHTML5Seo
                                }\r
                        }\r
                }\r
+\r
+               $this->html = file_get_contents($this->compiler->assets . '/_index.html');\r
        }\r
 \r
        public function getTextContent($infos)\r
@@ -165,8 +168,7 @@ class wsHTML5SeoPage
 \r
        public function getHTML()\r
        {\r
-               $compiler = $this->_container->compiler;\r
-               $html = file_get_contents($this->_container->compiler->assets . '/_index.html');\r
+               $html = $this->_container->html;\r
 \r
                $vars = ['description' => $this->description ? '<meta name="description" content="' . $this->description . '">' : '',\r
                        'keywords' => $this->keywords ? '<meta name="keywords" content="' . $this->keywords . '">' : '',\r
@@ -241,6 +243,17 @@ class wsHTML5SeoPage
                }\r
                $html = str_replace('<!-- $base -->', $base, $html);\r
 \r
-               $vdir->file_put_contents($path, $html);\r
+               $dir = WS_BOOKS . '/seo/' . $this->_container->compiler->book_id . '/';\r
+               if (!file_exists($dir)) {\r
+                       mkdir($dir, 0777, true);\r
+               }\r
+               $file = $dir . $this->page . '.html';\r
+               $hash = sha1($html);\r
+               $hashfile = $dir . $this->page . '.hash';\r
+               if (!file_exists($hashfile) || file_get_contents($hashfile) != $hash) {\r
+                       file_put_contents($file, $html);\r
+                       file_put_contents($hashfile, $hash);\r
+               }\r
+               $vdir->copy($file, $path);\r
        }\r
 }
\ No newline at end of file
index 89185cb0b118a143a6e517806ee78a14f717c171..d943374dfa89ff9b6bd35f16b7e2805efd15ce38 100644 (file)
--- a/index.php
+++ b/index.php
@@ -30,7 +30,7 @@ $standard = 'XHTML 1.0 Transitional';
 echo $core->url->getDocument();
 $buffer = ob_get_contents();
 
-cubePHP::set_memory('4G');
+cubePHP::set_memory('6G');
 
 ob_clean();
 echo cubePage::page($buffer, $js, $jsvar, $css, array(), 9, false, $meta, array(), $standard);