From b841b2f708772a3dffeb1e91bf72fb87e4e164fa Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 27 Mar 2024 16:27:45 +0100 Subject: [PATCH] =?UTF-8?q?Remplace=20pr=C3=A9f=C3=A9rence=20d=C3=A9pt.=20?= =?UTF-8?q?bul=5Fdisplay=5Fpublication=20par=20param=C3=A8tre=20global:=20?= =?UTF-8?q?passerelle=5Fdisabled=20+=20cosmetic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/forms/main/config_main.py | 15 ++++- app/models/config.py | 12 ++++ app/scodoc/sco_dept.py | 15 +++-- app/scodoc/sco_preferences.py | 12 ---- app/scodoc/sco_trombino.py | 4 +- app/scodoc/sco_utils.py | 6 ++ app/templates/configuration.j2 | 71 ++++++++++++++---------- app/templates/formsemestre_header.j2 | 10 ++-- app/templates/formsemestre_page_title.j2 | 5 +- app/templates/scolar/index.j2 | 6 +- 10 files changed, 98 insertions(+), 58 deletions(-) diff --git a/app/forms/main/config_main.py b/app/forms/main/config_main.py index 1b2c131c..21437249 100644 --- a/app/forms/main/config_main.py +++ b/app/forms/main/config_main.py @@ -48,13 +48,16 @@ class BonusConfigurationForm(FlaskForm): for (name, displayed_name) in ScoDocSiteConfig.get_bonus_sport_class_list() ], ) - submit_bonus = SubmitField("Valider") + submit_bonus = SubmitField("Enregistrer ce bonus") cancel_bonus = SubmitField("Annuler", render_kw={"formnovalidate": True}) class ScoDocConfigurationForm(FlaskForm): "Panneau de configuration avancée" enable_entreprises = BooleanField("activer le module entreprises") + disable_passerelle = BooleanField( # disable car par défaut activée + """cacher les fonctions liées à une passerelle de publication des résultats vers les étudiants ("œil"). N'affecte pas l'API, juste la présentation.""" + ) month_debut_annee_scolaire = SelectField( label="Mois de début des années scolaires", description="""Date pivot. En France métropolitaine, août. @@ -83,7 +86,7 @@ class ScoDocConfigurationForm(FlaskForm): disable_bul_pdf = BooleanField( "interdire les exports des bulletins en PDF (déconseillé)" ) - submit_scodoc = SubmitField("Valider") + submit_scodoc = SubmitField("Enregistrer ces paramètres") cancel_scodoc = SubmitField("Annuler", render_kw={"formnovalidate": True}) @@ -98,6 +101,7 @@ def configuration(): form_scodoc = ScoDocConfigurationForm( data={ "enable_entreprises": ScoDocSiteConfig.is_entreprises_enabled(), + "disable_passerelle": ScoDocSiteConfig.is_passerelle_disabled(), "month_debut_annee_scolaire": ScoDocSiteConfig.get_month_debut_annee_scolaire(), "month_debut_periode2": ScoDocSiteConfig.get_month_debut_periode2(), "email_from_addr": ScoDocSiteConfig.get("email_from_addr"), @@ -130,6 +134,13 @@ def configuration(): "Module entreprise " + ("activé" if form_scodoc.data["enable_entreprises"] else "désactivé") ) + if ScoDocSiteConfig.disable_passerelle( + disabled=form_scodoc.data["disable_passerelle"] + ): + flash( + "Fonction passerelle " + + ("cachées" if form_scodoc.data["disable_passerelle"] else "montrées") + ) if ScoDocSiteConfig.set_month_debut_annee_scolaire( int(form_scodoc.data["month_debut_annee_scolaire"]) ): diff --git a/app/models/config.py b/app/models/config.py index 7429926d..63892c2b 100644 --- a/app/models/config.py +++ b/app/models/config.py @@ -92,6 +92,7 @@ class ScoDocSiteConfig(db.Model): "INSTITUTION_CITY": str, "DEFAULT_PDF_FOOTER_TEMPLATE": str, "enable_entreprises": bool, + "disable_passerelle": bool, # remplace pref. bul_display_publication "month_debut_annee_scolaire": int, "month_debut_periode2": int, "disable_bul_pdf": bool, @@ -244,6 +245,12 @@ class ScoDocSiteConfig(db.Model): cfg = ScoDocSiteConfig.query.filter_by(name="enable_entreprises").first() return cfg is not None and cfg.value + @classmethod + def is_passerelle_disabled(cls): + """True si on doit cacher les fonctions passerelle ("oeil").""" + cfg = ScoDocSiteConfig.query.filter_by(name="disable_passerelle").first() + return cfg is not None and cfg.value + @classmethod def is_user_require_email_institutionnel_enabled(cls) -> bool: """True si impose saisie email_institutionnel""" @@ -263,6 +270,11 @@ class ScoDocSiteConfig(db.Model): """Active (ou déactive) le module entreprises. True si changement.""" return cls.set("enable_entreprises", "on" if enabled else "") + @classmethod + def disable_passerelle(cls, disabled: bool = True) -> bool: + """Désactive (ou active) les fonctions liées à la présence d'une passerelle. True si changement.""" + return cls.set("disable_passerelle", "on" if disabled else "") + @classmethod def disable_bul_pdf(cls, enabled=True) -> bool: """Interdit (ou autorise) les exports PDF. True si changement.""" diff --git a/app/scodoc/sco_dept.py b/app/scodoc/sco_dept.py index fda86ac4..a3815bbb 100644 --- a/app/scodoc/sco_dept.py +++ b/app/scodoc/sco_dept.py @@ -35,7 +35,7 @@ from flask_sqlalchemy.query import Query import app from app import log -from app.models import FormSemestre, ScolarNews +from app.models import FormSemestre, ScolarNews, ScoDocSiteConfig import app.scodoc.sco_utils as scu from app.scodoc.gen_tables import GenTable from app.scodoc.sco_permissions import Permission @@ -82,7 +82,7 @@ def index_html(showcodes=0, showsemtable=0, export_table_formsemestres=False): current_formsemestres_by_modalite, modalites = ( sco_modalites.group_formsemestres_by_modalite(current_formsemestres) ) - + passerelle_disabled = ScoDocSiteConfig.is_passerelle_disabled() return render_template( "scolar/index.j2", current_user=current_user, @@ -95,6 +95,8 @@ def index_html(showcodes=0, showsemtable=0, export_table_formsemestres=False): formsemestres=formsemestres, groupicon=scu.icontag("groupicon_img", title="Inscrits", border="0"), html_table_formsemestres=html_table_formsemestres, + icon_hidden="" if passerelle_disabled else scu.ICON_HIDDEN, + icon_published="" if passerelle_disabled else scu.ICON_PUBLISHED, locked_formsemestres=locked_formsemestres, modalites=modalites, nb_locked=locked_formsemestres.count(), @@ -175,9 +177,10 @@ def _sem_table_gt(formsemestres: Query, showcodes=False, fmt="html") -> GenTable s["modalite"], ) ) - columns_ids = ( - "lockimg", - "published", + columns_ids = ["lockimg"] + if not ScoDocSiteConfig.is_passerelle_disabled(): + columns_ids.append("published") + columns_ids += [ "dash_mois_fin", "semestre_id_n", "modalite", @@ -187,7 +190,7 @@ def _sem_table_gt(formsemestres: Query, showcodes=False, fmt="html") -> GenTable "etapes_apo_str", "elt_annee_apo", "elt_sem_apo", - ) + ] if showcodes: columns_ids = ("formsemestre_id",) + columns_ids diff --git a/app/scodoc/sco_preferences.py b/app/scodoc/sco_preferences.py index a79c274c..abe90f81 100644 --- a/app/scodoc/sco_preferences.py +++ b/app/scodoc/sco_preferences.py @@ -1601,18 +1601,6 @@ class BasePreferences: "labels": ["non", "oui"], }, ), - ( - "bul_display_publication", - { - "initvalue": 1, - "title": "Afficher icône indiquant si les bulletins sont publiés", - "explanation": "décocher si vous n'avez pas de passerelle ou portail étudiant publiant les bulletins", - "input_type": "boolcheckbox", - "labels": ["non", "oui"], - "category": "bul", - "only_global": False, - }, - ), # champs des bulletins PDF: ( "bul_pdf_title", diff --git a/app/scodoc/sco_trombino.py b/app/scodoc/sco_trombino.py index a77e6ec3..29dc772d 100644 --- a/app/scodoc/sco_trombino.py +++ b/app/scodoc/sco_trombino.py @@ -246,9 +246,11 @@ def _trombino_zip(groups_infos): # Copy photos from portal to ScoDoc -def trombino_copy_photos(group_ids=[], dialog_confirmed=False): +def trombino_copy_photos(group_ids=None, dialog_confirmed=False): "Copy photos from portal to ScoDoc (overwriting local copy)" + group_ids = [] if group_ids is None else group_ids groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids) + breakpoint() back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args portal_url = sco_portal_apogee.get_portal_url() diff --git a/app/scodoc/sco_utils.py b/app/scodoc/sco_utils.py index fa2ae54a..b0ae6ed5 100644 --- a/app/scodoc/sco_utils.py +++ b/app/scodoc/sco_utils.py @@ -1668,6 +1668,12 @@ def is_entreprises_enabled(): return ScoDocSiteConfig.is_entreprises_enabled() +def is_passerelle_disabled(): + from app.models import ScoDocSiteConfig + + return ScoDocSiteConfig.is_passerelle_disabled() + + def is_assiduites_module_forced( formsemestre_id: int = None, dept_id: int = None ) -> bool: diff --git a/app/templates/configuration.j2 b/app/templates/configuration.j2 index dfe87597..31a0410b 100644 --- a/app/templates/configuration.j2 +++ b/app/templates/configuration.j2 @@ -21,6 +21,13 @@ {% block app_content %} + + +

Configuration générale

Les paramètres donnés ici s'appliquent à tout ScoDoc (tous les départements).
@@ -30,22 +37,24 @@ Heure: {{ time.strftime("%d/%m/%Y %H:%M") }}
-

ScoDoc

-
- {{ form_scodoc.hidden_tag() }} -
-
- {{ wtf.quick_form(form_scodoc) }} +
+
ScoDoc : paramètres généraux
+ + {{ form_scodoc.hidden_tag() }} +
+
+ {{ wtf.quick_form(form_scodoc) }} +
-
-
- Éditer des liens personnalisés -
- +
+ Éditer des liens personnalisés +
+ +
-
-

Calcul des "bonus" définis par l'établissement

+
+
Calcul des "bonus" définis par l'établissement
{{ form_bonus.hidden_tag() }}
@@ -55,31 +64,31 @@ Heure: {{ time.strftime("%d/%m/%Y %H:%M") }}
+
-
- -
-

Gestion des images: logos, signatures, ...

+
+
Gestion des images: logos, signatures, ...
Ces images peuvent être intégrées dans les documents générés par ScoDoc: bulletins, PV, etc.

Configuration des images et logos

-
+
-
-

Exports Apogée

+
-
-

Assiduité et emplois du temps

+ + +
+ -

Utilisateurs, Rôles et CAS

-
+
+
Utilisateurs, Rôles et CAS
🎎 Définition des rôles et permissions
@@ -95,13 +104,15 @@ Heure: {{ time.strftime("%d/%m/%Y %H:%M") }} les permissions des rôles standards à leurs valeurs par défaut (efface les modifications apportées aux rôles)
-
+ -

Protection des données et RGPD

-
+
+
Protection des données et RGPD
📇 RGPD et données personnelles
-
+ + + {% endblock %} diff --git a/app/templates/formsemestre_header.j2 b/app/templates/formsemestre_header.j2 index dad4565a..1d8c7cdf 100644 --- a/app/templates/formsemestre_header.j2 +++ b/app/templates/formsemestre_header.j2 @@ -24,15 +24,15 @@ not sco.sem.etat %}{{scu.icontag("lock_img", border="0", title="Semestre verrouillé")|safe}}{% endif %} - {% if sco.prefs["bul_display_publication"] %} - {% if sco.sem.bul_hide_xml %} - {{ scu.ICON_HIDDEN|safe}} + {{ scu.ICON_HIDDEN|safe}} {% else %} - {{ scu.ICON_PUBLISHED|safe }} - {% endif %} + {{ scu.ICON_PUBLISHED|safe }} {% endif %} + {% endif %} diff --git a/app/templates/formsemestre_page_title.j2 b/app/templates/formsemestre_page_title.j2 index d90cde88..1d6f4f1f 100644 --- a/app/templates/formsemestre_page_title.j2 +++ b/app/templates/formsemestre_page_title.j2 @@ -26,7 +26,9 @@ scu.icontag("lock_img", border="0", title="Semestre verrouillé")|safe }} {%- endif -%} - {%- @@ -36,6 +38,7 @@ {{scu.ICON_PUBLISHED|safe}} {%- endif -%} + {%- endif -%} {{sem_menu_bar|safe}} \ No newline at end of file diff --git a/app/templates/scolar/index.j2 b/app/templates/scolar/index.j2 index 0e151691..74cd8a42 100644 --- a/app/templates/scolar/index.j2 +++ b/app/templates/scolar/index.j2 @@ -87,7 +87,7 @@ div.modalite { font-size: 16px; font-weight: bold; } -span.effectif { +div.effectif { display: inline-block; min-width: 24px; text-align: right; @@ -119,6 +119,9 @@ span.effectif { display: flex; align-items: center; } +.left-section img:nth-child(2) { + margin-left: 8px; +} .date { display: flex; @@ -186,6 +189,7 @@ span.effectif {
{{groupicon|safe if formsemestre.inscriptions|length else emptygroupicon|safe}} + {{icon_hidden|safe if formsemestre.bul_hide_xml else icon_published|safe }}
{{formsemestre.mois_fin()}}