1
0
forked from ScoDoc/ScoDoc

WIP refactoring: menus

This commit is contained in:
Emmanuel Viennet 2021-06-14 18:08:52 +02:00
parent 8cf1cc7c34
commit ea09f18377
23 changed files with 293 additions and 207 deletions

View File

@ -803,7 +803,7 @@ ErrorType: %(error_type)s
last_dept = None last_dept = None
last_date = None last_date = None
for (dept, etuds) in depts_etud: for (dept, etuds) in depts_etud:
dept.Scolarite.fillEtudsInfo(etuds) scolars.fillEtudsInfo(self, etuds)
etud = etuds[0] etud = etuds[0]
if etud["sems"]: if etud["sems"]:
if (not last_date) or (etud["sems"][0]["date_fin_iso"] > last_date): if (not last_date) or (etud["sems"][0]["date_fin_iso"] > last_date):

View File

@ -27,6 +27,7 @@
"""Various HTML generation functions """Various HTML generation functions
""" """
from flask import g, url_for
import listhistogram import listhistogram
@ -71,13 +72,14 @@ def histogram_notes(notes):
return "\n".join(D) return "\n".join(D)
def make_menu(title, items, css_class="", base_url="", alone=False): def make_menu(title, items, css_class="", alone=False):
"""HTML snippet to render a simple drop down menu. """HTML snippet to render a simple drop down menu.
items is a list of dicts: items is a list of dicts:
{ 'title' : { 'title' :
'url' : 'endpoint' : flask endpoint (name of the function)
'args' : url query args
'id' : 'id' :
'attr' : "" # optionnal html <a> attributes 'attr' : "" # optional html <a> attributes
'enabled' : # True by default 'enabled' : # True by default
'helpmsg' : 'helpmsg' :
'submenu' : [ list of sub-items ] 'submenu' : [ list of sub-items ]
@ -96,10 +98,11 @@ def make_menu(title, items, css_class="", base_url="", alone=False):
li_id = 'id="%s" ' % the_id li_id = 'id="%s" ' % the_id
else: else:
li_id = "" li_id = ""
if base_url and "url" in item: if "endpoint" in items:
item["urlq"] = base_url + item["url"] args = item.get("args", {})
item["urlq"] = url_for(endpoint, scodoc_dept=g.scodoc_dept, **args)
else: else:
item["urlq"] = item.get("url", "#") item["urlq"] = "#"
item["attr"] = item.get("attr", "") item["attr"] = item.get("attr", "")
submenu = item.get("submenu", None) submenu = item.get("submenu", None)
H.append( H.append(

View File

@ -118,7 +118,7 @@ def _report_request(context, REQUEST, fmt="txt"):
HTTP_USER_AGENT=HTTP_USER_AGENT, HTTP_USER_AGENT=HTTP_USER_AGENT,
form=REQUEST.get("form", ""), form=REQUEST.get("form", ""),
HTTP_X_FORWARDED_FOR=REQUEST.get("HTTP_X_FORWARDED_FOR", ""), HTTP_X_FORWARDED_FOR=REQUEST.get("HTTP_X_FORWARDED_FOR", ""),
svn_version=scu.get_svn_version(context.file_path), svn_version=scu.get_svn_version(scu.SCO_SRC_DIR),
SCOVERSION=VERSION.SCOVERSION, SCOVERSION=VERSION.SCOVERSION,
) )
txt = ( txt = (

View File

@ -21,7 +21,6 @@ from email.MIMEBase import MIMEBase # pylint: disable=no-name-in-module,import-
from email.Header import Header # pylint: disable=no-name-in-module,import-error from email.Header import Header # pylint: disable=no-name-in-module,import-error
from email import Encoders # pylint: disable=no-name-in-module,import-error from email import Encoders # pylint: disable=no-name-in-module,import-error
import mails
# Simple & stupid file logguer, used only to debug # Simple & stupid file logguer, used only to debug
# (logging to SQL is done in scolog) # (logging to SQL is done in scolog)
@ -113,6 +112,7 @@ def retreive_dept():
# Alarms by email: # Alarms by email:
def sendAlarm(context, subj, txt): def sendAlarm(context, subj, txt):
import sco_utils import sco_utils
import mails
msg = MIMEMultipart() msg = MIMEMultipart()
subj = Header(subj, sco_utils.SCO_ENCODING) subj = Header(subj, sco_utils.SCO_ENCODING)

View File

@ -1090,14 +1090,14 @@ def _formsemestre_bulletinetud_header_html(
H.append('<option value="%s"%s>%s</option>' % (v, selected, e)) H.append('<option value="%s"%s>%s</option>' % (v, selected, e))
H.append("""</select></td>""") H.append("""</select></td>""")
# Menu # Menu
url = REQUEST.URL0 endpoint = "notes.formsemestre_bulletinetud"
qurl = urllib.quote_plus(url + "?" + REQUEST.QUERY_STRING) qurl = urllib.quote_plus(url + "?" + REQUEST.QUERY_STRING)
menuBul = [ menuBul = [
{ {
"title": "Réglages bulletins", "title": "Réglages bulletins",
"url": "formsemestre_edit_options?formsemestre_id=%s&target_url=%s" "endpoint": "notes.formsemestre_edit_options",
% (formsemestre_id, qurl), "args": {"formsemestre_id": formsemestre_id, "target_url": qurl},
"enabled": (uid in sem["responsables"]) "enabled": (uid in sem["responsables"])
or authuser.has_permission(Permission.ScoImplement, context), or authuser.has_permission(Permission.ScoImplement, context),
}, },
@ -1106,15 +1106,23 @@ def _formsemestre_bulletinetud_header_html(
% sco_bulletins_generator.bulletin_get_class_name_displayed( % sco_bulletins_generator.bulletin_get_class_name_displayed(
context, formsemestre_id context, formsemestre_id
), ),
"url": url "endpoint": endpoint,
+ "?formsemestre_id=%s&etudid=%s&format=pdf&version=%s" "args": {
% (formsemestre_id, etudid, version), "formsemestre_id": formsemestre_id,
"etudid": etudid,
"version": version,
"format": "pdf",
},
}, },
{ {
"title": "Envoi par mail à %s" % etud["email"], "title": "Envoi par mail à %s" % etud["email"],
"url": url "endpoint": endpoint,
+ "?formsemestre_id=%s&etudid=%s&format=pdfmail&version=%s" "args": {
% (formsemestre_id, etudid, version), "formsemestre_id": formsemestre_id,
"etudid": etudid,
"version": version,
"format": "pdfmail",
},
"enabled": etud["email"] "enabled": etud["email"]
and can_send_bulletin_by_mail( and can_send_bulletin_by_mail(
context, formsemestre_id, REQUEST context, formsemestre_id, REQUEST
@ -1122,9 +1130,14 @@ def _formsemestre_bulletinetud_header_html(
}, },
{ {
"title": "Envoi par mail à %s (adr. personnelle)" % etud["emailperso"], "title": "Envoi par mail à %s (adr. personnelle)" % etud["emailperso"],
"url": url "endpoint": endpoint,
+ "?formsemestre_id=%s&etudid=%s&format=pdfmail&version=%s&prefer_mail_perso=1" "args": {
% (formsemestre_id, etudid, version), "formsemestre_id": formsemestre_id,
"etudid": etudid,
"version": version,
"format": "pdfmail",
"prefer_mail_perso": 1,
},
"enabled": etud["emailperso"] "enabled": etud["emailperso"]
and can_send_bulletin_by_mail( and can_send_bulletin_by_mail(
context, formsemestre_id, REQUEST context, formsemestre_id, REQUEST
@ -1132,14 +1145,21 @@ def _formsemestre_bulletinetud_header_html(
}, },
{ {
"title": "Version XML", "title": "Version XML",
"url": url "endpoint": endpoint,
+ "?formsemestre_id=%s&etudid=%s&format=xml&version=%s" "args": {
% (formsemestre_id, etudid, version), "formsemestre_id": formsemestre_id,
"etudid": etudid,
"version": version,
"format": "xml",
},
}, },
{ {
"title": "Ajouter une appréciation", "title": "Ajouter une appréciation",
"url": "appreciation_add_form?etudid=%s&formsemestre_id=%s" "endpoint": "notes.appreciation_add_form",
% (etudid, formsemestre_id), "args": {
"formsemestre_id": formsemestre_id,
"etudid": etudid,
},
"enabled": ( "enabled": (
(authuser in sem["responsables"]) (authuser in sem["responsables"])
or (authuser.has_permission(Permission.ScoEtudInscrit, context)) or (authuser.has_permission(Permission.ScoEtudInscrit, context))
@ -1147,32 +1167,47 @@ def _formsemestre_bulletinetud_header_html(
}, },
{ {
"title": "Enregistrer un semestre effectué ailleurs", "title": "Enregistrer un semestre effectué ailleurs",
"url": "formsemestre_ext_create_form?etudid=%s&formsemestre_id=%s" "endpoint": "notes.formsemestre_ext_create_form",
% (etudid, formsemestre_id), "args": {
"formsemestre_id": formsemestre_id,
"etudid": etudid,
},
"enabled": authuser.has_permission(Permission.ScoImplement, context), "enabled": authuser.has_permission(Permission.ScoImplement, context),
}, },
{ {
"title": "Enregistrer une validation d'UE antérieure", "title": "Enregistrer une validation d'UE antérieure",
"url": "formsemestre_validate_previous_ue?etudid=%s&formsemestre_id=%s" "endpoint": "notes.formsemestre_validate_previous_ue",
% (etudid, formsemestre_id), "args": {
"formsemestre_id": formsemestre_id,
"etudid": etudid,
},
"enabled": context._can_validate_sem(REQUEST, formsemestre_id), "enabled": context._can_validate_sem(REQUEST, formsemestre_id),
}, },
{ {
"title": "Enregistrer note d'une UE externe", "title": "Enregistrer note d'une UE externe",
"url": "external_ue_create_form?etudid=%s&formsemestre_id=%s" "endpoint": "notes.external_ue_create_form",
% (etudid, formsemestre_id), "args": {
"formsemestre_id": formsemestre_id,
"etudid": etudid,
},
"enabled": context._can_validate_sem(REQUEST, formsemestre_id), "enabled": context._can_validate_sem(REQUEST, formsemestre_id),
}, },
{ {
"title": "Entrer décisions jury", "title": "Entrer décisions jury",
"url": "formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s" "endpoint": "notes.formsemestre_validation_etud_form",
% (formsemestre_id, etudid), "args": {
"formsemestre_id": formsemestre_id,
"etudid": etudid,
},
"enabled": context._can_validate_sem(REQUEST, formsemestre_id), "enabled": context._can_validate_sem(REQUEST, formsemestre_id),
}, },
{ {
"title": "Editer PV jury", "title": "Editer PV jury",
"url": "formsemestre_pvjury_pdf?formsemestre_id=%s&etudid=%s" "endpoint": "notes.formsemestre_pvjury_pdf",
% (formsemestre_id, etudid), "args": {
"formsemestre_id": formsemestre_id,
"etudid": etudid,
},
"enabled": True, "enabled": True,
}, },
] ]

View File

@ -35,7 +35,7 @@ from TrivialFormulator import TrivialFormulator, TF, tf_error_message
import sco_codes_parcours import sco_codes_parcours
import sco_formsemestre import sco_formsemestre
from sco_exceptions import ScoValueError from sco_exceptions import ScoValueError
import sco_formation import sco_formations
def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST=None): def formation_delete(context, formation_id=None, dialog_confirmed=False, REQUEST=None):
@ -271,7 +271,7 @@ def do_formation_edit(context, args):
del args["formation_code"] del args["formation_code"]
cnx = context.GetDBConnexion() cnx = context.GetDBConnexion()
sco_formation._formationEditor.edit(cnx, args) sco_formations._formationEditor.edit(cnx, args)
# Invalide les semestres utilisant cette formation: # Invalide les semestres utilisant cette formation:
for sem in sco_formsemestre.do_formsemestre_list( for sem in sco_formsemestre.do_formsemestre_list(

View File

@ -120,8 +120,10 @@ def search_etud_in_dept(context, expnom="", REQUEST=None):
etuds = [] # si expnom est trop court, n'affiche rien etuds = [] # si expnom est trop court, n'affiche rien
if len(etuds) == 1: if len(etuds) == 1:
# va directement a la destination # va directement a la fiche
return context.ficheEtud(etudid=etuds[0]["etudid"], REQUEST=REQUEST) return REQUEST.RESPONSE.redirect(
context.NotesURL() + "/ficheEtud?etudid=" + etuds[0]["etudid"]
)
H = [ H = [
html_sco_header.sco_header( html_sco_header.sco_header(
@ -199,7 +201,7 @@ def search_etuds_infos(context, expnom=None, code_nip=None, REQUEST=None):
etuds = scolars.etudident_list(cnx, args={"code_nip": code_nip}) etuds = scolars.etudident_list(cnx, args={"code_nip": code_nip})
else: else:
etuds = [] etuds = []
context.fillEtudsInfo(etuds) scolars.fillEtudsInfo(context, etuds)
return etuds return etuds

View File

@ -57,7 +57,7 @@ def formsemestre_custommenu_get(context, formsemestre_id):
return vals return vals
def formsemestre_custommenu_html(context, formsemestre_id, base_url=""): def formsemestre_custommenu_html(context, formsemestre_id):
"HTML code for custom menu" "HTML code for custom menu"
menu = [] menu = []
# Calendrier électronique ? # Calendrier électronique ?
@ -69,9 +69,8 @@ def formsemestre_custommenu_html(context, formsemestre_id, base_url=""):
menu.append( menu.append(
{ {
"title": "Modifier ce menu...", "title": "Modifier ce menu...",
"url": base_url "endpoint": "notes.formsemestre_custommenu_edit",
+ "formsemestre_custommenu_edit?formsemestre_id=" "args": {"formsemestre_id": formsemestre_id},
+ formsemestre_id,
} }
) )
return sco_formsemestre_status.htmlutils.make_menu("Liens", menu) return sco_formsemestre_status.htmlutils.make_menu("Liens", menu)
@ -84,7 +83,9 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None):
context.NotesURL() + "/formsemestre_status?formsemestre_id=%s" % formsemestre_id context.NotesURL() + "/formsemestre_status?formsemestre_id=%s" % formsemestre_id
) )
H = [ H = [
html_sco_header.html_sem_header(context, REQUEST, "Modification du menu du semestre ", sem), html_sco_header.html_sem_header(
context, REQUEST, "Modification du menu du semestre ", sem
),
"""<p class="help">Ce menu, spécifique à chaque semestre, peut être utilisé pour placer des liens vers vos applications préférées.</p> """<p class="help">Ce menu, spécifique à chaque semestre, peut être utilisé pour placer des liens vers vos applications préférées.</p>
<p class="help">Procédez en plusieurs fois si vous voulez ajouter plusieurs items.</p>""", <p class="help">Procédez en plusieurs fois si vous voulez ajouter plusieurs items.</p>""",
] ]
@ -127,7 +128,9 @@ def formsemestre_custommenu_edit(context, formsemestre_id, REQUEST=None):
name="tf", name="tf",
) )
if tf[0] == 0: if tf[0] == 0:
return "\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer(context, REQUEST) return (
"\n".join(H) + "\n" + tf[1] + html_sco_header.sco_footer(context, REQUEST)
)
elif tf[0] == -1: elif tf[0] == -1:
return REQUEST.RESPONSE.redirect(dest_url) return REQUEST.RESPONSE.redirect(dest_url)
else: else:

View File

@ -76,54 +76,56 @@ def defMenuStats(context, formsemestre_id):
return [ return [
{ {
"title": "Statistiques...", "title": "Statistiques...",
"url": "formsemestre_report_counts?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_report_counts",
"args": {"formsemestre_id": formsemestre_id},
}, },
{ {
"title": "Suivi de cohortes", "title": "Suivi de cohortes",
"url": "formsemestre_suivi_cohorte?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_suivi_cohorte",
"args": {"formsemestre_id": formsemestre_id},
"enabled": True, "enabled": True,
}, },
{ {
"title": "Graphe des parcours", "title": "Graphe des parcours",
"url": "formsemestre_graph_parcours?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_graph_parcours",
"args": {"formsemestre_id": formsemestre_id},
"enabled": scu.WITH_PYDOT, "enabled": scu.WITH_PYDOT,
}, },
{ {
"title": "Codes des parcours", "title": "Codes des parcours",
"url": "formsemestre_suivi_parcours?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_suivi_parcours",
"args": {"formsemestre_id": formsemestre_id},
"enabled": True, "enabled": True,
}, },
{ {
"title": "Lycées d'origine", "title": "Lycées d'origine",
"url": "formsemestre_etuds_lycees?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_etuds_lycees",
"args": {"formsemestre_id": formsemestre_id},
"enabled": True, "enabled": True,
}, },
{ {
"title": 'Table "poursuite"', "title": 'Table "poursuite"',
"url": "formsemestre_poursuite_report?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_poursuite_report",
"args": {"formsemestre_id": formsemestre_id},
"enabled": True, "enabled": True,
}, },
{ {
"title": "Documents Avis Poursuite Etudes", "title": "Documents Avis Poursuite Etudes",
"url": "pe_view_sem_recap?formsemestre_id=" + formsemestre_id, "endpoint": "notes.pe_view_sem_recap",
"args": {"formsemestre_id": formsemestre_id},
"enabled": True,
},
{
"title": 'Table "débouchés"',
"endpoint": "notes.report_debouche_date",
"enabled": True, "enabled": True,
}, },
{"title": 'Table "débouchés"', "url": "report_debouche_date", "enabled": True},
{ {
"title": "Estimation du coût de la formation", "title": "Estimation du coût de la formation",
"url": "formsemestre_estim_cost?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_estim_cost?formsemestre_id",
"args": {"formsemestre_id": formsemestre_id},
"enabled": True, "enabled": True,
}, },
# { 'title' : 'experimental sub',
# 'submenu' : [
# { 'title' : 'sous 1',
# 'url' : '#' },
# { 'title' : 'sous 2',
# 'url' : '#' },
# { 'title' : 'sous 3',
# 'url' : '#' },
# ]
# },
] ]
@ -142,20 +144,23 @@ def formsemestre_status_menubar(context, sem, REQUEST):
menuSemestre = [ menuSemestre = [
{ {
"title": "Tableau de bord", "title": "Tableau de bord",
"url": "formsemestre_status?formsemestre_id=%(formsemestre_id)s" % sem, "endpoint": "notes.formsemestre_status",
"args": {"formsemestre_id": formsemestre_id},
"enabled": True, "enabled": True,
"helpmsg": "Tableau de bord du semestre", "helpmsg": "Tableau de bord du semestre",
}, },
{ {
"title": "Voir la formation %(acronyme)s (v%(version)s)" % F, "title": "Voir la formation %(acronyme)s (v%(version)s)" % F,
"url": "ue_list?formation_id=%(formation_id)s" % sem, "endpoint": "notes.ue_list",
"args": {"formation_id": sem["formation_id"]},
"enabled": True, "enabled": True,
"helpmsg": "Tableau de bord du semestre", "helpmsg": "Tableau de bord du semestre",
}, },
{ {
"title": "Modifier le semestre", "title": "Modifier le semestre",
"url": "formsemestre_editwithmodules?formation_id=%(formation_id)s&formsemestre_id=%(formsemestre_id)s" "endpoint": "notes.formsemestre_editwithmodules?formation_id=%(formation_id)s&formsemestre_id=%(formsemestre_id)s"
% sem, % sem,
"args": {"formsemestre_id": formsemestre_id},
"enabled": ( "enabled": (
authuser.has_permission(Permission.ScoImplement, context) authuser.has_permission(Permission.ScoImplement, context)
or ( or (
@ -168,8 +173,8 @@ def formsemestre_status_menubar(context, sem, REQUEST):
}, },
{ {
"title": "Préférences du semestre", "title": "Préférences du semestre",
"url": "formsemestre_edit_preferences?formsemestre_id=%(formsemestre_id)s" "endpoint": "notes.formsemestre_edit_preferences",
% sem, "args": {"formsemestre_id": formsemestre_id},
"enabled": ( "enabled": (
authuser.has_permission(Permission.ScoImplement, context) authuser.has_permission(Permission.ScoImplement, context)
or ( or (
@ -182,64 +187,71 @@ def formsemestre_status_menubar(context, sem, REQUEST):
}, },
{ {
"title": "Réglages bulletins", "title": "Réglages bulletins",
"url": "formsemestre_edit_options?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_edit_options",
"args": {"formsemestre_id": formsemestre_id},
"enabled": (uid in sem["responsables"]) "enabled": (uid in sem["responsables"])
or authuser.has_permission(Permission.ScoImplement, context), or authuser.has_permission(Permission.ScoImplement, context),
"helpmsg": "Change les options", "helpmsg": "Change les options",
}, },
{ {
"title": change_lock_msg, "title": change_lock_msg,
"url": "formsemestre_change_lock?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_change_lock",
"args": {"formsemestre_id": formsemestre_id},
"enabled": (uid in sem["responsables"]) "enabled": (uid in sem["responsables"])
or authuser.has_permission(Permission.ScoImplement, context), or authuser.has_permission(Permission.ScoImplement, context),
"helpmsg": "", "helpmsg": "",
}, },
{ {
"title": "Description du semestre", "title": "Description du semestre",
"url": "formsemestre_description?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_description",
"args": {"formsemestre_id": formsemestre_id},
"enabled": True, "enabled": True,
"helpmsg": "", "helpmsg": "",
}, },
{ {
"title": "Vérifier absences aux évaluations", "title": "Vérifier absences aux évaluations",
"url": "formsemestre_check_absences_html?formsemestre_id=" "endpoint": "notes.formsemestre_check_absences_html",
+ formsemestre_id, "args": {"formsemestre_id": formsemestre_id},
"enabled": True, "enabled": True,
"helpmsg": "", "helpmsg": "",
}, },
{ {
"title": "Lister tous les enseignants", "title": "Lister tous les enseignants",
"url": "formsemestre_enseignants_list?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_enseignants_list",
"args": {"formsemestre_id": formsemestre_id},
"enabled": True, "enabled": True,
"helpmsg": "", "helpmsg": "",
}, },
{ {
"title": "Cloner ce semestre", "title": "Cloner ce semestre",
"url": "formsemestre_clone?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_clone",
"args": {"formsemestre_id": formsemestre_id},
"enabled": authuser.has_permission(Permission.ScoImplement, context), "enabled": authuser.has_permission(Permission.ScoImplement, context),
"helpmsg": "", "helpmsg": "",
}, },
{ {
"title": "Associer à une nouvelle version du programme", "title": "Associer à une nouvelle version du programme",
"url": "formsemestre_associate_new_version?formsemestre_id=" "endpoint": "notes.formsemestre_associate_new_version",
+ formsemestre_id, "args": {"formsemestre_id": formsemestre_id},
"enabled": authuser.has_permission(Permission.ScoChangeFormation, context) "enabled": authuser.has_permission(Permission.ScoChangeFormation, context)
and (sem["etat"] == "1"), and (sem["etat"] == "1"),
"helpmsg": "", "helpmsg": "",
}, },
{ {
"title": "Supprimer ce semestre", "title": "Supprimer ce semestre",
"url": "formsemestre_delete?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_delete",
"args": {"formsemestre_id": formsemestre_id},
"enabled": authuser.has_permission(Permission.ScoImplement, context), "enabled": authuser.has_permission(Permission.ScoImplement, context),
"helpmsg": "", "helpmsg": "",
}, },
] ]
# debug : # debug :
if uid == "root" or uid[:7] == "viennet": if app.config["ENV"] == "development":
menuSemestre.append( menuSemestre.append(
{ {
"title": "Check integrity", "title": "Check integrity",
"url": "check_sem_integrity?formsemestre_id=" + formsemestre_id, "endpoint": "notes.check_sem_integrity",
"args": {"formsemestre_id": formsemestre_id},
"enabled": True, "enabled": True,
} }
) )
@ -247,79 +259,82 @@ def formsemestre_status_menubar(context, sem, REQUEST):
menuInscriptions = [ menuInscriptions = [
{ {
"title": "Voir les inscriptions aux modules", "title": "Voir les inscriptions aux modules",
"url": "moduleimpl_inscriptions_stats?formsemestre_id=" + formsemestre_id, "endpoint": "notes.moduleimpl_inscriptions_stats",
"args": {"formsemestre_id": formsemestre_id},
} }
] ]
menuInscriptions += [ menuInscriptions += [
{ {
"title": "Passage des étudiants depuis d'autres semestres", "title": "Passage des étudiants depuis d'autres semestres",
"url": "formsemestre_inscr_passage?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_inscr_passage",
"args": {"formsemestre_id": formsemestre_id},
"enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context)
and (sem["etat"] == "1"), and (sem["etat"] == "1"),
}, },
{ {
"title": "Synchroniser avec étape Apogée", "title": "Synchroniser avec étape Apogée",
"url": "formsemestre_synchro_etuds?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_synchro_etuds",
"args": {"formsemestre_id": formsemestre_id},
"enabled": authuser.has_permission(Permission.ScoView, context) "enabled": authuser.has_permission(Permission.ScoView, context)
and sco_preferences.get_preference(context, "portal_url") and sco_preferences.get_preference(context, "portal_url")
and (sem["etat"] == "1"), and (sem["etat"] == "1"),
}, },
{ {
"title": "Inscrire un étudiant", "title": "Inscrire un étudiant",
"url": "formsemestre_inscription_with_modules_etud?formsemestre_id=" "endpoint": "notes.formsemestre_inscription_with_modules_etud",
+ formsemestre_id, "args": {"formsemestre_id": formsemestre_id},
"enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context)
and (sem["etat"] == "1"), and (sem["etat"] == "1"),
}, },
{ {
"title": "Importer des étudiants dans ce semestre (table Excel)", "title": "Importer des étudiants dans ce semestre (table Excel)",
"url": "form_students_import_excel?formsemestre_id=" + formsemestre_id, "endpoint": "notes.form_students_import_excel",
"args": {"formsemestre_id": formsemestre_id},
"enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context)
and (sem["etat"] == "1"), and (sem["etat"] == "1"),
}, },
{ {
"title": "Import/export des données admission", "title": "Import/export des données admission",
"url": "form_students_import_infos_admissions?formsemestre_id=" "endpoint": "notes.form_students_import_infos_admissions",
+ formsemestre_id, "args": {"formsemestre_id": formsemestre_id},
"enabled": authuser.has_permission(Permission.ScoView, context), "enabled": authuser.has_permission(Permission.ScoView, context),
}, },
{ {
"title": "Resynchroniser données identité", "title": "Resynchroniser données identité",
"url": "formsemestre_import_etud_admission?formsemestre_id=" "endpoint": "notes.formsemestre_import_etud_admission",
+ formsemestre_id, "args": {"formsemestre_id": formsemestre_id},
"enabled": authuser.has_permission(Permission.ScoEtudChangeAdr, context) "enabled": authuser.has_permission(Permission.ScoEtudChangeAdr, context)
and sco_preferences.get_preference(context, "portal_url"), and sco_preferences.get_preference(context, "portal_url"),
}, },
{ {
"title": "Exporter table des étudiants", "title": "Exporter table des étudiants",
"url": "groups_view?format=allxls&group_ids=" "endpoint": "notes.groups_view",
+ sco_groups.get_default_group( "args": {
context, formsemestre_id, fix_if_missing=True, REQUEST=REQUEST "format": allxls,
), "group_ids": sco_groups.get_default_group(
context, formsemestre_id, fix_if_missing=True, REQUEST=REQUEST
),
},
}, },
{ {
"title": "Vérifier inscriptions multiples", "title": "Vérifier inscriptions multiples",
"url": "formsemestre_inscrits_ailleurs?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_inscrits_ailleurs",
"args": {"formsemestre_id": formsemestre_id},
}, },
] ]
menuGroupes = [ menuGroupes = [
{ {
"title": "Listes, photos, feuilles...", "title": "Listes, photos, feuilles...",
"url": "groups_view?formsemestre_id=" + formsemestre_id, "endpoint": "notes.groups_view",
"enabled": True, "args": {"formsemestre_id": formsemestre_id},
"helpmsg": "Accès aux listes des groupes d'étudiants",
},
# On laisse l'accès à l'ancienne page, le temps de tester
{
"title": "Listes (ancienne page)",
"url": "formsemestre_lists?formsemestre_id=" + formsemestre_id,
"enabled": True, "enabled": True,
"helpmsg": "Accès aux listes des groupes d'étudiants", "helpmsg": "Accès aux listes des groupes d'étudiants",
}, },
{ {
"title": "Créer/modifier les partitions...", "title": "Créer/modifier les partitions...",
"url": "editPartitionForm?formsemestre_id=" + formsemestre_id, "endpoint": "notes.editPartitionForm",
"args": {"formsemestre_id": formsemestre_id},
"enabled": sco_groups.can_change_groups(context, REQUEST, formsemestre_id), "enabled": sco_groups.can_change_groups(context, REQUEST, formsemestre_id),
}, },
] ]
@ -335,7 +350,8 @@ def formsemestre_status_menubar(context, sem, REQUEST):
submenu.append( submenu.append(
{ {
"title": "%s" % partition["partition_name"], "title": "%s" % partition["partition_name"],
"url": "affectGroups?partition_id=%s" % partition["partition_id"], "endpoint": "notes.affectGroups",
"args": {"partition_id": partition["partition_id"]},
"enabled": enabled, "enabled": enabled,
} }
) )
@ -346,60 +362,74 @@ def formsemestre_status_menubar(context, sem, REQUEST):
menuNotes = [ menuNotes = [
{ {
"title": "Tableau des moyennes (et liens bulletins)", "title": "Tableau des moyennes (et liens bulletins)",
"url": "formsemestre_recapcomplet?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_recapcomplet",
"args": {"formsemestre_id": formsemestre_id},
}, },
{ {
"title": "Saisie des notes", "title": "Saisie des notes",
"url": "formsemestre_status?formsemestre_id=%(formsemestre_id)s" % sem, "endpoint": "notes.formsemestre_status",
"args": {"formsemestre_id": formsemestre_id},
"enabled": True, "enabled": True,
"helpmsg": "Tableau de bord du semestre", "helpmsg": "Tableau de bord du semestre",
}, },
{ {
"title": "Classeur PDF des bulletins", "title": "Classeur PDF des bulletins",
"url": "formsemestre_bulletins_pdf_choice?formsemestre_id=" "endpoint": "notes.formsemestre_bulletins_pdf_choice",
+ formsemestre_id, "args": {"formsemestre_id": formsemestre_id},
"helpmsg": "PDF regroupant tous les bulletins", "helpmsg": "PDF regroupant tous les bulletins",
}, },
{ {
"title": "Envoyer à chaque étudiant son bulletin par e-mail", "title": "Envoyer à chaque étudiant son bulletin par e-mail",
"url": "formsemestre_bulletins_mailetuds_choice?formsemestre_id=" "endpoint": "notes.formsemestre_bulletins_mailetuds_choice",
+ formsemestre_id, "args": {"formsemestre_id": formsemestre_id},
"enabled": sco_bulletins.can_send_bulletin_by_mail( "enabled": sco_bulletins.can_send_bulletin_by_mail(
context, formsemestre_id, REQUEST context, formsemestre_id, REQUEST
), ),
}, },
{ {
"title": "Calendrier des évaluations", "title": "Calendrier des évaluations",
"url": "formsemestre_evaluations_cal?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_evaluations_cal",
"args": {"formsemestre_id": formsemestre_id},
}, },
{ {
"title": "Lister toutes les saisies de notes", "title": "Lister toutes les saisies de notes",
"url": "formsemestre_list_saisies_notes?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_list_saisies_notes",
"args": {"formsemestre_id": formsemestre_id},
}, },
] ]
menuJury = [ menuJury = [
{ {
"title": "Voir les décisions du jury", "title": "Voir les décisions du jury",
"url": "formsemestre_pvjury?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_pvjury",
"args": {"formsemestre_id": formsemestre_id},
}, },
{ {
"title": "Générer feuille préparation Jury", "title": "Générer feuille préparation Jury",
"url": "feuille_preparation_jury?formsemestre_id=" + formsemestre_id, "endpoint": "notes.feuille_preparation_jury",
"args": {"formsemestre_id": formsemestre_id},
}, },
{ {
"title": "Saisie des décisions du jury", "title": "Saisie des décisions du jury",
"url": "formsemestre_recapcomplet?modejury=1&hidemodules=1&hidebac=1&pref_override=0&formsemestre_id=" "endpoint": "notes.formsemestre_recapcomplet",
+ formsemestre_id, "args": {
"formsemestre_id": formsemestre_id,
"modejury": 1,
"hidemodules": 1,
"hidebac": 1,
"pref_override": 0,
},
"enabled": context._can_validate_sem(REQUEST, formsemestre_id), "enabled": context._can_validate_sem(REQUEST, formsemestre_id),
}, },
{ {
"title": "Editer les PV et archiver les résultats", "title": "Editer les PV et archiver les résultats",
"url": "formsemestre_archive?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_archive",
"args": {"formsemestre_id": formsemestre_id},
"enabled": context._can_edit_pv(REQUEST, formsemestre_id), "enabled": context._can_edit_pv(REQUEST, formsemestre_id),
}, },
{ {
"title": "Documents archivés", "title": "Documents archivés",
"url": "formsemestre_list_archives?formsemestre_id=" + formsemestre_id, "endpoint": "notes.formsemestre_list_archives",
"args": {"formsemestre_id": formsemestre_id},
"enabled": sco_archives.PVArchive.list_obj_archives( "enabled": sco_archives.PVArchive.list_obj_archives(
context, formsemestre_id context, formsemestre_id
), ),
@ -407,17 +437,16 @@ def formsemestre_status_menubar(context, sem, REQUEST):
] ]
menuStats = defMenuStats(context, formsemestre_id) menuStats = defMenuStats(context, formsemestre_id)
base_url = context.absolute_url() + "/" # context must be Notes
H = [ H = [
# <table><tr><td>', # <table><tr><td>',
'<ul id="sco_menu">', '<ul id="sco_menu">',
htmlutils.make_menu("Semestre", menuSemestre, base_url=base_url), htmlutils.make_menu("Semestre", menuSemestre),
htmlutils.make_menu("Inscriptions", menuInscriptions, base_url=base_url), htmlutils.make_menu("Inscriptions", menuInscriptions),
htmlutils.make_menu("Groupes", menuGroupes, base_url=base_url), htmlutils.make_menu("Groupes", menuGroupes),
htmlutils.make_menu("Notes", menuNotes, base_url=base_url), htmlutils.make_menu("Notes", menuNotes),
htmlutils.make_menu("Jury", menuJury, base_url=base_url), htmlutils.make_menu("Jury", menuJury),
htmlutils.make_menu("Statistiques", menuStats, base_url=base_url), htmlutils.make_menu("Statistiques", menuStats),
formsemestre_custommenu_html(context, formsemestre_id, base_url=base_url), formsemestre_custommenu_html(context, formsemestre_id),
"</ul>", "</ul>",
#'</td></tr></table>' #'</td></tr></table>'
] ]

View File

@ -210,7 +210,7 @@ def _make_menu(context, partitions, title="", check="true"):
) )
return ( return (
'<td class="inscr_addremove_menu">' '<td class="inscr_addremove_menu">'
+ htmlutils.make_menu(title, items, base_url=context.absolute_url(), alone=True) + htmlutils.make_menu(title, items, alone=True)
+ "</td>" + "</td>"
) )

View File

@ -28,7 +28,6 @@
"""Tableau de bord module """Tableau de bord module
""" """
import time import time
import urllib
import sco_utils as scu import sco_utils as scu
from sco_utils import ( from sco_utils import (
@ -80,21 +79,30 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None):
menuEval = [ menuEval = [
{ {
"title": "Saisir notes", "title": "Saisir notes",
"url": "saisie_notes?evaluation_id=" + evaluation_id, "endpoint": "notes.saisie_notes",
"args": {
"evaluation_id": evaluation_id,
},
"enabled": sco_saisie_notes.can_edit_notes( "enabled": sco_saisie_notes.can_edit_notes(
context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"] context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"]
), ),
}, },
{ {
"title": "Modifier évaluation", "title": "Modifier évaluation",
"url": "evaluation_edit?evaluation_id=" + evaluation_id, "endpoint": "notes.evaluation_edit",
"args": {
"evaluation_id": evaluation_id,
},
"enabled": sco_saisie_notes.can_edit_notes( "enabled": sco_saisie_notes.can_edit_notes(
context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False
), ),
}, },
{ {
"title": sup_label, "title": sup_label,
"url": "evaluation_delete?evaluation_id=" + evaluation_id, "endpoint": "notes.evaluation_delete",
"args": {
"evaluation_id": evaluation_id,
},
"enabled": nbnotes == 0 "enabled": nbnotes == 0
and sco_saisie_notes.can_edit_notes( and sco_saisie_notes.can_edit_notes(
context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False
@ -102,19 +110,28 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None):
}, },
{ {
"title": "Supprimer toutes les notes", "title": "Supprimer toutes les notes",
"url": "evaluation_suppress_alln?evaluation_id=" + evaluation_id, "endpoint": "notes.evaluation_suppress_alln",
"args": {
"evaluation_id": evaluation_id,
},
"enabled": sco_saisie_notes.can_edit_notes( "enabled": sco_saisie_notes.can_edit_notes(
context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"], allow_ens=False
), ),
}, },
{ {
"title": "Afficher les notes", "title": "Afficher les notes",
"url": "evaluation_listenotes?evaluation_id=" + evaluation_id, "endpoint": "notes.evaluation_listenotes",
"args": {
"evaluation_id": evaluation_id,
},
"enabled": nbnotes > 0, "enabled": nbnotes > 0,
}, },
{ {
"title": "Placement étudiants", "title": "Placement étudiants",
"url": "placement_eval_selectetuds?evaluation_id=" + evaluation_id, "endpoint": "notes.placement_eval_selectetuds",
"args": {
"evaluation_id": evaluation_id,
},
"enabled": nbnotes == 0 "enabled": nbnotes == 0
and sco_saisie_notes.can_edit_notes( and sco_saisie_notes.can_edit_notes(
context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"] context, REQUEST.AUTHENTICATED_USER, E["moduleimpl_id"]
@ -122,13 +139,16 @@ def moduleimpl_evaluation_menu(context, evaluation_id, nbnotes=0, REQUEST=None):
}, },
{ {
"title": "Absences ce jour", "title": "Absences ce jour",
"url": "Absences/EtatAbsencesDate?date=%s&group_ids=%s" "endpoint": "absences.EtatAbsencesDate?date=%s&group_ids=%s"
% (urllib.quote(E["jour"], safe=""), group_id), % (endpointlib.quote(E["jour"], safe=""), group_id),
"enabled": E["jour"], "enabled": E["jour"],
}, },
{ {
"title": "Vérifier notes vs absents", "title": "Vérifier notes vs absents",
"url": "evaluation_check_absences_html?evaluation_id=%s" % (evaluation_id), "endpoint": "notes.evaluation_check_absences_html",
"args": {
"evaluation_id": evaluation_id,
},
"enabled": nbnotes > 0 and E["jour"], "enabled": nbnotes > 0 and E["jour"],
}, },
] ]

View File

@ -75,70 +75,61 @@ def _menuScolarite(context, authuser, sem, etudid):
if ins["etat"] != "D": if ins["etat"] != "D":
dem_title = "Démission" dem_title = "Démission"
dem_url = "formDem?etudid=%(etudid)s&formsemestre_id=%(formsemestre_id)s" % args dem_url = "formDem"
else: else:
dem_title = "Annuler la démission" dem_title = "Annuler la démission"
dem_url = ( dem_url = "doCancelDem"
"doCancelDem?etudid=%(etudid)s&formsemestre_id=%(formsemestre_id)s" % args
)
# Note: seul un etudiant inscrit (I) peut devenir défaillant. # Note: seul un etudiant inscrit (I) peut devenir défaillant.
if ins["etat"] != sco_codes_parcours.DEF: if ins["etat"] != sco_codes_parcours.DEF:
def_title = "Déclarer défaillance" def_title = "Déclarer défaillance"
def_url = "formDef?etudid=%(etudid)s&formsemestre_id=%(formsemestre_id)s" % args def_url = "formDef"
elif ins["etat"] == sco_codes_parcours.DEF: elif ins["etat"] == sco_codes_parcours.DEF:
def_title = "Annuler la défaillance" def_title = "Annuler la défaillance"
def_url = ( def_url = "doCancelDef"
"doCancelDef?etudid=%(etudid)s&formsemestre_id=%(formsemestre_id)s" % args
)
def_enabled = ( def_enabled = (
(ins["etat"] != "D") (ins["etat"] != "D")
and authuser.has_permission(Permission.ScoEtudInscrit, context) and authuser.has_permission(Permission.ScoEtudInscrit, context)
and not locked and not locked
) )
items = [ items = [
# { 'title' : 'Changer de groupe',
# 'url' : 'formChangeGroup?etudid=%s&formsemestre_id=%s' % (etudid,ins['formsemestre_id']),
# 'enabled' : authuser.has_permission(Permission.ScoEtudChangeGroups,context) and not locked,
# },
{ {
"title": dem_title, "title": dem_title,
"url": dem_url, "endpoint": dem_url,
"args": args,
"enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context)
and not locked, and not locked,
}, },
{ {
"title": "Validation du semestre (jury)", "title": "Validation du semestre (jury)",
"url": "Notes/formsemestre_validation_etud_form?etudid=%(etudid)s&formsemestre_id=%(formsemestre_id)s" "endpoint": "notes.formsemestre_validation_etud_form",
% args, "args": args,
"enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context)
and not locked, and not locked,
}, },
{"title": def_title, "url": def_url, "enabled": def_enabled}, {"title": def_title, "endpoint": def_url, "enabled": def_enabled},
{ {
"title": "Inscrire à un module optionnel (ou au sport)", "title": "Inscrire à un module optionnel (ou au sport)",
"url": "Notes/formsemestre_inscription_option?formsemestre_id=%(formsemestre_id)s&etudid=%(etudid)s" "endpoint": "notes.formsemestre_inscription_option",
% args, "args": args,
"enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context)
and not locked, and not locked,
}, },
{ {
"title": "Désinscrire (en cas d'erreur)", "title": "Désinscrire (en cas d'erreur)",
"url": "Notes/formsemestre_desinscription?formsemestre_id=%(formsemestre_id)s&etudid=%(etudid)s" "endpoint": "notes.formsemestre_desinscription",
% args,
"enabled": authuser.has_permission(Permission.ScoEtudInscrit, context) "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context)
and not locked, and not locked,
}, },
{ {
"title": "Inscrire à un autre semestre", "title": "Inscrire à un autre semestre",
"url": "Notes/formsemestre_inscription_with_modules_form?etudid=%(etudid)s" "endpoint": "notes.formsemestre_inscription_with_modules_form",
% args, "args": {"etudid": etudid},
"enabled": authuser.has_permission(Permission.ScoEtudInscrit, context), "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context),
}, },
{ {
"title": "Enregistrer un semestre effectué ailleurs", "title": "Enregistrer un semestre effectué ailleurs",
"url": "Notes/formsemestre_ext_create_form?formsemestre_id=%(formsemestre_id)s&etudid=%(etudid)s" "endpoint": "notes.formsemestre_ext_create_form",
% args,
"enabled": authuser.has_permission(Permission.ScoImplement, context), "enabled": authuser.has_permission(Permission.ScoImplement, context),
}, },
] ]
@ -163,7 +154,7 @@ def ficheEtud(context, etudid=None, REQUEST=None):
raise ScoValueError("Etudiant inexistant !") raise ScoValueError("Etudiant inexistant !")
etud = etuds[0] etud = etuds[0]
etudid = etud["etudid"] etudid = etud["etudid"]
context.fillEtudsInfo([etud]) scolars.fillEtudsInfo(context, [etud])
# #
info = etud info = etud
info["ScoURL"] = context.ScoURL() info["ScoURL"] = context.ScoURL()
@ -510,35 +501,38 @@ def menus_etud(context, REQUEST=None):
menuEtud = [ menuEtud = [
{ {
"title": etud["nomprenom"], "title": etud["nomprenom"],
"url": "ficheEtud?etudid=%(etudid)s" % etud, "endpoint": "scolar.ficheEtud",
"args": {"etudid": etud["etudid"]},
"enabled": True, "enabled": True,
"helpmsg": "Fiche étudiant", "helpmsg": "Fiche étudiant",
}, },
{ {
"title": "Changer la photo", "title": "Changer la photo",
"url": "formChangePhoto?etudid=%(etudid)s" % etud, "endpoint": "scolar.formChangePhoto",
"args": {"etudid": etud["etudid"]},
"enabled": authuser.has_permission(Permission.ScoEtudChangeAdr, context), "enabled": authuser.has_permission(Permission.ScoEtudChangeAdr, context),
}, },
{ {
"title": "Changer les données identité/admission", "title": "Changer les données identité/admission",
"url": "etudident_edit_form?etudid=%(etudid)s" % etud, "endpoint": "scolar.etudident_edit_form",
"args": {"etudid": etud["etudid"]},
"enabled": authuser.has_permission(Permission.ScoEtudInscrit, context), "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context),
}, },
{ {
"title": "Supprimer cet étudiant...", "title": "Supprimer cet étudiant...",
"url": "etudident_delete?etudid=%(etudid)s" % etud, "endpoint": "scolar.etudident_delete",
"args": {"etudid": etud["etudid"]},
"enabled": authuser.has_permission(Permission.ScoEtudInscrit, context), "enabled": authuser.has_permission(Permission.ScoEtudInscrit, context),
}, },
{ {
"title": "Voir le journal...", "title": "Voir le journal...",
"url": "showEtudLog?etudid=%(etudid)s" % etud, "endpoint": "scolar.showEtudLog",
"args": {"etudid": etud["etudid"]},
"enabled": True, "enabled": True,
}, },
] ]
return htmlutils.make_menu( return htmlutils.make_menu("Etudiant", menuEtud, alone=True)
"Etudiant", menuEtud, base_url=context.absolute_url() + "/", alone=True
)
def etud_info_html(context, etudid, with_photo="1", REQUEST=None, debug=False): def etud_info_html(context, etudid, with_photo="1", REQUEST=None, debug=False):

View File

@ -335,8 +335,8 @@ def get_etud_apogee(context, code_nip):
def get_default_etapes(context): def get_default_etapes(context):
"""Liste par défaut: devrait etre lue d'un fichier de config""" """Liste par défaut, lue du fichier de config"""
filename = context.file_path + "/config/default-etapes.txt" filename = SCO_TOOLS_DIR + "/default-etapes.txt"
log("get_default_etapes: reading %s" % filename) log("get_default_etapes: reading %s" % filename)
f = open(filename) f = open(filename)
etapes = {} etapes = {}

View File

@ -345,7 +345,7 @@ def pdf_lettres_individuelles(
return "" return ""
# Ajoute infos sur etudiants # Ajoute infos sur etudiants
etuds = [x["identite"] for x in dpv["decisions"]] etuds = [x["identite"] for x in dpv["decisions"]]
context.fillEtudsInfo(etuds) scolars.fillEtudsInfo(context, etuds)
# #
sem = sco_formsemestre.get_formsemestre(context, formsemestre_id) sem = sco_formsemestre.get_formsemestre(context, formsemestre_id)
prefs = sco_preferences.SemPreferences(context, formsemestre_id) prefs = sco_preferences.SemPreferences(context, formsemestre_id)

View File

@ -941,21 +941,23 @@ def saisie_notes(context, evaluation_id, group_ids=[], REQUEST=None):
{ {
"title": "Saisie par fichier tableur", "title": "Saisie par fichier tableur",
"id": "menu_saisie_tableur", "id": "menu_saisie_tableur",
"url": "/saisie_notes_tableur?evaluation_id=%s&%s" "endpoint": "notes.saisie_notes_tableur",
% (E["evaluation_id"], groups_infos.groups_query_args), "args": {
"evaluation_id": E["evaluation_id"],
"group_ids": groups_infos.group_ids,
},
}, },
{ {
"title": "Voir toutes les notes du module", "title": "Voir toutes les notes du module",
"url": "/evaluation_listenotes?moduleimpl_id=%s" "endpoint": "notes.evaluation_listenotes",
% E["moduleimpl_id"], "args": {"moduleimpl_id": E["moduleimpl_id"]},
}, },
{ {
"title": "Effacer toutes les notes de cette évaluation", "title": "Effacer toutes les notes de cette évaluation",
"url": "/evaluation_suppress_alln?evaluation_id=%s" "endpoint": "notes.evaluation_suppress_alln",
% (E["evaluation_id"],), "args": {"evaluation_id": E["evaluation_id"]},
}, },
], ],
base_url=context.absolute_url(),
alone=True, alone=True,
) )
) )

View File

@ -104,16 +104,21 @@ def _trombino_html_header(context, REQUEST):
def trombino_html(context, groups_infos, REQUEST=None): def trombino_html(context, groups_infos, REQUEST=None):
"HTML snippet for trombino (with title and menu)" "HTML snippet for trombino (with title and menu)"
args = groups_infos.groups_query_args
menuTrombi = [ menuTrombi = [
{"title": "Charger des photos...", "url": "photos_import_files_form?%s" % args}, {
"title": "Charger des photos...",
"endpoint": "scolar.photos_import_files_form",
"args": {"group_ids": groups_infos.group_ids},
},
{ {
"title": "Obtenir archive Zip des photos", "title": "Obtenir archive Zip des photos",
"url": "trombino?%s&format=zip" % args, "endpoint": "scolar.trombino",
"args": {"group_ids": groups_infos.group_ids, "format": "zip"},
}, },
{ {
"title": "Recopier les photos depuis le portail", "title": "Recopier les photos depuis le portail",
"url": "trombino_copy_photos?%s" % args, "endpoint": "scolar.trombino_copy_photos",
"args": {"group_ids": groups_infos.group_ids},
}, },
] ]

View File

@ -81,7 +81,7 @@ def is_up_to_date(context):
# return _UP_TO_DATE, _UP_TO_DATE_MSG # return _UP_TO_DATE, _UP_TO_DATE_MSG
# last_stable_ver = get_last_stable_version() # last_stable_ver = get_last_stable_version()
# cur_ver = scu.get_svn_version(context.file_path) # in sco_utils # cur_ver = scu.get_svn_version(scu.SCO_SRC_DIR) # in sco_utils
# cur_ver2 = cur_ver # cur_ver2 = cur_ver
# cur_ver_num = -1 # cur_ver_num = -1
# # Convert versions to integers: # # Convert versions to integers:

View File

@ -47,8 +47,6 @@ from Globals import Persistent
from Globals import INSTANCE_HOME from Globals import INSTANCE_HOME
from Acquisition import Implicit from Acquisition import Implicit
# where we exist on the file system
file_path = Globals.package_home(globals())
# Collect all security declarations (Zope2Flask) # Collect all security declarations (Zope2Flask)

View File

@ -29,7 +29,7 @@
""" """
import time import time
import mail import mails
import sco_utils as scu import sco_utils as scu
from sco_utils import SCO_ENCODING from sco_utils import SCO_ENCODING
from sco_exceptions import ScoGenError, ScoValueError from sco_exceptions import ScoGenError, ScoValueError
@ -709,7 +709,7 @@ def create_etud(context, cnx, args={}, REQUEST=None):
msg="creation initiale", msg="creation initiale",
) )
etud = etudident_list(cnx, {"etudid": etudid})[0] etud = etudident_list(cnx, {"etudid": etudid})[0]
context.fillEtudsInfo([etud]) fillEtudsInfo(context, [etud])
etud["url"] = "ficheEtud?etudid=%(etudid)s" % etud etud["url"] = "ficheEtud?etudid=%(etudid)s" % etud
sco_news.add( sco_news.add(
context, context,

View File

@ -264,11 +264,6 @@ sco_publish(
sco_formsemestre_status.formsemestre_description, sco_formsemestre_status.formsemestre_description,
Permission.ScoView, Permission.ScoView,
) )
sco_publish(
"/formsemestre_lists",
sco_formsemestre_status.formsemestre_lists,
Permission.ScoView,
)
sco_publish( sco_publish(
"/formsemestre_status_menubar", "/formsemestre_status_menubar",
sco_formsemestre_status.formsemestre_status_menubar, sco_formsemestre_status.formsemestre_status_menubar,
@ -1178,12 +1173,6 @@ def formsemestre_custommenu_edit(context, REQUEST, formsemestre_id):
) )
sco_publish(
"/formsemestre_custommenu_html",
sco_formsemestre_custommenu.formsemestre_custommenu_html,
Permission.ScoView,
)
# --- dialogue modif enseignants/moduleimpl # --- dialogue modif enseignants/moduleimpl
@bp.route("/edit_enseignants_form") @bp.route("/edit_enseignants_form")
@permission_required(Permission.ScoView) @permission_required(Permission.ScoView)
@ -2624,6 +2613,7 @@ def formsemestre_bulletins_mailetuds_choice(
) )
# not published
def formsemestre_bulletins_choice( def formsemestre_bulletins_choice(
context, REQUEST, formsemestre_id, title="", explanation="", choose_mail=False context, REQUEST, formsemestre_id, title="", explanation="", choose_mail=False
): ):

View File

@ -387,7 +387,7 @@ def etud_info(context, etudid=None, format="xml", REQUEST=None):
) )
d = {} d = {}
etud = etuds[0] etud = etuds[0]
context.fillEtudsInfo([etud]) scolars.fillEtudsInfo(context, [etud])
etud["date_naissance_iso"] = ndb.DateDMYtoISO(etud["date_naissance"]) etud["date_naissance_iso"] = ndb.DateDMYtoISO(etud["date_naissance"])
for a in ( for a in (
"etudid", "etudid",
@ -1460,7 +1460,7 @@ def _etudident_create_or_edit_form(context, REQUEST, edit):
# modif d'un etudiant # modif d'un etudiant
scolars.etudident_edit(cnx, tf[2], context=context, REQUEST=REQUEST) scolars.etudident_edit(cnx, tf[2], context=context, REQUEST=REQUEST)
etud = scolars.etudident_list(cnx, {"etudid": etudid})[0] etud = scolars.etudident_list(cnx, {"etudid": etudid})[0]
context.fillEtudsInfo([etud]) scolars.fillEtudsInfo(context, [etud])
# Inval semesters with this student: # Inval semesters with this student:
to_inval = [s["formsemestre_id"] for s in etud["sems"]] to_inval = [s["formsemestre_id"] for s in etud["sems"]]
if to_inval: if to_inval:
@ -1482,7 +1482,7 @@ def etudident_delete(context, etudid, dialog_confirmed=False, REQUEST=None):
raise ScoValueError("Etudiant inexistant !") raise ScoValueError("Etudiant inexistant !")
else: else:
etud = etuds[0] etud = etuds[0]
context.fillEtudsInfo([etud]) scolars.fillEtudsInfo(context, [etud])
if not dialog_confirmed: if not dialog_confirmed:
return scu.confirm_dialog( return scu.confirm_dialog(
context, context,

View File

@ -35,6 +35,8 @@ class ConfigClass(object):
SCODOC7_SQL_USER = os.environ.get("SCODOC7_SQL_USER", "www-data") SCODOC7_SQL_USER = os.environ.get("SCODOC7_SQL_USER", "www-data")
DEFAULT_SQL_PORT = os.environ.get("DEFAULT_SQL_PORT", "5432") DEFAULT_SQL_PORT = os.environ.get("DEFAULT_SQL_PORT", "5432")
SERVER_NAME = os.environ.get("SERVER_NAME")
def __init__(self): def __init__(self):
"""Used to build some config variable at startup time""" """Used to build some config variable at startup time"""
self.SCODOC_VAR_DIR = os.path.join(self.INSTANCE_HOME, "var", "scodoc") self.SCODOC_VAR_DIR = os.path.join(self.INSTANCE_HOME, "var", "scodoc")

View File

@ -17,6 +17,7 @@ import flask
from app import create_app, cli, db from app import create_app, cli, db
from app.auth.models import User, Role, UserRole from app.auth.models import User, Role, UserRole
from app.views import notes, scolar, absences
from config import Config from config import Config
@ -32,6 +33,8 @@ def make_shell_context():
"User": User, "User": User,
"Role": Role, "Role": Role,
"UserRole": UserRole, "UserRole": UserRole,
"notes": notes,
"scolar": scolar,
"pp": pp, "pp": pp,
"flask": flask, "flask": flask,
"current_app": flask.current_app, "current_app": flask.current_app,