Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
10 changed files with 98 additions and 58 deletions
Showing only changes of commit b841b2f708 - Show all commits

View File

@ -48,13 +48,16 @@ class BonusConfigurationForm(FlaskForm):
for (name, displayed_name) in ScoDocSiteConfig.get_bonus_sport_class_list() 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}) cancel_bonus = SubmitField("Annuler", render_kw={"formnovalidate": True})
class ScoDocConfigurationForm(FlaskForm): class ScoDocConfigurationForm(FlaskForm):
"Panneau de configuration avancée" "Panneau de configuration avancée"
enable_entreprises = BooleanField("activer le module <em>entreprises</em>") enable_entreprises = BooleanField("activer le module <em>entreprises</em>")
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( month_debut_annee_scolaire = SelectField(
label="Mois de début des années scolaires", label="Mois de début des années scolaires",
description="""Date pivot. En France métropolitaine, août. description="""Date pivot. En France métropolitaine, août.
@ -83,7 +86,7 @@ class ScoDocConfigurationForm(FlaskForm):
disable_bul_pdf = BooleanField( disable_bul_pdf = BooleanField(
"interdire les exports des bulletins en PDF (déconseillé)" "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}) cancel_scodoc = SubmitField("Annuler", render_kw={"formnovalidate": True})
@ -98,6 +101,7 @@ def configuration():
form_scodoc = ScoDocConfigurationForm( form_scodoc = ScoDocConfigurationForm(
data={ data={
"enable_entreprises": ScoDocSiteConfig.is_entreprises_enabled(), "enable_entreprises": ScoDocSiteConfig.is_entreprises_enabled(),
"disable_passerelle": ScoDocSiteConfig.is_passerelle_disabled(),
"month_debut_annee_scolaire": ScoDocSiteConfig.get_month_debut_annee_scolaire(), "month_debut_annee_scolaire": ScoDocSiteConfig.get_month_debut_annee_scolaire(),
"month_debut_periode2": ScoDocSiteConfig.get_month_debut_periode2(), "month_debut_periode2": ScoDocSiteConfig.get_month_debut_periode2(),
"email_from_addr": ScoDocSiteConfig.get("email_from_addr"), "email_from_addr": ScoDocSiteConfig.get("email_from_addr"),
@ -130,6 +134,13 @@ def configuration():
"Module entreprise " "Module entreprise "
+ ("activé" if form_scodoc.data["enable_entreprises"] else "désactivé") + ("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( if ScoDocSiteConfig.set_month_debut_annee_scolaire(
int(form_scodoc.data["month_debut_annee_scolaire"]) int(form_scodoc.data["month_debut_annee_scolaire"])
): ):

View File

@ -92,6 +92,7 @@ class ScoDocSiteConfig(db.Model):
"INSTITUTION_CITY": str, "INSTITUTION_CITY": str,
"DEFAULT_PDF_FOOTER_TEMPLATE": str, "DEFAULT_PDF_FOOTER_TEMPLATE": str,
"enable_entreprises": bool, "enable_entreprises": bool,
"disable_passerelle": bool, # remplace pref. bul_display_publication
"month_debut_annee_scolaire": int, "month_debut_annee_scolaire": int,
"month_debut_periode2": int, "month_debut_periode2": int,
"disable_bul_pdf": bool, "disable_bul_pdf": bool,
@ -244,6 +245,12 @@ class ScoDocSiteConfig(db.Model):
cfg = ScoDocSiteConfig.query.filter_by(name="enable_entreprises").first() cfg = ScoDocSiteConfig.query.filter_by(name="enable_entreprises").first()
return cfg is not None and cfg.value 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 @classmethod
def is_user_require_email_institutionnel_enabled(cls) -> bool: def is_user_require_email_institutionnel_enabled(cls) -> bool:
"""True si impose saisie email_institutionnel""" """True si impose saisie email_institutionnel"""
@ -263,6 +270,11 @@ class ScoDocSiteConfig(db.Model):
"""Active (ou déactive) le module entreprises. True si changement.""" """Active (ou déactive) le module entreprises. True si changement."""
return cls.set("enable_entreprises", "on" if enabled else "") 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 @classmethod
def disable_bul_pdf(cls, enabled=True) -> bool: def disable_bul_pdf(cls, enabled=True) -> bool:
"""Interdit (ou autorise) les exports PDF. True si changement.""" """Interdit (ou autorise) les exports PDF. True si changement."""

View File

@ -35,7 +35,7 @@ from flask_sqlalchemy.query import Query
import app import app
from app import log from app import log
from app.models import FormSemestre, ScolarNews from app.models import FormSemestre, ScolarNews, ScoDocSiteConfig
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from app.scodoc.gen_tables import GenTable from app.scodoc.gen_tables import GenTable
from app.scodoc.sco_permissions import Permission 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 = ( current_formsemestres_by_modalite, modalites = (
sco_modalites.group_formsemestres_by_modalite(current_formsemestres) sco_modalites.group_formsemestres_by_modalite(current_formsemestres)
) )
passerelle_disabled = ScoDocSiteConfig.is_passerelle_disabled()
return render_template( return render_template(
"scolar/index.j2", "scolar/index.j2",
current_user=current_user, current_user=current_user,
@ -95,6 +95,8 @@ def index_html(showcodes=0, showsemtable=0, export_table_formsemestres=False):
formsemestres=formsemestres, formsemestres=formsemestres,
groupicon=scu.icontag("groupicon_img", title="Inscrits", border="0"), groupicon=scu.icontag("groupicon_img", title="Inscrits", border="0"),
html_table_formsemestres=html_table_formsemestres, 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, locked_formsemestres=locked_formsemestres,
modalites=modalites, modalites=modalites,
nb_locked=locked_formsemestres.count(), nb_locked=locked_formsemestres.count(),
@ -175,9 +177,10 @@ def _sem_table_gt(formsemestres: Query, showcodes=False, fmt="html") -> GenTable
s["modalite"], s["modalite"],
) )
) )
columns_ids = ( columns_ids = ["lockimg"]
"lockimg", if not ScoDocSiteConfig.is_passerelle_disabled():
"published", columns_ids.append("published")
columns_ids += [
"dash_mois_fin", "dash_mois_fin",
"semestre_id_n", "semestre_id_n",
"modalite", "modalite",
@ -187,7 +190,7 @@ def _sem_table_gt(formsemestres: Query, showcodes=False, fmt="html") -> GenTable
"etapes_apo_str", "etapes_apo_str",
"elt_annee_apo", "elt_annee_apo",
"elt_sem_apo", "elt_sem_apo",
) ]
if showcodes: if showcodes:
columns_ids = ("formsemestre_id",) + columns_ids columns_ids = ("formsemestre_id",) + columns_ids

View File

@ -1601,18 +1601,6 @@ class BasePreferences:
"labels": ["non", "oui"], "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: # champs des bulletins PDF:
( (
"bul_pdf_title", "bul_pdf_title",

View File

@ -246,9 +246,11 @@ def _trombino_zip(groups_infos):
# Copy photos from portal to ScoDoc # 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)" "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) groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids)
breakpoint()
back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args
portal_url = sco_portal_apogee.get_portal_url() portal_url = sco_portal_apogee.get_portal_url()

View File

@ -1668,6 +1668,12 @@ def is_entreprises_enabled():
return ScoDocSiteConfig.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( def is_assiduites_module_forced(
formsemestre_id: int = None, dept_id: int = None formsemestre_id: int = None, dept_id: int = None
) -> bool: ) -> bool:

View File

@ -21,6 +21,13 @@
{% block app_content %} {% block app_content %}
<style>
div.config-generale div.scobox {
background-color: #e7e2ff;
}
</style>
<div class="config-generale">
<h1>Configuration générale</h1> <h1>Configuration générale</h1>
<div class="sco_help greenboldtext">Les paramètres donnés ici s'appliquent à tout ScoDoc (tous les départements).</div> <div class="sco_help greenboldtext">Les paramètres donnés ici s'appliquent à tout ScoDoc (tous les départements).</div>
@ -30,22 +37,24 @@ Heure: <b><tt>{{ time.strftime("%d/%m/%Y %H:%M") }}</tt></b>
</div> </div>
</div> </div>
<h2>ScoDoc</h2> <div class="scobox">
<form id="configuration_form_scodoc" class="sco-form" action="" method="post" enctype="multipart/form-data" novalidate> <div class="scobox-title">ScoDoc : paramètres généraux</div>
{{ form_scodoc.hidden_tag() }} <form id="configuration_form_scodoc" class="sco-form" action="" method="post" enctype="multipart/form-data" novalidate>
<div class="row"> {{ form_scodoc.hidden_tag() }}
<div class="col-md-8"> <div class="row">
{{ wtf.quick_form(form_scodoc) }} <div class="col-md-8">
{{ wtf.quick_form(form_scodoc) }}
</div>
</div> </div>
</div>
<div style="margin-top: 16px;"> <div style="margin-top: 16px;">
<a class="stdlink" href="{{url_for('scodoc.config_personalized_links')}}">Éditer des liens personnalisés</a> <a class="stdlink" href="{{url_for('scodoc.config_personalized_links')}}">Éditer des liens personnalisés</a>
</div> </div>
</form> </form>
</div>
<section> <div class="scobox">
<h2>Calcul des "bonus" définis par l'établissement</h2> <div class="scobox-title">Calcul des "bonus" définis par l'établissement</div>
<form id="configuration_form" class="sco-form" action="" method="post" enctype="multipart/form-data" novalidate> <form id="configuration_form" class="sco-form" action="" method="post" enctype="multipart/form-data" novalidate>
{{ form_bonus.hidden_tag() }} {{ form_bonus.hidden_tag() }}
<div class="row"> <div class="row">
@ -55,31 +64,31 @@ Heure: <b><tt>{{ time.strftime("%d/%m/%Y %H:%M") }}</tt></b>
</div> </div>
<div id="bonus_description"></div> <div id="bonus_description"></div>
</form> </form>
</div>
</section> <div class="scobox">
<div class="scobox-title">Gestion des images: logos, signatures, ...</div>
<section>
<h2>Gestion des images: logos, signatures, ...</h2>
<div class="sco_help">Ces images peuvent être intégrées dans les documents <div class="sco_help">Ces images peuvent être intégrées dans les documents
générés par ScoDoc: bulletins, PV, etc. générés par ScoDoc: bulletins, PV, etc.
</div> </div>
<p><a class="stdlink" href="{{url_for('scodoc.configure_logos')}}">Configuration des images et logos</a> <p><a class="stdlink" href="{{url_for('scodoc.configure_logos')}}">Configuration des images et logos</a>
</p> </p>
</section> </div>
<section> <div class="scobox">
<h2>Exports Apogée</h2> <div class="scobox-title">Exports Apogée</div>
<p><a class="stdlink" href="{{url_for('scodoc.config_codes_decisions')}}">Configuration des codes de décision</a> <p><a class="stdlink" href="{{url_for('scodoc.config_codes_decisions')}}">Configuration des codes de décision</a>
</p> </p>
</section> </div>
<section>
<h2>Assiduité et emplois du temps</h2> <div class="scobox">
<div class="scobox-title">Assiduité et emplois du temps</div>
<p><a class="stdlink" href="{{url_for('scodoc.config_assiduites')}}">Configuration du suivi de l'assiduité et accès aux emplois du temps</a> <p><a class="stdlink" href="{{url_for('scodoc.config_assiduites')}}">Configuration du suivi de l'assiduité et accès aux emplois du temps</a>
</p> </p>
</section> </div>
<h2>Utilisateurs, Rôles et CAS</h2> <div class="scobox">
<section> <div class="scobox-title">Utilisateurs, Rôles et CAS</div>
<div> <div>
🎎 <a class="stdlink" href="{{url_for('scodoc.config_roles')}}">Définition des rôles et permissions</a> 🎎 <a class="stdlink" href="{{url_for('scodoc.config_roles')}}">Définition des rôles et permissions</a>
</div> </div>
@ -95,13 +104,15 @@ Heure: <b><tt>{{ time.strftime("%d/%m/%Y %H:%M") }}</tt></b>
les permissions des rôles standards à leurs valeurs par défaut</a> les permissions des rôles standards à leurs valeurs par défaut</a>
(efface les modifications apportées aux rôles) (efface les modifications apportées aux rôles)
</div> </div>
</section> </div>
<h2>Protection des données et RGPD</h2> <div class="scobox">
<section> <div class="scobox-title">Protection des données et RGPD</div>
<div>📇 <a class="stdlink" href="{{url_for('scodoc.config_rgpd')}}">RGPD et données personnelles</a> <div>📇 <a class="stdlink" href="{{url_for('scodoc.config_rgpd')}}">RGPD et données personnelles</a>
</div> </div>
</section> </div>
</div>
{% endblock %} {% endblock %}

View File

@ -24,15 +24,15 @@
not sco.sem.etat %}<a href="{{url_for('notes.formsemestre_flip_lock', scodoc_dept=g.scodoc_dept, not sco.sem.etat %}<a href="{{url_for('notes.formsemestre_flip_lock', scodoc_dept=g.scodoc_dept,
formsemestre_id=sco.sem.id)}}">{{scu.icontag("lock_img", border="0", title="Semestre formsemestre_id=sco.sem.id)}}">{{scu.icontag("lock_img", border="0", title="Semestre
verrouillé")|safe}}</a>{% endif %}</span><span class="eye"> verrouillé")|safe}}</a>{% endif %}</span><span class="eye">
{% if sco.prefs["bul_display_publication"] %} {% if not scu.is_passerelle_disabled() %}
<a href="{{url_for('notes.formsemestre_change_publication_bul', scodoc_dept=g.scodoc_dept, <a href="{{url_for('notes.formsemestre_change_publication_bul', scodoc_dept=g.scodoc_dept,
formsemestre_id=sco.sem.id)}}"> formsemestre_id=sco.sem.id)}}">
{% if sco.sem.bul_hide_xml %} {% if sco.sem.bul_hide_xml %}
{{ scu.ICON_HIDDEN|safe}} {{ scu.ICON_HIDDEN|safe}}
{% else %} {% else %}
{{ scu.ICON_PUBLISHED|safe }} {{ scu.ICON_PUBLISHED|safe }}
{% endif %}
{% endif %} {% endif %}
{% endif %}
</span> </span>
</div> </div>

