]> _ Git - cubeextranet.git/commitdiff
WIP #3917 @1
authorstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 30 Sep 2020 17:07:41 +0000 (17:07 +0000)
committerstephen@cubedesigners.com <stephen@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 30 Sep 2020 17:07:41 +0000 (17:07 +0000)
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.links.php

index a0739a3721a89380171b968134a8349da58ddf49..9da3ec260aaaf8a07c2b723db31509c729628e48 100644 (file)
@@ -436,6 +436,7 @@ class wsBookParametres extends wsParametres
         $this->fields['videoBigPlay'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Afficher le gros bouton Play'), 'grade' => 3);
         $this->fields['brightcovePlayerId'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Brightcove Player Id'), 'grade' => 3);
         $this->fields['brightcovePlayerSecret'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Brightcove Player Secret'), 'grade' => 3);
+        $this->fields['slideshowCaptionSize'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Taille de police de la légende du diaporama'), 'hint' => __('Laisser vide pour utiliser la valeur par défaut'));
         $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];
@@ -444,7 +445,7 @@ class wsBookParametres extends wsParametres
         $this->fields['OAMChromeFactor'] = ['type' => 'float', 'default' => '1', 'editable' => true, 'label' => __('Facteur OAM Chrome')];
         $this->fields['OAMIEFactor'] = ['type' => 'float', 'default' => '1', 'editable' => true, 'label' => __('Facteur OAM IE11')];
         $this->forms['multimedia'] = array('label' => __('Liens et multimédia'),
-            'fieldsnames' => array('permanentLinks', 'linkBlinkTime', 'linkBlinkRepetition', '|', 'customLinkClass', 'ignoreLinksTypes', 'linkTooltipManager', 'linkCornerSize', 'linkTooltipMaxWidth', '|', 'linkTracker', 'linkTrackerRegexp', '|', 'linkFilePrefix', '|', 'linkMultimediaPerformanceMode', 'linkMultimediaQuality', '|', 'inlineSlideshowTransitionDuration', 'inlineSlideshowDuration', '|', 'videoReset', 'videoBigPlay', '|', 'brightcovePlayerId', 'brightcovePlayerSecret', '|', 'textPopupStylesheet', 'textPopupWidth', '|', 'iframePopupMaxWidth', '|', 'OAMChromeFactor', 'OAMIEFactor'));
+            'fieldsnames' => array('permanentLinks', 'linkBlinkTime', 'linkBlinkRepetition', '|', 'customLinkClass', 'ignoreLinksTypes', 'linkTooltipManager', 'linkCornerSize', 'linkTooltipMaxWidth', '|', 'linkTracker', 'linkTrackerRegexp', '|', 'linkFilePrefix', '|', 'linkMultimediaPerformanceMode', 'linkMultimediaQuality', '|', 'slideshowCaptionSize', 'inlineSlideshowTransitionDuration', 'inlineSlideshowDuration', '|', 'videoReset', 'videoBigPlay', '|', 'brightcovePlayerId', 'brightcovePlayerSecret', '|', 'textPopupStylesheet', 'textPopupWidth', '|', 'iframePopupMaxWidth', '|', 'OAMChromeFactor', 'OAMIEFactor'));
         //.
         $this->fields['downloadPortionPDF'] = ['type' => 'freefile', 'default' => '', 'editable' => true, 'label' => 'PDF utilisé pour le téléchargement des extraits'];
         $this->fields['downloadPortionZoom'] = ['type' => 'integer', 'default' => 8, 'editable' => false, 'editable' => true, 'label' => __('Zoom des images extraites')];
index 335ef58cd6889b01874d47af024bab32b4eece89..27289ee2ae6483d33c57e7e78bd97c5f236c4134 100644 (file)
@@ -2091,6 +2091,8 @@ class wsHTML5Compiler
         // Links Styles
         $this->lessVariables['links-color'] = wsHTML5::colorToCSS($this->theme->parametres->linksColor);
         $this->lessVariables['inlineslideshow-transition-time'] = (floatval($this->book->parametres->inlineSlideshowTransitionDuration) * 1000) . 'ms';
+        $this->lessVariables['slideshow-caption-size'] = $this->book->parametres->slideshowCaptionSize ?: '16px';
+
         $res = array_merge($res, $links);
 
         // Bookmarks
index 2fe024cfbca2901bf152dfba472c3cc41067336c..517878b61305a2a6fecbaba5abce3abd8dbf2fe5 100644 (file)
@@ -2277,6 +2277,7 @@ class slideshowLink extends normalLink
         $this->getURL();
 
         $slides = [];
+        $slides_options = [];
 
         // If the zip file contained a slideshow.xml file, use that for fetching images and their captions
         if (file_exists($XML_path)) {
@@ -2289,10 +2290,16 @@ class slideshowLink extends normalLink
                 $slideshow_settings['type'] = 'fade';
                 $slideshow_settings['rewind'] = true; // Loop infinitely
             }
+
+            // Autoplay
             if (isset($slideshowData->_autoplay) && $slideshowData->_autoplay == 'true') {
                 $slideshow_settings['autoplay'] = true;
             }
 
+            // Allow caption font-size to be overridden from XML file
+            $slides_options['caption_size'] = $slideshowData->_captionsize ?? null;
+
+
             if (isset($slideshowData->image)) {
                 $images = [];
                 if (is_array($slideshowData->image)) {
@@ -2321,11 +2328,11 @@ class slideshowLink extends normalLink
         }
 
         // Main slider
-        $res = '<div class="fb-slideshow splide" id="' . $slideshowID . '" data-open-index="' . $this->extra . '" data-thumbnails="' . ($thumbnails ? '1' : '0') . '" data-splide=\'' . json_encode($slideshow_settings) . '\'>' . $this->_slides($slides) . '</div>';
+        $res = '<div class="fb-slideshow splide" id="' . $slideshowID . '" data-open-index="' . $this->extra . '" data-thumbnails="' . ($thumbnails ? '1' : '0') . '" data-splide=\'' . json_encode($slideshow_settings) . '\'>' . $this->_slides($slides, $slides_options) . '</div>';
 
         // Thumbnails slider
         if ($thumbnails) {
-            $res .= '<div class="fb-slideshow-thumbnails splide" id="' . $slideshowID . '_thumbnails">' . $this->_slides($slides, false, $this->thumbnail_height) . '</div>';
+            $res .= '<div class="fb-slideshow-thumbnails splide" id="' . $slideshowID . '_thumbnails">' . $this->_slides($slides, ['show_captions' => false, 'max_height' => $this->thumbnail_height]) . '</div>';
         }
 
         $res = '<div class="fb-slideshow-wrapper">' . $res . '</div>';
@@ -2358,8 +2365,15 @@ class slideshowLink extends normalLink
         return $slides;
     }
 
-    protected function _slides($slides, $show_captions = true, $max_height = null)
+    protected function _slides($slides, $options = [])
     {
+        $default_options = [
+            'show_captions' => true,
+            'caption_size' => null,
+            'max_height' => null,
+        ];
+
+        $options = array_merge($default_options, $options);
 
         $res = '<div class="splide__track">';
         $res .= '<ul class="splide__list">';
@@ -2372,9 +2386,9 @@ class slideshowLink extends normalLink
 
             // When displaying thumbnails, they are a fixed size, based on height
             // We set dimensions here to avoid extra work on the client side
-            if ($max_height && $image_info) {
-                $thumb_width = round($max_height / $image_info[1] * $image_info[0]); // max_height / image_height * image_width
-                $image_dimensions = 'style="width:' . $thumb_width . 'px; height:' . $max_height . 'px"';
+            if ($options['max_height'] && $image_info) {
+                $thumb_width = round($options['max_height'] / $image_info[1] * $image_info[0]); // max_height / image_height * image_width
+                $image_dimensions = 'style="width:' . $thumb_width . 'px; height:' . $options['max_height'] . 'px"';
             }
 
             $res .= '<li class="fb-slideshow-slide splide__slide">';
@@ -2382,8 +2396,12 @@ class slideshowLink extends normalLink
             $res .= '<img class="fb-slideshow-slide-image" src="' . $image_path_relative . '" data-meta="' . htmlspecialchars($image_info_json, ENT_QUOTES) . '" ' . $image_dimensions . '>';
             //$res .= '</div>'; // .splide__slide__container
 
-            if ($show_captions && null !== $slide['caption']) {
-                $res .= '<p class="fb-slideshow-slide-caption">' . $slide['caption'] . '</p>';
+            if ($options['show_captions'] && null !== $slide['caption']) {
+
+                // Caption font size can be overridden if specified in XML
+                $caption_style = $options['caption_size'] ? ' style="font-size:'. $options['caption_size'] .'"' : '';
+
+                $res .= '<p class="fb-slideshow-slide-caption"'. $caption_style .'>' . $slide['caption'] . '</p>';
             }
 
             $res .= '</li>'; // .fb-slideshow-slide