From 30158504b5267f225469216ea4aa0d123a8f5d8e Mon Sep 17 00:00:00 2001 From: Denise sur Lya Date: Fri, 26 Jun 2020 22:43:04 +0200 Subject: [PATCH] =?utf8?q?possibilit=C3=A9=20de=20saisir=20la=20date=20au?= =?utf8?q?=20format=20texte=20+=20export=20donn=C3=A9es=20en=20txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- data/changelog_data.txt | 7 ++++++ gestion_donnees.py | 3 ++- gestion_unites.py | 2 ++ static/outilspage.js | 52 ++++++++++++++++++++++++++++++++++++++--- static/requetes.js | 4 ++-- static/style.css | 4 ++++ templates/index.html | 3 ++- 7 files changed, 68 insertions(+), 7 deletions(-) diff --git a/data/changelog_data.txt b/data/changelog_data.txt index 45c4238..f2faef6 100644 --- a/data/changelog_data.txt +++ b/data/changelog_data.txt @@ -1,3 +1,10 @@ +"Version 1.1","26/06/2020","

Petites améliorations : +

+

" + "Version 1.0001","24/06/2020","

Petit bug corrigé (lors du choix de l'âge maxi sur la courbe)

" "Version 1.0","22/06/2020","

On release ! :) Vous pouvez voir plus bas la liste des trucs implémentés jusque-là. Je ne dis pas que c'est fini, mais c'est assez sûr pour être lancé. Il reste des bugs et des améliorations bien sûr ! diff --git a/gestion_donnees.py b/gestion_donnees.py index ea1f259..6abcd51 100644 --- a/gestion_donnees.py +++ b/gestion_donnees.py @@ -115,11 +115,12 @@ def convertit_date_vers_python(chaine,liste_err): warning("La date : "+chaine+" est invalide !",liste_err) return "" else: + debug("Conversion de la date "+chaine+". Découpage : "+str(liste),liste_err) try: date = datetime.date(int(liste[0]),int(liste[1]),int(liste[2])) except: date = "" - warning("Impossible de lire la date "+chaine,liste_err) + warning("Impossible de lire la date "+chaine+". Format accepté : aaaa-mm-jj",liste_err) return date def convertit_date_vers_texte(date): diff --git a/gestion_unites.py b/gestion_unites.py index afbc479..8fcb1ad 100644 --- a/gestion_unites.py +++ b/gestion_unites.py @@ -10,6 +10,8 @@ def choix_unite(maxi): """ en fonction de l'âge maxi, on choisit une unité pertinente : jours, mois, année""" if maxi<40: return "jours" + elif maxi <100: + return "semaines" elif maxi<25*CONFIG["jours_dans_mois"]: return "mois" else: diff --git a/static/outilspage.js b/static/outilspage.js index 8da9e88..58dfb7f 100644 --- a/static/outilspage.js +++ b/static/outilspage.js @@ -1,5 +1,9 @@ // fonctions générales pour la page +var taillemaxdate = 10; +var placeholder_date = "aaaa-mm-jj" ; + + function ajoutelignes() { // va ajouter 3 lignes au tableau de données @@ -7,6 +11,11 @@ function ajoutelignes() var nbligne = table.children[0].childElementCount ; // les données étant numérotées à partir de 0 on pourra commencer à partir de nbligne -1 // car il faut éliminer la ligne de header. + + // voir dans quel mode on est : date ou texte + var deuxiemeligne = table.children[0].children[1] ; + var celldate = deuxiemeligne.children[1] ; + var mode = celldate.firstChild.type ; var nbajout = 3 ; for(var i=nbligne-1; i' ; - celldate.innerHTML = '' ; - cellpoids.innerHTML = '' ; - + celldate.innerHTML = '' ; + celldate.firstChild.type = mode ; + if(mode == "text") // si on a déjà affiché les cases en mode texte, on continue en mode texte + { + celldate.firstChild.size = taillemaxdate ; + celldate.firstChild.maxlength = taillemaxdate ; + celldate.firstChild.placeholder = placeholder_date ; + } + cellpoids.innerHTML = '' ; } } @@ -49,3 +64,34 @@ function affiche_cache(id,elemcourant) } } + +function change_mode_dates(mode) +{ + // passe de l'affichage en mode "date" à l'affichage en mode "texte" pour les navigateurs + // qui gèrent mal le mode date + var listeinput = document.getElementsByTagName("input") ; + for(i=0;iCliquez ici pour revenir à une saisie de dates « confortable Â»." + } + else + { + elem.innerHTML = "Cliquez ici pour saisir les dates comme du texte." + } + +} diff --git a/static/requetes.js b/static/requetes.js index 4442470..bf8d484 100644 --- a/static/requetes.js +++ b/static/requetes.js @@ -25,7 +25,7 @@ function appelle_image() var boutondl = document.getElementById("export_dl") ; - boutondl.setAttribute('onclick',"download_file('donnees_"+nomenfant+".json', 'application/json;charset=utf-8','"+encodeURIComponent(texte) +"')") + boutondl.setAttribute('onclick',"download_file('donnees_"+nomenfant+".txt', 'application/json;charset=utf-8','"+encodeURIComponent(texte) +"')") if(result == "success") @@ -106,4 +106,4 @@ function download_file(filename,mimetype,data) { function upload_file(data) { document.getElementById('form_import_donnees').submit(); -} \ No newline at end of file +} diff --git a/static/style.css b/static/style.css index 88f77fb..414f996 100644 --- a/static/style.css +++ b/static/style.css @@ -74,6 +74,10 @@ img#courbe { display: none; } +.petit { + font-size: 0.8em; +} + .bouton { text-decoration: underline; } diff --git a/templates/index.html b/templates/index.html index 7e00234..9fc8637 100644 --- a/templates/index.html +++ b/templates/index.html @@ -29,7 +29,8 @@ Effacer les données du formulaire - + +

Cliquer ici pour saisir les dates comme du texte.