View File

@ -26,7 +26,9 @@
scu.icontag("lock_img", border="0", title="Semestre verrouillé")|safe scu.icontag("lock_img", border="0", title="Semestre verrouillé")|safe
}}</a> }}</a>
{%- endif -%} {%- endif -%}
</span><span class="eye"><a href="{{ </span>
{%-if not scu.is_passerelle_disabled()-%}
<span class="eye"><a href="{{
url_for('notes.formsemestre_change_publication_bul', url_for('notes.formsemestre_change_publication_bul',
scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre.id ) scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre.id )
}}">{%- }}">{%-
@ -36,6 +38,7 @@
{{scu.ICON_PUBLISHED|safe}} {{scu.ICON_PUBLISHED|safe}}
{%- endif -%} {%- endif -%}
</a></span> </a></span>
{%- endif -%}
</div> </div>
{{sem_menu_bar|safe}} {{sem_menu_bar|safe}}
</div> </div>

View File

@ -87,7 +87,7 @@ div.modalite {
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
} }
span.effectif { div.effectif {
display: inline-block; display: inline-block;
min-width: 24px; min-width: 24px;
text-align: right; text-align: right;
@ -119,6 +119,9 @@ span.effectif {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.left-section img:nth-child(2) {
margin-left: 8px;
}
.date { .date {
display: flex; display: flex;
@ -186,6 +189,7 @@ span.effectif {
<div class="cur-formsemestre {{'new-sem' if loop.first or formsemestre.semestre_id != loop.previtem.semestre_id}}"> <div class="cur-formsemestre {{'new-sem' if loop.first or formsemestre.semestre_id != loop.previtem.semestre_id}}">
<div class="left-section"> <div class="left-section">
{{groupicon|safe if formsemestre.inscriptions|length else emptygroupicon|safe}} {{groupicon|safe if formsemestre.inscriptions|length else emptygroupicon|safe}}
{{icon_hidden|safe if formsemestre.bul_hide_xml else icon_published|safe }}
<div class="date"> <div class="date">
<div class="date-begin"><a title="{{formsemestre.session_id()}}">{{formsemestre.mois_debut()}}</a></div> <div class="date-begin"><a title="{{formsemestre.session_id()}}">{{formsemestre.mois_debut()}}</a></div>
<div class="date-end">{{formsemestre.mois_fin()}}</div> <div class="date-end">{{formsemestre.mois_fin()}}</div>