[9.2.22] Choix photo album
This commit is contained in:
parent
af371a97e8
commit
1e39da2b65
@ -4,6 +4,10 @@
|
||||
- Modifications :
|
||||
- Aperçu de la police dans les sélecteurs.
|
||||
- Gestion du canal de mise à jour selon la version installée
|
||||
- Module Blog : position des boutons d'édition de l'article au-dessus des commentaires.
|
||||
- Module Gallery :
|
||||
- choix de la vignette d'album
|
||||
- Tri ordre naturel de la galerie et des images de la galerie
|
||||
- Mises à jour :
|
||||
- Configurations Code Mirror pour TinyMCE et standalone
|
||||
|
||||
|
@ -39,7 +39,7 @@ class gallery extends common {
|
||||
// Liste des galeries
|
||||
$galleries = $this->getData(['module', $this->getUrl(0)]);
|
||||
if($galleries) {
|
||||
ksort($galleries);
|
||||
ksort($galleries,SORT_NATURAL);
|
||||
foreach($galleries as $galleryId => $gallery) {
|
||||
// Erreur dossier vide
|
||||
if(is_dir($gallery['config']['directory'])) {
|
||||
@ -165,16 +165,25 @@ class gallery extends common {
|
||||
// Supprime l'ancienne galerie
|
||||
$this->deleteData(['module', $this->getUrl(0), $this->getUrl(2)]);
|
||||
}
|
||||
// légendes
|
||||
$legends = [];
|
||||
foreach((array) $this->getInput('legend', null) as $file => $legend) {
|
||||
$file = str_replace('.','',$file);
|
||||
$legends[$file] = helper::filter($legend, helper::FILTER_STRING_SHORT);
|
||||
}
|
||||
|
||||
// Photo de la page de garde de l'album
|
||||
$homePictures = [];
|
||||
foreach((array) $this->getInput('homePicture', null) as $file => $homePicture) {
|
||||
$homePictures[$file] = $file;
|
||||
}
|
||||
// Pas de sélection, retourne NULL plutôt que 0
|
||||
// Permet de traiter aussi le cas où l'image d'album n'est pas définie.
|
||||
$homePictures[$file] = $homePictures[$file] === 0 ? NULL : $homePictures[$file];
|
||||
$this->setData(['module', $this->getUrl(0), $galleryId, [
|
||||
'config' => [
|
||||
'name' => $this->getInput('galleryEditName', helper::FILTER_STRING_SHORT, true),
|
||||
'directory' => $this->getInput('galleryEditDirectory', helper::FILTER_STRING_SHORT, true)
|
||||
'directory' => $this->getInput('galleryEditDirectory', helper::FILTER_STRING_SHORT, true),
|
||||
'homePicture' => $homePictures[$file]
|
||||
],
|
||||
'legend' => $legends
|
||||
]]);
|
||||
@ -193,6 +202,11 @@ class gallery extends common {
|
||||
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
|
||||
self::$pictures[$fileInfos->getFilename()] = [
|
||||
$fileInfos->getFilename(),
|
||||
template::checkbox( 'homePicture[' . $fileInfos->getFilename() . ']', true, '', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2),'config', 'homePicture']) === $fileInfos->getFilename() ? true : false,
|
||||
'class' => 'homePicture'
|
||||
|
||||
]),
|
||||
template::text('legend[' . $fileInfos->getFilename() . ']', [
|
||||
'value' => $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'legend', str_replace('.','',$fileInfos->getFilename())])
|
||||
])
|
||||
@ -200,7 +214,7 @@ class gallery extends common {
|
||||
}
|
||||
}
|
||||
// Tri des images par ordre alphabétique
|
||||
ksort(self::$pictures);
|
||||
ksort(self::$pictures,SORT_NATURAL);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -235,7 +249,7 @@ class gallery extends common {
|
||||
}
|
||||
}
|
||||
// Tri des images par ordre alphabétique
|
||||
ksort(self::$pictures);
|
||||
ksort(self::$pictures,SORT_NATURAL);
|
||||
}
|
||||
// Affichage du template
|
||||
if(self::$pictures) {
|
||||
@ -271,7 +285,6 @@ class gallery extends common {
|
||||
continue(2);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// Valeurs en sortie
|
||||
|
@ -49,3 +49,8 @@ setInterval(function() {
|
||||
directoryDOM.on("change", function() {
|
||||
directoryOldDOM.val($(this).val());
|
||||
});
|
||||
|
||||
$('.homePicture').click(function(){
|
||||
$('.homePicture').prop('checked', false);
|
||||
$(this).prop('checked', true);
|
||||
});
|
@ -38,6 +38,6 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php if($module::$pictures): ?>
|
||||
<?php echo template::table([4, 8], $module::$pictures, ['Image', 'Légende']); ?>
|
||||
<?php echo template::table([4, 1, 7], $module::$pictures, ['Image', 'Album','Légende']); ?>
|
||||
<?php endif; ?>
|
||||
<?php echo template::formClose(); ?>
|
@ -9,7 +9,13 @@
|
||||
<a
|
||||
href="<?php echo helper::baseUrl() . $this->getUrl(0); ?>/<?php echo $galleryId; ?>"
|
||||
class="galleryPicture"
|
||||
style="background-image:url('<?php echo helper::baseUrl(false) . $module::$firstPictures[$galleryId]; ?>')"
|
||||
style="background-image:url('<?php
|
||||
if ($this->getData(['module', $this->getUrl(0), $galleryId, 'config', 'homePicture']) === NULL ) {
|
||||
echo helper::baseUrl(false) . $module::$firstPictures[$galleryId];
|
||||
} else {
|
||||
echo helper::baseUrl(false) . $this->getData(['module', $this->getUrl(0), $galleryId, 'config', 'directory']) . '/' . $this->getData(['module', $this->getUrl(0), $galleryId, 'config', 'homePicture']);
|
||||
}
|
||||
?>')"
|
||||
>
|
||||
<div class="galleryName"><?php echo $gallery['config']['name']; ?></div>
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user