]> _ Git - cubeextranet.git/commitdiff
WIP #2498 @0.5
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 15 Jan 2019 16:20:59 +0000 (16:20 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 15 Jan 2019 16:20:59 +0000 (16:20 +0000)
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Util/html5/printing/class.ws.html5.compiler.php
l10n/en/main.lang.php

index ebbe3b185b0f83775a95a6633dbe6399e1f529c8..ba020201276d559fa68ee8b7d29f8438fd746481 100644 (file)
@@ -248,13 +248,15 @@ class wsBookParametres extends wsParametres
                // .
                //
                $this->fields['print'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Activer l'impression"));
+               $this->fields['printFullBrochure'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Autoriser l'impression de la brochure complète"));
+               $this->fields['printPageRange'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __("Activer l'option pour imprimer une plage de pages"));
                $this->fields['printMode'] = array('type' => 'combo', 'default' => 'vector', 'editable' => true, 'label' => __("Mode d'impression"),
                        'datas' => array(__('Bitmap') => 'bitmap',
                                __('Vectoriel') => 'vector',
                                __('PDF') => 'pdf'));
                $this->fields['printCoverWithMarks'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __("Imprimer les couvertures avec les pages marquées"), 'grade' => 3);
                $this->forms['print'] = array('label' => __('Impression'),
-                       'fieldsnames' => array('print', 'printMode', 'printCoverWithMarks'));
+                       'fieldsnames' => array('print', 'printFullBrochure', 'printPageRange', 'printMode', 'printCoverWithMarks'));
 
 
                $this->fields['search'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer le moteur de recherche'));
index 171c6a8c93c7fbb917fc4ac2d9beac69991e8b3b..fee62e37708e28c9e6546bb9904ca1654cd73afe 100644 (file)
@@ -180,14 +180,14 @@ class wsHTML5Compiler
        public $logtime = null;
        public $beginBody = array();
        public $seoArticles = [];
-       public $securityPolicyWhitelist = ['*.google-analytics.com', '*.youtube.com', '*.ytimg.com'];
+       public $securityPolicyWhitelist = ['*.google-analytics.com', '*.youtube.com', '*.ytimg.com', '*.googletagmanager.com'];
        public $writeLinksData = false;
        public $content_lock = [];
        protected $_indexVars = null;
 
        public $_signature;
        /**
-        * @var wsHTML5Seo
+        * @var wsHTML5SeolinksData
         */
        public $seo = null;
 
@@ -493,7 +493,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');
@@ -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);
@@ -1300,7 +1301,7 @@ class wsHTML5Compiler
                                        copy($tmp, $minimized);
                                }
 
-                               if (!file_exists($minimized)) {
+                               if (!file_exists($minimized) || filesize($minimized) == 0) {
                                        die('An error occured while uglifying : ' . $uglify->output);
                                }
                        }
@@ -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);
+                       }
                }
 
 
@@ -1563,7 +1566,7 @@ class wsHTML5Compiler
                return $val ? 'true' : 'false';
        }
 
-       protected function writeCSS($file, $links)
+       protected function writeCSS($links)
        {
                $res = array();
 
@@ -1610,11 +1613,13 @@ class wsHTML5Compiler
 
 
                $left = $w;
+               $centerOffset = 0;
                if ($this->book->parametres->correctCenter) {
                        $centerOffset = 3;
                        $left = ($cssWidth - $centerOffset) . 'px';
                        $res[] = '.doublePage._3d .page.left{left:-' . ($centerOffset + 1) . 'px !important;}';
                }
+               $lessVariables['correct-center'] = ($centerOffset * -1);
 
                $res[] = '.doublePage._3d{left:' . $left . ';}';
                $res[] = '#links.right{left:-' . $left . ';}';
@@ -1764,16 +1769,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 71e62a5bee22542abf565d012df9ada750e4d792..093ac11e58ed3058085dc4bea1b7417fd03fad0a 100644 (file)
@@ -647,6 +647,8 @@ let us know by writing to ',
   'Activer le scroll automatique' => 'Enable automatic scrolling',
   'Index' => 'Index',
   'Activer l\'impression' => 'Enable printing ',
+  'Autoriser l\'impression de la brochure complète' => 'Allow full brochure to be printed',
+  'Activer l\'option pour imprimer une plage de pages' => 'Allow page ranges to be printed',
   'Mode d\'impression' => 'Printing mode',
   'Bitmap' => 'Bitmap',
   'Vectoriel' => 'Vector',