From a934542537f4ca9556384b3583e1cf2c6452dad7 Mon Sep 17 00:00:00 2001 From: viennet Date: Tue, 6 Oct 2020 12:13:04 +0200 Subject: [PATCH] Option to show emails in marks listings --- sco_liste_notes.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/sco_liste_notes.py b/sco_liste_notes.py index aeac6acc4..591e74f87 100644 --- a/sco_liste_notes.py +++ b/sco_liste_notes.py @@ -137,6 +137,17 @@ def do_evaluation_listenotes(context, REQUEST): "template": '%(label)s%(elem)s   ', }, ), + ( + "note_sur_20", + { + "input_type": "checkbox", + "title": "", + "allowed_values": ("yes",), + "labels": ("notes sur 20",), + "attributes": ('onclick="document.tf.submit();"',), + "template": "%(elem)s   ", + }, + ), ( "hide_groups", { @@ -149,12 +160,12 @@ def do_evaluation_listenotes(context, REQUEST): }, ), ( - "note_sur_20", + "with_emails", { "input_type": "checkbox", "title": "", "allowed_values": ("yes",), - "labels": ("notes sur 20",), + "labels": ("montrer les e-mails",), "attributes": ('onclick="document.tf.submit();"',), "template": "%(elem)s", }, @@ -183,6 +194,7 @@ def do_evaluation_listenotes(context, REQUEST): anonymous_listing = tf[2]["anonymous_listing"] note_sur_20 = tf[2]["note_sur_20"] hide_groups = tf[2]["hide_groups"] + with_emails = tf[2]["with_emails"] return _make_table_notes( context, REQUEST, @@ -193,6 +205,7 @@ def do_evaluation_listenotes(context, REQUEST): anonymous_listing=anonymous_listing, group_ids=tf[2]["group_ids"], hide_groups=hide_groups, + with_emails=with_emails, ) @@ -205,6 +218,7 @@ def _make_table_notes( note_sur_20=False, anonymous_listing=False, hide_groups=False, + with_emails=False, group_ids=[], ): """Generate table for evaluations marks""" @@ -253,6 +267,8 @@ def _make_table_notes( "prenom": "Prénom", "nomprenom": "Nom", "expl_key": "Rem.", + "email" : "e-mail", + "emailperso" : "e-mail perso" } rows = [] @@ -307,6 +323,8 @@ def _make_table_notes( "prenom": strcapitalize(strlower(etud["prenom"])), "nomprenom": etud["nomprenom"], "group": grc, + "email" : etud["email"], + "emailperso" : etud["emailperso"], "_css_row_class": css_row_class or "", } ) @@ -377,7 +395,10 @@ def _make_table_notes( ) columns_ids.append("moymod") - # ajoute lignes en tête et moyennes + # Ajoute colonnes emails tout à droite: + if with_emails: + columns_ids += [ "email", "emailperso" ] + # Ajoute lignes en tête et moyennes if len(evals) > 0: rows = [coefs, note_max] + rows rows.append(moys) @@ -409,6 +430,8 @@ def _make_table_notes( gl = "&anonymous_listing%3Alist=yes" + gl if hide_groups: gl = "&hide_groups%3Alist=yes" + gl + if with_emails: + gl = "&with_emails%3Alist=yes" + gl if len(evals) == 1: evalname = "%s-%s" % (Mod["code"], DateDMYtoISO(E["jour"])) hh = "%s, %s (%d étudiants)" % (E["description"], gr_title, len(etudids))