aboutsummaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rw-r--r--public/css/form.css3
-rw-r--r--public/css/show_emails.css24
-rw-r--r--public/js/form.js62
3 files changed, 85 insertions, 4 deletions
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 @@
35.form .admin_form i{ 35.form .admin_form i{
36 font-size: smaller; 36 font-size: smaller;
37} 37}
38.form_gdpr{
39 font-size: smaller;
40}
38 41
39@media screen and (max-width: 600px){ 42@media screen and (max-width: 600px){
40 .form_inputs{ 43 .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 @@
1.show_emails p{
2 font-size: smaller;
3}
4.show_emails table{
5
6 padding: 10px;
7 border-collapse: collapse;
8 font-size: smaller;
9}
10.show_emails table th, .show_emails table td{
11 background-color: white;
12 border: 1px black solid;
13}
14.show_emails table td{
15 vertical-align: top;
16 text-align: center;
17}
18.show_emails table .email_delete_button{
19 /*background-color: initial;*/
20 /*border: none;*/
21}
22.show_emails .action_icon{
23 width: 20px;
24} \ 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 @@
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