From d3b1aaabd8f37dd6bd434e5faefc0dfafb841bcb Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Fri, 29 Dec 2023 04:11:37 +0100 Subject: [PATCH] =?UTF-8?q?Editeur=20partition:=20pas=20d'affichage=20conf?= =?UTF-8?q?ig=20EDT=20si=20EDT=20non=20configur=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/scodoc/sco_edt_cal.py | 5 +++ app/templates/scolar/partition_editor.j2 | 9 ++++ app/views/scolar.py | 54 +++++++++++++----------- 3 files changed, 43 insertions(+), 25 deletions(-) diff --git a/app/scodoc/sco_edt_cal.py b/app/scodoc/sco_edt_cal.py index e0a94e7d..6781f7fe 100644 --- a/app/scodoc/sco_edt_cal.py +++ b/app/scodoc/sco_edt_cal.py @@ -50,6 +50,11 @@ def get_ics_filename(edt_id: str) -> str | None: return edt_ics_path.format(edt_id=edt_id) +def is_edt_configured() -> bool: + "True si accès EDT configuré" + return bool(ScoDocSiteConfig.get("edt_ics_path")) + + def formsemestre_load_calendar( formsemestre: FormSemestre = None, edt_id: str = None ) -> tuple[bytes, icalendar.cal.Calendar]: diff --git a/app/templates/scolar/partition_editor.j2 b/app/templates/scolar/partition_editor.j2 index a8f3b83b..ef0e5345 100644 --- a/app/templates/scolar/partition_editor.j2 +++ b/app/templates/scolar/partition_editor.j2 @@ -1,4 +1,13 @@ {# -*- mode: jinja-html -*- #} + +{% if not is_edt_configured %} + +{% endif %} +

{% if not read_only %}Édition des p{% else %}P{%endif%}artitions

diff --git a/app/views/scolar.py b/app/views/scolar.py index c15766ce..78c69305 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -80,31 +80,34 @@ from app.scodoc.sco_exceptions import ( from app.scodoc.TrivialFormulator import DMY_REGEXP, TrivialFormulator, tf_error_message from app.scodoc.gen_tables import GenTable -from app.scodoc import html_sco_header -from app.scodoc import sco_import_etuds -from app.scodoc import sco_archives_etud -from app.scodoc import codes_cursus -from app.scodoc import sco_cache -from app.scodoc import sco_debouche -from app.scodoc import sco_dept -from app.scodoc import sco_dump_db -from app.scodoc import sco_etud -from app.scodoc import sco_find_etud -from app.scodoc import sco_formsemestre -from app.scodoc import sco_formsemestre_inscriptions -from app.scodoc import sco_groups -from app.scodoc import sco_groups_edit -from app.scodoc import sco_groups_exports -from app.scodoc import sco_groups_view -from app.scodoc import sco_page_etud -from app.scodoc import sco_permissions_check -from app.scodoc import sco_photos -from app.scodoc import sco_portal_apogee -from app.scodoc import sco_preferences -from app.scodoc import sco_synchro_etuds -from app.scodoc import sco_trombino -from app.scodoc import sco_trombino_tours -from app.scodoc import sco_up_to_date +from app.scodoc import ( + codes_cursus, + html_sco_header, + sco_import_etuds, + sco_archives_etud, + sco_cache, + sco_debouche, + sco_dept, + sco_dump_db, + sco_etud, + sco_edt_cal, + sco_find_etud, + sco_formsemestre, + sco_formsemestre_inscriptions, + sco_groups, + sco_groups_edit, + sco_groups_exports, + sco_groups_view, + sco_page_etud, + sco_permissions_check, + sco_photos, + sco_portal_apogee, + sco_preferences, + sco_synchro_etuds, + sco_trombino, + sco_trombino_tours, + sco_up_to_date, +) from app.tables import list_etuds @@ -935,6 +938,7 @@ def partition_editor(formsemestre_id: int, edit_partition=False): formsemestre=formsemestre, read_only=not formsemestre.can_change_groups(), edit_partition=edit_partition, + is_edt_configured=sco_edt_cal.is_edt_configured(), scu=scu, ), html_sco_header.sco_footer(),