diff --git a/app/forms/main/config_main.py b/app/forms/main/config_main.py index 1b2c131c7..214372494 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 7429926d8..63892c2be 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 fda86ac4c..a3815bbb9 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 a79c274c8..abe90f819 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 a77e6ec31..29dc772d8 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 fa2ae54a7..b0ae6ed57 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 dfe875976..31a0410b2 100644 --- a/app/templates/configuration.j2 +++ b/app/templates/configuration.j2 @@ -21,6 +21,13 @@ {% block app_content %} + + +