From ffff95e62de62f3f1359163cb8ccdc82d91e0186 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 19 Dec 2018 17:53:58 +0000 Subject: [PATCH] #2249 --- inc/ws/Metier/class.ws.book.parametres.php | 8 +++++++- .../html5/master/class.ws.html5.compiler.php | 18 ++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index c223466af..08993dded 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -61,6 +61,10 @@ class wsBookParametres extends wsParametres $seoFilter->name = __('Fichier Excel') . ' (.xlsx)'; $seoFilter->extensions = '*.xlsx'; + $cssFilter = new stdClass(); + $cssFilter->name = __('Feuille de style') . ' (.css)'; + $cssFilter->extensions = '*.css'; + $branches = array('master : git (stable)' => 'stable', 'master : local (dev)' => 'dev'); $gitbranches = json_decode(file_get_contents(WS_CACHE . '/activebranches')); @@ -385,8 +389,10 @@ class wsBookParametres extends wsParametres $this->fields['brightcovePlayerSecret'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Brightcove Player Secret'), 'grade' => 3); $this->fields['inlineSlideshowTransitionDuration'] = array('type' => 'float', 'default' => 0.75, 'editable' => true, 'label' => __('Durée de la transition des diaporamas intégrés aux pages (s)')); $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->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')); + 'fieldsnames' => array('permanentLinks', 'linkBlinkTime', 'customLinkClass', 'ignoreLinksTypes', 'linkTooltipManager', 'linkCornerSize', 'linkTooltipMaxWidth', '|', 'linkTracker', 'linkTrackerRegexp', '|', 'linkFilePrefix', '|', 'linkMultimediaPerformanceMode', 'linkMultimediaQuality', '|', 'inlineSlideshowTransitionDuration', 'inlineSlideshowDuration', '|', 'videoReset', 'videoBigPlay', '|', 'brightcovePlayerId', 'brightcovePlayerSecret', '|', 'textPopupWidth', 'textPopupStylesheet')); //. $this->fields['externalArchives'] = array('type' => 'freefile', 'default' => '', 'editable' => true, 'label' => __('Archives'), 'grade' => 3, 'fileFilter' => $imageFilter); 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 e712590e4..c3f5d27f9 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -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'); @@ -1563,7 +1563,7 @@ class wsHTML5Compiler return $val ? 'true' : 'false'; } - protected function writeCSS($file, $links) + protected function writeCSS($links) { $res = array(); @@ -1766,16 +1766,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 = '') -- 2.39.5