From 37c93c8524da904a9ecba1f816cc3f726a169f58 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 24 Aug 2024 08:06:46 +0200 Subject: [PATCH] Cosmetic / templatification --- app/scodoc/gen_tables.py | 3 +- app/scodoc/sco_archives_formsemestre.py | 24 +++--- app/scodoc/sco_debouche.py | 16 ++-- app/scodoc/sco_edit_formation.py | 9 ++- app/scodoc/sco_edit_module.py | 49 +++++------ app/scodoc/sco_edit_ue.py | 12 +-- app/scodoc/sco_evaluations.py | 4 +- app/scodoc/sco_excel.py | 2 +- app/scodoc/sco_formation_recap.py | 4 +- app/scodoc/sco_formation_versions.py | 1 + app/scodoc/sco_formsemestre_edit.py | 25 +++--- app/scodoc/sco_formsemestre_status.py | 81 ++++++++++++------- app/scodoc/sco_formsemestre_validation.py | 12 ++- app/scodoc/sco_groups_exports.py | 2 +- app/scodoc/sco_groups_view.py | 25 +++--- app/scodoc/sco_moduleimpl_status.py | 2 +- app/scodoc/sco_utils.py | 7 +- app/static/css/scodoc.css | 20 ++++- .../pages/feuille_abs_formsemestre.j2 | 30 +++---- app/templates/bul_head.j2 | 2 +- app/templates/but/bulletin_court_page.j2 | 2 +- app/templates/but/parcour_formation.j2 | 2 +- app/templates/but/refcomp_load.j2 | 2 +- app/templates/but/refcomp_show.j2 | 2 +- app/templates/but/refcomp_table.j2 | 2 +- app/templates/but/validate_dut120.j2 | 2 +- .../formation/ue_assoc_parcours_ects.j2 | 20 ++--- .../formsemestre/bulletins_choice.j2 | 2 + app/templates/pn/form_modules_ue_coefs.j2 | 28 ++++++- app/views/pn_modules.py | 74 +++++------------ sco_version.py | 2 +- 31 files changed, 260 insertions(+), 208 deletions(-) diff --git a/app/scodoc/gen_tables.py b/app/scodoc/gen_tables.py index f37a55f6..e9368f07 100644 --- a/app/scodoc/gen_tables.py +++ b/app/scodoc/gen_tables.py @@ -685,6 +685,7 @@ class GenTable: javascripts=(), with_html_headers=True, publish=True, + template="sco_page.j2", ): """ Build page at given format @@ -703,7 +704,7 @@ class GenTable: H.append(self.html()) if with_html_headers: return render_template( - "sco_page.j2", + template, content="\n".join(H), title=page_title, javascripts=javascripts, diff --git a/app/scodoc/sco_archives_formsemestre.py b/app/scodoc/sco_archives_formsemestre.py index 44986253..2365e1b7 100644 --- a/app/scodoc/sco_archives_formsemestre.py +++ b/app/scodoc/sco_archives_formsemestre.py @@ -36,7 +36,6 @@ from app.comp.res_compat import NotesTableCompat from app.models import FormSemestre from app.scodoc.TrivialFormulator import TrivialFormulator from app.scodoc.sco_exceptions import ScoPermissionDenied -from app.scodoc import html_sco_header from app.scodoc import sco_bulletins_pdf from app.scodoc import sco_groups from app.scodoc import sco_groups_view @@ -123,18 +122,18 @@ def do_formsemestre_archive( ) 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}", - no_sidebar=True, - ), - f'

Valeurs archivées le {date}

', - """""", - table_html, - html_sco_header.sco_footer(), - ] + table_html, + ] + ), ) PV_ARCHIVER.store( archive_id, "Tableau_moyennes.html", data, dept_id=formsemestre.dept_id @@ -254,7 +253,6 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement. }">Paramétrage" (accessible à l'administrateur du département).

""", - html_sco_header.sco_footer(), ] descr = [ diff --git a/app/scodoc/sco_debouche.py b/app/scodoc/sco_debouche.py index 116c815d..a5c97ab9 100644 --- a/app/scodoc/sco_debouche.py +++ b/app/scodoc/sco_debouche.py @@ -29,7 +29,7 @@ Rapport (table) avec dernier semestre fréquenté et débouché de chaque étudiant """ import http -from flask import url_for, g, request +from flask import g, render_template, request, url_for from app import log from app.comp import res_sem @@ -40,7 +40,6 @@ import app.scodoc.notesdb as ndb from app.scodoc.sco_exceptions import AccessDenied, ScoValueError from app.scodoc.gen_tables import GenTable from app.scodoc import safehtml -from app.scodoc import html_sco_header from app.scodoc import sco_permissions_check from app.scodoc import sco_preferences from app.scodoc import sco_tag_module @@ -78,6 +77,7 @@ def report_debouche_date(start_year=None, fmt="html"): title="""

Débouchés étudiants

""", fmt=fmt, with_html_headers=True, + template="sco_page_dept.j2", ) @@ -226,14 +226,16 @@ def table_debouche_etudids(etudids, keep_numeric=True): def report_debouche_ask_date(msg: str) -> str: """Formulaire demande date départ""" - return f"""{html_sco_header.sco_header()} + return render_template( + "sco_page_dept.j2", + content=f"""

Table des débouchés des étudiants

{msg}
- {html_sco_header.sco_footer()} - """ + """, + ) # ---------------------------------------------------------------------------- @@ -323,11 +325,11 @@ def itemsuivi_set_date(itemsuivi_id, item_date): return ("", 204) -def itemsuivi_set_situation(object, value): +def itemsuivi_set_situation(obj, value): """set situation""" if not sco_permissions_check.can_edit_suivi(): raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !") - itemsuivi_id = object + itemsuivi_id = obj situation = value.strip("-_ \t") # log('itemsuivi_set_situation %s : %s' % (itemsuivi_id, situation)) cnx = ndb.GetDBConnexion() diff --git a/app/scodoc/sco_edit_formation.py b/app/scodoc/sco_edit_formation.py index 82d7d8d4..151f83d5 100644 --- a/app/scodoc/sco_edit_formation.py +++ b/app/scodoc/sco_edit_formation.py @@ -29,7 +29,7 @@ (portage from DTML) """ import flask -from flask import flash, g, url_for, request +from flask import flash, g, url_for, render_template, request import sqlalchemy from app import db @@ -54,7 +54,6 @@ def formation_delete(formation_id=None, dialog_confirmed=False): formation: Formation = Formation.query.get_or_404(formation_id) H = [ - html_sco_header.sco_header(page_title="Suppression d'une formation"), f"""

Suppression de la formation {formation.titre} ({formation.acronyme})

""", ] formsemestres = formation.formsemestres.all() @@ -85,6 +84,7 @@ def formation_delete(formation_id=None, dialog_confirmed=False): OK="Supprimer cette formation", cancel_url=url_for("notes.index_html", scodoc_dept=g.scodoc_dept), parameters={"formation_id": formation_id}, + template="sco_page_dept.j2", ) else: do_formation_delete(formation_id) @@ -95,8 +95,9 @@ def formation_delete(formation_id=None, dialog_confirmed=False): }">continuer

