Merge branch '114_dev' into 12_dev

This commit is contained in:
fredtempez 2022-04-01 14:19:55 +02:00
commit 08e486c3cb
6 changed files with 13 additions and 22 deletions

View File

@ -357,7 +357,7 @@ class gallery extends common {
} }
// Met en forme le tableau // Met en forme le tableau
self::$galleries[] = [ self::$galleries[] = [
template::ico('sort'), $gallery['config']['position'] + 1,
$gallery['config']['name'], $gallery['config']['name'],
$gallery['config']['directory'], $gallery['config']['directory'],
template::button('galleryConfigEdit' . $galleryId , [ template::button('galleryConfigEdit' . $galleryId , [
@ -584,7 +584,7 @@ class gallery extends common {
], ],
'legend' => $legends, '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 // Valeurs en sortie
@ -598,7 +598,6 @@ class gallery extends common {
$directory = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']); $directory = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']);
if(is_dir($directory)) { if(is_dir($directory)) {
$iterator = new DirectoryIterator($directory); $iterator = new DirectoryIterator($directory);
foreach($iterator as $fileInfos) { foreach($iterator as $fileInfos) {
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) { if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
// Créer la miniature RFM si manquante // Créer la miniature RFM si manquante
@ -608,7 +607,7 @@ class gallery extends common {
122); 122);
} }
self::$pictures[str_replace('.','',$fileInfos->getFilename())] = [ 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(), $fileInfos->getFilename(),
template::checkbox( 'homePicture[' . $fileInfos->getFilename() . ']', true, '', [ template::checkbox( 'homePicture[' . $fileInfos->getFilename() . ']', true, '', [
'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2),'config', 'homePicture']) === $fileInfos->getFilename() ? true : false, 'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2),'config', 'homePicture']) === $fileInfos->getFilename() ? true : false,
@ -625,7 +624,7 @@ class gallery extends common {
// Tri des images // Tri des images
switch ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort'])) { switch ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort'])) {
case self::SORT_HAND: 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) { if ($positions) {
foreach ($positions as $key => $value) { foreach ($positions as $key => $value) {
if (array_key_exists($key,self::$pictures)) { if (array_key_exists($key,self::$pictures)) {

View File

@ -21,12 +21,8 @@ $( document ).ready(function() {
$("#galleryTable").tableDnD({ $("#galleryTable").tableDnD({
onDrop: function(table, row) { onDrop: function(table, row) {
$("#galleryConfigFilterResponse").val($.tableDnD.serialize()); $("#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(); sortGalleries();
location.reload();
}, },
// Supprime le tiret des séparateurs // Supprime le tiret des séparateurs
serializeRegexp: "" serializeRegexp: ""

View File

@ -30,7 +30,7 @@
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<?php if($module::$galleries): ?> <?php if($module::$galleries): ?>
<?php echo template::table([1, 4, 5, 1, 1], $module::$galleries, ['','Nom', 'Dossier cible', '', ''], ['id' => 'galleryTable'],$module::$galleriesId); ?> <?php echo template::table([1, 4, 5, 1, 1], $module::$galleries, ['#','Nom', 'Dossier cible', '', ''], ['id' => 'galleryTable'],$module::$galleriesId); ?>
<?php echo template::hidden('galleryConfigFilterResponse'); ?> <?php echo template::hidden('galleryConfigFilterResponse'); ?>
<?php else: ?> <?php else: ?>
<?php echo template::speech('Aucune galerie.'); ?> <?php echo template::speech('Aucune galerie.'); ?>

View File

@ -65,11 +65,7 @@ $( document ).ready(function() {
$("#galleryTable").tableDnD({ $("#galleryTable").tableDnD({
onDrop: function(table, row) { onDrop: function(table, row) {
$("#galleryEditFormResponse").val($.tableDnD.serialize()); $("#galleryEditFormResponse").val($.tableDnD.serialize());
},
onDragStop : function(table, row) {
// Sauvegarde le tri
sortPictures(); sortPictures();
$("#galleryEditFormResponse").val("");
}, },
serializeRegexp: "" serializeRegexp: ""
}); });

View File

@ -63,7 +63,7 @@
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<?php if($module::$pictures): ?> <?php if($module::$pictures): ?>
<?php echo template::table([1, 4, 1, 5, 1], $module::$pictures, ['','Image', 'Couverture','Légende',''],['id' => 'galleryTable'], $module::$picturesId ); ?> <?php echo template::table([1, 4, 1, 5, 1], $module::$pictures, ['#','Image', 'Couverture','Légende',''],['id' => 'galleryTable'], $module::$picturesId ); ?>
<?php echo template::hidden('galleryEditFormResponse'); ?> <?php echo template::hidden('galleryEditFormResponse'); ?>
<?php echo template::hidden('galleryEditFormGalleryName',['value' => $this->getUrl(2)]); ?> <?php echo template::hidden('galleryEditFormGalleryName',['value' => $this->getUrl(2)]); ?>
<?php else: ?> <?php else: ?>

View File

@ -1,13 +1,13 @@
<?php echo template::formOpen('galleryOptionForm'); ?> <?php echo template::formOpen('galleriesOptionForm'); ?>
<div class="row"> <div class="row">
<div class="col1"> <div class="col2">
<?php echo template::button('galleryOptionBack', [ <?php echo template::button('galleriesOptionBack', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/config', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'value' => template::ico('left') 'value' => template::ico('left')
]); ?> ]); ?>
</div> </div>
<div class="col2 offset9"> <div class="col2 offset8">
<?php echo template::submit('galleryOptionSubmit'); ?> <?php echo template::submit('galleriesOptionSubmit'); ?>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
@ -16,7 +16,7 @@
<h4>Options</h4> <h4>Options</h4>
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<?php echo template::checkbox('galleryOptionShowUniqueGallery', true, 'Masquer l\'index des galeries lorsque le module ne contient qu\'une galerie' , [ <?php echo template::checkbox('galleriesOptionShowUniqueGallery', true, 'Masquer l\'index des galeries lorsque le module ne contient qu\'une galerie' , [
'checked' => count($this->getData(['module', $this->getUrl(0), 'content'])) === 1 'checked' => count($this->getData(['module', $this->getUrl(0), 'content'])) === 1
? $this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery']) ? $this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery'])
: false, : false,