options des galeries à vérifier
This commit is contained in:
parent
1b3a467bc7
commit
3da6f8970c
@ -379,6 +379,7 @@ class gallery extends common {
|
||||
}
|
||||
}
|
||||
// Soumission du formulaire d'ajout d'une galerie
|
||||
/*
|
||||
if($this->isPost()) {
|
||||
if (!$this->getInput('galleryConfigFilterResponse')) {
|
||||
$galleryId = helper::increment($this->getInput('galleryConfigName', helper::FILTER_ID, true), (array) $this->getData(['module', $this->getUrl(0), 'content']));
|
||||
@ -413,12 +414,13 @@ class gallery extends common {
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl() /*. '#galleryConfigForm'*/,
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
*/
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du module',
|
||||
@ -536,6 +538,46 @@ class gallery extends common {
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Photo de la page de garde de l'album définie dans form
|
||||
if (is_array($this->getInput('homePicture', null)) ) {
|
||||
$d = array_keys($this->getInput('homePicture', null));
|
||||
$homePicture = $d[0];
|
||||
}
|
||||
// légendes
|
||||
$legends = [];
|
||||
$homePicture ='';
|
||||
foreach((array) $this->getInput('legend', null) as $file => $legend) {
|
||||
// Image de couverture par défaut si non définie
|
||||
$homePicture = $file;
|
||||
$file = str_replace('.','',$file);
|
||||
$legends[$file] = helper::filter($legend, helper::FILTER_STRING_SHORT);
|
||||
|
||||
}
|
||||
// Sauvegarder
|
||||
$this->setData(['module', $this->getUrl(0), 'content', $this->getUrl(2), [
|
||||
'config' => [
|
||||
'name' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'name']),
|
||||
'directory' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']),
|
||||
'homePicture' => $homePicture,
|
||||
// pas de positions, on active le tri alpha
|
||||
'sort' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2),'config','sort']),
|
||||
'position' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2),'config', 'position']),
|
||||
'fullScreen' =>$this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'fullscreen']),
|
||||
'showPageContent' =>$this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'showPageContent'])
|
||||
|
||||
],
|
||||
'legend' => $legends,
|
||||
'positions' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'positions'])
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' .$this->getUrl(2) . '/' . $_SESSION['csrf'] ,
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// La galerie n'existe pas
|
||||
if($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]) === null) {
|
||||
// Valeurs en sortie
|
||||
@ -863,6 +905,8 @@ class gallery extends common {
|
||||
'backPosition' => $this->getinput('galleryOptionBackPosition', null),
|
||||
'backAlign' => $this->getinput('galleryOptionBackAlign', null)
|
||||
]]);
|
||||
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl() . '/option',
|
||||
@ -878,9 +922,10 @@ class gallery extends common {
|
||||
'view' => 'option'
|
||||
]);
|
||||
} elseif ($this->getUrl(2) === 'gallery') {
|
||||
|
||||
// Paramètre d'une galerie
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
if ($this->getUrl(4) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit',
|
||||
@ -899,35 +944,20 @@ class gallery extends common {
|
||||
// Supprime l'ancienne galerie
|
||||
$this->deleteData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]);
|
||||
}
|
||||
// légendes
|
||||
$legends = [];
|
||||
foreach((array) $this->getInput('legend', null) as $file => $legend) {
|
||||
// Image de couverture par défaut si non définie
|
||||
$homePicture = $file;
|
||||
$file = str_replace('.','',$file);
|
||||
$legends[$file] = helper::filter($legend, helper::FILTER_STRING_SHORT);
|
||||
|
||||
}
|
||||
// Photo de la page de garde de l'album définie dans form
|
||||
if (is_array($this->getInput('homePicture', null)) ) {
|
||||
$d = array_keys($this->getInput('homePicture', null));
|
||||
$homePicture = $d[0];
|
||||
}
|
||||
// Sauvegarder
|
||||
if ($this->getInput('galleryEditName')) {
|
||||
$this->setData(['module', $this->getUrl(0), 'content', $galleryId, [
|
||||
'config' => [
|
||||
'name' => $this->getInput('galleryEditName', helper::FILTER_STRING_SHORT, true),
|
||||
'directory' => $this->getInput('galleryEditDirectory', helper::FILTER_STRING_SHORT, true),
|
||||
'homePicture' => $homePicture,
|
||||
// pas de positions, on active le tri alpha
|
||||
'homePicture' => $this->getData(['module', $this->getUrl(0), 'content', $galleryId, 'config', 'homePicture']),
|
||||
'sort' => $this->getInput('galleryEditSort'),
|
||||
'position' => $this->getData(['module', $this->getUrl(0), 'content', $galleryId,'config','position']),
|
||||
'fullScreen' => $this->getInput('galleryEditFullscreen', helper::FILTER_BOOLEAN),
|
||||
'showPageContent' => $this->getInput('galleryEditShowPageContent', helper::FILTER_BOOLEAN)
|
||||
|
||||
],
|
||||
'legend' => $legends,
|
||||
'legend' => $this->getData(['module', $this->getUrl(0), 'content', $galleryId, 'config', 'legend']),
|
||||
'positions' => empty($oldPositions) ? $this->getData(['module', $this->getUrl(0), 'content', $galleryId, 'positions']) : $oldPositions
|
||||
]]);
|
||||
}
|
||||
|
@ -11,50 +11,7 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Liste des dossiers
|
||||
*/
|
||||
var oldResult = [];
|
||||
var directoryDOM = $("#galleryEditDirectory");
|
||||
var directoryOldDOM = $("#galleryEditDirectoryOld");
|
||||
function dirs() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo helper::baseUrl() . $this->getUrl(0); ?>/dirs",
|
||||
success: function(result) {
|
||||
if($(result).not(oldResult).length !== 0 || $(oldResult).not(result).length !== 0) {
|
||||
directoryDOM.empty();
|
||||
for(var i = 0; i < result.length; i++) {
|
||||
directoryDOM.append(function(i) {
|
||||
var option = $("<option>").val(result[i]).text(result[i]);
|
||||
if(directoryOldDOM.val() === result[i]) {
|
||||
option.prop("selected", true);
|
||||
}
|
||||
return option;
|
||||
}(i))
|
||||
}
|
||||
oldResult = result;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
dirs();
|
||||
// Actualise la liste des dossiers toutes les trois secondes
|
||||
setInterval(function() {
|
||||
dirs();
|
||||
}, 3000);
|
||||
|
||||
/**
|
||||
* Stock le dossier choisi pour le re-sélectionner en cas d'actualisation ajax de la liste des dossiers
|
||||
*/
|
||||
directoryDOM.on("change", function() {
|
||||
directoryOldDOM.val($(this).val());
|
||||
});
|
||||
|
||||
$('.homePicture').click(function(){
|
||||
$('.homePicture').prop('checked', false);
|
||||
$(this).prop('checked', true);
|
||||
});
|
||||
|
||||
/**
|
||||
* Tri dynamique de la galerie
|
||||
@ -70,7 +27,9 @@ $( document ).ready(function() {
|
||||
serializeRegexp: ""
|
||||
});
|
||||
|
||||
if ($("#galleryEditSort").val() !== "SORT_HAND") {
|
||||
console.log($("#galleryEditSort").val());
|
||||
|
||||
if ($("#galleryEditSort").val() !== "SORT_HAND") {
|
||||
$("#galleryTable tr").addClass("nodrag nodrop");
|
||||
$(".zwiico-sort").hide();
|
||||
$("#galleryTable").tableDnDUpdate();
|
||||
|
@ -9,7 +9,7 @@
|
||||
</div>
|
||||
<div class="col1 offset8">
|
||||
<?php echo template::button('galleryConfigOption', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/option/gallery/' . $_SESSION['csrf'],
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/option/gallery/' . $this->getUrl(2) . '/'. $_SESSION['csrf'],
|
||||
'value' => template::ico('sliders')
|
||||
]); ?>
|
||||
</div>
|
||||
@ -17,17 +17,18 @@
|
||||
<?php echo template::submit('galleryEditSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?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::hidden('galleryEditFormResponse'); ?>
|
||||
<?php echo template::hidden('galleryEditSort',['value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort' ])]);?>
|
||||
<?php echo template::hidden('galleryEditFormGalleryName',['value' => $this->getUrl(2)]); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucune image.'); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
||||
|
@ -24,3 +24,49 @@ $("#galleryOptionShowUniqueGallery").click(function() {
|
||||
$("#galleryOptionBackPosition, #galleryOptionBackAlign").prop( "disabled", false );
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* Liste des dossiers
|
||||
*/
|
||||
var oldResult = [];
|
||||
var directoryDOM = $("#galleryEditDirectory");
|
||||
var directoryOldDOM = $("#galleryEditDirectoryOld");
|
||||
function dirs() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "<?php echo helper::baseUrl() . $this->getUrl(0); ?>/dirs",
|
||||
success: function(result) {
|
||||
if($(result).not(oldResult).length !== 0 || $(oldResult).not(result).length !== 0) {
|
||||
directoryDOM.empty();
|
||||
for(var i = 0; i < result.length; i++) {
|
||||
directoryDOM.append(function(i) {
|
||||
var option = $("<option>").val(result[i]).text(result[i]);
|
||||
if(directoryOldDOM.val() === result[i]) {
|
||||
option.prop("selected", true);
|
||||
}
|
||||
return option;
|
||||
}(i))
|
||||
}
|
||||
oldResult = result;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
dirs();
|
||||
// Actualise la liste des dossiers toutes les trois secondes
|
||||
setInterval(function() {
|
||||
dirs();
|
||||
}, 3000);
|
||||
|
||||
/**
|
||||
* Stock le dossier choisi pour le re-sélectionner en cas d'actualisation ajax de la liste des dossiers
|
||||
*/
|
||||
directoryDOM.on("change", function() {
|
||||
directoryOldDOM.val($(this).val());
|
||||
});
|
||||
|
||||
$('.homePicture').click(function(){
|
||||
$('.homePicture').prop('checked', false);
|
||||
$(this).prop('checked', true);
|
||||
});
|
@ -63,12 +63,12 @@
|
||||
<div class="col6">
|
||||
<?php echo template::text('galleryEditName', [
|
||||
'label' => 'Nom',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'name'])
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'config', 'name'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::hidden('galleryEditDirectoryOld', [
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']),
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'config', 'directory']),
|
||||
'noDirty' => true // Désactivé à cause des modifications en ajax
|
||||
]); ?>
|
||||
<?php echo template::select('galleryEditDirectory', [], [
|
||||
@ -80,7 +80,7 @@
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('galleryEditSort', $module::$sort, [
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort']),
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'config', 'sort']),
|
||||
'label' => 'Tri des images',
|
||||
'help' => 'Tri manuel : déplacez le images dans le tableau ci-dessous. L\'ordre est sauvegardé automatiquement.'
|
||||
]); ?>
|
||||
@ -89,7 +89,7 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('galleryEditFullscreen', true, 'Mode plein écran automatique' , [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'fullScreen']),
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'config', 'fullScreen']),
|
||||
'help' => 'A l\'ouverture de la galerie, la première image est affichée en plein écran.'
|
||||
]); ?>
|
||||
</div>
|
||||
@ -97,7 +97,7 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('galleryEditShowPageContent', true, 'Afficher le contenu de la page avec la galerie' , [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'showPageContent']),
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'config', 'showPageContent']),
|
||||
'help' => 'Le contenu de la page est toujours affiché dans la liste des galeries. Quand une seule galerie est disponible, il est possible de l\'afficher directement, cette option est utile dans ce cas précis.'
|
||||
]); ?>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user