From 48d3edac4f9231a7a78f4a26e1d544f525559b10 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Thu, 16 Apr 2020 22:34:59 +0200 Subject: [PATCH] 2.14 Option d'ouverture automatique des images --- module/gallery/gallery.php | 18 +++++++++++++----- module/gallery/view/edit/edit.php | 9 ++++++++- module/gallery/view/gallery/gallery.js.php | 11 +++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 7658b268..42efd90c 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -8,6 +8,8 @@ * * @author Rémi Jean * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2020, Frédéric Tempez * @license GNU General Public License, version 3 * @link http://zwiicms.com/ */ @@ -47,7 +49,7 @@ class gallery extends common { public static $thumbs = []; - const GALLERY_VERSION = '2.13'; + const GALLERY_VERSION = '2.14'; /** @@ -64,9 +66,12 @@ class gallery extends common { 'directory' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','directory']), 'homePicture' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','homePicture']), 'sort' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','sort']), - 'position' => $i + 'position' => $i, + 'fullScreen' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','fullScreen']) + ], - 'legend' => $this->getData(['module',$this->getUrl(0),$data[$i],'legend']) + 'legend' => $this->getData(['module',$this->getUrl(0),$data[$i],'legend']), + 'position' => $this->getData(['module',$this->getUrl(0),$data[$i],'position']) ]]); } } @@ -143,7 +148,8 @@ class gallery extends common { 'directory' => $this->getInput('galleryConfigDirectory', helper::FILTER_STRING_SHORT, true), 'homePicture' => $homePicture, 'sort' => self::SORT_ASC, - 'position' => count($this->getData(['module',$this->getUrl(0)])) + 1 + 'position' => count($this->getData(['module',$this->getUrl(0)])) + 1, + 'fullScreen' => false ], 'legend' => [], 'position' => [] @@ -279,7 +285,9 @@ class gallery extends common { 'homePicture' => $homePicture, // pas de positions, on active le tri alpha 'sort' => (empty($picturesPosition) && $this->getInput('galleryEditSort') === self::SORT_HAND) ? self::SORT_ASC : $this->getInput('galleryEditSort'), - 'position' => $this->getData(['module', $this->getUrl(0), $galleryId,'config','position']) === '' ? count($this->getData(['module',$this->getUrl(0)]))-1 : $this->getData(['module', $this->getUrl(0), $galleryId,'config','position']) + 'position' => $this->getData(['module', $this->getUrl(0), $galleryId,'config','position']) === '' ? count($this->getData(['module',$this->getUrl(0)]))-1 : $this->getData(['module', $this->getUrl(0), $galleryId,'config','position']), + 'fullScreen' => $this->getInput('galleryEditFullscreen', helper::FILTER_BOOLEAN) + ], 'legend' => $legends, 'position' => $picturesPosition diff --git a/module/gallery/view/edit/edit.php b/module/gallery/view/edit/edit.php index 8a9ff9b6..a6f14f2b 100644 --- a/module/gallery/view/edit/edit.php +++ b/module/gallery/view/edit/edit.php @@ -39,7 +39,14 @@ 'label' => 'Tri des images', 'help' => 'Les tris alphabétiques conviennent également aux images numérotées.
Cliquez sur \'Enregistrer\' pour valider le tri.' ]); ?> - + +
+
+ $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'fullScreen']), + 'help' => 'A l\'ouverture de la galerie, la première image est affichée en plein écran.' + ]); ?> +
diff --git a/module/gallery/view/gallery/gallery.js.php b/module/gallery/view/gallery/gallery.js.php index e0c6f85d..731e6236 100644 --- a/module/gallery/view/gallery/gallery.js.php +++ b/module/gallery/view/gallery/gallery.js.php @@ -6,6 +6,8 @@ * * @author Rémi Jean * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2020, Frédéric Tempez * @license GNU General Public License, version 3 * @link http://zwiicms.com/ */ @@ -20,3 +22,12 @@ var b = new SimpleLightbox('.galleryGalleryPicture', { captionsData: "caption", closeText: "×" }); + +$( document ).ready(function() { + // Démarre en mode plein écran + var fullscreen = getData(['module', $this->getUrl(0), $this->getUrl(1), 'config', 'fullScreen'])); ?>; + console.log(fullscreen); + if ( fullscreen === true) { + $('a.galleryGalleryPicture:first')[0].click(); + } + });