From 37a8b3bb0bbf04cd8feb54d258beed27cfbd8acf Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Sun, 2 Oct 2022 23:43:29 +0200 Subject: [PATCH] =?UTF-8?q?Edition=20pr=C3=A9f=C3=A9rences:=20sections=20d?= =?UTF-8?q?=C3=A9pliables.=20+=20Code=20cleaning.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/but/jury_but_pv.py | 2 +- app/pe/pe_avislatex.py | 2 +- app/pe/pe_view.py | 4 +- app/scodoc/TrivialFormulator.py | 48 ++++++++++++++---- app/scodoc/html_sco_header.py | 4 +- app/scodoc/html_sidebar.py | 18 +++---- app/scodoc/safehtml.py | 2 +- app/scodoc/sco_abs_views.py | 14 +++--- app/scodoc/sco_apogee_csv.py | 4 +- app/scodoc/sco_archives_etud.py | 2 +- app/scodoc/sco_bulletins_generator.py | 2 +- app/scodoc/sco_cost_formation.py | 10 ++-- app/scodoc/sco_dept.py | 2 +- app/scodoc/sco_etape_bilan.py | 16 +++--- app/scodoc/sco_etud.py | 2 +- app/scodoc/sco_evaluation_check_abs.py | 2 +- app/scodoc/sco_find_etud.py | 2 +- app/scodoc/sco_formsemestre_edit.py | 2 +- app/scodoc/sco_formsemestre_inscriptions.py | 2 +- app/scodoc/sco_formsemestre_validation.py | 4 +- app/scodoc/sco_import_etuds.py | 2 +- app/scodoc/sco_import_users.py | 2 +- app/scodoc/sco_liste_notes.py | 16 +++--- app/scodoc/sco_lycee.py | 2 +- app/scodoc/sco_moduleimpl_inscriptions.py | 2 +- app/scodoc/sco_page_etud.py | 6 +-- app/scodoc/sco_placement.py | 2 +- app/scodoc/sco_preferences.py | 55 +++++++++++++-------- app/scodoc/sco_pvpdf.py | 12 ++--- app/scodoc/sco_report.py | 4 +- app/scodoc/sco_saisie_notes.py | 2 +- app/scodoc/sco_semset.py | 9 ++-- app/scodoc/sco_synchro_etuds.py | 2 +- app/scodoc/sco_trombino.py | 2 +- app/scodoc/sco_ue_external.py | 2 +- app/scodoc/sco_users.py | 2 +- app/static/css/scodoc.css | 11 ++++- app/views/absences.py | 10 ++-- app/views/notes.py | 10 ++-- app/views/scolar.py | 6 +-- app/views/users.py | 2 +- 41 files changed, 178 insertions(+), 127 deletions(-) diff --git a/app/but/jury_but_pv.py b/app/but/jury_but_pv.py index 78d8d4de..2940345e 100644 --- a/app/but/jury_but_pv.py +++ b/app/but/jury_but_pv.py @@ -47,7 +47,7 @@ def pvjury_table_but(formsemestre_id: int, format="html"): title = "Procès-verbal de jury BUT annuel" if format == "html": - line_sep = "
" + line_sep = "
" else: line_sep = "\n" # remplace pour le BUT la fonction sco_pvjury.pvjury_table diff --git a/app/pe/pe_avislatex.py b/app/pe/pe_avislatex.py index fc64253c..5a507738 100644 --- a/app/pe/pe_avislatex.py +++ b/app/pe/pe_avislatex.py @@ -253,7 +253,7 @@ def get_annotation_PE(etudid, tag_annotation_pe): ) # Suppression du tag d'annotation PE annotationPE = annotationPE.replace("\r", "") # Suppression des \r annotationPE = annotationPE.replace( - "
", "\n\n" + "
", "\n\n" ) # Interprète les retours chariots html return annotationPE return "" # pas d'annotations diff --git a/app/pe/pe_view.py b/app/pe/pe_view.py index ba129f7b..06302cd8 100644 --- a/app/pe/pe_view.py +++ b/app/pe/pe_view.py @@ -55,7 +55,7 @@ def _pe_view_sem_recap_form(formsemestre_id):

Cette fonction génère un ensemble de fichiers permettant d'éditer des avis de poursuites d'études. -
+
De nombreux aspects sont paramétrables: voir la documentation. @@ -65,7 +65,7 @@ def _pe_view_sem_recap_form(formsemestre_id):

