From 423755b019a09111b971e36c53e2557e2f5a704f Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 16 Dec 2025 22:41:57 +0100 Subject: page emails, application du RGPD: table email et nettoyeur, renommage de $id_email --- public/css/form.css | 3 +++ public/css/show_emails.css | 24 ++++++++++++++++++ public/js/form.js | 62 +++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 public/css/show_emails.css (limited to 'public') diff --git a/public/css/form.css b/public/css/form.css index c17662d..09d4140 100644 --- a/public/css/form.css +++ b/public/css/form.css @@ -35,6 +35,9 @@ .form .admin_form i{ font-size: smaller; } +.form_gdpr{ + font-size: smaller; +} @media screen and (max-width: 600px){ .form_inputs{ diff --git a/public/css/show_emails.css b/public/css/show_emails.css new file mode 100644 index 0000000..4fb9f3b --- /dev/null +++ b/public/css/show_emails.css @@ -0,0 +1,24 @@ +.show_emails p{ + font-size: smaller; +} +.show_emails table{ + + padding: 10px; + border-collapse: collapse; + font-size: smaller; +} +.show_emails table th, .show_emails table td{ + background-color: white; + border: 1px black solid; +} +.show_emails table td{ + vertical-align: top; + text-align: center; +} +.show_emails table .email_delete_button{ + /*background-color: initial;*/ + /*border: none;*/ +} +.show_emails .action_icon{ + width: 20px; +} \ No newline at end of file diff --git a/public/js/form.js b/public/js/form.js index 4be83c6..b498b40 100644 --- a/public/js/form.js +++ b/public/js/form.js @@ -1,5 +1,3 @@ -//function sendMessage(){} - // modif des paramètres d'e-mail: e-mail source/dest, mot de passe, serveur smtp & chiffrement tls/ssl function setEmailParam(what_param, id){ const value = document.getElementById(what_param + '_' + id).value; @@ -28,8 +26,8 @@ function setEmailParam(what_param, id){ }); } -function checkCase(){ - if(document.getElementById('email_address').value.match('[A-Z]')){ +function checkCase(id){ + if(document.getElementById('email_address_' + id).value.match('[A-Z]')){ toastNotify("Votre e-mail comporte une lettre majuscule, il s'agit probablement d'une erreur."); } } @@ -118,4 +116,60 @@ function sendVisitorEmail(id){ .catch(error => { console.error('Erreur:', error); }); +} + +function deleteEmail(id){ + const table_row = document.getElementById(id); + if(!table_row){ + return; + } + + if(confirm('Voulez-vous supprimer cet e-mail ?')){ + fetch('index.php?action=delete_email', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + id: id + }) + }) + .then(response => response.json()) + .then(data => { + table_row.remove(); + toastNotify("E-mail supprimé"); + }) + .catch(error => { + console.error('Erreur:', error); + }); + } +} + +function toggleSensitiveEmail(id){ + const table_row = document.getElementById(id); + const checkbox = table_row.querySelector("input[class='make_checkbox_sensitive']"); + const deletion_date = table_row.querySelector(".deletion_date"); + if(!table_row || !checkbox || !deletion_date){ + return; + } + + fetch('index.php?action=toggle_sensitive_email', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + id: id, + checked: checkbox.checked + }) + }) + .then(response => response.json()) + .then(data => { + checkbox.checked = data.checked; + deletion_date.innerHTML = data.deletion_date; + console.log(data.checked ? "Cet e-mail est maintenant considéré comme sensible." : "Cet e-mail n'est plus sensible."); + }) + .catch(error => { + console.error('Erreur:', error); + }); } \ No newline at end of file -- cgit v1.2.3