diff --git a/core/module/page/page.php b/core/module/page/page.php index 0e63ce90..941f191c 100644 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -475,7 +475,7 @@ class page extends common { 'metaDescription' => $this->getInput('pageEditMetaDescription', helper::FILTER_STRING_LONG), 'metaTitle' => $this->getInput('pageEditMetaTitle'), 'moduleId' => $this->getInput('pageEditModuleId'), - 'modulePosition' => $this->getInput('configModulePosition'), + 'modulePosition' => $this->getInput('pageModulePosition'), 'parentPageId' => $this->getInput('pageEditParentPageId'), 'position' => $position, 'group' => $this->getinput('pageEditBlock') !== 'bar' ? $this->getInput('pageEditGroup', helper::FILTER_INT) : 0, diff --git a/core/module/page/view/edit/edit.js.php b/core/module/page/view/edit/edit.js.php index 28d5dca9..7eaf1d2e 100644 --- a/core/module/page/view/edit/edit.js.php +++ b/core/module/page/view/edit/edit.js.php @@ -52,15 +52,22 @@ function protectModule() { */ $( document ).ready(function() { - /** - * Position initiales des blocs + * Sélection des onglets */ + var pageLayout = getCookie("pageLayout"); + if (pageLayout == null) { + pageLayout = "content"; + setCookie("pageLayout", "content"); + } + $("#pageEditContentContainer").hide(); $("#pageEditExtensionContainer").hide(); $("#pageEditPositionContainer").hide(); $("#pageEditLayoutContainer").hide(); $("#pageEditPermissionContainer").hide(); - $("#pageEditContentButton").addClass("activeButton"); + $("#pageEdit" + capitalizeFirstLetter(pageLayout) + "Container").show(); + $("#pageEdit" + capitalizeFirstLetter(pageLayout) + "Button").addClass("activeButton"); + /* * Enleve le menu fixe en édition de page @@ -87,12 +94,12 @@ $( document ).ready(function() { */ if( $("#pageEditModuleId").val() === "redirection" || $("#pageEditModuleId").val() === "" ) { - $("#configModulePositionWrapper").removeClass("disabled"); - $("#configModulePositionWrapper").slideUp(); + $("#pageModulePositionWrapper").removeClass("disabled"); + $("#pageModulePositionWrapper").slideUp(); } else { - $("#configModulePositionWrapper").addClass("disabled"); - $("#configModulePositionWrapper").slideDown(); + $("#pageModulePositionWrapper").addClass("disabled"); + $("#pageModulePositionWrapper").slideDown(); } @@ -275,6 +282,7 @@ $( document ).ready(function() { $("#PageEditPositionButton").removeClass("activeButton"); $("#pageEditLayoutButton").removeClass("activeButton"); $("#pageEditPermissionButton").removeClass("activeButton"); + setCookie("pageLayout", "content"); }); $("#pageEditExtensionButton").on("click", function () { $("#pageEditContentContainer").hide(); @@ -287,6 +295,7 @@ $( document ).ready(function() { $("#PageEditPositionButton").removeClass("activeButton"); $("#pageEditLayoutButton").removeClass("activeButton"); $("#pageEditPermissionButton").removeClass("activeButton"); + console.log("extension"); }); $("#PageEditPositionButton").on("click", function () { $("#pageEditContentContainer").hide(); @@ -299,6 +308,7 @@ $( document ).ready(function() { $("#PageEditPositionButton").addClass("activeButton"); $("#pageEditLayoutButton").removeClass("activeButton"); $("#pageEditPermissionButton").removeClass("activeButton"); + setCookie("pageLayout", "position"); }); $("#pageEditLayoutButton").on("click", function () { $("#pageEditContentContainer").hide(); @@ -311,6 +321,7 @@ $( document ).ready(function() { $("#PageEditPositionButton").removeClass("activeButton"); $("#pageEditLayoutButton").addClass("activeButton"); $("#pageEditPermissionButton").removeClass("activeButton"); + setCookie("pageLayout", "layout"); }); $("#pageEditPermissionButton").on("click", function () { $("#pageEditContentContainer").hide(); @@ -323,6 +334,7 @@ $( document ).ready(function() { $("#pageEditPositionButton").removeClass("activeButton"); $("#pageEditLayoutButton").removeClass("activeButton"); $("#pageEditPermissionButton").addClass("activeButton"); + setCookie("pageLayout", "permission"); }); /** @@ -381,12 +393,12 @@ var pageEditModuleIdDOM = $("#pageEditModuleId"); pageEditModuleIdDOM.on("change", function() { if( $(this).val() === "redirection" || $(this).val() === "") { - $("#configModulePositionWrapper").removeClass("disabled"); - $("#configModulePositionWrapper").slideUp(); + $("#pageModulePositionWrapper").removeClass("disabled"); + $("#pageModulePositionWrapper").slideUp(); } else { - $("#configModulePositionWrapper").addClass("disabled"); - $("#configModulePositionWrapper").slideDown(); + $("#pageModulePositionWrapper").addClass("disabled"); + $("#pageModulePositionWrapper").slideDown(); } }); @@ -691,3 +703,32 @@ function buildPagesList(extraPosition) { // Sélectionne la bonne position positionDOM.val(positionSelected); }; + +/** + * Cookies + */ +function setCookie(name, value, days) { + var expires = ""; + if (days) { + var date = new Date(); + date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); + expires = "; expires=" + date.toUTCString(); + } + document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=lax"; +} + +function getCookie(name) { + var nameEQ = name + "="; + var ca = document.cookie.split(';'); + for (var i = 0; i < ca.length; i++) { + var c = ca[i]; + while (c.charAt(0) == ' ') c = c.substring(1, c.length); + if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); + } + return null; +} + +// Define function to capitalize the first letter of a string +function capitalizeFirstLetter(string) { + return string.charAt(0).toUpperCase() + string.slice(1); +} \ No newline at end of file diff --git a/core/module/page/view/edit/edit.php b/core/module/page/view/edit/edit.php index d33bb791..12bbfce0 100644 --- a/core/module/page/view/edit/edit.php +++ b/core/module/page/view/edit/edit.php @@ -43,7 +43,7 @@
'Contenu', - 'class' => 'buttonTab activeButton' + 'class' => 'buttonTab' ]); ?> 'Menu', @@ -52,15 +52,15 @@ 'Extension', 'class' => 'buttonTab' - ]); ?> + ]); ?> 'Mise en page', 'class' => 'buttonTab' ]); ?> 'Référencement', + 'value' => 'Permission', 'class' => 'buttonTab' - ]); ?> + ]); ?>
@@ -244,7 +244,7 @@
- 'En position libre ajoutez le module en plaçant [MODULE] à l\'endroit voulu dans votre page.', 'label' => 'Position du module', 'selected' => $this->getData(['page', $this->getUrl(2), 'modulePosition'])