Les templates sont généralement installés sur le serveur ou dans le paramétrage de ScoDoc. -
+
Au besoin, vous pouvez spécifier ici votre propre fichier de template (un_avis.tex):
Template: diff --git a/app/scodoc/TrivialFormulator.py b/app/scodoc/TrivialFormulator.py index 0920ab0e..f3c768a2 100644 --- a/app/scodoc/TrivialFormulator.py +++ b/app/scodoc/TrivialFormulator.py @@ -38,6 +38,9 @@ def TrivialFormulator( html_foot_markup="", readonly=False, is_submitted=False, + title="", + after_table="", + before_table="{title}", ): """ form_url : URL for this form @@ -74,7 +77,8 @@ def TrivialFormulator( HTML elements: input_type : 'text', 'textarea', 'password', 'radio', 'menu', 'checkbox', - 'hidden', 'separator', 'file', 'date', 'datedmy' (avec validation), + 'hidden', 'separator', 'table_separator', + 'file', 'date', 'datedmy' (avec validation), 'boolcheckbox', 'text_suggest', 'color' (default text) @@ -111,6 +115,9 @@ def TrivialFormulator( html_foot_markup=html_foot_markup, readonly=readonly, is_submitted=is_submitted, + title=title, + after_table=after_table, + before_table=before_table, ) form = t.getform() if t.canceled(): @@ -144,6 +151,9 @@ class TF(object): html_foot_markup="", # html snippet put at the end, just after the table readonly=False, is_submitted=False, + title="", + after_table="", + before_table="{title}", ): self.form_url = form_url self.values = values.copy() @@ -165,6 +175,9 @@ class TF(object): self.top_buttons = top_buttons self.bottom_buttons = bottom_buttons self.html_foot_markup = html_foot_markup + self.title = title + self.after_table = after_table + self.before_table = before_table self.readonly = readonly self.result = None self.is_submitted = is_submitted @@ -426,6 +439,7 @@ class TF(object): R.append('' % self.formid) if self.top_buttons: R.append(buttons_markup + "

") + R.append(self.before_table.format(title=self.title)) R.append('') for field, descr in self.formdescription: if descr.get("readonly", False): @@ -453,6 +467,16 @@ class TF(object): etempl = separatortemplate R.append(etempl % {"label": title, "item_dom_attr": item_dom_attr}) continue + elif input_type == "table_separator": + etempl = "" + # Table ouverte ? + if len([p for p in R if " len( + [p for p in R if "{self.after_table}""") + R.append( + f"""{self.before_table.format(title=descr.get("title", ""))}
""" + ) else: etempl = itemtemplate lab = [] @@ -610,7 +634,7 @@ class TF(object): '' % (field, wid, values[field], attribs) ) - elif input_type == "separator": + elif (input_type == "separator") or (input_type == "table_separator"): pass elif input_type == "file": lem.append( @@ -641,13 +665,15 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts); ) lem.append(('value="%(' + field + ')s" >') % values) else: - raise ValueError("unkown input_type for form (%s)!" % input_type) + raise ValueError(f"unkown input_type for form ({input_type})!") explanation = descr.get("explanation", "") if explanation: - lem.append('%s' % explanation) + lem.append(f"""{explanation}""") comment = descr.get("comment", "") if comment: - lem.append('
%s' % comment) + if (input_type != "checkbox") and (input_type != "boolcheckbox"): + lem.append("
") + lem.append(f"""{comment}""") R.append( etempl % { @@ -657,11 +683,11 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts); } ) R.append("
") - + R.append(self.after_table) R.append(self.html_foot_markup) if self.bottom_buttons: - R.append("
" + buttons_markup) + R.append("
" + buttons_markup) if add_no_enter_js: R.append( @@ -753,7 +779,7 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts); if input_type == "separator": # separator R.append('%s' % title) - else: + elif input_type != "table_separator": R.append('' % klass) R.append("%s" % title) R.append('' % klass) @@ -786,7 +812,11 @@ var {field}_as = new bsn.AutoSuggest('{field}', {field}_opts); R.append( '
%s
' % html.escape(self.values[field]) ) - elif input_type == "separator" or input_type == "hidden": + elif ( + input_type == "separator" + or input_type == "hidden" + or input_type == "table_separator" + ): pass elif input_type == "file": R.append("'%s'" % self.values[field]) diff --git a/app/scodoc/html_sco_header.py b/app/scodoc/html_sco_header.py index 0b2a3d58..409e4d13 100644 --- a/app/scodoc/html_sco_header.py +++ b/app/scodoc/html_sco_header.py @@ -284,8 +284,8 @@ def sco_header( if current_user.passwd_temp: H.append( f"""
- Attention !
- Vous avez reçu un mot de passe temporaire.
+ Attention !
+ Vous avez reçu un mot de passe temporaire.
Vous devez le changer: cliquez ici
""" ) diff --git a/app/scodoc/html_sidebar.py b/app/scodoc/html_sidebar.py index 5b578d68..45497ff2 100644 --- a/app/scodoc/html_sidebar.py +++ b/app/scodoc/html_sidebar.py @@ -48,26 +48,26 @@ def sidebar_common(): url_for("users.user_info_page", scodoc_dept=g.scodoc_dept, user_name=current_user.user_name) }">{current_user.user_name} -
déconnexion +
déconnexion
{sidebar_dept()}

Scolarité

- Semestres
- Programmes
- Absences
+ Semestres
+ Programmes
+ Absences
""" ] if current_user.has_permission( Permission.ScoUsersAdmin ) or current_user.has_permission(Permission.ScoUsersView): H.append( - f"""Utilisateurs
""" + f"""Utilisateurs
""" ) if current_user.has_permission(Permission.ScoChangePreferences): H.append( f"""Paramétrage
""" + class="sidebar">Paramétrage
""" ) return "".join(H) @@ -84,7 +84,7 @@ def sidebar(etudid: int = None): H = [ f"""