aboutsummaryrefslogtreecommitdiff
path: root/public/js/form.js
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2025-12-16 22:41:57 +0100
committerpolo <ordipolo@gmx.fr>2025-12-16 22:41:57 +0100
commit423755b019a09111b971e36c53e2557e2f5a704f (patch)
tree022c0a911133d676dd8e4e90379f8b186863fc88 /public/js/form.js
parent22da81bbcb9bb61fa484c9af6fbb667b685d2f9b (diff)
downloadcms-423755b019a09111b971e36c53e2557e2f5a704f.tar.gz
cms-423755b019a09111b971e36c53e2557e2f5a704f.tar.bz2
cms-423755b019a09111b971e36c53e2557e2f5a704f.zip
page emails, application du RGPD: table email et nettoyeur, renommage de $id_email
Diffstat (limited to 'public/js/form.js')
-rw-r--r--public/js/form.js62
1 files changed, 58 insertions, 4 deletions
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 @@
1//function sendMessage(){}
2
3// modif des paramètres d'e-mail: e-mail source/dest, mot de passe, serveur smtp & chiffrement tls/ssl 1// modif des paramètres d'e-mail: e-mail source/dest, mot de passe, serveur smtp & chiffrement tls/ssl
4function setEmailParam(what_param, id){ 2function setEmailParam(what_param, id){
5 const value = document.getElementById(what_param + '_' + id).value; 3 const value = document.getElementById(what_param + '_' + id).value;
@@ -28,8 +26,8 @@ function setEmailParam(what_param, id){
28 }); 26 });
29} 27}
30 28
31function checkCase(){ 29function checkCase(id){
32 if(document.getElementById('email_address').value.match('[A-Z]')){ 30 if(document.getElementById('email_address_' + id).value.match('[A-Z]')){
33 toastNotify("Votre e-mail comporte une lettre majuscule, il s'agit probablement d'une erreur."); 31 toastNotify("Votre e-mail comporte une lettre majuscule, il s'agit probablement d'une erreur.");
34 } 32 }
35} 33}
@@ -118,4 +116,60 @@ function sendVisitorEmail(id){
118 .catch(error => { 116 .catch(error => {
119 console.error('Erreur:', error); 117 console.error('Erreur:', error);
120 }); 118 });
119}
120
121function deleteEmail(id){
122 const table_row = document.getElementById(id);
123 if(!table_row){
124 return;
125 }
126
127 if(confirm('Voulez-vous supprimer cet e-mail ?')){
128 fetch('index.php?action=delete_email', {
129 method: 'POST',
130 headers: {
131 'Content-Type': 'application/json'
132 },
133 body: JSON.stringify({
134 id: id
135 })
136 })
137 .then(response => response.json())
138 .then(data => {
139 table_row.remove();
140 toastNotify("E-mail supprimé");
141 })
142 .catch(error => {
143 console.error('Erreur:', error);
144 });
145 }
146}
147
148function toggleSensitiveEmail(id){
149 const table_row = document.getElementById(id);
150 const checkbox = table_row.querySelector("input[class='make_checkbox_sensitive']");
151 const deletion_date = table_row.querySelector(".deletion_date");
152 if(!table_row || !checkbox || !deletion_date){
153 return;
154 }
155
156 fetch('index.php?action=toggle_sensitive_email', {
157 method: 'POST',
158 headers: {
159 'Content-Type': 'application/json'
160 },
161 body: JSON.stringify({
162 id: id,
163 checked: checkbox.checked
164 })
165 })
166 .then(response => response.json())
167 .then(data => {
168 checkbox.checked = data.checked;
169 deletion_date.innerHTML = data.deletion_date;
170 console.log(data.checked ? "Cet e-mail est maintenant considéré comme sensible." : "Cet e-mail n'est plus sensible.");
171 })
172 .catch(error => {
173 console.error('Erreur:', error);
174 });
121} \ No newline at end of file 175} \ No newline at end of file