diff --git a/app/scodoc/html_sco_header.py b/app/scodoc/html_sco_header.py
index 9f537be83..76e8727ab 100644
--- a/app/scodoc/html_sco_header.py
+++ b/app/scodoc/html_sco_header.py
@@ -140,7 +140,7 @@ def sco_header(
init_google_maps=False, # Google maps
init_datatables=True,
titrebandeau="", # titre dans bandeau superieur
- head_message="", # message action (petit cadre jaune en haut)
+ head_message="", # message action (petit cadre jaune en haut) DEPRECATED
user_check=True, # verifie passwords temporaires
etudid=None,
formsemestre_id=None,
diff --git a/app/scodoc/sco_archives.py b/app/scodoc/sco_archives.py
index fce36c22c..dea28b74c 100644
--- a/app/scodoc/sco_archives.py
+++ b/app/scodoc/sco_archives.py
@@ -342,11 +342,11 @@ def do_formsemestre_archive(
formsemestre, res, include_evaluations=True
)
if table_html:
+ flash(f"Moyennes archivées le {date}", category="info")
data = "\n".join(
[
html_sco_header.sco_header(
page_title=f"Moyennes archivées le {date}",
- head_message=f"Moyennes archivées le {date}",
no_side_bar=True,
),
f'
Valeurs archivées le {date}
',
diff --git a/app/scodoc/sco_archives_etud.py b/app/scodoc/sco_archives_etud.py
index 271892149..1ca8eecef 100644
--- a/app/scodoc/sco_archives_etud.py
+++ b/app/scodoc/sco_archives_etud.py
@@ -30,7 +30,7 @@
les dossiers d'admission et autres pièces utiles.
"""
import flask
-from flask import url_for, render_template
+from flask import flash, render_template, url_for
from flask import g, request
from flask_login import current_user
@@ -38,7 +38,6 @@ import app.scodoc.sco_utils as scu
from app.scodoc import sco_import_etuds
from app.scodoc import sco_groups
from app.scodoc import sco_trombino
-from app.scodoc import sco_excel
from app.scodoc import sco_archives
from app.scodoc.sco_permissions import Permission
from app.scodoc.sco_exceptions import AccessDenied, ScoValueError
@@ -233,13 +232,9 @@ def etud_delete_archive(etudid, archive_name, dialog_confirmed=False):
)
EtudsArchive.delete_archive(archive_id)
+ flash("Archive supprimée")
return flask.redirect(
- url_for(
- "scolar.ficheEtud",
- scodoc_dept=g.scodoc_dept,
- etudid=etudid,
- head_message="Archive%20supprimée",
- )
+ url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
)
diff --git a/app/scodoc/sco_etape_apogee_view.py b/app/scodoc/sco_etape_apogee_view.py
index 35be5a66c..b53fe5e02 100644
--- a/app/scodoc/sco_etape_apogee_view.py
+++ b/app/scodoc/sco_etape_apogee_view.py
@@ -32,7 +32,7 @@ import io
from zipfile import ZipFile
import flask
-from flask import url_for, g, send_file, request
+from flask import flash, g, request, send_file, url_for
import app.scodoc.sco_utils as scu
from app import log
@@ -692,8 +692,10 @@ def view_apo_csv_delete(etape_apo="", semset_id="", dialog_confirmed=False):
)
if info:
sco_etape_apogee.apo_csv_delete(info["archive_id"])
- return flask.redirect(dest_url + "&head_message=Archive%20supprimée")
- return flask.redirect(dest_url + "&head_message=Archive%20inexistante")
+ flash("Archive supprimée")
+ return flask.redirect(dest_url)
+ flash("Archive inexistante", category="error")
+ return flask.redirect(dest_url)
def view_apo_csv(etape_apo="", semset_id="", format="html"):
diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py
index 999fd5253..d64bf4d9c 100644
--- a/app/scodoc/sco_formsemestre_edit.py
+++ b/app/scodoc/sco_formsemestre_edit.py
@@ -1179,9 +1179,13 @@ def formsemestre_clone(formsemestre_id):
clone_evaluations=tf[2]["clone_evaluations"],
clone_partitions=tf[2]["clone_partitions"],
)
+ flash("Nouveau semestre créé")
return flask.redirect(
- "formsemestre_status?formsemestre_id=%s&head_message=Nouveau%%20semestre%%20créé"
- % new_formsemestre_id
+ url_for(
+ "notes.formsemestre_status",
+ scodoc_dept=g.scodoc_dept,
+ formsemestre_id=new_formsemestre_id,
+ )
)
@@ -1364,7 +1368,8 @@ def formsemestre_delete2(formsemestre_id, dialog_confirmed=False):
)
# Bon, s'il le faut...
do_formsemestre_delete(formsemestre_id)
- return flask.redirect(scu.ScoURL() + "?head_message=Semestre%20supprimé")
+ flash("Semestre supprimé !")
+ return flask.redirect(scu.ScoURL())
def formsemestre_has_decisions_or_compensations(formsemestre: FormSemestre):
diff --git a/app/scodoc/sco_preferences.py b/app/scodoc/sco_preferences.py
index 5a659bc85..b77ee34b7 100644
--- a/app/scodoc/sco_preferences.py
+++ b/app/scodoc/sco_preferences.py
@@ -111,7 +111,7 @@ get_base_preferences(formsemestre_id)
"""
import flask
-from flask import g, request, current_app
+from flask import flash, g, request
# from flask_login import current_user
@@ -2115,7 +2115,8 @@ class BasePreferences(object):
for pref in self.prefs_definition:
self.prefs[None][pref[0]] = tf[2][pref[0]]
self.save()
- return flask.redirect(scu.ScoURL() + "?head_message=Préférences modifiées")
+ flash("Préférences modifiées")
+ return flask.redirect(scu.ScoURL())
def build_tf_form(self, categories: list[str] = None, formsemestre_id: int = None):
"""Build list of elements for TrivialFormulator.
@@ -2287,7 +2288,8 @@ function set_global_pref(el, pref_name) {
if tf[0] == 0:
return "\n".join(H) + tf[1] + html_sco_header.sco_footer()
elif tf[0] == -1:
- return flask.redirect(dest_url + "&head_message=Annulé") # cancel
+ flash("Annulé")
+ return flask.redirect(dest_url)
else:
# Supprime pref locale du semestre (retour à la valeur globale)
if tf[2]["suppress"]:
@@ -2299,7 +2301,7 @@ function set_global_pref(el, pref_name) {
self.formsemestre_id, tf[2]["create_local"], cur_value
)
# Modifie valeurs:
- for (pref_name, descr) in self.base_prefs.prefs_definition:
+ for pref_name, descr in self.base_prefs.prefs_definition:
if (
pref_name in tf[2]
and not descr.get("only_global", False)
@@ -2321,7 +2323,8 @@ function set_global_pref(el, pref_name) {
# done: change prefs and redirect to semestre status
destination = tf[2]["destination"]
if destination == "done" or destination == "":
- return flask.redirect(dest_url + "&head_message=Préférences modifiées")
+ flash("Préférences modifiées")
+ return flask.redirect(dest_url)
elif destination == "again":
return flask.redirect(
request.base_url + "?formsemestre_id=" + str(self.formsemestre_id)
diff --git a/app/views/notes.py b/app/views/notes.py
index 046e078f1..9753542ea 100644
--- a/app/views/notes.py
+++ b/app/views/notes.py
@@ -1193,12 +1193,12 @@ def edit_moduleimpl_expr(moduleimpl_id):
sco_cache.invalidate_formsemestre(
formsemestre_id=sem["formsemestre_id"]
) # > modif regle calcul
+ flash("règle de calcul modifiée")
return flask.redirect(
url_for(
"notes.moduleimpl_status",
scodoc_dept=g.scodoc_dept,
moduleimpl_id=moduleimpl_id,
- head_message="règle%20de%20calcul%20modifiée",
)
)
@@ -1321,7 +1321,6 @@ def delete_ue_expr(formsemestre_id: int, ue_id: int):
"notes.formsemestre_status",
scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id,
- head_message="formule supprimée",
)
)
@@ -2009,7 +2008,7 @@ def formsemestre_bulletins_choice(
""",
]
H.append("""