diff --git a/core/module/plugin/view/index/index.js.php b/core/module/plugin/view/index/index.js.php index 060d7e18..a82e2447 100644 --- a/core/module/plugin/view/index/index.js.php +++ b/core/module/plugin/view/index/index.js.php @@ -11,6 +11,22 @@ * @link http://zwiicms.fr/ */ + + $(document).ready(function () { + var configLayout = getCookie("pluginLayout"); + if (configLayout == null) { + configLayout = "module"; + setCookie("pluginLayout", "module"); + } + $("#moduleContainer").hide(); + $("#dataContainer").hide(); + $("#" + configLayout + "Container").show(); + $("#config" + capitalizeFirstLetter(configLayout) + "Button").addClass("activeButton"); + + }); + + + /** * Confirmation de suppression */ @@ -33,18 +49,48 @@ $(".moduleDelete").on("click", function() { // Sélecteur de fonctions -$("#configManageModuleButton").on("click", function () { +$("#configModuleButton").on("click", function () { console.log("clic"); - $("#manageDatas").hide(); - $("#manageModules").show(); - $("#configManageModuleButton").addClass("activeButton"); - $("#configManageDatasButton").removeClass("activeButton"); + $("#dataContainer").hide(); + $("#moduleContainer").show(); + $("#configModuleButton").addClass("activeButton"); + $("#configDataButton").removeClass("activeButton"); setCookie("pluginLayout", "module"); }); -$("#configManageDatasButton").on("click", function () { - $("#manageModules").hide(); - $("#manageDatas").show(); - $("#configManageModuleButton").removeClass("activeButton"); - $("#configManageDatasButton").addClass("activeButton"); +$("#configDataButton").on("click", function () { + $("#moduleContainer").hide(); + $("#dataContainer").show(); + $("#configModuleButton").removeClass("activeButton"); + $("#configDataButton").addClass("activeButton"); setCookie("pluginLayout", "data"); }); + + + + +// Fonctions +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); +} diff --git a/core/module/plugin/view/index/index.php b/core/module/plugin/view/index/index.php index 0c33f68d..ca894a5b 100644 --- a/core/module/plugin/view/index/index.php +++ b/core/module/plugin/view/index/index.php @@ -31,16 +31,16 @@
- 'Modules installés', - 'class' => ' buttonTab activeButton' + 'class' => ' buttonTab' ]); ?> - 'Données des modules', 'class' => 'buttonTab' ]); ?>
-
+
@@ -64,7 +64,7 @@
-
+