diff options
author | Denise sur Lya <sekhmet@lya> | 2020-06-16 00:32:10 +0200 |
---|---|---|
committer | Denise sur Lya <sekhmet@lya> | 2020-06-16 00:32:10 +0200 |
commit | 66a3e38cc085dc000776d3e2ad3acd7ef57068a3 (patch) | |
tree | 1cfb7b1953596c6bd3e01706a20bb6e7e10d3bca /static | |
parent | 9cb3c31c54b868e0c3a335ef3a4b4cdc81e479fb (diff) | |
download | oms-66a3e38cc085dc000776d3e2ad3acd7ef57068a3.tar.gz oms-66a3e38cc085dc000776d3e2ad3acd7ef57068a3.tar.zst oms-66a3e38cc085dc000776d3e2ad3acd7ef57068a3.zip |
Ajout de la FAQ, correction de bugs. Meilleure requête de courbe.
Diffstat (limited to 'static')
-rw-r--r-- | static/requetes.js | 46 | ||||
-rw-r--r-- | static/style.css | 4 |
2 files changed, 31 insertions, 19 deletions
diff --git a/static/requetes.js b/static/requetes.js index 41fd850..9da579c 100644 --- a/static/requetes.js +++ b/static/requetes.js | |||
@@ -5,31 +5,39 @@ function appelle_image() | |||
5 | var formData = new FormData( document.getElementById("donnees_enfant") ); | 5 | var formData = new FormData( document.getElementById("donnees_enfant") ); |
6 | 6 | ||
7 | var requete = new XMLHttpRequest(); | 7 | var requete = new XMLHttpRequest(); |
8 | requete.responseType = "json"; | ||
8 | requete.onreadystatechange = function() | 9 | requete.onreadystatechange = function() |
9 | { | 10 | { |
10 | if (this.readyState == 4 && this.status == 200) { | 11 | if (this.readyState == 4 && this.status == 200) { |
11 | document.getElementById('courbe').src = 'data:image/png;base64,'+(this.response); | 12 | // on récupère les différents champs de la réponse |
13 | var image = this.response.image ; | ||
14 | var liste_warnings = this.response.messages | ||
15 | var texte = this.response.export_txt; | ||
16 | // On affiche l'image | ||
17 | document.getElementById('courbe').src = 'data:image/png;base64,'+(image); | ||
12 | document.getElementById('sectioncourbe').style.display = "block"; | 18 | document.getElementById('sectioncourbe').style.display = "block"; |
19 | |||
20 | // on affiche l'export des données | ||
21 | document.getElementById('export').innerHTML = texte; | ||
22 | document.getElementById('sectionexport').style.display = "block"; | ||
23 | |||
24 | // Si y'a eu des warnings, faut les afficher | ||
25 | if(liste_warnings.length != 0) | ||
26 | { | ||
27 | // afficher la liste des warnings | ||
28 | var elem_div = document.getElementById('courbe_warnings') ; | ||
29 | elem_div.style.display = "block" ; | ||
30 | var ul = elem_div.children[1] ; | ||
31 | for(i=0; i<liste_warnings.length; i++) { | ||
32 | var li = document.createElement("li"); | ||
33 | li.appendChild(document.createTextNode(liste_warnings[i])); | ||
34 | ul.appendChild(li); | ||
35 | } | ||
36 | |||
37 | |||
38 | } | ||
13 | } | 39 | } |
14 | } | 40 | } |
15 | requete.open("POST","courbe/b64",true) | 41 | requete.open("POST","courbe/b64",true) |
16 | requete.send(formData) | 42 | requete.send(formData) |
17 | } | 43 | } |
18 | |||
19 | function exporte_donnees() | ||
20 | { | ||
21 | var formData = new FormData( document.getElementById("donnees_enfant") ); | ||
22 | |||
23 | var requete = new XMLHttpRequest(); | ||
24 | requete.onreadystatechange = function() | ||
25 | { | ||
26 | if (this.readyState == 4 && this.status == 200) { | ||
27 | document.getElementById('export').innerHTML = this.responseText; | ||
28 | document.getElementById('sectionexport').style.display = "block"; | ||
29 | } | ||
30 | } | ||
31 | requete.open("POST","export_donnees",true) | ||
32 | requete.send(formData) | ||
33 | |||
34 | |||
35 | } | ||
diff --git a/static/style.css b/static/style.css index 58ddc3b..3216d34 100644 --- a/static/style.css +++ b/static/style.css | |||
@@ -14,3 +14,7 @@ body { | |||
14 | width: 25em; | 14 | width: 25em; |
15 | height: 20em; | 15 | height: 20em; |
16 | } | 16 | } |
17 | |||
18 | #courbe_warnings { | ||
19 | display: none; | ||
20 | } | ||