forked from ZwiiCMS-Team/ZwiiCMS
Supprimer le bouton trier
This commit is contained in:
parent
514c1d31b7
commit
c2f68a4716
@ -18,6 +18,7 @@ class gallery extends common {
|
|||||||
'config' => self::GROUP_MODERATOR,
|
'config' => self::GROUP_MODERATOR,
|
||||||
'delete' => self::GROUP_MODERATOR,
|
'delete' => self::GROUP_MODERATOR,
|
||||||
'dirs' => self::GROUP_MODERATOR,
|
'dirs' => self::GROUP_MODERATOR,
|
||||||
|
'sort' => self::GROUP_MODERATOR,
|
||||||
'edit' => self::GROUP_MODERATOR,
|
'edit' => self::GROUP_MODERATOR,
|
||||||
'index' => self::GROUP_VISITOR
|
'index' => self::GROUP_VISITOR
|
||||||
];
|
];
|
||||||
@ -45,39 +46,34 @@ class gallery extends common {
|
|||||||
const GALLERY_VERSION = '2.1';
|
const GALLERY_VERSION = '2.1';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tri sans bouton
|
||||||
|
*/
|
||||||
|
public function sort () {
|
||||||
|
if($_POST['response']) {
|
||||||
|
$data = explode('&',$_POST['response']);
|
||||||
|
$data = str_replace('galleryTable%5B%5D=','',$data);
|
||||||
|
for($i=0;$i<count($data);$i++) {
|
||||||
|
$this->setData(['module', $this->getUrl(0), $data[$i], [
|
||||||
|
'config' => [
|
||||||
|
'name' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','name']),
|
||||||
|
'directory' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','directory']),
|
||||||
|
'homePicture' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','homePicture']),
|
||||||
|
'sort' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','sort']),
|
||||||
|
'position' => $i
|
||||||
|
],
|
||||||
|
'legend' => $this->getData(['module',$this->getUrl(0),$data[$i],'legend'])
|
||||||
|
]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration
|
* Configuration
|
||||||
*/
|
*/
|
||||||
public function config() {
|
public function config() {
|
||||||
|
//Affichage de la galerie triée
|
||||||
// Le traitement du tri s'effectue en début de fonction
|
|
||||||
// Soumission du formulaire
|
|
||||||
if($this->isPost()) {
|
|
||||||
if ($this->getInput('galleryConfigFilterResponse')) {
|
|
||||||
$data = explode('&',($this->getInput('galleryConfigFilterResponse')));
|
|
||||||
$data = str_replace('galleryTable%5B%5D=','',$data);
|
|
||||||
for($i=0;$i<count($data);$i++) {
|
|
||||||
$this->setData(['module', $this->getUrl(0), $data[$i], [
|
|
||||||
'config' => [
|
|
||||||
'name' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','name']),
|
|
||||||
'directory' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','directory']),
|
|
||||||
'homePicture' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','homePicture']),
|
|
||||||
'sort' => $this->getData(['module',$this->getUrl(0),$data[$i],'config','sort']),
|
|
||||||
'position' => $i
|
|
||||||
],
|
|
||||||
'legend' => $this->getData(['module',$this->getUrl(0),$data[$i],'legend'])
|
|
||||||
]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Valeurs en sortie
|
|
||||||
//header('Refresh: 0;url='. helper::baseUrl() . $this->getUrl() . '#galleryConfigFilterForm' );
|
|
||||||
$this->addOutput([
|
|
||||||
'redirect' => helper::baseUrl() . $this->getUrl() /* . '#galleryConfigFilterForm'*/,
|
|
||||||
'notification' => 'Modifications enregistrées',
|
|
||||||
'state' => true
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
// Tri pour l'affichage de la galerie
|
|
||||||
$g = $this->getData(['module', $this->getUrl(0)]);
|
$g = $this->getData(['module', $this->getUrl(0)]);
|
||||||
$p = helper::arrayCollumn(helper::arrayCollumn($g,'config'),'position');
|
$p = helper::arrayCollumn(helper::arrayCollumn($g,'config'),'position');
|
||||||
asort($p,SORT_NUMERIC);
|
asort($p,SORT_NUMERIC);
|
||||||
|
@ -12,20 +12,21 @@
|
|||||||
* @link http://zwiicms.com/
|
* @link http://zwiicms.com/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$( document ).ready(function() {
|
$( document ).ready(function() {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tri dynamique de la galerie
|
* Tri de la galerie avec drag and drop
|
||||||
*/
|
*/
|
||||||
$("#galleryTable").tableDnD({
|
$("#galleryTable").tableDnD({
|
||||||
onDrop: function(table, row) {
|
onDrop: function(table, row) {
|
||||||
// Stocke dans un champ caché l'ordre de tri modifié
|
|
||||||
$("#galleryConfigFilterResponse").val($.tableDnD.serialize());
|
$("#galleryConfigFilterResponse").val($.tableDnD.serialize());
|
||||||
},
|
},
|
||||||
onDragStop : function(table, row) {
|
onDragStop : function(table, row) {
|
||||||
// Affiche le bouton de tri après un déplacement
|
// Affiche le bouton de tri après un déplacement
|
||||||
$(":input[type='submit']").prop('disabled', false);
|
$(":input[type='submit']").prop('disabled', false);
|
||||||
|
// Sauvegarde le tri
|
||||||
|
sort();
|
||||||
},
|
},
|
||||||
// Supprime le tiret des séparateurs
|
// Supprime le tiret des séparateurs
|
||||||
serializeRegexp: "[^\_]*$"
|
serializeRegexp: "[^\_]*$"
|
||||||
@ -84,3 +85,20 @@ setInterval(function() {
|
|||||||
directoryDOM.on("change", function() {
|
directoryDOM.on("change", function() {
|
||||||
directoryOldDOM.val($(this).val());
|
directoryOldDOM.val($(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tri dynamique des galeries
|
||||||
|
*/
|
||||||
|
|
||||||
|
function sort() {
|
||||||
|
var url = "<?php echo helper::baseUrl() . $this->getUrl(0) . '/sort'; ?>";
|
||||||
|
var data = $("#galleryConfigFilterResponse").val();
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: url ,
|
||||||
|
data: {
|
||||||
|
response : data
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
@ -51,19 +51,9 @@
|
|||||||
<div class="col12">
|
<div class="col12">
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<h4>Galeries installées</h4>
|
<h4>Galeries installées</h4>
|
||||||
<div class="col2 offset10">
|
|
||||||
<?php echo template::submit('galleryConfigFilterSubmit', [
|
|
||||||
'value' => 'Trier',
|
|
||||||
'disabled' => true,
|
|
||||||
'class' => 'gallerySubmit'
|
|
||||||
]); ?>
|
|
||||||
</div>
|
|
||||||
<?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 echo template::hidden('galleryConfigFilterSubmit',[
|
|
||||||
'value' => false
|
|
||||||
]); ?>
|
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php echo template::speech('Aucune galerie.'); ?>
|
<?php echo template::speech('Aucune galerie.'); ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user