From 6608f4dbd968cecf1293c45c3c442fbf34b77666 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 30 Mar 2022 12:30:27 +0200 Subject: [PATCH 1/3] init --- module/gallery/gallery.php | 9 ++++----- module/gallery/view/config/config.php | 2 +- module/gallery/view/edit/edit.php | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index aad375f0..c6607fb9 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -345,7 +345,7 @@ class gallery extends common { } // Met en forme le tableau self::$galleries[] = [ - template::ico('sort'), + $gallery['config']['position'] + 1, $gallery['config']['name'], $gallery['config']['directory'], template::button('galleryConfigEdit' . $galleryId , [ @@ -570,7 +570,7 @@ class gallery extends common { ], 'legend' => $legends, - 'positions' => empty($oldPositions) ? $this->getdata(['module', $this->getUrl(0), 'content', $galleryId, 'positions']) : $oldPositions + 'positions' => empty($oldPositions) ? $this->getData(['module', $this->getUrl(0), 'content', $galleryId, 'positions']) : $oldPositions ]]); } // Valeurs en sortie @@ -584,7 +584,6 @@ class gallery extends common { $directory = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']); if(is_dir($directory)) { $iterator = new DirectoryIterator($directory); - foreach($iterator as $fileInfos) { if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) { // Créer la miniature RFM si manquante @@ -594,7 +593,7 @@ class gallery extends common { 122); } self::$pictures[str_replace('.','',$fileInfos->getFilename())] = [ - template::ico('sort'), + $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'positions', str_replace('.','',$fileInfos->getFilename())]) + 1, $fileInfos->getFilename(), template::checkbox( 'homePicture[' . $fileInfos->getFilename() . ']', true, '', [ 'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2),'config', 'homePicture']) === $fileInfos->getFilename() ? true : false, @@ -611,7 +610,7 @@ class gallery extends common { // Tri des images switch ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort'])) { case self::SORT_HAND: - $positions = $this->getdata(['module',$this->getUrl(0), $this->getUrl(2),'positions']); + $positions = $this->getData(['module',$this->getUrl(0), $this->getUrl(2),'positions']); if ($positions) { foreach ($positions as $key => $value) { if (array_key_exists($key,self::$pictures)) { diff --git a/module/gallery/view/config/config.php b/module/gallery/view/config/config.php index d80038c3..2d1a0a38 100644 --- a/module/gallery/view/config/config.php +++ b/module/gallery/view/config/config.php @@ -30,7 +30,7 @@
- 'galleryTable'],$module::$galleriesId); ?> + 'galleryTable'],$module::$galleriesId); ?> diff --git a/module/gallery/view/edit/edit.php b/module/gallery/view/edit/edit.php index ca300f61..80d066ba 100644 --- a/module/gallery/view/edit/edit.php +++ b/module/gallery/view/edit/edit.php @@ -64,7 +64,7 @@
- 'galleryTable'], $module::$picturesId ); ?> + 'galleryTable'], $module::$picturesId ); ?> $this->getUrl(2)]); ?> From 0ec7a8dc4e89460c48f6ed08cee5b7dac63e88b9 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 1 Apr 2022 10:10:15 +0200 Subject: [PATCH 2/3] Gallery sort bug OKAY --- module/gallery/view/config/config.js.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/module/gallery/view/config/config.js.php b/module/gallery/view/config/config.js.php index 95509907..31db6636 100644 --- a/module/gallery/view/config/config.js.php +++ b/module/gallery/view/config/config.js.php @@ -21,12 +21,8 @@ $( document ).ready(function() { $("#galleryTable").tableDnD({ onDrop: function(table, row) { $("#galleryConfigFilterResponse").val($.tableDnD.serialize()); - }, - onDragStop : function(table, row) { - // Affiche le bouton de tri après un déplacement - //$(":input[type='submit']").prop('disabled', false); - // Sauvegarde le tri sortGalleries(); + location.reload(); }, // Supprime le tiret des séparateurs serializeRegexp: "" From 03796c6bd118dc11c456e3771a7df6eeefc391eb Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 1 Apr 2022 14:14:36 +0200 Subject: [PATCH 3/3] Bug position images tri manuel --- module/gallery/gallery.php | 4 ++-- module/gallery/view/edit/edit.js.php | 4 ---- module/gallery/view/option/option.php | 8 ++++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index c6607fb9..4e783539 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -610,7 +610,7 @@ class gallery extends common { // Tri des images switch ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort'])) { case self::SORT_HAND: - $positions = $this->getData(['module',$this->getUrl(0), $this->getUrl(2),'positions']); + $positions = $this->getData(['module',$this->getUrl(0),'content', $this->getUrl(2),'positions']); if ($positions) { foreach ($positions as $key => $value) { if (array_key_exists($key,self::$pictures)) { @@ -887,7 +887,7 @@ class gallery extends common { mkdir (self::DATADIRECTORY . $this->getUrl(0), 0755, true); } $this->setData(['module', $this->getUrl(0), 'config', [ - 'showUniqueGallery' => $this->getinput('galleryOptionShowUniqueGallery', helper::FILTER_BOOLEAN) + 'showUniqueGallery' => $this->getinput('galleriesOptionShowUniqueGallery', helper::FILTER_BOOLEAN) ]]); // Valeurs en sortie $this->addOutput([ diff --git a/module/gallery/view/edit/edit.js.php b/module/gallery/view/edit/edit.js.php index b1de55bb..9b0eadb3 100644 --- a/module/gallery/view/edit/edit.js.php +++ b/module/gallery/view/edit/edit.js.php @@ -65,11 +65,7 @@ $( document ).ready(function() { $("#galleryTable").tableDnD({ onDrop: function(table, row) { $("#galleryEditFormResponse").val($.tableDnD.serialize()); - }, - onDragStop : function(table, row) { - // Sauvegarde le tri sortPictures(); - $("#galleryEditFormResponse").val(""); }, serializeRegexp: "" }); diff --git a/module/gallery/view/option/option.php b/module/gallery/view/option/option.php index 7b8a9579..222b740a 100644 --- a/module/gallery/view/option/option.php +++ b/module/gallery/view/option/option.php @@ -1,14 +1,14 @@ - +
- helper::baseUrl() . $this->getUrl(0) . '/config', 'ico' => 'left', 'value' => 'Retour' ]); ?>
- +
@@ -17,7 +17,7 @@

Galerie unique

- count($this->getData(['module', $this->getUrl(0), 'content'])) === 1 ? $this->getData(['module', $this->getUrl(0), 'theme', 'showUniqueGallery']) : false,