From 60a77b8ba79da02f86943ea88417d0762189bfc4 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 14 Feb 2022 23:21:42 +0100 Subject: [PATCH 01/10] =?UTF-8?q?WIP:=20r=C3=A9organisation=20code=20bulle?= =?UTF-8?q?tins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 +- app/but/bulletin_but.py | 33 ++++++---- app/models/formsemestre.py | 1 + app/scodoc/sco_bulletins.py | 86 +++++++++++++-------------- app/scodoc/sco_bulletins_generator.py | 2 +- app/scodoc/sco_bulletins_pdf.py | 22 +++++-- app/scodoc/sco_preferences.py | 5 +- app/views/notes.py | 2 +- sco_version.py | 2 +- 9 files changed, 89 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index 209a2a017..f571216ab 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,10 @@ Flask, SQLAlchemy, au lien de Python2/Zope dans les versions précédentes). ### État actuel (26 jan 22) - - 9.1 (master) reproduit l'ensemble des fonctions de ScoDoc 7 (donc pas de BUT), sauf: + - 9.1.5x (master) reproduit l'ensemble des fonctions de ScoDoc 7 (donc pas de BUT), sauf: - ancien module "Entreprises" (obsolète) et ajoute la gestion du BUT. - - 9.2 (branche refactor_nt) est la version de développement. + - 9.2 (branche dev92) est la version de développement. ### Lignes de commandes diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py index 5d4fd74f3..771746bf4 100644 --- a/app/but/bulletin_but.py +++ b/app/but/bulletin_but.py @@ -9,14 +9,15 @@ import datetime from flask import url_for, g -from app.models.formsemestre import FormSemestre +from app.comp.res_but import ResultatsSemestreBUT +from app.models import FormSemestre, Identite from app.scodoc import sco_utils as scu from app.scodoc import sco_bulletins_json +from app.scodoc import sco_bulletins_pdf from app.scodoc import sco_preferences from app.scodoc.sco_codes_parcours import UE_SPORT from app.scodoc.sco_utils import fmt_note -from app.comp.res_but import ResultatsSemestreBUT class BulletinBUT: @@ -28,6 +29,7 @@ class BulletinBUT: def __init__(self, formsemestre: FormSemestre): """ """ self.res = ResultatsSemestreBUT(formsemestre) + self.prefs = sco_preferences.SemPreferences(formsemestre.id) def etud_ue_mod_results(self, etud, ue, modimpls) -> dict: "dict synthèse résultats dans l'UE pour les modules indiqués" @@ -84,7 +86,7 @@ class BulletinBUT: "saes": self.etud_ue_mod_results(etud, ue, res.saes), } if ue.type != UE_SPORT: - if sco_preferences.get_preference("bul_show_ue_rangs", res.formsemestre.id): + if self.prefs["bul_show_ue_rangs"]: rangs, effectif = res.ue_rangs[ue.id] rang = rangs[etud.id] else: @@ -155,9 +157,7 @@ class BulletinBUT: if e.visibulletin and ( modimpl_results.evaluations_etat[e.id].is_complete - or sco_preferences.get_preference( - "bul_show_all_evals", res.formsemestre.id - ) + or self.prefs["bul_show_all_evals"] ) ], } @@ -216,9 +216,11 @@ class BulletinBUT: else: return f"Bonus de {fmt_note(bonus_vect.iloc[0])}" - def bulletin_etud(self, etud, formsemestre, force_publishing=False) -> dict: - """Le bulletin de l'étudiant dans ce semestre. - Si force_publishing, rempli le bulletin même si bul_hide_xml est vrai + def bulletin_etud( + self, etud: Identite, formsemestre, force_publishing=False + ) -> dict: + """Le bulletin de l'étudiant dans ce semestre: dict pour la version JSON / HTML. + - Si force_publishing, rempli le bulletin même si bul_hide_xml est vrai (bulletins non publiés). """ res = self.res @@ -239,7 +241,9 @@ class BulletinBUT: }, "formsemestre_id": formsemestre.id, "etat_inscription": etat_inscription, - "options": sco_preferences.bulletin_option_affichage(formsemestre.id), + "options": sco_preferences.bulletin_option_affichage( + formsemestre.id, self.prefs + ), } if not published: return d @@ -312,3 +316,12 @@ class BulletinBUT: ) return d + + def bulletin_etud_complet(self, etud) -> dict: + """Bulletin dict complet avec toutes les infos pour les bulletins pdf""" + d = self.bulletin_etud(force_publishing=True) + d["filigranne"] = sco_bulletins_pdf.get_filigranne( + self.res.get_etud_etat(etud.id), self.prefs + ) + # XXX TODO A COMPLETER + raise NotImplementedError() diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index 245142484..2d491d7ed 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -117,6 +117,7 @@ class FormSemestre(db.Model): return f"<{self.__class__.__name__} {self.id} {self.titre_num()}>" def to_dict(self): + "dict (compatible ScoDoc7)" d = dict(self.__dict__) d.pop("_sa_instance_state", None) # ScoDoc7 output_formators: (backward compat) diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index 93a926b64..642841058 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -28,30 +28,21 @@ """Génération des bulletins de notes """ -from app.models import formsemestre -import time -import pprint import email -from email.mime.multipart import MIMEMultipart -from email.mime.text import MIMEText -from email.mime.base import MIMEBase -from email.header import Header -from reportlab.lib.colors import Color -import urllib +import pprint +import time from flask import g, request from flask import url_for from flask_login import current_user from flask_mail import Message -from app.models.moduleimpls import ModuleImplInscription -import app.scodoc.sco_utils as scu -from app.scodoc.sco_utils import ModuleType -import app.scodoc.notesdb as ndb +from app import email from app import log +from app.but import bulletin_but from app.comp import res_sem from app.comp.res_common import NotesTableCompat -from app.models import FormSemestre +from app.models import FormSemestre, Identite, ModuleImplInscription from app.scodoc.sco_permissions import Permission from app.scodoc.sco_exceptions import AccessDenied, ScoValueError from app.scodoc import html_sco_header @@ -60,9 +51,9 @@ from app.scodoc import sco_abs from app.scodoc import sco_abs_views from app.scodoc import sco_bulletins_generator from app.scodoc import sco_bulletins_json +from app.scodoc import sco_bulletins_pdf from app.scodoc import sco_bulletins_xml from app.scodoc import sco_codes_parcours -from app.scodoc import sco_cache from app.scodoc import sco_etud from app.scodoc import sco_evaluation_db from app.scodoc import sco_formations @@ -73,7 +64,9 @@ from app.scodoc import sco_photos from app.scodoc import sco_preferences from app.scodoc import sco_pvjury from app.scodoc import sco_users -from app import email +import app.scodoc.sco_utils as scu +from app.scodoc.sco_utils import ModuleType +import app.scodoc.notesdb as ndb # ----- CLASSES DE BULLETINS DE NOTES from app.scodoc import sco_bulletins_standard @@ -190,28 +183,18 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"): show_mention=prefs["bul_show_mention"], ) - if dpv: - I["decision_sem"] = dpv["decisions"][0]["decision_sem"] - else: - I["decision_sem"] = "" I.update(infos) I["etud_etat_html"] = _get_etud_etat_html( formsemestre.etuds_inscriptions[etudid].etat ) I["etud_etat"] = nt.get_etud_etat(etudid) - I["filigranne"] = "" + I["filigranne"] = sco_bulletins_pdf.get_filigranne(I["etud_etat"], prefs) I["demission"] = "" - if I["etud_etat"] == "D": + if I["etud_etat"] == scu.DEMISSION: I["demission"] = "(Démission)" - I["filigranne"] = "Démission" elif I["etud_etat"] == sco_codes_parcours.DEF: I["demission"] = "(Défaillant)" - I["filigranne"] = "Défaillant" - elif (prefs["bul_show_temporary"] and not I["decision_sem"]) or prefs[ - "bul_show_temporary_forced" - ]: - I["filigranne"] = prefs["bul_temporary_txt"] # --- Appreciations cnx = ndb.GetDBConnexion() @@ -687,6 +670,7 @@ def etud_descr_situation_semestre( descr_defaillance : "Défaillant" ou vide si non défaillant. decision_jury : "Validé", "Ajourné", ... (code semestre) descr_decision_jury : "Décision jury: Validé" (une phrase) + decision_sem : decisions_ue : noms (acronymes) des UE validées, séparées par des virgules. descr_decisions_ue : ' UE acquises: UE1, UE2', ou vide si pas de dec. ou si pas show_uevalid descr_mention : 'Mention Bien', ou vide si pas de mention ou si pas show_mention @@ -696,7 +680,7 @@ def etud_descr_situation_semestre( # --- Situation et décisions jury - # demission/inscription ? + # démission/inscription ? events = sco_etud.scolar_events_list( cnx, args={"etudid": etudid, "formsemestre_id": formsemestre_id} ) @@ -763,11 +747,15 @@ def etud_descr_situation_semestre( infos["situation"] += " " + infos["descr_defaillance"] dpv = sco_pvjury.dict_pvjury(formsemestre_id, etudids=[etudid]) + if dpv: + infos["decision_sem"] = dpv["decisions"][0]["decision_sem"] + else: + infos["decision_sem"] = "" if not show_decisions: return infos, dpv - # Decisions de jury: + # Décisions de jury: pv = dpv["decisions"][0] dec = "" if pv["decision_sem_descr"]: @@ -819,11 +807,15 @@ def formsemestre_bulletinetud( except: sco_etud.log_unknown_etud() raise ScoValueError("étudiant inconnu") - # API, donc erreurs admises en ScoValueError - sem = sco_formsemestre.get_formsemestre(formsemestre_id, raise_soft_exc=True) + + formsemestre: FormSemestre = FormSemestre.query.get(formsemestre_id) + if not formsemestre: + # API, donc erreurs admises + raise ScoValueError(f"semestre {formsemestre_id} inconnu !") + sem = formsemestre.to_dict() bulletin = do_formsemestre_bulletinetud( - formsemestre_id, + formsemestre, etudid, format=format, version=version, @@ -835,7 +827,6 @@ def formsemestre_bulletinetud( filename = scu.bul_filename(sem, etud, format) return scu.send_file(bulletin, filename, mime=scu.get_mime_suffix(format)[0]) - sem = sco_formsemestre.get_formsemestre(formsemestre_id) H = [ _formsemestre_bulletinetud_header_html( etud, etudid, sem, formsemestre_id, format, version @@ -892,14 +883,14 @@ def can_send_bulletin_by_mail(formsemestre_id): def do_formsemestre_bulletinetud( - formsemestre_id, - etudid, + formsemestre: FormSemestre, + etudid: int, version="long", # short, long, selectedevals format="html", nohtml=False, - xml_with_decisions=False, # force decisions dans XML - force_publishing=False, # force publication meme si semestre non publie sur "portail" - prefer_mail_perso=False, # mails envoyes sur adresse perso si non vide + xml_with_decisions=False, # force décisions dans XML + force_publishing=False, # force publication meme si semestre non publié sur "portail" + prefer_mail_perso=False, # mails envoyés sur adresse perso si non vide ): """Génère le bulletin au format demandé. Retourne: (bul, filigranne) @@ -908,7 +899,7 @@ def do_formsemestre_bulletinetud( """ if format == "xml": bul = sco_bulletins_xml.make_xml_formsemestre_bulletinetud( - formsemestre_id, + formsemestre.id, etudid, xml_with_decisions=xml_with_decisions, force_publishing=force_publishing, @@ -919,7 +910,7 @@ def do_formsemestre_bulletinetud( elif format == "json": bul = sco_bulletins_json.make_json_formsemestre_bulletinetud( - formsemestre_id, + formsemestre.id, etudid, xml_with_decisions=xml_with_decisions, force_publishing=force_publishing, @@ -927,8 +918,13 @@ def do_formsemestre_bulletinetud( ) return bul, "" - I = formsemestre_bulletinetud_dict(formsemestre_id, etudid) - etud = I["etud"] + if formsemestre.formation.is_apc(): + etud = Identite.query.get(etudid) + r = bulletin_but.BulletinBUT(formsemestre) + I = r.bulletin_etud_complet(etud, formsemestre) + else: + I = formsemestre_bulletinetud_dict(formsemestre.id, etudid) + etud = I["etud"] if format == "html": htm, _ = sco_bulletins_generator.make_formsemestre_bulletinetud( @@ -954,7 +950,7 @@ def do_formsemestre_bulletinetud( elif format == "pdfmail": # format pdfmail: envoie le pdf par mail a l'etud, et affiche le html # check permission - if not can_send_bulletin_by_mail(formsemestre_id): + if not can_send_bulletin_by_mail(formsemestre.id): raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !") if nohtml: @@ -983,7 +979,7 @@ def do_formsemestre_bulletinetud( ) + htm return h, I["filigranne"] # - mail_bulletin(formsemestre_id, I, pdfdata, filename, recipient_addr) + mail_bulletin(formsemestre.id, I, pdfdata, filename, recipient_addr) emaillink = '%s' % ( recipient_addr, recipient_addr, diff --git a/app/scodoc/sco_bulletins_generator.py b/app/scodoc/sco_bulletins_generator.py index 04a9efaee..aafdc09f6 100644 --- a/app/scodoc/sco_bulletins_generator.py +++ b/app/scodoc/sco_bulletins_generator.py @@ -99,7 +99,7 @@ def bulletin_get_class_name_displayed(formsemestre_id): return "invalide ! (voir paramètres)" -class BulletinGenerator(object): +class BulletinGenerator: "Virtual superclass for PDF bulletin generators" "" # Here some helper methods # see sco_bulletins_standard.BulletinGeneratorStandard subclass for real methods diff --git a/app/scodoc/sco_bulletins_pdf.py b/app/scodoc/sco_bulletins_pdf.py index 94cfcf6bc..748fd5a0b 100644 --- a/app/scodoc/sco_bulletins_pdf.py +++ b/app/scodoc/sco_bulletins_pdf.py @@ -61,12 +61,10 @@ from reportlab.platypus.doctemplate import BaseDocTemplate from flask import g, request from app import log, ScoValueError -from app.comp import res_sem -from app.comp.res_common import NotesTableCompat from app.models import FormSemestre from app.scodoc import sco_cache -from app.scodoc import sco_formsemestre +from app.scodoc import sco_codes_parcours from app.scodoc import sco_pdf from app.scodoc import sco_preferences from app.scodoc import sco_etud @@ -190,7 +188,7 @@ def get_formsemestre_bulletins_pdf(formsemestre_id, version="selectedevals"): i = 1 for etud in formsemestre.get_inscrits(include_demdef=True, order=True): frag, filigranne = sco_bulletins.do_formsemestre_bulletinetud( - formsemestre_id, + formsemestre, etud.id, format="pdfpart", version=version, @@ -239,8 +237,9 @@ def get_etud_bulletins_pdf(etudid, version="selectedevals"): filigrannes = {} i = 1 for sem in etud["sems"]: + formsemestre = FormSemestre.query.get(sem["formsemestre_id"]) frag, filigranne = sco_bulletins.do_formsemestre_bulletinetud( - sem["formsemestre_id"], + formsemestre, etudid, format="pdfpart", version=version, @@ -275,3 +274,16 @@ def get_etud_bulletins_pdf(etudid, version="selectedevals"): ) return pdfdoc, filename + + +def get_filigranne(etud_etat: str, prefs) -> str: + """Texte à placer en "filigranne" sur le bulletin pdf""" + if etud_etat == scu.DEMISSION: + return "Démission" + elif etud_etat == sco_codes_parcours.DEF: + return "Défaillant" + elif (prefs["bul_show_temporary"] and not I["decision_sem"]) or prefs[ + "bul_show_temporary_forced" + ]: + return prefs["bul_temporary_txt"] + return "" diff --git a/app/scodoc/sco_preferences.py b/app/scodoc/sco_preferences.py index b639d5ee4..e0fcc5378 100644 --- a/app/scodoc/sco_preferences.py +++ b/app/scodoc/sco_preferences.py @@ -2114,7 +2114,7 @@ class BasePreferences(object): return form -class SemPreferences(object): +class SemPreferences: """Preferences for a formsemestre""" def __init__(self, formsemestre_id=None): @@ -2270,9 +2270,8 @@ def doc_preferences(): return "\n".join([" | ".join(x) for x in L]) -def bulletin_option_affichage(formsemestre_id: int) -> dict: +def bulletin_option_affichage(formsemestre_id: int, prefs: SemPreferences) -> dict: "dict avec les options d'affichages (préférences) pour ce semestre" - prefs = SemPreferences(formsemestre_id) fields = ( "bul_show_abs", "bul_show_abs_modules", diff --git a/app/views/notes.py b/app/views/notes.py index efad2808b..b0b812a16 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -1925,7 +1925,7 @@ def formsemestre_bulletins_mailetuds( nb_send = 0 for etudid in etudids: h, _ = sco_bulletins.do_formsemestre_bulletinetud( - formsemestre_id, + formsemestre, etudid, version=version, prefer_mail_perso=prefer_mail_perso, diff --git a/sco_version.py b/sco_version.py index 23fba0069..035ab07f2 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.1.56" +SCOVERSION = "9.2a-57" SCONAME = "ScoDoc" From b165bc26593ed817dde0e335ce0de33c4a6af1db Mon Sep 17 00:00:00 2001 From: lehmann Date: Tue, 15 Feb 2022 11:45:56 +0100 Subject: [PATCH 02/10] =?UTF-8?q?Rang=20+=20am=C3=A9lioration=20espacement?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/static/css/releve-but.css | 19 +++++++++++++++++-- app/static/js/releve-but.js | 1 + 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/static/css/releve-but.css b/app/static/css/releve-but.css index a20c8bfa3..02cceb94c 100644 --- a/app/static/css/releve-but.css +++ b/app/static/css/releve-but.css @@ -97,7 +97,8 @@ section>div:nth-child(1){ .hide_coef .synthese em, .hide_coef .eval>em, .hide_date_inscr .dateInscription, -.hide_ects .ects{ +.hide_ects .ects, +.hide_rangs .rang{ display: none; } @@ -158,7 +159,10 @@ section>div:nth-child(1){ text-align: right; } .rang{ - text-decoration: underline var(--couleurIntense); + font-weight: bold; +} +.ue .rang{ + font-weight: 400; } .decision{ margin: 5px 0; @@ -186,6 +190,9 @@ section>div:nth-child(1){ .synthese h3{ background: var(--couleurFondTitresUE); } +.synthese .ue>div{ + text-align: right; +} .synthese em, .eval em{ opacity: 0.6; @@ -308,6 +315,14 @@ h3{ margin-bottom: 8px; } +@media screen and (max-width: 700px) { + section{ + padding: 16px; + } + .syntheseModule, .eval { + margin: 0; + } +} /*.absences{ display: grid; grid-template-columns: auto auto; diff --git a/app/static/js/releve-but.js b/app/static/js/releve-but.js index 5dcd9e5bc..c0273e6a3 100644 --- a/app/static/js/releve-but.js +++ b/app/static/js/releve-but.js @@ -254,6 +254,7 @@ class releveBUT extends HTMLElement {
Moyenne : ${dataUE.moyenne?.value || "-"}
+
Rang : ${dataUE.moyenne?.rang} / ${dataUE.moyenne?.total}
Bonus : ${dataUE.bonus || 0} - Malus : ${dataUE.malus || 0} From aa3a2fb3e0efc875139108d4ee60a0f1cf669390 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 20 Feb 2022 15:10:15 +0100 Subject: [PATCH 03/10] Cosmetic: edition prog. classiques --- app/scodoc/sco_edit_module.py | 7 +++++-- app/scodoc/sco_edit_ue.py | 10 ++++++---- app/static/css/scodoc.css | 23 ++++++++++++++++++++++- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/app/scodoc/sco_edit_module.py b/app/scodoc/sco_edit_module.py index 2bedc0c11..9c8aa07df 100644 --- a/app/scodoc/sco_edit_module.py +++ b/app/scodoc/sco_edit_module.py @@ -512,8 +512,8 @@ def module_edit(module_id=None): ] else: mat_names = ["%s / %s" % (mat.ue.acronyme, mat.titre or "") for mat in matieres] - ue_mat_ids = ["%s!%s" % (mat.ue.id, mat.id) for mat in matieres] + ue_mat_ids = ["%s!%s" % (mat.ue.id, mat.id) for mat in matieres] module["ue_matiere_id"] = "%s!%s" % (module["ue_id"], module["matiere_id"]) semestres_indices = list(range(1, parcours.NB_SEM + 1)) @@ -741,8 +741,11 @@ def module_edit(module_id=None): else: # l'UE de rattachement peut changer tf[2]["ue_id"], tf[2]["matiere_id"] = tf[2]["ue_matiere_id"].split("!") + x, y = tf[2]["ue_matiere_id"].split("!") + tf[2]["ue_id"] = int(x) + tf[2]["matiere_id"] = int(y) old_ue_id = a_module.ue.id - new_ue_id = int(tf[2]["ue_id"]) + new_ue_id = tf[2]["ue_id"] if (old_ue_id != new_ue_id) and in_use: new_ue = UniteEns.query.get_or_404(new_ue_id) if new_ue.semestre_idx != a_module.ue.semestre_idx: diff --git a/app/scodoc/sco_edit_ue.py b/app/scodoc/sco_edit_ue.py index 061bf43c6..408109122 100644 --- a/app/scodoc/sco_edit_ue.py +++ b/app/scodoc/sco_edit_ue.py @@ -941,13 +941,13 @@ def _ue_table_ues( if cur_ue_semestre_id != ue["semestre_id"]: cur_ue_semestre_id = ue["semestre_id"] - # if iue > 0: - # H.append("") if ue["semestre_id"] == sco_codes_parcours.UE_SEM_DEFAULT: lab = "Pas d'indication de semestre:" else: lab = "Semestre %s:" % ue["semestre_id"] - H.append('
%s
' % lab) + H.append( + '
%s
' % lab + ) H.append('
    ') H.append('
  • ') if iue != 0 and editable: @@ -1015,7 +1015,9 @@ def _ue_table_ues( H.append( f"""
