From 48de07f99785268a54e39bb9ada6f22ce4096f56 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 5 Jun 2023 18:31:16 +0200 Subject: [PATCH] =?UTF-8?q?Etat=20des=20checkbox=20li=C3=A9s=20=C3=A0=20l'?= =?UTF-8?q?=C3=A9dition=20d'une=20page=20et=20aux=20modules=20dans=20l'?= =?UTF-8?q?=C3=A9dition=20et=20l'ajout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/view/profilAdd/profilAdd.js.php | 36 ++-- .../user/view/profilEdit/profilEdit.js.php | 41 +++- .../user/view/profilEdit/profilEdit.php | 176 +++++++++--------- 3 files changed, 146 insertions(+), 107 deletions(-) diff --git a/core/module/user/view/profilAdd/profilAdd.js.php b/core/module/user/view/profilAdd/profilAdd.js.php index 538c6e17..3d1021c5 100644 --- a/core/module/user/view/profilAdd/profilAdd.js.php +++ b/core/module/user/view/profilAdd/profilAdd.js.php @@ -13,35 +13,41 @@ $(document).ready(function () { - // Désactive tous les éléments de la classe "filemanager" si le checkbox avec l'id "profilEditFileManager" est décoché au chargement de la page - if (!$("#profilAddFileManager").prop("checked")) { - $(".filemanager").prop("disabled", true); - } - // À chaque inversion de l'état du checkbox avec l'id "profilEditFileManager", désactive ou active tous les éléments de la classe "filemanager" en fonction de l'état + + // À chaque inversion de l'état du checkbox avec l'id "profilAddFileManager", désactive ou active tous les éléments de la classe "filemanager" en fonction de l'état $("#profilAddFileManager").change(function () { - if (!$(this).prop("checked")) { + if (!$(this).is(':checked')) { $(".filemanager").prop("disabled", true); } else { $(".filemanager").prop("disabled", false); } }); - // Désactive la gestion des pages pour les membres - $('#profilAddGroup').change(function() {; - if ($(this).val() === '1') { - $('.containerPage, .containerModule').slideUp(); + // Gérer l'évènement affichage des + $("#profilAddPageModule").change(function () { + if (!$(this).is(':checked')) { + $(".containerModule").slideUp(); + // Décocher les checkboxes dans la classe .containerModule + $('.containerModule input[type="checkbox"]').removeAttr('checked'); } else { - $('.containerPage, .containerModule').slideDown(); + $(".containerModule").slideDown(); } }); - $("#profilAddPageEdit").change(function () { - if (!$(this).prop("checked")) { - $(".containerModule").prop("disabled", true); + // Gérer l’évènement de modification de la checkbox #profilAddPageEdit + $('#profilAddPageEdit').change(function () { + if ($(this).is(':checked')) { + // Activer les autres checkboxes + $('#profilAddPageModule, #profilAddPagecssEditor, #profilAddPagejsEditor').prop('disabled', false); } else { - $(".containerModule").prop("disabled", false); + // Désactiver les autres checkboxes + $('#profilAddPageModule, #profilAddPagecssEditor, #profilAddPagejsEditor').prop('checked', false).prop('disabled', true); + // Désactiver les modules et tout décocher + $(".containerModule").slideUp(); + $('.containerModule input[type="checkbox"]').removeAttr('checked'); } }); + }); diff --git a/core/module/user/view/profilEdit/profilEdit.js.php b/core/module/user/view/profilEdit/profilEdit.js.php index 39d9510d..aa9e3334 100644 --- a/core/module/user/view/profilEdit/profilEdit.js.php +++ b/core/module/user/view/profilEdit/profilEdit.js.php @@ -17,21 +17,52 @@ $(document).ready(function () { if (!$("#profilEditFileManager").prop("checked")) { $(".filemanager").prop("disabled", true); } + // Vérifier l'état initial de la checkbox #profilEditPageEdit + if ($('#profilEditPageEdit').is(':checked')) { + // Activer les autres checkboxes + $('#profilEditPageModule, #profilEditPagecssEditor, #profilEditPagejsEditor').prop('disabled', false); + } else { + // Désactiver les autres checkboxes + $('#profilEditPageModule, #profilEditPagecssEditor, #profilEditPagejsEditor').prop('checked', false).prop('disabled', true); + } + if (!$("#profilEditPageModule").is(':checked')) { + $(".containerModule").slideUp(); + } else { + $(".containerModule").slideDown(); + } // À chaque inversion de l'état du checkbox avec l'id "profilEditFileManager", désactive ou active tous les éléments de la classe "filemanager" en fonction de l'état $("#profilEditFileManager").change(function () { - if (!$(this).prop("checked")) { + if (!$(this).is(':checked')) { $(".filemanager").prop("disabled", true); } else { $(".filemanager").prop("disabled", false); } }); - $("#profilEditPageEdit").change(function () { - if (!$(this).prop("checked")) { - $(".containerModule").prop("disabled", true); + // Gérer l'évènement affichage des + $("#profilEditPageModule").change(function () { + if (!$(this).is(':checked')) { + $(".containerModule").slideUp(); + // Décocher les checkboxes dans la classe .containerModule + $('.containerModule input[type="checkbox"]').removeAttr('checked'); } else { - $(".containerModule").prop("disabled", false); + $(".containerModule").slideDown(); } }); + + // Gérer l’évènement de modification de la checkbox #profilEditPageEdit + $('#profilEditPageEdit').change(function () { + if ($(this).is(':checked')) { + // Activer les autres checkboxes + $('#profilEditPageModule, #profilEditPagecssEditor, #profilEditPagejsEditor').prop('disabled', false); + } else { + // Désactiver les autres checkboxes + $('#profilEditPageModule, #profilEditPagecssEditor, #profilEditPagejsEditor').prop('checked', false).prop('disabled', true); + // Désactiver les modules et tout décocher + $(".containerModule").slideUp(); + $('.containerModule input[type="checkbox"]').removeAttr('checked'); + } + }); + }); diff --git a/core/module/user/view/profilEdit/profilEdit.php b/core/module/user/view/profilEdit/profilEdit.php index 1befaa18..0230f30c 100644 --- a/core/module/user/view/profilEdit/profilEdit.php +++ b/core/module/user/view/profilEdit/profilEdit.php @@ -100,101 +100,103 @@ -
-
-
-

- -

-
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'add']) - ]); ?> +
+
+
+
+

+ +

+
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'add']) + ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'edit']) + ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'delete']) + ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'config']) + ]); ?> +
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'edit']) - ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'option']) + ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'comment']) + ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'commentApprove']) + ]); ?> +
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'delete']) - ]); ?> -
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'config']) - ]); ?> -
-
-
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'option']) - ]); ?> -
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'comment']) - ]); ?> -
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'commentApprove']) - ]); ?> -
-
-
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'commentDelete']) - ]); ?> -
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'commentDeleteAll']) - ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'commentDelete']) + ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'blog', 'commentDeleteAll']) + ]); ?> +
-
-
-
-
-

- -

-
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'add']) - ]); ?> -
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'edit']) - ]); ?> -
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'delete']) - ]); ?> -
-
-
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'config']) - ]); ?> -
-
- $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'option']) - ]); ?> +
+
+
+

+ +

+
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'add']) + ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'edit']) + ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'delete']) + ]); ?> +
+
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'config']) + ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'news', 'option']) + ]); ?> +
+