diff --git a/core/core.php b/core/core.php index cc718c83..c5826838 100644 --- a/core/core.php +++ b/core/core.php @@ -1172,7 +1172,7 @@ class common { $pageList [] = $childKey; } } - // Parcourir toutes les pages + // Mise à jour des données pour la galerie v2 foreach ($pageList as $parentKey => $parent) { //La page a une galerie if ($this->getData(['page',$parent,'moduleId']) === 'gallery' ) { @@ -1180,12 +1180,19 @@ class common { $tempData = $this->getData(['module', $parent]); $i = 1; foreach ($tempData as $galleryKey => $galleryItem) { + // Ordre de tri des galeries if ( $this->getdata(['module',$parent,$galleryKey,'config','sort']) === NULL) { $this->setdata(['module',$parent,$galleryKey,'config','sort','SORT_ASC']); } + // Position de la galerie, tri manuel if ( $this->getdata(['module',$parent,$galleryKey,'config','position']) === NULL) { $this->setdata(['module',$parent,$galleryKey,'config','position',$i++]); } + // Positions des images, tri manuel + if ( $this->getdata(['module',$parent,$galleryKey,'position']) === NULL) { + $c = count($this->getdata(['module',$parent,$galleryKey,'legend'])); + $this->setdata(['module',$parent,$galleryKey,'position', range(0,$c-1) ]); + } // Image de couverture if ( $this->getdata(['module',$parent,$galleryKey,'config','homePicture']) === NULL) { $iterator = new DirectoryIterator($this->getdata(['module',$parent,$galleryKey,'config','directory'])); @@ -1199,20 +1206,7 @@ class common { } } } - } - //---------------------------------------- - // Mise à jour de la taille des miniatures - /* - $iterator = new RecursiveDirectoryIterator('site/file/source/'); - foreach(new RecursiveIteratorIterator($iterator) as $fileInfos) { - if($fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) { - if (!file_exists( str_replace('source','thumb',$fileInfos->getPathname()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))) { - $this->makeThumb($fileInfos->getPathname(), - str_replace('source','thumb',$fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()), - self::THUMBS_WIDTH); - } - } - }*/ + } $this->setData(['core', 'dataVersion', 10000]); } } diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 5cc67e04..53fdac77 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -23,9 +23,9 @@ class gallery extends common { ]; public static $sort = [ - 'SORT_ASC' => 'Alphabétique ', - 'SORT_DSC' => 'Alphabétique inversé', 'SORT_HAND' => 'Tri manuel', + 'SORT_ASC' => 'Alphabétique ', + 'SORT_DSC' => 'Alphabétique inversé' ]; public static $directories = []; diff --git a/module/gallery/view/edit/edit.js.php b/module/gallery/view/edit/edit.js.php index 2cdb78ad..73654ece 100644 --- a/module/gallery/view/edit/edit.js.php +++ b/module/gallery/view/edit/edit.js.php @@ -58,7 +58,9 @@ $('.homePicture').click(function(){ /** * Tri dynamique de la galerie */ + $( document ).ready(function() { + $("#galleryTable").tableDnD({ onDrop: function(table, row) { $("#galleryEditFormResponse").val($.tableDnD.serialize()); @@ -66,3 +68,15 @@ $( document ).ready(function() { serializeRegexp: "[^\_]*$" }); }); + +$("#galleryEditSort").change(function() { + if ($("#galleryEditSort").val() !== "SORT_HAND") { + $("#galleryTable > tbody > tr").addClass("nodrag"); + $("#galleryTable").tableDnDUpdate(); + } else { + $("#galleryTable > tbody > tr").removeClass("nodrag"); + $("#galleryTable").tableDnDUpdate(); + } +}); + +