""" + }">Ajouter une UE dans le semestre {ue['semestre_id'] or ''} +
+ """ ) iue += 1 diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index ecd8b0ab0..9079cfa7d 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -1699,7 +1699,7 @@ ul.notes_ue_list { margin-top: 4px; margin-right: 1em; margin-left: 1em; - padding-top: 1em; + /* padding-top: 1em; */ padding-bottom: 1em; font-weight: bold; } @@ -1761,6 +1761,27 @@ ul.notes_module_list { font-style: normal; } +div.ue_list_div { + border: 3px solid rgb(35, 0, 160); + padding-left: 5px; + padding-top: 5px; + margin-bottom: 5px; + margin-right: 5px; +} + +div.ue_list_tit_sem { + font-size: 120%; + font-weight: bold; + color: orangered; + display: list-item; /* This has to be "list-item" */ + list-style-type: disc; /* See https://developer.mozilla.org/en-US/docs/Web/CSS/list-style-type */ + list-style-position: inside; +} + +input.sco_tag_checkbox { + margin-bottom: 10px; +} + .notes_ue_list a.stdlink { color: #001084; text-decoration: underline; From c923a5015b42b02c2dbed1621e62f0154a1ac46d Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sat, 5 Mar 2022 12:47:08 +0100 Subject: [PATCH 04/10] Infos pour bulletins BUT pdf --- app/but/bulletin_but.py | 32 +++++++- app/scodoc/sco_abs_notification.py | 56 +++++++------ app/scodoc/sco_bulletins.py | 128 ++++++++++++----------------- app/scodoc/sco_find_etud.py | 4 +- app/scodoc/sco_groups.py | 16 ++-- app/scodoc/sco_import_etuds.py | 2 +- app/scodoc/sco_inscr_passage.py | 5 +- app/scodoc/sco_page_etud.py | 4 +- app/views/scolar.py | 2 +- 9 files changed, 134 insertions(+), 115 deletions(-) diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py index 87ec62a28..c0c29bf15 100644 --- a/app/but/bulletin_but.py +++ b/app/but/bulletin_but.py @@ -16,7 +16,7 @@ from app.scodoc import sco_bulletins, sco_utils as scu from app.scodoc import sco_bulletins_json from app.scodoc import sco_bulletins_pdf from app.scodoc import sco_preferences -from app.scodoc.sco_codes_parcours import UE_SPORT +from app.scodoc.sco_codes_parcours import UE_SPORT, DEF from app.scodoc.sco_utils import fmt_note @@ -318,19 +318,42 @@ class BulletinBUT: return d def bulletin_etud_complet(self, etud: Identite) -> dict: - """Bulletin dict complet avec toutes les infos pour les bulletins pdf""" + """Bulletin dict complet avec toutes les infos pour les bulletins BUT pdf + Résultat compatible avec celui de sco_bulletins.formsemestre_bulletinetud_dict + """ d = self.bulletin_etud(etud, self.res.formsemestre, force_publishing=True) d["etudid"] = etud.id d["etud"] = d["etudiant"] d["etud"]["nomprenom"] = etud.nomprenom d.update(self.res.sem) + etud_etat = self.res.get_etud_etat(etud.id) d["filigranne"] = sco_bulletins_pdf.get_filigranne( - self.res.get_etud_etat(etud.id), + etud_etat, self.prefs, decision_sem=d["semestre"].get("decision_sem"), ) + if etud_etat == scu.DEMISSION: + d["demission"] = "(Démission)" + elif etud_etat == DEF: + d["demission"] = "(Défaillant)" + else: + d["demission"] = "" + # --- Absences d["nbabs"], d["nbabsjust"] = self.res.formsemestre.get_abs_count(etud.id) + + # --- Decision Jury + infos, dpv = sco_bulletins.etud_descr_situation_semestre( + etud.id, + self.res.formsemestre.id, + format="html", + show_date_inscr=self.prefs["bul_show_date_inscr"], + show_decisions=self.prefs["bul_show_decision"], + show_uevalid=self.prefs["bul_show_uevalid"], + show_mention=self.prefs["bul_show_mention"], + ) + + d.update(infos) # --- Rangs d[ "rang_nt" @@ -341,5 +364,6 @@ class BulletinBUT: d.update( sco_bulletins.get_appreciations_list(self.res.formsemestre.id, etud.id) ) - # XXX TODO A COMPLETER ? + d.update(sco_bulletins.make_context_dict(self.res.formsemestre, d["etud"])) + return d diff --git a/app/scodoc/sco_abs_notification.py b/app/scodoc/sco_abs_notification.py index f15e7d4c8..466d13df1 100644 --- a/app/scodoc/sco_abs_notification.py +++ b/app/scodoc/sco_abs_notification.py @@ -35,6 +35,7 @@ import datetime from flask import g, url_for from flask_mail import Message +from app.models.formsemestre import FormSemestre import app.scodoc.notesdb as ndb import app.scodoc.sco_utils as scu @@ -55,27 +56,30 @@ def abs_notify(etudid, date): """ from app.scodoc import sco_abs - sem = retreive_current_formsemestre(etudid, date) - if not sem: + formsemestre = retreive_current_formsemestre(etudid, date) + if not formsemestre: return # non inscrit a la date, pas de notification - nbabs, nbabsjust = sco_abs.get_abs_count(etudid, sem) - do_abs_notify(sem, etudid, date, nbabs, nbabsjust) + nbabs, nbabsjust = sco_abs.get_abs_count_in_interval( + etudid, formsemestre.date_debut.isoformat(), formsemestre.date_fin.isoformat() + ) + do_abs_notify(formsemestre, etudid, date, nbabs, nbabsjust) -def do_abs_notify(sem, etudid, date, nbabs, nbabsjust): +def do_abs_notify(formsemestre: FormSemestre, etudid, date, nbabs, nbabsjust): """Given new counts of absences, check if notifications are requested and send them.""" # prefs fallback to global pref if sem is None: - if sem: - formsemestre_id = sem["formsemestre_id"] + if formsemestre: + formsemestre_id = formsemestre.id else: formsemestre_id = None - prefs = sco_preferences.SemPreferences(formsemestre_id=sem["formsemestre_id"]) + prefs = sco_preferences.SemPreferences(formsemestre_id=formsemestre_id) destinations = abs_notify_get_destinations( - sem, prefs, etudid, date, nbabs, nbabsjust + formsemestre, prefs, etudid, date, nbabs, nbabsjust ) - msg = abs_notification_message(sem, prefs, etudid, nbabs, nbabsjust) + + msg = abs_notification_message(formsemestre, prefs, etudid, nbabs, nbabsjust) if not msg: return # abort @@ -131,19 +135,19 @@ def abs_notify_send(destinations, etudid, msg, nbabs, nbabsjust, formsemestre_id ) -def abs_notify_get_destinations(sem, prefs, etudid, date, nbabs, nbabsjust): +def abs_notify_get_destinations( + formsemestre: FormSemestre, prefs, etudid, date, nbabs, nbabsjust +) -> set: """Returns set of destination emails to be notified""" - formsemestre_id = sem["formsemestre_id"] destinations = [] # list of email address to notify - if abs_notify_is_above_threshold(etudid, nbabs, nbabsjust, formsemestre_id): - if sem and prefs["abs_notify_respsem"]: + if abs_notify_is_above_threshold(etudid, nbabs, nbabsjust, formsemestre.id): + if prefs["abs_notify_respsem"]: # notifie chaque responsable du semestre - for responsable_id in sem["responsables"]: - u = sco_users.user_info(responsable_id) - if u["email"]: - destinations.append(u["email"]) + for responsable in formsemestre.responsables: + if responsable.email: + destinations.append(responsable.email) if prefs["abs_notify_chief"] and prefs["email_chefdpt"]: destinations.append(prefs["email_chefdpt"]) if prefs["abs_notify_email"]: @@ -156,7 +160,7 @@ def abs_notify_get_destinations(sem, prefs, etudid, date, nbabs, nbabsjust): # Notification (à chaque fois) des resp. de modules ayant des évaluations # à cette date # nb: on pourrait prevoir d'utiliser un autre format de message pour ce cas - if sem and prefs["abs_notify_respeval"]: + if prefs["abs_notify_respeval"]: mods = mod_with_evals_at_date(date, etudid) for mod in mods: u = sco_users.user_info(mod["responsable_id"]) @@ -232,7 +236,9 @@ def user_nbdays_since_last_notif(email_addr, etudid): return None -def abs_notification_message(sem, prefs, etudid, nbabs, nbabsjust): +def abs_notification_message( + formsemestre: FormSemestre, prefs, etudid, nbabs, nbabsjust +): """Mime notification message based on template. returns a Message instance or None if sending should be canceled (empty template). @@ -242,7 +248,7 @@ def abs_notification_message(sem, prefs, etudid, nbabs, nbabsjust): etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0] # Variables accessibles dans les balises du template: %(nom_variable)s : - values = sco_bulletins.make_context_dict(sem, etud) + values = sco_bulletins.make_context_dict(formsemestre, etud) values["nbabs"] = nbabs values["nbabsjust"] = nbabsjust @@ -264,9 +270,11 @@ def abs_notification_message(sem, prefs, etudid, nbabs, nbabsjust): return msg -def retreive_current_formsemestre(etudid, cur_date): +def retreive_current_formsemestre(etudid: int, cur_date) -> FormSemestre: """Get formsemestre dans lequel etudid est (ou était) inscrit a la date indiquée date est une chaine au format ISO (yyyy-mm-dd) + + Result: FormSemestre ou None si pas inscrit à la date indiquée """ req = """SELECT i.formsemestre_id FROM notes_formsemestre_inscription i, notes_formsemestre sem @@ -278,8 +286,8 @@ def retreive_current_formsemestre(etudid, cur_date): if not r: return None # s'il y a plusieurs semestres, prend le premier (rarissime et non significatif): - sem = sco_formsemestre.get_formsemestre(r[0]["formsemestre_id"]) - return sem + formsemestre = FormSemestre.query.get(r[0]["formsemestre_id"]) + return formsemestre def mod_with_evals_at_date(date_abs, etudid): diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index 60cf4931d..6b1afc4a2 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -78,33 +78,20 @@ from app.scodoc import sco_bulletins_legacy from app.scodoc import sco_bulletins_ucac # format expérimental UCAC Cameroun -def make_context_dict(sem, etud): +def make_context_dict(formsemestre: FormSemestre, etud: dict) -> dict: """Construit dictionnaire avec valeurs pour substitution des textes (preferences bul_pdf_*) """ - C = sem.copy() - C["responsable"] = " ,".join( - [ - sco_users.user_info(responsable_id)["prenomnom"] - for responsable_id in sem["responsables"] - ] - ) - - annee_debut = sem["date_debut"].split("/")[2] - annee_fin = sem["date_fin"].split("/")[2] - if annee_debut != annee_fin: - annee = "%s - %s" % (annee_debut, annee_fin) - else: - annee = annee_debut - C["anneesem"] = annee + C = formsemestre.get_infos_dict() + C["responsable"] = formsemestre.responsables_str() + C["anneesem"] = C["annee"] # backward compat C.update(etud) # copie preferences - # XXX devrait acceder directement à un dict de preferences, à revoir for name in sco_preferences.get_base_preferences().prefs_name: - C[name] = sco_preferences.get_preference(name, sem["formsemestre_id"]) + C[name] = sco_preferences.get_preference(name, formsemestre.id) # ajoute groupes et group_0, group_1, ... - sco_groups.etud_add_group_infos(etud, sem) + sco_groups.etud_add_group_infos(etud, formsemestre.id) C["groupes"] = etud["groupes"] n = 0 for partition_id in etud["partitions"]: @@ -125,7 +112,8 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"): Le contenu du dictionnaire dépend des options (rangs, ...) et de la version choisie (short, long, selectedevals). - Cette fonction est utilisée pour les bulletins HTML et PDF, mais pas ceux en XML. + Cette fonction est utilisée pour les bulletins CLASSIQUES (DUT, ...) + en HTML et PDF, mais pas ceux en XML. """ from app.scodoc import sco_abs @@ -190,7 +178,7 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"): ) I["etud_etat"] = nt.get_etud_etat(etudid) I["filigranne"] = sco_bulletins_pdf.get_filigranne( - I["etud_etat"], prefs, decision_dem=I["decision_sem"] + I["etud_etat"], prefs, decision_sem=I["decision_sem"] ) I["demission"] = "" if I["etud_etat"] == scu.DEMISSION: @@ -384,7 +372,7 @@ def formsemestre_bulletinetud_dict(formsemestre_id, etudid, version="long"): I["matieres_modules"].update(_sort_mod_by_matiere(modules, nt, etudid)) # - C = make_context_dict(I["sem"], I["etud"]) + C = make_context_dict(formsemestre, I["etud"]) C.update(I) # # log( 'C = \n%s\n' % pprint.pformat(C) ) # tres pratique pour voir toutes les infos dispo @@ -842,7 +830,7 @@ def formsemestre_bulletinetud( H = [ _formsemestre_bulletinetud_header_html( - etud, etudid, sem, formsemestre_id, format, version + etud, etudid, formsemestre, format, version ), bulletin, ] @@ -1063,8 +1051,7 @@ def mail_bulletin(formsemestre_id, I, pdfdata, filename, recipient_addr): def _formsemestre_bulletinetud_header_html( etud, etudid, - sem, - formsemestre_id=None, + formsemestre: FormSemestre, format=None, version=None, ): @@ -1078,33 +1065,27 @@ def _formsemestre_bulletinetud_header_html( ], cssstyles=["css/radar_bulletin.css"], ), - """
-

%s

- """ - % ( + f""" -
+

""" - % request.base_url, - f"""Bulletin {sem["titremois"]} -
""" - % sem, - """""", - """""" % time.strftime("%d/%m/%Y à %Hh%M"), - """""") - H.append( - '' - % ( - url_for( - "notes.formsemestre_bulletinetud", - scodoc_dept=g.scodoc_dept, - formsemestre_id=formsemestre.id, - etudid=etudid, - format="pdf", + +def _formsemestre_bulletinetud_header_html( + etud, + formsemestre: FormSemestre, + format=None, + version=None, +): + H = [ + html_sco_header.sco_header( + page_title=f"Bulletin de {etud.nomprenom}", + javascripts=[ + "js/bulletin.js", + "libjs/d3.v3.min.js", + "js/radar_bulletin.js", + ], + cssstyles=["css/radar_bulletin.css"], + ), + render_template( + "bul_head.html", + etud=etud, + format=format, + formsemestre=formsemestre, + menu_autres_operations=make_menu_autres_operations( + etud=etud, + formsemestre=formsemestre, + endpoint="notes.formsemestre_bulletinetud", version=version, ), - scu.ICON_PDF, - ) - ) - H.append("""
établi le %s (notes sur 20) - """ - % formsemestre_id, - """""" % etudid, - """""" % format, - """ + + +
établi le {time.strftime("%d/%m/%Y à %Hh%M")} (notes sur 20) + + + + """) # Menu endpoint = "notes.formsemestre_bulletinetud" + menu_autres_operations = make_menu_autres_operations( + formsemestre, etud, endpoint, version + ) - menuBul = [ + H.append("""""") + H.append( + '' + % ( + url_for( + "notes.formsemestre_bulletinetud", + scodoc_dept=g.scodoc_dept, + formsemestre_id=formsemestre.id, + etudid=etud.id, + format="pdf", + version=version, + ), + scu.ICON_PDF, + ) + ) + H.append("""

{etud["nomprenom"]}

+ "scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud.id + )}">{etud.nomprenom}
Bulletin
- +
""") + H.append(menu_autres_operations) + H.append("""
%s
""") + # + H.append( + """
%s + """ + % ( + url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etud.id), + sco_photos.etud_photo_html(etud, title="fiche de " + etud.nomprenom), + ) + ) + H.append( + """
+ """ + ) + + return "".join(H) + + +def make_menu_autres_operations( + formsemestre: FormSemestre, etud: Identite, endpoint: str, version: str +) -> str: + etud_email = etud.get_first_email() or "" + etud_perso = etud.get_first_email("emailperso") or "" + menu_items = [ { "title": "Réglages bulletins", "endpoint": "notes.formsemestre_edit_options", @@ -1124,43 +1159,42 @@ def _formsemestre_bulletinetud_header_html( "endpoint": endpoint, "args": { "formsemestre_id": formsemestre.id, - "etudid": etudid, + "etudid": etud.id, "version": version, "format": "pdf", }, }, { - "title": "Envoi par mail à %s" % etud["email"], + "title": f"Envoi par mail à {etud_email}", "endpoint": endpoint, "args": { "formsemestre_id": formsemestre.id, - "etudid": etudid, + "etudid": etud.id, "version": version, "format": "pdfmail", }, # possible slt si on a un mail... - "enabled": etud["email"] and can_send_bulletin_by_mail(formsemestre.id), + "enabled": etud_email and can_send_bulletin_by_mail(formsemestre.id), }, { - "title": "Envoi par mail à %s (adr. personnelle)" % etud["emailperso"], + "title": f"Envoi par mail à {etud_perso} (adr. personnelle)", "endpoint": endpoint, "args": { "formsemestre_id": formsemestre.id, - "etudid": etudid, + "etudid": etud.id, "version": version, "format": "pdfmail", "prefer_mail_perso": 1, }, # possible slt si on a un mail... - "enabled": etud["emailperso"] - and can_send_bulletin_by_mail(formsemestre.id), + "enabled": etud_perso and can_send_bulletin_by_mail(formsemestre.id), }, { "title": "Version json", "endpoint": endpoint, "args": { "formsemestre_id": formsemestre.id, - "etudid": etudid, + "etudid": etud.id, "version": version, "format": "json", }, @@ -1170,7 +1204,7 @@ def _formsemestre_bulletinetud_header_html( "endpoint": endpoint, "args": { "formsemestre_id": formsemestre.id, - "etudid": etudid, + "etudid": etud.id, "version": version, "format": "xml", }, @@ -1180,7 +1214,7 @@ def _formsemestre_bulletinetud_header_html( "endpoint": "notes.appreciation_add_form", "args": { "formsemestre_id": formsemestre.id, - "etudid": etudid, + "etudid": etud.id, }, "enabled": ( formsemestre.can_be_edited_by(current_user) @@ -1192,7 +1226,7 @@ def _formsemestre_bulletinetud_header_html( "endpoint": "notes.formsemestre_ext_create_form", "args": { "formsemestre_id": formsemestre.id, - "etudid": etudid, + "etudid": etud.id, }, "enabled": current_user.has_permission(Permission.ScoImplement), }, @@ -1201,7 +1235,7 @@ def _formsemestre_bulletinetud_header_html( "endpoint": "notes.formsemestre_validate_previous_ue", "args": { "formsemestre_id": formsemestre.id, - "etudid": etudid, + "etudid": etud.id, }, "enabled": sco_permissions_check.can_validate_sem(formsemestre.id), }, @@ -1210,7 +1244,7 @@ def _formsemestre_bulletinetud_header_html( "endpoint": "notes.external_ue_create_form", "args": { "formsemestre_id": formsemestre.id, - "etudid": etudid, + "etudid": etud.id, }, "enabled": sco_permissions_check.can_validate_sem(formsemestre.id), }, @@ -1219,7 +1253,7 @@ def _formsemestre_bulletinetud_header_html( "endpoint": "notes.formsemestre_validation_etud_form", "args": { "formsemestre_id": formsemestre.id, - "etudid": etudid, + "etudid": etud.id, }, "enabled": sco_permissions_check.can_validate_sem(formsemestre.id), }, @@ -1228,43 +1262,44 @@ def _formsemestre_bulletinetud_header_html( "endpoint": "notes.formsemestre_pvjury_pdf", "args": { "formsemestre_id": formsemestre.id, - "etudid": etudid, + "etudid": etud.id, }, "enabled": True, }, ] + return htmlutils.make_menu("Autres opérations", menu_items, alone=True) - H.append("""
""") - H.append(htmlutils.make_menu("Autres opérations", menuBul, alone=True)) - H.append("""
%s
""") - # - H.append( - """

%s - """ - % ( - url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid), - sco_photos.etud_photo_html(etud, title="fiche de " + etud["nom"]), - ) - ) - H.append( - """
- """ - ) - - return "".join(H) + scu=scu, + time=time, + version=version, + ), + ] + return "\n".join(H) diff --git a/app/scodoc/sco_bulletins_generator.py b/app/scodoc/sco_bulletins_generator.py index ceeb0aac2..7f6a53c60 100644 --- a/app/scodoc/sco_bulletins_generator.py +++ b/app/scodoc/sco_bulletins_generator.py @@ -117,7 +117,7 @@ class BulletinGenerator: def get_filename(self): """Build a filename to be proposed to the web client""" sem = sco_formsemestre.get_formsemestre(self.infos["formsemestre_id"]) - return scu.bul_filename(sem, self.infos["etud"], "pdf") + return scu.bul_filename_old(sem, self.infos["etud"], "pdf") def generate(self, format="", stand_alone=True): """Return bulletin in specified format""" diff --git a/app/scodoc/sco_bulletins_json.py b/app/scodoc/sco_bulletins_json.py index ee57b60e7..ee0ddae27 100644 --- a/app/scodoc/sco_bulletins_json.py +++ b/app/scodoc/sco_bulletins_json.py @@ -138,7 +138,7 @@ def formsemestre_bulletinetud_published_dict( if not published: return d # stop ! - etat_inscription = etud.etat_inscription(formsemestre.id) + etat_inscription = etud.inscription_etat(formsemestre.id) if etat_inscription != scu.INSCRIT: d.update(dict_decision_jury(etudid, formsemestre_id, with_decisions=True)) return d diff --git a/app/scodoc/sco_etud.py b/app/scodoc/sco_etud.py index d019d2df2..48c6b82bf 100644 --- a/app/scodoc/sco_etud.py +++ b/app/scodoc/sco_etud.py @@ -33,8 +33,7 @@ import os import time from operator import itemgetter -from flask import url_for, g, request -from flask_mail import Message +from flask import url_for, g from app import email from app import log @@ -46,7 +45,6 @@ from app.scodoc.sco_exceptions import ScoGenError, ScoValueError from app.scodoc import safehtml from app.scodoc import sco_preferences from app.scodoc.scolog import logdb -from app.scodoc.TrivialFormulator import TrivialFormulator def format_etud_ident(etud): @@ -860,7 +858,7 @@ def list_scolog(etudid): return cursor.dictfetchall() -def fill_etuds_info(etuds, add_admission=True): +def fill_etuds_info(etuds: list[dict], add_admission=True): """etuds est une liste d'etudiants (mappings) Pour chaque etudiant, ajoute ou formatte les champs -> informations pour fiche etudiant ou listes diverses @@ -977,7 +975,10 @@ def etud_inscriptions_infos(etudid: int, ne="") -> dict: def descr_situation_etud(etudid: int, ne="") -> str: - """chaîne décrivant la situation actuelle de l'étudiant""" + """Chaîne décrivant la situation actuelle de l'étudiant + XXX Obsolete, utiliser Identite.descr_situation_etud() dans + les nouveaux codes + """ from app.scodoc import sco_formsemestre cnx = ndb.GetDBConnexion() diff --git a/app/scodoc/sco_photos.py b/app/scodoc/sco_photos.py index 80f3553e5..cf66a8526 100644 --- a/app/scodoc/sco_photos.py +++ b/app/scodoc/sco_photos.py @@ -351,7 +351,8 @@ def copy_portal_photo_to_fs(etud): """Copy the photo from portal (distant website) to local fs. Returns rel. path or None if copy failed, with a diagnostic message """ - sco_etud.format_etud_ident(etud) + if "nomprenom" not in etud: + sco_etud.format_etud_ident(etud) url = photo_portal_url(etud) if not url: return None, "%(nomprenom)s: pas de code NIP" % etud diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py index 196c2c210..b30c493ca 100644 --- a/app/scodoc/sco_utils.py +++ b/app/scodoc/sco_utils.py @@ -608,7 +608,7 @@ def is_valid_filename(filename): return VALID_EXP.match(filename) -def bul_filename(sem, etud, format): +def bul_filename_old(sem: dict, etud: dict, format): """Build a filename for this bulletin""" dt = time.strftime("%Y-%m-%d") filename = f"bul-{sem['titre_num']}-{dt}-{etud['nom']}.{format}" @@ -616,6 +616,14 @@ def bul_filename(sem, etud, format): return filename +def bul_filename(formsemestre, etud, format): + """Build a filename for this bulletin""" + dt = time.strftime("%Y-%m-%d") + filename = f"bul-{formsemestre.sem.titre_num}-{dt}-{etud.nom}.{format}" + filename = make_filename(filename) + return filename + + def flash_errors(form): """Flashes form errors (version sommaire)""" for field, errors in form.errors.items(): diff --git a/app/static/js/releve-but.js b/app/static/js/releve-but.js index 076fef1af..c7c649e51 100644 --- a/app/static/js/releve-but.js +++ b/app/static/js/releve-but.js @@ -41,7 +41,7 @@ class releveBUT extends HTMLElement { } set showData(data) { - this.showInformations(data); + // this.showInformations(data); this.showSemestre(data); this.showSynthese(data); this.showEvaluations(data); @@ -68,13 +68,7 @@ class releveBUT extends HTMLElement {
- - - -
- Photo de l'étudiant -
-
+ diff --git a/app/templates/bul_head.html b/app/templates/bul_head.html new file mode 100644 index 000000000..5211fcd4f --- /dev/null +++ b/app/templates/bul_head.html @@ -0,0 +1,58 @@ +{# -*- mode: jinja-html -*- #} +{# L'en-tête des bulletins HTML #} +{# was _formsemestre_bulletinetud_header_html #} + + + + + + +
+

{{etud.nomprenom}}

+
+ Bulletin {{formsemestre.titre_mois()}} +
+ + + + + + + +
établi le {{time.strftime("%d/%m/%Y à %Hh%M")}} (notes sur 20) + + + + + + +
{{menu_autres_operations|safe}}
+
{{scu.ICON_PDF|safe}} +
+
+
{{etud.photo_html(title="fiche de " + etud["nom"])|safe}} +
diff --git a/app/templates/but/bulletin.html b/app/templates/but/bulletin.html index ff0682fce..02a09e848 100644 --- a/app/templates/but/bulletin.html +++ b/app/templates/but/bulletin.html @@ -6,6 +6,8 @@ {% endblock %} {% block app_content %} +

Totoro

+ From 2220b617b883319725b5e269a1c20d6d068898a5 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 7 Mar 2022 21:49:11 +0100 Subject: [PATCH 06/10] =?UTF-8?q?WIP:=20int=C3=A9gration=20bulletins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/but/bulletin_but.py | 27 +++++++++--- app/models/etudiants.py | 1 + app/models/formsemestre.py | 14 +++++- app/scodoc/sco_bulletins.py | 8 ++-- app/scodoc/sco_bulletins_generator.py | 6 ++- app/scodoc/sco_formsemestre_status.py | 36 +++++----------- app/scodoc/sco_photos.py | 2 +- app/scodoc/sco_utils.py | 2 +- app/static/css/releve-but.css | 37 ++++++++++++---- app/static/css/scodoc.css | 4 +- app/static/js/releve-but.js | 15 ++++--- app/templates/bul_head.html | 4 ++ app/templates/but/bulletin.html | 2 +- app/templates/formsemestre_page_title.html | 50 ++++++++++++++++++++++ app/views/__init__.py | 37 +++++++++------- app/views/notes.py | 25 +++++++++-- 16 files changed, 193 insertions(+), 77 deletions(-) create mode 100644 app/templates/formsemestre_page_title.html diff --git a/app/but/bulletin_but.py b/app/but/bulletin_but.py index 4379fdac5..f64769fc9 100644 --- a/app/but/bulletin_but.py +++ b/app/but/bulletin_but.py @@ -111,9 +111,10 @@ class BulletinBUT: d["modules"] = self.etud_mods_results(etud, modimpls_spo) return d - def etud_mods_results(self, etud, modimpls) -> dict: + def etud_mods_results(self, etud, modimpls, version="long") -> dict: """dict synthèse résultats des modules indiqués, - avec évaluations de chacun.""" + avec évaluations de chacun (sauf si version == "short") + """ res = self.res d = {} # etud_idx = self.etud_index[etud.id] @@ -154,12 +155,14 @@ class BulletinBUT: "evaluations": [ self.etud_eval_results(etud, e) for e in modimpl.evaluations - if e.visibulletin + if (e.visibulletin or version == "long") and ( modimpl_results.evaluations_etat[e.id].is_complete or self.prefs["bul_show_all_evals"] ) - ], + ] + if version != "short" + else [], } return d @@ -217,9 +220,17 @@ class BulletinBUT: return f"Bonus de {fmt_note(bonus_vect.iloc[0])}" def bulletin_etud( - self, etud: Identite, formsemestre: FormSemestre, force_publishing=False + self, + etud: Identite, + formsemestre: FormSemestre, + force_publishing=False, + version="long", ) -> dict: """Le bulletin de l'étudiant dans ce semestre: dict pour la version JSON / HTML. + - version: + "long", "selectedevals": toutes les infos (notes des évaluations) + "short" : ne descend pas plus bas que les modules. + - Si force_publishing, rempli le bulletin même si bul_hide_xml est vrai (bulletins non publiés). """ @@ -282,8 +293,10 @@ class BulletinBUT: ) d.update( { - "ressources": self.etud_mods_results(etud, res.ressources), - "saes": self.etud_mods_results(etud, res.saes), + "ressources": self.etud_mods_results( + etud, res.ressources, version=version + ), + "saes": self.etud_mods_results(etud, res.saes, version=version), "ues": { ue.acronyme: self.etud_ue_results(etud, ue) for ue in res.ues diff --git a/app/models/etudiants.py b/app/models/etudiants.py index 953fb280a..060debc3b 100644 --- a/app/models/etudiants.py +++ b/app/models/etudiants.py @@ -160,6 +160,7 @@ class Identite(db.Model): "etudid": self.id, "nom": self.nom_disp(), "prenom": self.prenom, + "nomprenom": self.nomprenom, } if include_urls: d["fiche_url"] = url_for( diff --git a/app/models/formsemestre.py b/app/models/formsemestre.py index ce162d249..d92c375fb 100644 --- a/app/models/formsemestre.py +++ b/app/models/formsemestre.py @@ -22,6 +22,7 @@ from app.scodoc import sco_codes_parcours from app.scodoc import sco_preferences from app.scodoc.sco_vdi import ApoEtapeVDI from app.scodoc.sco_permissions import Permission +from app.scodoc.sco_utils import MONTH_NAMES_ABBREV class FormSemestre(db.Model): @@ -162,8 +163,8 @@ class FormSemestre(db.Model): d["periode"] = 2 # typiquement, début en février: S2, S4... d["titre_num"] = self.titre_num() d["titreannee"] = self.titre_annee() - d["mois_debut"] = f"{self.date_debut.month} {self.date_debut.year}" - d["mois_fin"] = f"{self.date_fin.month} {self.date_fin.year}" + d["mois_debut"] = self.mois_debut() + d["mois_fin"] = self.mois_fin() d["titremois"] = "%s %s (%s - %s)" % ( d["titre_num"], self.modalite or "", @@ -293,6 +294,7 @@ class FormSemestre(db.Model): """chaîne "J. Dupond, X. Martin" ou "Jacques Dupond, Xavier Martin" """ + # was "nomcomplet" if not self.responsables: return "" if abbrev_prenom: @@ -304,6 +306,14 @@ class FormSemestre(db.Model): "2021 - 2022" return scu.annee_scolaire_repr(self.date_debut.year, self.date_debut.month) + def mois_debut(self) -> str: + "Oct 2021" + return f"{MONTH_NAMES_ABBREV[self.date_debut.month - 1]} {self.date_debut.year}" + + def mois_fin(self) -> str: + "Jul 2022" + return f"{MONTH_NAMES_ABBREV[self.date_fin.month - 1]} {self.date_debut.year}" + def session_id(self) -> str: """identifiant externe de semestre de formation Exemple: RT-DUT-FI-S1-ANNEE diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index 046c81468..b21404276 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -793,13 +793,14 @@ def etud_descr_situation_semestre( def formsemestre_bulletinetud( etudid=None, formsemestre_id=None, - format="html", + format=None, version="long", xml_with_decisions=False, force_publishing=False, # force publication meme si semestre non publie sur "portail" prefer_mail_perso=False, ): "page bulletin de notes" + format = format or "html" etud: Identite = Identite.query.get_or_404(etudid) formsemestre: FormSemestre = FormSemestre.query.get(formsemestre_id) if not formsemestre: @@ -879,7 +880,7 @@ def do_formsemestre_bulletinetud( formsemestre: FormSemestre, etudid: int, version="long", # short, long, selectedevals - format="html", + format=None, nohtml=False, xml_with_decisions=False, # force décisions dans XML force_publishing=False, # force publication meme si semestre non publié sur "portail" @@ -890,6 +891,7 @@ def do_formsemestre_bulletinetud( où bul est str ou bytes au format demandé (html, pdf, pdfmail, pdfpart, xml, json) et filigranne est un message à placer en "filigranne" (eg "Provisoire"). """ + format = format or "html" if format == "xml": bul = sco_bulletins_xml.make_xml_formsemestre_bulletinetud( formsemestre.id, @@ -1258,7 +1260,7 @@ def make_menu_autres_operations( "enabled": sco_permissions_check.can_validate_sem(formsemestre.id), }, { - "title": "Editer PV jury", + "title": "Éditer PV jury", "endpoint": "notes.formsemestre_pvjury_pdf", "args": { "formsemestre_id": formsemestre.id, diff --git a/app/scodoc/sco_bulletins_generator.py b/app/scodoc/sco_bulletins_generator.py index 7f6a53c60..2aeb792fb 100644 --- a/app/scodoc/sco_bulletins_generator.py +++ b/app/scodoc/sco_bulletins_generator.py @@ -297,7 +297,11 @@ def register_bulletin_class(klass): def bulletin_class_descriptions(): - return [x.description for x in BULLETIN_CLASSES.values()] + return [ + BULLETIN_CLASSES[class_name].description + for class_name in BULLETIN_CLASSES + if BULLETIN_CLASSES[class_name].list_in_menu + ] def bulletin_class_names() -> list[str]: diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 2080e9572..11e665d92 100644 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -31,7 +31,7 @@ from flask import current_app from flask import g from flask import request -from flask import url_for +from flask import render_template, url_for from flask_login import current_user from app import log @@ -411,7 +411,7 @@ def formsemestre_status_menubar(sem): "enabled": sco_permissions_check.can_validate_sem(formsemestre_id), }, { - "title": "Editer les PV et archiver les résultats", + "title": "Éditer les PV et archiver les résultats", "endpoint": "notes.formsemestre_archive", "args": {"formsemestre_id": formsemestre_id}, "enabled": sco_permissions_check.can_edit_pv(formsemestre_id), @@ -445,6 +445,7 @@ def retreive_formsemestre_from_request() -> int: """Cherche si on a de quoi déduire le semestre affiché à partir des arguments de la requête: formsemestre_id ou moduleimpl ou evaluation ou group_id ou partition_id + Returns None si pas défini. """ if request.method == "GET": args = request.args @@ -505,34 +506,17 @@ def formsemestre_page_title(): return "" try: formsemestre_id = int(formsemestre_id) - sem = sco_formsemestre.get_formsemestre(formsemestre_id).copy() + formsemestre = FormSemestre.query.get(formsemestre_id) except: log("can't find formsemestre_id %s" % formsemestre_id) return "" - fill_formsemestre(sem) - - h = f"""
- - {formsemestre_status_menubar(sem)} -
- """ + h = render_template( + "formsemestre_page_title.html", + formsemestre=formsemestre, + scu=scu, + sem_menu_bar=formsemestre_status_menubar(formsemestre.to_dict()), + ) return h diff --git a/app/scodoc/sco_photos.py b/app/scodoc/sco_photos.py index cf66a8526..0dfeaafe3 100644 --- a/app/scodoc/sco_photos.py +++ b/app/scodoc/sco_photos.py @@ -175,7 +175,7 @@ def etud_photo_is_local(etud: dict, size="small"): return photo_pathname(etud["photo_filename"], size=size) -def etud_photo_html(etud=None, etudid=None, title=None, size="small"): +def etud_photo_html(etud: dict = None, etudid=None, title=None, size="small"): """HTML img tag for the photo, either in small size (h90) or original size (size=="orig") """ diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py index b30c493ca..ba7fd504a 100644 --- a/app/scodoc/sco_utils.py +++ b/app/scodoc/sco_utils.py @@ -619,7 +619,7 @@ def bul_filename_old(sem: dict, etud: dict, format): def bul_filename(formsemestre, etud, format): """Build a filename for this bulletin""" dt = time.strftime("%Y-%m-%d") - filename = f"bul-{formsemestre.sem.titre_num}-{dt}-{etud.nom}.{format}" + filename = f"bul-{formsemestre.titre_num()}-{dt}-{etud.nom}.{format}" filename = make_filename(filename) return filename diff --git a/app/static/css/releve-but.css b/app/static/css/releve-but.css index 02cceb94c..d9756ace4 100644 --- a/app/static/css/releve-but.css +++ b/app/static/css/releve-but.css @@ -14,16 +14,25 @@ } main{ --couleurPrincipale: rgb(240,250,255); - --couleurFondTitresUE: rgb(206,255,235); - --couleurFondTitresRes: rgb(125, 170, 255); - --couleurFondTitresSAE: rgb(211, 255, 255); + --couleurFondTitresUE: #b6ebff; + --couleurFondTitresRes: #f8c844; + --couleurFondTitresSAE: #c6ffab; --couleurSecondaire: #fec; - --couleurIntense: #c09; - --couleurSurlignage: rgba(232, 255, 132, 0.47); + --couleurIntense: rgb(4, 16, 159);; + --couleurSurlignage: rgba(255, 253, 110, 0.49); max-width: 1000px; margin: auto; display: none; } +.releve a, .releve a:visited { + color: navy; + text-decoration: none; +} +.releve a:hover { + color: red; + text-decoration: underline; +} + .ready .wait{display: none;} .ready main{display: block;} h2{ @@ -152,12 +161,14 @@ section>div:nth-child(1){ column-gap: 4px; flex: none; } -.infoSemestre>div:nth-child(1){ - margin-right: auto; -} + .infoSemestre>div>div:nth-child(even){ text-align: right; } +.photo { + border: none; + margin-left: auto; +} .rang{ font-weight: bold; } @@ -213,7 +224,6 @@ section>div:nth-child(1){ scroll-margin-top: 60px; } .module, .ue { - background: var(--couleurSecondaire); color: #000; padding: 4px 32px; border-radius: 4px; @@ -225,6 +235,15 @@ section>div:nth-child(1){ cursor: pointer; position: relative; } +.ue { + background: var(--couleurFondTitresRes); +} +.module { + background: var(--couleurFondTitresRes); +} +.module h3 { + background: var(--couleurFondTitresRes); +} .module::before, .ue::before { content:url("data:image/svg+xml;utf8,"); width: 26px; diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index a9390db24..31603a34b 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -1963,7 +1963,9 @@ table.notes_recapcomplet a:hover { div.notes_bulletin { margin-right: 5px; } - +div.bulletin_menubar { + margin-right: 2em; +} table.notes_bulletin { border-collapse: collapse; border: 2px solid rgb(100,100,240); diff --git a/app/static/js/releve-but.js b/app/static/js/releve-but.js index c7c649e51..97f97e29d 100644 --- a/app/static/js/releve-but.js +++ b/app/static/js/releve-but.js @@ -79,8 +79,8 @@ class releveBUT extends HTMLElement {
-

Semestre

-
+

+
@@ -97,7 +97,7 @@ class releveBUT extends HTMLElement {
-

Synthèse

+

Unités d'enseignement

La moyenne des ressources dans une UE dépend des poids donnés aux évaluations.
@@ -126,7 +126,7 @@ class releveBUT extends HTMLElement {
-

SAÉ

+

Situations d'apprentissage et d'évaluation (SAÉ)

Liste @@ -192,7 +192,8 @@ class releveBUT extends HTMLElement { /* Information sur le semestre */ /*******************************/ showSemestre(data) { - this.shadow.querySelector("h2").innerHTML += data.semestre.numero; + + this.shadow.querySelector("#identite_etudiant").innerHTML = ` ${data.etudiant.nomprenom} `; this.shadow.querySelector(".dateInscription").innerHTML += this.ISOToDate(data.semestre.inscription); let output = `
@@ -206,7 +207,9 @@ class releveBUT extends HTMLElement {
Absences
N.J. ${data.semestre.absences?.injustifie ?? "-"}
Total ${data.semestre.absences?.total ?? "-"}
-
`; +
+ photo de l'étudiant + `; /*${data.semestre.groupes.map(groupe => { return `
diff --git a/app/templates/bul_head.html b/app/templates/bul_head.html index 5211fcd4f..12df3c4f8 100644 --- a/app/templates/bul_head.html +++ b/app/templates/bul_head.html @@ -5,10 +5,12 @@ +{% if not is_apc %} +{% endif %}
+{% if not is_apc %}

{{etud.nomprenom}}

+{% endif %}
Bulletin
{{etud.photo_html(title="fiche de " + etud["nom"])|safe}}
diff --git a/app/templates/but/bulletin.html b/app/templates/but/bulletin.html index 02a09e848..c3e8c834e 100644 --- a/app/templates/but/bulletin.html +++ b/app/templates/but/bulletin.html @@ -6,8 +6,8 @@ {% endblock %} {% block app_content %} -

Totoro

+{% include 'bul_head.html' %} diff --git a/app/templates/formsemestre_page_title.html b/app/templates/formsemestre_page_title.html new file mode 100644 index 000000000..70fef579d --- /dev/null +++ b/app/templates/formsemestre_page_title.html @@ -0,0 +1,50 @@ +{# -*- mode: jinja-html -*- #} +{# Element HTML decrivant un semestre (barre de menu et infos) #} +{# was formsemestre_page_title #} + + \ No newline at end of file diff --git a/app/views/__init__.py b/app/views/__init__.py index 3d8af0777..f3c8e13d4 100644 --- a/app/views/__init__.py +++ b/app/views/__init__.py @@ -50,27 +50,29 @@ def close_dept_db_connection(arg): class ScoData: """Classe utilisée pour passer des valeurs aux vues (templates)""" - def __init__(self): + def __init__(self, etud=None, formsemestre=None): # Champs utilisés par toutes les pages ScoDoc (sidebar, en-tête) self.Permission = Permission self.scu = scu self.SCOVERSION = sco_version.SCOVERSION # -- Informations étudiant courant, si sélectionné: - etudid = g.get("etudid", None) - if not etudid: - if request.method == "GET": - etudid = request.args.get("etudid", None) - elif request.method == "POST": - etudid = request.form.get("etudid", None) - - if etudid: + if etud is None: + etudid = g.get("etudid", None) + if etudid is None: + if request.method == "GET": + etudid = request.args.get("etudid", None) + elif request.method == "POST": + etudid = request.form.get("etudid", None) + if etudid is not None: + etud = Identite.query.get_or_404(etudid) + self.etud = etud + if etud is not None: # Infos sur l'étudiant courant - self.etud = Identite.query.get_or_404(etudid) ins = self.etud.inscription_courante() if ins: self.etud_cur_sem = ins.formsemestre self.nbabs, self.nbabsjust = sco_abs.get_abs_count_in_interval( - etudid, + etud.id, self.etud_cur_sem.date_debut.isoformat(), self.etud_cur_sem.date_fin.isoformat(), ) @@ -80,17 +82,22 @@ class ScoData: else: self.etud = None # --- Informations sur semestre courant, si sélectionné - formsemestre_id = sco_formsemestre_status.retreive_formsemestre_from_request() - if formsemestre_id is None: + if formsemestre is None: + formsemestre_id = ( + sco_formsemestre_status.retreive_formsemestre_from_request() + ) + if formsemestre_id is not None: + formsemestre = FormSemestre.query.get_or_404(formsemestre_id) + if formsemestre is None: self.sem = None self.sem_menu_bar = None else: - self.sem = FormSemestre.query.get_or_404(formsemestre_id) + self.sem = formsemestre self.sem_menu_bar = sco_formsemestre_status.formsemestre_status_menubar( self.sem.to_dict() ) # --- Préférences - self.prefs = sco_preferences.SemPreferences(formsemestre_id) + self.prefs = sco_preferences.SemPreferences(formsemestre.id) from app.views import scodoc, notes, scolar, absences, users, pn_modules, refcomp diff --git a/app/views/notes.py b/app/views/notes.py index 6cbf0be43..5ca463b4c 100644 --- a/app/views/notes.py +++ b/app/views/notes.py @@ -32,6 +32,7 @@ Emmanuel Viennet, 2021 """ from operator import itemgetter +import time from xml.etree import ElementTree import flask @@ -276,7 +277,7 @@ sco_publish( def formsemestre_bulletinetud( etudid=None, formsemestre_id=None, - format="html", + format=None, version="long", xml_with_decisions=False, force_publishing=False, @@ -284,6 +285,7 @@ def formsemestre_bulletinetud( code_nip=None, code_ine=None, ): + format = format or "html" if not formsemestre_id: flask.abort(404, "argument manquant: formsemestre_id") if not isinstance(formsemestre_id, int): @@ -311,12 +313,16 @@ def formsemestre_bulletinetud( if format == "json": r = bulletin_but.BulletinBUT(formsemestre) return jsonify( - r.bulletin_etud(etud, formsemestre, force_publishing=force_publishing) + r.bulletin_etud( + etud, + formsemestre, + force_publishing=force_publishing, + version=version, + ) ) elif format == "html": return render_template( "but/bulletin.html", - title=f"Bul. {etud.nom} - BUT", bul_url=url_for( "notes.formsemestre_bulletinetud", scodoc_dept=g.scodoc_dept, @@ -324,8 +330,19 @@ def formsemestre_bulletinetud( etudid=etudid, format="json", force_publishing=1, # pour ScoDoc lui même + version=version, ), - sco=ScoData(), + etud=etud, + formsemestre=formsemestre, + is_apc=formsemestre.formation.is_apc(), + menu_autres_operations=sco_bulletins.make_menu_autres_operations( + formsemestre, etud, "notes.formsemestre_bulletinetud", version + ), + sco=ScoData(etud=etud), + scu=scu, + time=time, + title=f"Bul. {etud.nom} - BUT", + version=version, ) if not (etudid or code_nip or code_ine): From a09418329faf670fc29f1c6873496ab92682cc69 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Mon, 7 Mar 2022 23:43:48 +0100 Subject: [PATCH 07/10] =?UTF-8?q?Int=C3=A9gration=20bulletins=20html?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_bulletins.py | 47 ++++----------------- app/static/css/scodoc.css | 19 +++++---- app/templates/bul_foot.html | 34 +++++++++++++++ app/templates/bul_head.html | 73 +++++++++++++++------------------ app/templates/but/bulletin.html | 3 ++ app/views/notes.py | 2 + 6 files changed, 93 insertions(+), 85 deletions(-) create mode 100644 app/templates/bul_foot.html diff --git a/app/scodoc/sco_bulletins.py b/app/scodoc/sco_bulletins.py index b21404276..65dcb3a91 100644 --- a/app/scodoc/sco_bulletins.py +++ b/app/scodoc/sco_bulletins.py @@ -822,47 +822,16 @@ def formsemestre_bulletinetud( H = [ _formsemestre_bulletinetud_header_html(etud, formsemestre, format, version), bulletin, + render_template( + "bul_foot.html", + etud=etud, + formsemestre=formsemestre, + inscription_courante=etud.inscription_courante(), + inscription_str=etud.inscription_descr()["inscription_str"], + ), + html_sco_header.sco_footer(), ] - H.append("""

Situation actuelle: """) - inscription_courante = etud.inscription_courante() - if inscription_courante: - H.append( - f"""""" - ) - inscription_descr = etud.inscription_descr() - H.append(inscription_descr["inscription_str"]) - if inscription_courante: - H.append("""""") - H.append("""

""") - if formsemestre.modalite == "EXT": - H.append( - f"""

- Éditer les validations d'UE dans ce semestre extérieur -

""" - ) - # Place du diagramme radar - H.append( - """
- - -
""" - % (etudid, formsemestre_id) - ) - H.append('
') - - # --- Pied de page - H.append(html_sco_header.sco_footer()) - return "".join(H) diff --git a/app/static/css/scodoc.css b/app/static/css/scodoc.css index 31603a34b..b5f2b325b 100644 --- a/app/static/css/scodoc.css +++ b/app/static/css/scodoc.css @@ -1963,7 +1963,18 @@ table.notes_recapcomplet a:hover { div.notes_bulletin { margin-right: 5px; } -div.bulletin_menubar { +div.bull_head { + display: grid; + justify-content: space-between; + grid-template-columns: auto auto; +} +div.bull_photo { + display: inline-block; + margin-right: 10px; +} +span.bulletin_menubar_but { + display: inline-block; + margin-left: 2em; margin-right: 2em; } table.notes_bulletin { @@ -2105,12 +2116,6 @@ a.bull_link:hover { text-decoration: underline; } -table.bull_head { - width: 100%; -} -td.bull_photo { - text-align: right; -} div.bulletin_menubar { padding-left: 25px; diff --git a/app/templates/bul_foot.html b/app/templates/bul_foot.html new file mode 100644 index 000000000..873b43c76 --- /dev/null +++ b/app/templates/bul_foot.html @@ -0,0 +1,34 @@ +{# -*- mode: jinja-html -*- #} +{# Pied des bulletins HTML #} + +

Situation actuelle: +{% if inscription_courante %} +{{inscription_str}} +{% else %} + {{inscription_str}} +{% endif %} +

+ +{% if formsemestre.modalite == "EXT" %} +

+ Éditer les validations d'UE dans ce semestre extérieur +

+{% endif %} + +{# Place du diagramme radar #} +
+ + +
+
+ + diff --git a/app/templates/bul_head.html b/app/templates/bul_head.html index 12df3c4f8..d706ef9ae 100644 --- a/app/templates/bul_head.html +++ b/app/templates/bul_head.html @@ -2,9 +2,8 @@ {# L'en-tête des bulletins HTML #} {# was _formsemestre_bulletinetud_header_html #} - - - + {% if not is_apc %} - + {% endif %} - -
+
+
{% if not is_apc %}

{{etud.nomprenom}}

{% endif %}
- Bulletin + + + Bulletin + {{formsemestre.titre_mois()}} -
- - - - - - - -
établi le {{time.strftime("%d/%m/%Y à %Hh%M")}} (notes sur 20) - - - - - - -
{{menu_autres_operations|safe}}
-
{{formsemestre.titre_mois() + }} + +
+ établi le {{time.strftime("%d/%m/%Y à %Hh%M")}} (notes sur 20) + + + + + {{menu_autres_operations|safe}} + {{scu.ICON_PDF|safe}} -
+ +
-
{{etud.photo_html(title="fiche de " + etud["nom"])|safe}} -
+
diff --git a/app/templates/but/bulletin.html b/app/templates/but/bulletin.html index c3e8c834e..d394f255b 100644 --- a/app/templates/but/bulletin.html +++ b/app/templates/but/bulletin.html @@ -11,6 +11,9 @@ + +{% include 'bul_foot.html' %} +