""" ) - H.append(html_sco_header.sco_footer()) - return "\n".join(H) + return render_template( + "sco_page-dept.j2", content="\n".join(H), title="Suppression d'une formation" + ) def do_formation_delete(formation_id): diff --git a/app/scodoc/sco_edit_module.py b/app/scodoc/sco_edit_module.py index eef881a1..4b2c0bd6 100644 --- a/app/scodoc/sco_edit_module.py +++ b/app/scodoc/sco_edit_module.py @@ -51,7 +51,6 @@ from app.scodoc.sco_exceptions import ( ScoGenError, ScoNonEmptyFormationObject, ) -from app.scodoc import html_sco_header from app.scodoc import codes_cursus from app.scodoc import sco_edit_matiere from app.scodoc import sco_moduleimpl @@ -208,8 +207,8 @@ def module_delete(module_id=None): ) H = [ - html_sco_header.sco_header(page_title="Suppression d'un module"), - f"""

Suppression du module {module.titre or "sans titre"} ({module.code})

""", + f"""

Suppression du module {module.titre or "sans titre"} + ({module.code})

""", ] dest_url = url_for( @@ -227,7 +226,11 @@ def module_delete(module_id=None): cancelbutton="Annuler", ) if tf[0] == 0: - return "\n".join(H) + tf[1] + html_sco_header.sco_footer() + return render_template( + "sco_page_dept.j2", + title="Suppression d'un module", + content="\n".join(H) + tf[1], + ) elif tf[0] == -1: return flask.redirect(dest_url) else: @@ -372,16 +375,6 @@ def module_edit( """ H = [ - html_sco_header.sco_header( - page_title=page_title, - cssstyles=["libjs/jQuery-tagEditor/jquery.tag-editor.css"], - javascripts=[ - "libjs/jQuery-tagEditor/jquery.tag-editor.min.js", - "libjs/jQuery-tagEditor/jquery.caret.min.js", - "js/module_tag_editor.js", - "js/module_edit.js", - ], - ), f"""

{title}

""", render_template( "scodoc/help/modules.j2", @@ -780,7 +773,7 @@ def module_edit( scu.get_request_args(), descr, html_foot_markup=( - f"""
""" @@ -793,8 +786,17 @@ def module_edit( ) # if tf[0] == 0: - return ( - "\n".join(H) + return render_template( + "sco_page_dept.j2", + title=page_title, + cssstyles=["libjs/jQuery-tagEditor/jquery.tag-editor.css"], + javascripts=[ + "libjs/jQuery-tagEditor/jquery.tag-editor.min.js", + "libjs/jQuery-tagEditor/jquery.caret.min.js", + "js/module_tag_editor.js", + "js/module_edit.js", + ], + content="\n".join(H) + tf[1] + ( f""" @@ -805,8 +807,7 @@ def module_edit( """ if not create else "" - ) - + html_sco_header.sco_footer() + ), ) elif tf[0] == -1: return flask.redirect( @@ -904,9 +905,6 @@ def module_table(formation_id): raise ScoValueError("invalid formation !") formation: Formation = Formation.query.get_or_404(formation_id) H = [ - html_sco_header.sco_header( - page_title=f"Liste des modules de {formation.titre}" - ), f"""

Listes des modules dans la formation {formation.titre} ({formation.acronyme}

") - H.append(html_sco_header.sco_footer()) - return "\n".join(H) + return render_template( + "sco_page_dept.j2", + title=f"Liste des modules de {formation.titre}", + content="\n".join(H), + ) def module_is_locked(module_id): diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index 9414a26b..e24affef 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -505,8 +505,11 @@ def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=No else: clone_form = "" - return f""" - {html_sco_header.sco_header(page_title=title, javascripts=["js/edit_ue.js"])} + return render_template( + "sco_page_dept.j2", + title=title, + javascripts=["js/edit_ue.js"], + content=f"""

{title}, (formation {formation.acronyme}, version {formation.version})

Les UEs sont des groupes de modules dans une formation donnée, utilisés pour la validation (on calcule des moyennes par UE et applique des @@ -529,9 +532,8 @@ def ue_edit(ue_id=None, create=False, formation_id=None, default_semestre_idx=No

- - {html_sco_header.sco_footer()} - """ + """, + ) elif tf[0] == 1: if create: if not tf[2]["ue_code"]: diff --git a/app/scodoc/sco_evaluations.py b/app/scodoc/sco_evaluations.py index a961ecb3..40072970 100644 --- a/app/scodoc/sco_evaluations.py +++ b/app/scodoc/sco_evaluations.py @@ -486,7 +486,8 @@ def formsemestre_evaluations_cal(formsemestre_id):
{ cal_html }
-

soit {nb_evals} évaluations planifiées; +

+

soit {nb_evals} évaluations planifiées :

""", ) diff --git a/app/scodoc/sco_excel.py b/app/scodoc/sco_excel.py index 8a30e92e..acd4293c 100644 --- a/app/scodoc/sco_excel.py +++ b/app/scodoc/sco_excel.py @@ -825,7 +825,7 @@ def excel_feuille_listeappel( ws.append_blank_row() # bas de page (date, serveur) - dt = time.strftime("%d/%m/%Y à %Hh%M") + dt = time.strftime(scu.DATEATIME_FMT) if server_name: dt += " sur " + server_name cell_2 = ws.make_cell(("Liste éditée le " + dt), style1i) diff --git a/app/scodoc/sco_formation_recap.py b/app/scodoc/sco_formation_recap.py index 0cc10c30..71c08c9c 100644 --- a/app/scodoc/sco_formation_recap.py +++ b/app/scodoc/sco_formation_recap.py @@ -174,7 +174,9 @@ def formation_table_recap(formation: Formation, fmt="html") -> Response: preferences=sco_preferences.SemPreferences(), table_id="formation_table_recap", ) - return tab.make_page(fmt=fmt, javascripts=["js/formation_recap.js"]) + return tab.make_page( + fmt=fmt, javascripts=["js/formation_recap.js"], template="sco_page_dept.j2" + ) def export_recap_formations_annee_scolaire(annee_scolaire): diff --git a/app/scodoc/sco_formation_versions.py b/app/scodoc/sco_formation_versions.py index 8fbf3931..b532146c 100644 --- a/app/scodoc/sco_formation_versions.py +++ b/app/scodoc/sco_formation_versions.py @@ -149,6 +149,7 @@ def formsemestre_associate_new_version( "formation_id": formation_id, "formsemestre_id": formsemestre_id, }, + template="sco_page_dept.j2", ) elif request.method == "POST": if formsemestre_id is not None: # pas dans le form car checkbox disabled diff --git a/app/scodoc/sco_formsemestre_edit.py b/app/scodoc/sco_formsemestre_edit.py index 1058cf7a..e607b2cd 100644 --- a/app/scodoc/sco_formsemestre_edit.py +++ b/app/scodoc/sco_formsemestre_edit.py @@ -60,7 +60,6 @@ from app.scodoc.TrivialFormulator import TrivialFormulator from app.scodoc.sco_exceptions import AccessDenied, ScoValueError from app.scodoc.sco_permissions import Permission from app.scodoc.sco_vdi import ApoEtapeVDI -from app.scodoc import html_sco_header from app.scodoc import codes_cursus from app.scodoc import sco_edit_module from app.scodoc import sco_formsemestre @@ -80,20 +79,20 @@ def _default_sem_title(formation): def formsemestre_createwithmodules(): """Page création d'un semestre""" - H = [ - html_sco_header.sco_header( - page_title="Création d'un semestre", - javascripts=["libjs/AutoSuggest.js", "js/formsemestre_edit.js"], - cssstyles=["css/autosuggest_inquisitor.css"], - ), - """

Mise en place d'un semestre de formation

""", - ] + H = ["""

Mise en place d'un semestre de formation

"""] r = do_formsemestre_createwithmodules() - if isinstance(r, str): - H.append(r) - else: + if not isinstance(r, str): return r # response redirect - return "\n".join(H) + html_sco_header.sco_footer() + + H.append(r) + + return render_template( + "sco_page_dept.j2", + title="Création d'un semestre", + content="\n".join(H), + javascripts=["libjs/AutoSuggest.js", "js/formsemestre_edit.js"], + cssstyles=["css/autosuggest_inquisitor.css"], + ) def formsemestre_editwithmodules(formsemestre_id: int): diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index a6a0d7f3..154a5597 100755 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -802,7 +802,7 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str: })""" ) # - H.append('
') + H.append('
') disable_abs: str | bool = scass.has_assiduites_disable_pref(formsemestre) show_abs: str = "hidden" if disable_abs else "" @@ -812,6 +812,8 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str: groups = partition.groups.all() effectifs = {g.id: g.get_nb_inscrits() for g in groups} partition_is_empty = sum(effectifs.values()) == 0 + if partition_is_empty and (partition.is_default() or partition.is_parcours()): + continue # inutile de montrer des partitions vides non éditables H.append( f"""
@@ -909,7 +911,9 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str: ) H.append("
") # /sem-groups-assi - if partition_is_empty and not partition.is_default(): + if partition_is_empty and not ( + partition.is_default() or partition.is_parcours() + ): H.append( '
Aucun groupe peuplé dans cette partition' ) @@ -924,41 +928,72 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str: H.append("
") H.append("
") # /sem-groups-partition + # Boite avec liens divers + autres_liens = [] if formsemestre.can_change_groups(): - H.append( - f"""

Ajouter une partition

""" + }">Ajouter une partition""" ) # --- Formulaire importation Assiduité excel (si autorisé) if current_user.has_permission(Permission.AbsChange) and not disable_abs: - H.append( - f"""

+ autres_liens.append( + f""" Importation de l'assiduité depuis un fichier excel -

""" + """ ) # --- Lien Traitement Justificatifs: - if ( current_user.has_permission(Permission.AbsJustifView) and current_user.has_permission(Permission.JustifValidate) and not disable_abs ): - H.append( - f"""

+ autres_liens.append( + f""" Traitement des justificatifs d'absence -

""" + """ + ) + + # --- Lien pour mail aux enseignants + # Construit la liste de tous les enseignants de ce semestre: + mails_enseignants = set(u.email for u in formsemestre.responsables) + for modimpl in formsemestre.modimpls_sorted: + mails_enseignants.add(sco_users.user_info(modimpl.responsable_id)["email"]) + mails_enseignants |= {u.email for u in modimpl.enseignants if u.email} + adrlist = list(mails_enseignants - {None, ""}) + if adrlist: + autres_liens.append( + f""" + Courrier aux { + len(adrlist)} enseignants du semestre + """ + ) + + # Met le tout en boite + if autres_liens: + H.append( + f""" +
+
+
    +
  • {'
  • '.join(autres_liens)}
  • +
+
+
+ """ ) H.append("
") @@ -1033,8 +1068,9 @@ def formsemestre_status_head(formsemestre_id: int = None, page_title: str = None ) if evals["last_modif"]: H.append( - " (dernière note saisie le %s)" - % evals["last_modif"].strftime("%d/%m/%Y à %Hh%M") + f""" (dernière note saisie le { + evals["last_modif"].strftime(scu.DATEATIME_FMT) + })""" ) H.append("") H.append("") @@ -1073,12 +1109,6 @@ def formsemestre_status(formsemestre_id=None, check_parcours=True): modimpls = formsemestre.modimpls_sorted nt = res_sem.load_formsemestre_results(formsemestre) - # Construit la liste de tous les enseignants de ce semestre: - mails_enseignants = set(u.email for u in formsemestre.responsables) - for modimpl in modimpls: - mails_enseignants.add(sco_users.user_info(modimpl.responsable_id)["email"]) - mails_enseignants |= {u.email for u in modimpl.enseignants if u.email} - can_edit = formsemestre.can_be_edited_by(current_user) can_change_all_notes = current_user.has_permission(Permission.EditAllNotes) or ( current_user.id in [resp.id for resp in formsemestre.responsables] @@ -1206,20 +1236,11 @@ def formsemestre_status(formsemestre_id=None, check_parcours=True): ) # --- LISTE DES ETUDIANTS H += [ - '
', + '
', _make_listes_sem(formsemestre), "
", ] - # --- Lien mail enseignants: - adrlist = list(mails_enseignants - {None, ""}) - if adrlist: - H.append( - f"""

- Courrier aux { - len(adrlist)} enseignants du semestre -

""" - ) return render_template( "sco_page.j2", content="".join(H), diff --git a/app/scodoc/sco_formsemestre_validation.py b/app/scodoc/sco_formsemestre_validation.py index dfac0461..f211a9da 100644 --- a/app/scodoc/sco_formsemestre_validation.py +++ b/app/scodoc/sco_formsemestre_validation.py @@ -583,6 +583,11 @@ def formsemestre_recap_parcours_table( ) is_cur = situation_etud_cursus.formsemestre_id == formsemestre.id num_sem += 1 + url_status = url_for( + "notes.formsemestre_status", + scodoc_dept=g.scodoc_dept, + formsemestre_id=formsemestre.id, + ) dpv = sco_pv_dict.dict_pvjury(formsemestre.id, etudids=[etudid]) pv = dpv["decisions"][0] @@ -642,7 +647,7 @@ def formsemestre_recap_parcours_table( H.append( f""" {num_sem}{pm} - {formsemestre.mois_debut()} + {formsemestre.mois_debut()} %s%s' - % (formsemestre.mois_fin(), sem_info.get(formsemestre.id, default_sem_info)) + f"""{formsemestre.mois_fin()} + {sem_info.get(formsemestre.id, default_sem_info)} + """ ) # Moy Gen (sous le code decision) H.append( diff --git a/app/scodoc/sco_groups_exports.py b/app/scodoc/sco_groups_exports.py index ddf02d1a..4bce8512 100644 --- a/app/scodoc/sco_groups_exports.py +++ b/app/scodoc/sco_groups_exports.py @@ -65,7 +65,7 @@ def groups_export_annotations(group_ids, formsemestre_id=None, fmt="html"): ) annotations = groups_list_annotation(groups_infos.group_ids) for annotation in annotations: - annotation["date_str"] = annotation["date"].strftime("%d/%m/%Y à %Hh%M") + annotation["date_str"] = annotation["date"].strftime(scu.DATEATIME_FMT) if fmt == "xls": columns_ids = ("etudid", "nom", "prenom", "date", "comment") else: diff --git a/app/scodoc/sco_groups_view.py b/app/scodoc/sco_groups_view.py index 598ede76..26b30918 100644 --- a/app/scodoc/sco_groups_view.py +++ b/app/scodoc/sco_groups_view.py @@ -782,16 +782,21 @@ def groups_table( [ tab.html(), f""" -
- établi le {{time.strftime("%d/%m/%Y à %Hh%M")}} (notes sur 20) + établi le {{time.strftime(scu.DATEATIME_FMT)}} (notes sur 20) - +
+ + +
{% endblock %} diff --git a/app/templates/formsemestre/bulletins_choice.j2 b/app/templates/formsemestre/bulletins_choice.j2 index db38985b..20d5f81c 100644 --- a/app/templates/formsemestre/bulletins_choice.j2 +++ b/app/templates/formsemestre/bulletins_choice.j2 @@ -20,6 +20,7 @@

{{ title }}

+

{{ explanation|safe }}

@@ -46,5 +47,6 @@
+
{% endblock %} diff --git a/app/templates/pn/form_modules_ue_coefs.j2 b/app/templates/pn/form_modules_ue_coefs.j2 index 66ba286f..92d316b1 100644 --- a/app/templates/pn/form_modules_ue_coefs.j2 +++ b/app/templates/pn/form_modules_ue_coefs.j2 @@ -1,4 +1,26 @@ {# -*- mode: jinja-html -*- #} +{% extends "sco_page_dept.j2" %} + + +{% block styles %} +{{super()}} + +{% endblock %} + +{% block app_content %} +

Formation {{formation.titre}} ({{formation.acronyme}}) + [version {{formation.version}}] code {{formation.formation_code}} + {% if read_only %} + {{scu.icontag("lock32_img", title="verrouillé")|safe}} + {% endif %} +

+ +{% if read_only %} + +Formation verrouilée car un ou plusieurs semestres verrouillés l'utilisent. + +{% endif %} +

{% if not read_only %}Édition des c{% else %}C{%endif%}oefficients des modules vers les UEs

{% if not read_only %} @@ -59,8 +81,11 @@
module non associé au parcours de cette UE, le coef devrait être nul.
+{% endblock %} - +{% block scripts %} +{{super()}} + +{% endblock %} \ No newline at end of file diff --git a/app/views/pn_modules.py b/app/views/pn_modules.py index cd9ec4db..01f06ac8 100644 --- a/app/views/pn_modules.py +++ b/app/views/pn_modules.py @@ -31,24 +31,18 @@ PN / Edition des coefs Emmanuel Viennet, 2021 """ -from flask import url_for -from flask import g, request +from flask import g, render_template, request, url_for from flask_json import as_json from flask_login import current_user -from flask.templating import render_template -from app.scodoc.codes_cursus import UE_SPORT - from app import db, models - from app.comp import moy_ue from app.decorators import scodoc, permission_required from app.models import ApcParcours, Formation, Module -from app.views import notes_bp as bp - -from app.scodoc import html_sco_header +from app.scodoc.codes_cursus import UE_SPORT from app.scodoc import sco_utils as scu from app.scodoc.sco_permissions import Permission +from app.views import notes_bp as bp @bp.route("/table_modules_ue_coefs/") @@ -197,51 +191,23 @@ def edit_modules_ue_coefs(): formation_id=formation_id ).first_or_404() locked = formation.has_locked_sems(semestre_idx) - if locked: - lockicon = scu.icontag("lock32_img", title="verrouillé") - else: - lockicon = "" - H = [ - html_sco_header.sco_header( - cssstyles=["css/table_editor.css"], - javascripts=[ - "js/table_editor.js", - ], - page_title=f"Coefs programme {formation.acronyme}", - ), - f"""

Formation {formation.titre} ({formation.acronyme}) - [version {formation.version}] code {formation.formation_code} - {lockicon} -

- """, - ( - """Formation verrouilée car un ou plusieurs - semestres verrouillés l'utilisent. - """ - if locked - else "" - ), - render_template( - "pn/form_modules_ue_coefs.j2", - formation=formation, - data_source=url_for( - "notes.table_modules_ue_coefs", - scodoc_dept=g.scodoc_dept, - formation_id=formation_id, - semestre_idx=semestre_idx, - parcours_id=parcours_id, - ), - data_save=url_for( - "notes.set_module_ue_coef", - scodoc_dept=g.scodoc_dept, - ), - read_only=locked - or not current_user.has_permission(Permission.EditFormation), + return render_template( + "pn/form_modules_ue_coefs.j2", + formation=formation, + data_source=url_for( + "notes.table_modules_ue_coefs", + scodoc_dept=g.scodoc_dept, + formation_id=formation_id, semestre_idx=semestre_idx, - semestre_ids=range(1, formation.get_cursus().NB_SEM + 1), parcours_id=parcours_id, ), - html_sco_header.sco_footer(), - ] - - return "\n".join(H) + data_save=url_for( + "notes.set_module_ue_coef", + scodoc_dept=g.scodoc_dept, + ), + read_only=locked or not current_user.has_permission(Permission.EditFormation), + semestre_idx=semestre_idx, + semestre_ids=range(1, formation.get_cursus().NB_SEM + 1), + parcours_id=parcours_id, + title=f"Coefs programme {formation.acronyme}", + ) diff --git a/sco_version.py b/sco_version.py index b5372319..42dab115 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.7.6" +SCOVERSION = "9.7.7" SCONAME = "ScoDoc"