diff --git a/app/scodoc/sco_archives_etud.py b/app/scodoc/sco_archives_etud.py index b7ff7d32..0067be0a 100644 --- a/app/scodoc/sco_archives_etud.py +++ b/app/scodoc/sco_archives_etud.py @@ -358,7 +358,7 @@ def etudarchive_import_files( unmatched_files=unmatched_files, stored_etud_filename=stored_etud_filename, next_page=url_for( - "scolar.groups_view", + "scolar.groups_feuilles", scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre_id, ), diff --git a/app/scodoc/sco_formsemestre_status.py b/app/scodoc/sco_formsemestre_status.py index 6b5d1a3a..5f3d69ce 100755 --- a/app/scodoc/sco_formsemestre_status.py +++ b/app/scodoc/sco_formsemestre_status.py @@ -335,7 +335,7 @@ def formsemestre_status_menubar(formsemestre: FormSemestre | None) -> str: }, { "title": "Exporter table des étudiants", - "endpoint": "scolar.groups_view", + "endpoint": "scolar.groups_lists", "args": { "fmt": "allxls", "group_ids": sco_groups.get_default_group( @@ -354,12 +354,26 @@ def formsemestre_status_menubar(formsemestre: FormSemestre | None) -> str: can_change_groups = formsemestre.can_change_groups() menu_groupes = [ { - "title": "Listes, photos, feuilles...", - "endpoint": "scolar.groups_view", + "title": "Listes des groupes", + "endpoint": "scolar.groups_lists", "args": {"formsemestre_id": formsemestre_id}, "enabled": True, "helpmsg": "Accès aux listes des groupes d'étudiants", }, + { + "title": "Trombinoscopes", + "endpoint": "scolar.groups_photos", + "args": {"formsemestre_id": formsemestre_id}, + "enabled": True, + "helpmsg": "Accès aux photos des groupes d'étudiants", + }, + { + "title": "Assiduité, feuilles d'appel, ...", + "endpoint": "scolar.groups_feuilles", + "args": {"formsemestre_id": formsemestre_id}, + "enabled": True, + "helpmsg": "Accès aux feuilles d'appel des groupes d'étudiants", + }, { "title": "Modifier groupes et partitions", "endpoint": "scolar.partition_editor", @@ -826,7 +840,7 @@ def _make_listes_sem(formsemestre: FormSemestre) -> str:
- span.warning_unauthorized {{ - color: pink; - font-style: italic; - margin-left: 12px; - }} - -
- - {form_groups_choice(groups_infos, submit_on_change=True)} - - -
-
- { - groups_table( - groups_infos=groups_infos, - fmt=fmt, - with_codes=with_codes, - etat=etat, - with_paiement=with_paiement, - with_archives=with_archives, - with_annotations=with_annotations, - with_bourse=with_bourse, - ) - } -
-
- { tab_photos_html(groups_infos, etat=etat) } -
-
- { tab_absences_html(groups_infos, etat=etat) } -
-
-
+ return render_template( + "formsemestre/groups_lists.j2", + form_groups_choice=form_groups_choice(groups_infos, submit_on_change=True), + groups_table=groups_table( + groups_infos=groups_infos, + fmt=fmt, + with_codes=with_codes, + etat=etat, + with_paiement=with_paiement, + with_archives=with_archives, + with_annotations=with_annotations, + with_bourse=with_bourse, + ), + groups_titles=groups_infos.groups_titles, + ) - { html_sco_header.sco_footer() } + +# view +def groups_photos(group_ids=(), etat=None, formsemestre_id=None): + """Affichage des photos des étudiants (trombi) des groupes indiqués + group_ids: liste de group_id + formsemestre_id est utilisé si aucun groupe selectionné pour construire la liste des groupes. """ + groups_infos = DisplayedGroupsInfos( + group_ids, + formsemestre_id=formsemestre_id, + select_all_when_unspecified=True, + ) + return render_template( + "formsemestre/groups_photos.j2", + form_groups_choice=form_groups_choice(groups_infos, submit_on_change=True), + tab_photos_html=tab_photos_html(groups_infos, etat=etat), + groups_titles=groups_infos.groups_titles, + ) + + +def groups_feuilles(group_ids=(), etat=None, formsemestre_id=None): + """Affichage des feuilles d'appel des groupes indiqués + group_ids: liste de group_id + formsemestre_id est utilisé si aucun groupe selectionné pour construire la liste des groupes. + """ + groups_infos = DisplayedGroupsInfos( + group_ids, + formsemestre_id=formsemestre_id, + select_all_when_unspecified=True, + ) + return render_template( + "formsemestre/groups_feuilles.j2", + form_groups_choice=form_groups_choice(groups_infos, submit_on_change=True), + tab_absences_html=tab_absences_html(groups_infos, etat=etat), + groups_titles=groups_infos.groups_titles, + ) def form_groups_choice( diff --git a/app/scodoc/sco_page_etud.py b/app/scodoc/sco_page_etud.py index c2f604c3..5250af77 100644 --- a/app/scodoc/sco_page_etud.py +++ b/app/scodoc/sco_page_etud.py @@ -254,7 +254,7 @@ def fiche_etud(etudid=None): grlinks.append( f"""
{gr_name} """ diff --git a/app/scodoc/sco_trombino.py b/app/scodoc/sco_trombino.py index 7431609b..3ed60ec1 100644 --- a/app/scodoc/sco_trombino.py +++ b/app/scodoc/sco_trombino.py @@ -208,8 +208,7 @@ def check_local_photos_availability(groups_infos, fmt=""): >exporter seulement les photos existantes""", dest_url="trombino", OK="Exporter seulement les photos existantes", - cancel_url="groups_view?curtab=tab-photos&" - + groups_infos.groups_query_args, + cancel_url="groups_photos?" + groups_infos.groups_query_args, parameters=parameters, ), ) @@ -249,7 +248,7 @@ 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) - back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args + back_url = "groups_photos?" + str(groups_infos.groups_query_args) portal_url = sco_portal_apogee.get_portal_url() header = html_sco_header.sco_header(page_title="Chargement des photos") @@ -504,7 +503,7 @@ def photos_import_files_form(group_ids=()): if not group_ids: raise ScoValueError("paramètre manquant !") groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids) - back_url = f"groups_view?{groups_infos.groups_query_args}&curtab=tab-photos" + back_url = f"groups_photos?{groups_infos.groups_query_args}" H = [ html_sco_header.sco_header(page_title="Import des photos des étudiants"), @@ -567,10 +566,9 @@ def photos_import_files_form(group_ids=()): unmatched_files=unmatched_files, stored_etud_filename=stored_etud_filename, next_page=url_for( - "scolar.groups_view", + "scolar.groups_photos", scodoc_dept=g.scodoc_dept, formsemestre_id=groups_infos.formsemestre_id, - curtab="tab-photos", ), ) diff --git a/app/static/js/groups_view.js b/app/static/js/groups_view.js index 29517a32..7f16a580 100644 --- a/app/static/js/groups_view.js +++ b/app/static/js/groups_view.js @@ -20,11 +20,6 @@ function groups_view_url() { "formsemestre_id", $("#group_selector")[0].formsemestre_id.value ); - // ajout du tab actif - const tabActif = document.querySelector( - '[role="tab"][aria-selected="true"]' - ).id; - urlParams.set("tab", tabActif); urlParams.delete("group_ids"); // ajout des groupes selectionnes var selected_groups = document.getElementById("group_ids_sel").value; diff --git a/app/templates/formsemestre/groups_feuilles.j2 b/app/templates/formsemestre/groups_feuilles.j2 new file mode 100644 index 00000000..2565ca0f --- /dev/null +++ b/app/templates/formsemestre/groups_feuilles.j2 @@ -0,0 +1,27 @@ +{# Trombinoscope HTML #} + +{% extends "sco_page.j2" %} + + +{% block title %} + Feuilles {{groups_titles}} +{% endblock title %} + + +{% block app_content %} +
+ + {{form_groups_choice|safe}} + +
+ {{tab_absences_html|safe}} +
+
+ +{% endblock %} + + +{% block scripts %} + {{ super() }} + +{% endblock %} diff --git a/app/templates/formsemestre/groups_lists.j2 b/app/templates/formsemestre/groups_lists.j2 new file mode 100644 index 00000000..eeb0fdd1 --- /dev/null +++ b/app/templates/formsemestre/groups_lists.j2 @@ -0,0 +1,37 @@ +{# Liste des membres d'un ou plusieurs groupes #} + +{% extends "sco_page.j2" %} + +{% block styles %} + {{ super() }} + +{% endblock styles %} + + + +{% block title %} + {{groups_titles}} +{% endblock title %} + +{% block app_content %} +
+ + {{form_groups_choice|safe}} + +
+ {{groups_table|safe}} +
+
+{% endblock %} + + +{% block scripts %} + {{ super() }} + +{% endblock %} diff --git a/app/templates/formsemestre/groups_photos.j2 b/app/templates/formsemestre/groups_photos.j2 new file mode 100644 index 00000000..68d1516f --- /dev/null +++ b/app/templates/formsemestre/groups_photos.j2 @@ -0,0 +1,27 @@ +{# Trombinoscope HTML #} + +{% extends "sco_page.j2" %} + + +{% block title %} + Photos {{groups_titles}} +{% endblock title %} + + +{% block app_content %} +
+ + {{form_groups_choice|safe}} + +
+ {{tab_photos_html|safe}} +
+
+ +{% endblock %} + + +{% block scripts %} + {{ super() }} + +{% endblock %} diff --git a/app/templates/formsemestre_header.j2 b/app/templates/formsemestre_header.j2 index d8d7693e..1e5019a9 100644 --- a/app/templates/formsemestre_header.j2 +++ b/app/templates/formsemestre_header.j2 @@ -21,7 +21,7 @@ {{sco.formsemestre.responsables_str()}} - {{sco.formsemestre.inscriptions|length}} inscrits {% if not sco.formsemestre.etat %}{{formsemestre.mois_debut()}} - {{formsemestre.mois_fin()}}{{formsemestre.responsables_str()}}{{formsemestre.etuds_inscriptions|length}} inscrits {%-if not formsemestre.etat -%} diff --git a/app/views/scolar.py b/app/views/scolar.py index 60e89d4d..b375b533 100644 --- a/app/views/scolar.py +++ b/app/views/scolar.py @@ -461,11 +461,11 @@ sco_publish( ) -@bp.route("/groups_view") +@bp.route("/groups_lists") @scodoc -@permission_required_compat_scodoc7(Permission.ScoView) +@permission_required(Permission.ScoView) @scodoc7func -def groups_view( +def groups_lists( group_ids=(), fmt="html", # Options pour listes: @@ -477,10 +477,10 @@ def groups_view( with_bourse=0, formsemestre_id=None, ): - return sco_groups_view.groups_view( + "Listes des étudiants des groupes" + return sco_groups_view.groups_lists( group_ids=group_ids, fmt=fmt, - # Options pour listes: with_codes=with_codes, etat=etat, with_paiement=with_paiement, @@ -491,6 +491,40 @@ def groups_view( ) +@bp.route("/groups_photos") +@scodoc +@permission_required(Permission.ScoView) +@scodoc7func +def groups_photos( + group_ids=(), + etat=None, + formsemestre_id=None, +): + "trombi HTML" + return sco_groups_view.groups_photos( + group_ids=group_ids, + etat=etat, + formsemestre_id=formsemestre_id, + ) + + +@bp.route("/groups_feuilles") +@scodoc +@permission_required(Permission.ScoView) +@scodoc7func +def groups_feuilles( + group_ids=(), + etat=None, + formsemestre_id=None, +): + "Feuilles appel, liens assiduité, etc." + return sco_groups_view.groups_feuilles( + group_ids=group_ids, + etat=etat, + formsemestre_id=formsemestre_id, + ) + + sco_publish( "/export_groups_as_moodle_csv", sco_groups_view.export_groups_as_moodle_csv, diff --git a/tests/unit/test_formsemestre.py b/tests/unit/test_formsemestre.py index e9677c4f..928aae83 100644 --- a/tests/unit/test_formsemestre.py +++ b/tests/unit/test_formsemestre.py @@ -136,7 +136,9 @@ def test_formsemestre_misc_views(test_client): ans = sco_formsemestre_inscriptions.formsemestre_inscrits_ailleurs(formsemestre.id) # ----- MENU GROUPES - ans = call_view(scolar.groups_view, formsemestre.id) + ans = call_view(scolar.groups_lists, formsemestre.id) + ans = call_view(scolar.groups_photos, formsemestre.id) + ans = call_view(scolar.groups_feuilles, formsemestre.id) ans = call_view(scolar.partition_editor, formsemestre.id) ans = sco_groups.edit_partition_form(formsemestre.id)