Update v9

This commit is contained in:
Fred Tempez 2020-04-09 10:03:20 +02:00
parent 987d03845d
commit 2ba13c89b8
3 changed files with 25 additions and 17 deletions

View File

@ -1172,7 +1172,7 @@ class common {
$pageList [] = $childKey; $pageList [] = $childKey;
} }
} }
// Parcourir toutes les pages // Mise à jour des données pour la galerie v2
foreach ($pageList as $parentKey => $parent) { foreach ($pageList as $parentKey => $parent) {
//La page a une galerie //La page a une galerie
if ($this->getData(['page',$parent,'moduleId']) === 'gallery' ) { if ($this->getData(['page',$parent,'moduleId']) === 'gallery' ) {
@ -1180,12 +1180,19 @@ class common {
$tempData = $this->getData(['module', $parent]); $tempData = $this->getData(['module', $parent]);
$i = 1; $i = 1;
foreach ($tempData as $galleryKey => $galleryItem) { foreach ($tempData as $galleryKey => $galleryItem) {
// Ordre de tri des galeries
if ( $this->getdata(['module',$parent,$galleryKey,'config','sort']) === NULL) { if ( $this->getdata(['module',$parent,$galleryKey,'config','sort']) === NULL) {
$this->setdata(['module',$parent,$galleryKey,'config','sort','SORT_ASC']); $this->setdata(['module',$parent,$galleryKey,'config','sort','SORT_ASC']);
} }
// Position de la galerie, tri manuel
if ( $this->getdata(['module',$parent,$galleryKey,'config','position']) === NULL) { if ( $this->getdata(['module',$parent,$galleryKey,'config','position']) === NULL) {
$this->setdata(['module',$parent,$galleryKey,'config','position',$i++]); $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 // Image de couverture
if ( $this->getdata(['module',$parent,$galleryKey,'config','homePicture']) === NULL) { if ( $this->getdata(['module',$parent,$galleryKey,'config','homePicture']) === NULL) {
$iterator = new DirectoryIterator($this->getdata(['module',$parent,$galleryKey,'config','directory'])); $iterator = new DirectoryIterator($this->getdata(['module',$parent,$galleryKey,'config','directory']));
@ -1200,19 +1207,6 @@ 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]); $this->setData(['core', 'dataVersion', 10000]);
} }
} }

View File

@ -23,9 +23,9 @@ class gallery extends common {
]; ];
public static $sort = [ public static $sort = [
'SORT_ASC' => 'Alphabétique ',
'SORT_DSC' => 'Alphabétique inversé',
'SORT_HAND' => 'Tri manuel', 'SORT_HAND' => 'Tri manuel',
'SORT_ASC' => 'Alphabétique ',
'SORT_DSC' => 'Alphabétique inversé'
]; ];
public static $directories = []; public static $directories = [];

View File

@ -58,7 +58,9 @@ $('.homePicture').click(function(){
/** /**
* Tri dynamique de la galerie * Tri dynamique de la galerie
*/ */
$( document ).ready(function() { $( document ).ready(function() {
$("#galleryTable").tableDnD({ $("#galleryTable").tableDnD({
onDrop: function(table, row) { onDrop: function(table, row) {
$("#galleryEditFormResponse").val($.tableDnD.serialize()); $("#galleryEditFormResponse").val($.tableDnD.serialize());
@ -66,3 +68,15 @@ $( document ).ready(function() {
serializeRegexp: "[^\_]*$" serializeRegexp: "[^\_]*$"
}); });
}); });
$("#galleryEditSort").change(function() {
if ($("#galleryEditSort").val() !== "SORT_HAND") {
$("#galleryTable > tbody > tr").addClass("nodrag");
$("#galleryTable").tableDnDUpdate();
} else {
$("#galleryTable > tbody > tr").removeClass("nodrag");
$("#galleryTable").tableDnDUpdate();
}
});