From b6839bc0ac01ca48dd3fc8a6cf7171b4af60ae9d Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sun, 8 Mar 2020 14:56:10 +0100 Subject: [PATCH 1/9] init WIp --- core/core.php | 2 +- module/gallery/gallery.php | 41 +++++++++++++++++++----- module/gallery/view/config/config.js.php | 11 +++++++ module/gallery/view/config/config.php | 2 +- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/core/core.php b/core/core.php index 13a42874..d48e585a 100644 --- a/core/core.php +++ b/core/core.php @@ -3332,7 +3332,7 @@ class template { $html .= ''; $i = 0; foreach($tr as $td) { - $html .= '' . $td . ''; + $html .= '' . $td . ''; } $html .= ''; } diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index da6f4a64..2cc514a3 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -23,8 +23,8 @@ class gallery extends common { ]; public static $sort = [ - 'asc' => 'Alphabétique naturel', - 'dsc' => 'Alphabétique naturel inverse', + 'SORT_ASC' => 'Alphabétique naturel', + 'SORT_DSC' => 'Alphabétique naturel inverse', 'none' => 'Aucun tri', ]; @@ -44,8 +44,24 @@ class gallery extends common { public function config() { // Liste des galeries $galleries = $this->getData(['module', $this->getUrl(0)]); + $countGalleries = count($this->getData(['module',$this->getUrl(0)])); + // Tri des éléments de la galerie + /* + echo "
";	
+		if($galleries) {	
+			foreach($galleries as $galleryId => $gallery) {
+				echo $galleryId;
+				echo "|";
+				echo $gallery['config']['order'] ;
+				echo '

'; + } + } + + + echo "

"; + */ + if($galleries) { - ksort($galleries,SORT_NATURAL); foreach($galleries as $galleryId => $gallery) { // Erreur dossier vide if(is_dir($gallery['config']['directory'])) { @@ -57,10 +73,18 @@ class gallery extends common { else { $gallery['config']['directory'] = '' . $gallery['config']['directory'] . ' (dossier introuvable)'; } + // Ordre des galeries + // Element 0 chaine vide + $galeryOrder = range(1,count($this->getData(['module',$this->getUrl(0)]))); // Met en forme le tableau self::$galleries[] = [ $gallery['config']['name'], $gallery['config']['directory'], + template::select('galleryConfigOrder', $galeryOrder , [ + 'selected' => $gallery['config']['order'], + 'class' => 'configOrder' + + ]), template::button('galleryConfigEdit' . $galleryId , [ 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'], 'value' => template::ico('pencil') @@ -80,7 +104,8 @@ class gallery extends common { 'config' => [ 'name' => $this->getInput('galleryConfigName'), 'directory' => $this->getInput('galleryConfigDirectory', helper::FILTER_STRING_SHORT, true), - 'sort' => $this->getInput('galleryConfigSort') + 'sort' => $this->getInput('galleryConfigSort'), + 'order' => count($this->getData(['module',$this->getUrl(0)])) + 1 ], 'legend' => [] ]]); @@ -223,10 +248,10 @@ class gallery extends common { switch ($this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'sort'])) { case 'none': break; - case 'dsc': + case 'SORT_DSC': krsort(self::$pictures,SORT_NATURAL); break; - case 'asc': + case 'SORT_ASC': default: ksort(self::$pictures,SORT_NATURAL); break; @@ -268,10 +293,10 @@ class gallery extends common { switch ($this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'config', 'sort'])) { case 'none': break; - case 'dsc': + case 'SORT_DSC': krsort(self::$pictures,SORT_NATURAL); break; - case 'asc': + case 'SORT_ASC': default: ksort(self::$pictures,SORT_NATURAL); break; diff --git a/module/gallery/view/config/config.js.php b/module/gallery/view/config/config.js.php index 39e47491..03c26eba 100644 --- a/module/gallery/view/config/config.js.php +++ b/module/gallery/view/config/config.js.php @@ -58,4 +58,15 @@ setInterval(function() { */ directoryDOM.on("change", function() { directoryOldDOM.val($(this).val()); +}); + + +/** + * Tri de la galerie + */ + +$( document ).ready(function() { + $('tbody > tr').sort(function (a, b) { + return +$('td#pos3', b).text() > +$('td#pos3', a).text(); + }).appendTo('tbody'); }); \ No newline at end of file diff --git a/module/gallery/view/config/config.php b/module/gallery/view/config/config.php index 508b07a0..a124965c 100644 --- a/module/gallery/view/config/config.php +++ b/module/gallery/view/config/config.php @@ -45,7 +45,7 @@ - + From cfc044a9f3de050857ee6612f31823c0ba65e26a Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sun, 8 Mar 2020 14:57:42 +0100 Subject: [PATCH 2/9] Texte au lieu de select --- module/gallery/gallery.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 2cc514a3..6663ca17 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -80,11 +80,13 @@ class gallery extends common { self::$galleries[] = [ $gallery['config']['name'], $gallery['config']['directory'], + $gallery['config']['order'], + /* template::select('galleryConfigOrder', $galeryOrder , [ 'selected' => $gallery['config']['order'], 'class' => 'configOrder' - ]), + ]),*/ template::button('galleryConfigEdit' . $galleryId , [ 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'], 'value' => template::ico('pencil') From c8040983a6fc4cb926e4dd486b62d2e93071ab6f Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sun, 8 Mar 2020 18:19:52 +0100 Subject: [PATCH 3/9] WIP --- core/core.php | 2 +- module/gallery/view/config/config.js.php | 19 +++++++++++++----- module/gallery/view/config/config.php | 2 +- module/gallery/view/edit/edit.php | 6 +++--- module/gallery/view/index/index.js.php | 25 ++++++++++++++++++++++++ module/gallery/view/index/index.php | 2 +- 6 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 module/gallery/view/index/index.js.php diff --git a/core/core.php b/core/core.php index d48e585a..2c2fad2a 100644 --- a/core/core.php +++ b/core/core.php @@ -3332,7 +3332,7 @@ class template { $html .= ''; $i = 0; foreach($tr as $td) { - $html .= '' . $td . ''; + $html .= '' . $td . ''; } $html .= ''; } diff --git a/module/gallery/view/config/config.js.php b/module/gallery/view/config/config.js.php index 03c26eba..80bef565 100644 --- a/module/gallery/view/config/config.js.php +++ b/module/gallery/view/config/config.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/ */ @@ -62,11 +64,18 @@ directoryDOM.on("change", function() { /** - * Tri de la galerie + * Tri dynamique de la galerie */ - $( document ).ready(function() { - $('tbody > tr').sort(function (a, b) { - return +$('td#pos3', b).text() > +$('td#pos3', a).text(); - }).appendTo('tbody'); + var $tbody = $('#galleryTable tbody'); + $tbody.find('tr').sort(function (a, b) { + var tda = $(a).find('td.pos3:eq(0)').text(); + var tdb = $(b).find('td.pos3:eq(0)').text(); + // if a < b return 1 + return tda > tdb ? 1 + // else if a > b return -1 + : tda < tdb ? -1 + // else they are equal - return 0 + : 0; + }).appendTo($tbody); }); \ No newline at end of file diff --git a/module/gallery/view/config/config.php b/module/gallery/view/config/config.php index a124965c..4f00d51c 100644 --- a/module/gallery/view/config/config.php +++ b/module/gallery/view/config/config.php @@ -45,7 +45,7 @@ - + 'galleryTable']); ?> diff --git a/module/gallery/view/edit/edit.php b/module/gallery/view/edit/edit.php index c088032d..60f7dff4 100644 --- a/module/gallery/view/edit/edit.php +++ b/module/gallery/view/edit/edit.php @@ -17,7 +17,7 @@

Informations générales

-
+
'Nom', 'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'name']) @@ -33,13 +33,13 @@ 'noDirty' => true // Désactivé à cause des modifications en ajax ]); ?>
-
+
$this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'config', 'sort']), 'label' => 'Tri des images', 'help' => 'Les images sont triées par nom de fichier grâce à la méthode naturelle qui donne de meilleurs résultats lorsque les images sont numérotées.' ]); ?> -
+
diff --git a/module/gallery/view/index/index.js.php b/module/gallery/view/index/index.js.php new file mode 100644 index 00000000..17927eda --- /dev/null +++ b/module/gallery/view/index/index.js.php @@ -0,0 +1,25 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @authorFrédéric Tempez + * @copyright Copyright (C) 2018-2020, Frédéric Tempez + * @license GNU General Public License, version 3 + * @link http://zwiicms.com/ + */ + +$( document ).ready(function() { +/* + asc=false; + var sorted=$('.pictureBox').sort(function(a,b){ + return (asc == + ($(a).data('sort') < $(b).data('sort'))) ? 1 : -1; + }); + asc = asc ? false : true; + $('body').html(sorted); + */ +}); \ No newline at end of file diff --git a/module/gallery/view/index/index.php b/module/gallery/view/index/index.php index b2040e8b..a9269e6f 100644 --- a/module/gallery/view/index/index.php +++ b/module/gallery/view/index/index.php @@ -5,7 +5,7 @@
-
+
Date: Mon, 23 Mar 2020 16:33:22 +0100 Subject: [PATCH 4/9] Update gallery.css MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Optimisation de l'affichage des photos sur de petits écran en mode portrait et paysage. Plus "responsive desgin". --- module/gallery/view/gallery/gallery.css | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/module/gallery/view/gallery/gallery.css b/module/gallery/view/gallery/gallery.css index 9206e2d7..7374a3f5 100644 --- a/module/gallery/view/gallery/gallery.css +++ b/module/gallery/view/gallery/gallery.css @@ -21,4 +21,15 @@ background: rgba(0, 0, 0, .6); color: #FFF; text-align: center; -} \ No newline at end of file +} +/* Ajout de régles css ---------------------------- */ +.galleryRow { + display: flex; + flex-wrap: wrap; + justify-content: center; +} +.col3 { + width : 16em; + max-width: 50%; + } +/* ----------------------------------------------*/ From 5c157189f7c782fc862622b458f980bff9ebe037 Mon Sep 17 00:00:00 2001 From: brunoduc <54796327+brunoduc@users.noreply.github.com> Date: Mon, 23 Mar 2020 16:38:34 +0100 Subject: [PATCH 5/9] Update gallery.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Optimisation de l'affichage des photos sur de petits écrans en mode portrait et paysage. Plus "responsive desgin". --- module/gallery/view/gallery/gallery.php | 37 ++++++++++--------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/module/gallery/view/gallery/gallery.php b/module/gallery/view/gallery/gallery.php index 6dde60ee..3f958f33 100644 --- a/module/gallery/view/gallery/gallery.php +++ b/module/gallery/view/gallery/gallery.php @@ -8,26 +8,19 @@ ]); ?>
- - + +
$legend): ?> - - - - - \ No newline at end of file + + From e09cbf2e80e0238a8871bb2325a3d21aef57e3df Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Mon, 23 Mar 2020 17:36:56 +0100 Subject: [PATCH 6/9] Revert "Update gallery.php" This reverts commit 5c157189f7c782fc862622b458f980bff9ebe037. --- module/gallery/view/gallery/gallery.php | 37 +++++++++++++++---------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/module/gallery/view/gallery/gallery.php b/module/gallery/view/gallery/gallery.php index 3f958f33..6dde60ee 100644 --- a/module/gallery/view/gallery/gallery.php +++ b/module/gallery/view/gallery/gallery.php @@ -8,19 +8,26 @@ ]); ?>
- -
+ + $legend): ?> - - + +
+ + + +
+ + + \ No newline at end of file From 21ca53c9b0d6257a68fb0c0cbb9c782d23883533 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Mon, 23 Mar 2020 17:37:07 +0100 Subject: [PATCH 7/9] Revert "Update gallery.css" This reverts commit 64157f89f27f8934e08476be7f42253531eec1ee. --- module/gallery/view/gallery/gallery.css | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/module/gallery/view/gallery/gallery.css b/module/gallery/view/gallery/gallery.css index 7374a3f5..9206e2d7 100644 --- a/module/gallery/view/gallery/gallery.css +++ b/module/gallery/view/gallery/gallery.css @@ -21,15 +21,4 @@ background: rgba(0, 0, 0, .6); color: #FFF; text-align: center; -} -/* Ajout de régles css ---------------------------- */ -.galleryRow { - display: flex; - flex-wrap: wrap; - justify-content: center; -} -.col3 { - width : 16em; - max-width: 50%; - } -/* ----------------------------------------------*/ +} \ No newline at end of file From a137f5e962ca5d4535f0bc33f4304c2dc385f595 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Mon, 23 Mar 2020 17:42:22 +0100 Subject: [PATCH 8/9] [9.2.26] Suppression de commentaires --- module/gallery/gallery.php | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 1dde307b..bc2844fa 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -45,21 +45,6 @@ class gallery extends common { // Liste des galeries $galleries = $this->getData(['module', $this->getUrl(0)]); $countGalleries = count($this->getData(['module',$this->getUrl(0)])); - // Tri des éléments de la galerie - /* - echo "
";	
-		if($galleries) {	
-			foreach($galleries as $galleryId => $gallery) {
-				echo $galleryId;
-				echo "|";
-				echo $gallery['config']['order'] ;
-				echo '

'; - } - } - - - echo "

"; - */ if($galleries) { foreach($galleries as $galleryId => $gallery) { From 6d200124fde485e4138bbb1548d7b155fa3e648c Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Mon, 23 Mar 2020 18:04:06 +0100 Subject: [PATCH 9/9] gallery nettoyage code --- module/gallery/gallery.php | 7 ------- module/gallery/view/config/config.php | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index bc2844fa..b1c3b30a 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -65,13 +65,6 @@ class gallery extends common { self::$galleries[] = [ $gallery['config']['name'], $gallery['config']['directory'], - $gallery['config']['order'], - /* - template::select('galleryConfigOrder', $galeryOrder , [ - 'selected' => $gallery['config']['order'], - 'class' => 'configOrder' - - ]),*/ template::button('galleryConfigEdit' . $galleryId , [ 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'], 'value' => template::ico('pencil') diff --git a/module/gallery/view/config/config.php b/module/gallery/view/config/config.php index 4f00d51c..109021c6 100644 --- a/module/gallery/view/config/config.php +++ b/module/gallery/view/config/config.php @@ -45,7 +45,7 @@
- 'galleryTable']); ?> + 'galleryTable']); ?>