bugs divers

This commit is contained in:
fredtempez 2022-03-24 10:09:41 +01:00
parent 67e873c7ed
commit 02c7319035
2 changed files with 17 additions and 14 deletions

View File

@ -263,7 +263,7 @@ class gallery extends common {
* *
*/ */
public function sortGalleries() { public function sortGalleries() {
if($_POST['response']) { if( isset($_POST['response']) ){
$data = explode('&',$_POST['response']); $data = explode('&',$_POST['response']);
$data = str_replace('galleryTable%5B%5D=','',$data); $data = str_replace('galleryTable%5B%5D=','',$data);
for($i=0;$i<count($data);$i++) { for($i=0;$i<count($data);$i++) {
@ -274,7 +274,8 @@ class gallery extends common {
'homePicture' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'config','homePicture']), 'homePicture' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'config','homePicture']),
'sort' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'config','sort']), 'sort' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'config','sort']),
'position'=> $i, 'position'=> $i,
'fullScreen' => $this->getData(['module',$this->getUrl(0), 'content',$data[$i],'config','fullScreen']) 'fullScreen' => $this->getData(['module',$this->getUrl(0), 'content',$data[$i],'config','fullScreen']),
'showPageContent' => $this->getData(['module',$this->getUrl(0), 'content',$data[$i],'config','showPageContent'])
], ],
'legend' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'legend']), 'legend' => $this->getData(['module',$this->getUrl(0), 'content', $data[$i],'legend']),
@ -289,22 +290,22 @@ class gallery extends common {
* *
*/ */
public function sortPictures() { public function sortPictures() {
if($_POST['response']) { if( isset($_POST['response']) ) {
$galleryName = $_POST['gallery']; $galleryName = $_POST['gallery'];
$data = explode('&',$_POST['response']); $data = explode('&',$_POST['response']);
$data = str_replace('galleryTable%5B%5D=','',$data); $data = str_replace('galleryTable%5B%5D=','',$data);
// Sauvegarder // Sauvegarder
$this->setData(['module', $this->getUrl(0), 'content', $galleryName, [ $this->setData(['module', $this->getUrl(0), 'content', $galleryName, [
'config' => [ 'config' => [
'name' => $this->getData(['module',$this->getUrl(0),$galleryName,'config','name']), 'name' => $this->getData(['module',$this->getUrl(0), 'content', $galleryName,'config','name']),
'directory' => $this->getData(['module',$this->getUrl(0),$galleryName,'config','directory']), 'directory' => $this->getData(['module',$this->getUrl(0),'content',$galleryName,'config','directory']),
'homePicture' => $this->getData(['module',$this->getUrl(0),$galleryName,'config','homePicture']), 'homePicture' => $this->getData(['module',$this->getUrl(0),'content',$galleryName,'config','homePicture']),
'sort' => $this->getData(['module',$this->getUrl(0),$galleryName,'config','sort']), 'sort' => $this->getData(['module',$this->getUrl(0),'content',$galleryName,'config','sort']),
'position' => $this->getData(['module',$this->getUrl(0),$galleryName,'config','position']), 'position' => $this->getData(['module',$this->getUrl(0),'content',$galleryName,'config','position']),
'fullScreen' => $this->getData(['module',$this->getUrl(0),$galleryName,'config','fullScreen']) 'fullScreen' => $this->getData(['module',$this->getUrl(0),'content',$galleryName,'config','fullScreen'])
], ],
'legend' => $this->getData(['module',$this->getUrl(0),$galleryName,'legend']), 'legend' => $this->getData(['module',$this->getUrl(0), 'content', $galleryName,'legend']),
'positions' => array_flip($data) 'positions' => array_flip($data)
]]); ]]);
} }
@ -385,8 +386,9 @@ class gallery extends common {
'directory' => $this->getInput('galleryConfigDirectory', helper::FILTER_STRING_SHORT, true), 'directory' => $this->getInput('galleryConfigDirectory', helper::FILTER_STRING_SHORT, true),
'homePicture' => $homePicture, 'homePicture' => $homePicture,
'sort' => self::SORT_ASC, 'sort' => self::SORT_ASC,
'position' => $this->getData(['module', $this->getUrl(0), 'content', $galleryId,'config','position']), 'position' => count($this->getData(['module', $this->getUrl(0), 'content'])) + 1,
'fullScreen' => false 'fullScreen' => false,
'showPageContent' => false
], ],
'legend' => [], 'legend' => [],
'positions' => [] 'positions' => []

View File

@ -103,7 +103,7 @@ $("#galleryEditSort").change(function() {
*/ */
function sortPictures() { function sortPictures() {
var url = "<?php echo helper::baseUrl() . $this->getUrl(0); ?>/sortPictures"; var url = "<?php echo helper::baseUrl(true,true) . $this->getUrl(0); ?>/sortPictures";
var d1 = $("#galleryEditFormResponse").val(); var d1 = $("#galleryEditFormResponse").val();
var d2 = $("#galleryEditFormGalleryName").val(); var d2 = $("#galleryEditFormGalleryName").val();
$.ajax({ $.ajax({
@ -112,10 +112,11 @@ function sortPictures() {
data: { data: {
response : d1, response : d1,
gallery: d2 gallery: d2
}, },/*
error: function (xhr, ajaxOptions, thrownError) { error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status); alert(xhr.status);
alert(thrownError); alert(thrownError);
} }
*/
}); });
} }