Ajout titre page import utilisateur

This commit is contained in:
Emmanuel Viennet 2021-08-22 17:43:02 +02:00
parent 21c4fb6451
commit 1a9862f472

View File

@ -469,7 +469,7 @@ def create_user_form(REQUEST, user_name=None, edit=0):
def import_users_generate_excel_sample(REQUEST): def import_users_generate_excel_sample(REQUEST):
"une feuille excel pour importation utilisateurs" "une feuille excel pour importation utilisateurs"
data = sco_import_users.generate_excel_sample() data = sco_import_users.generate_excel_sample()
return sco_excel.send_excel_file(REQUEST, data, "ImportUtilisateurs") return sco_excel.send_excel_file(REQUEST, data, "ImportUtilisateurs.xlsx")
@bp.route("/import_users_form", methods=["GET", "POST"]) @bp.route("/import_users_form", methods=["GET", "POST"])
@ -523,16 +523,20 @@ def import_users_form(REQUEST=None):
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + tf[1] + "</li></ol>" + help + F return "\n".join(H) + tf[1] + "</li></ol>" + help + F
elif tf[0] == -1: elif tf[0] == -1:
return flask.redirect(back_url) return flask.redirect(url_for("scodoc.index"))
else: else:
# IMPORT # IMPORT
ok, diag = sco_import_users.import_excel_file(tf[2]["xlsfile"]) ok, diag = sco_import_users.import_excel_file(tf[2]["xlsfile"])
# TODO Afficher la liste des messages H = [
H = [html_sco_header.sco_header(page_title="Import utilisateurs")] html_sco_header.sco_header(page_title="Import utilisateurs"),
H.append("<ul>") """<h2>Téléchargement d'une nouvelle liste d'utilisateurs</h2>
for d in diag: """,
H.append("<li>%s</li>" % d) ]
H.append("</ul>") if diag:
H.append("""<h3>Problèmes rencontrés:</h3><ul>""")
for d in diag:
H.append(f"<li>{d}</li>")
H.append("</ul>")
if ok: if ok:
dest = url_for("users.index_html", scodoc_dept=g.scodoc_dept) dest = url_for("users.index_html", scodoc_dept=g.scodoc_dept)
H.append("<p>Ok, Import terminé !</p>") H.append("<p>Ok, Import terminé !</p>")
@ -542,7 +546,6 @@ def import_users_form(REQUEST=None):
H.append("<p>Erreur, importation annulée !</p>") H.append("<p>Erreur, importation annulée !</p>")
H.append('<p><a class="stdlink" href="%s">Continuer</a></p>' % dest) H.append('<p><a class="stdlink" href="%s">Continuer</a></p>' % dest)
return "\n".join(H) + html_sco_header.sco_footer() return "\n".join(H) + html_sco_header.sco_footer()
return "\n".join(H) + help + F
@bp.route("/user_info_page") @bp.route("/user_info_page")