forked from ScoDoc/ScoDoc
Merge pull request 'Grand nettoyage: élimination des REQUEST héritées de Zope.' (#138) from no-request into master
Reviewed-on: https://scodoc.org/git/viennet/ScoDoc/pulls/138
This commit is contained in:
commit
1b89010b45
@ -39,68 +39,6 @@ class ZUser(object):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
class ZRequest(object):
|
||||
"Emulating Zope 2 REQUEST"
|
||||
|
||||
def __init__(self):
|
||||
# if current_app.config["DEBUG"]:
|
||||
|
||||
# le ReverseProxied se charge maintenant de mettre le bon protocole http ou https
|
||||
# self.URL = request.base_url
|
||||
# self.BASE0 = request.url_root
|
||||
# else:
|
||||
# self.URL = request.base_url.replace("http://", "https://")
|
||||
# self.BASE0 = request.url_root.replace("http://", "https://")
|
||||
# self.URL0 = self.URL
|
||||
# query_string is bytes:
|
||||
# self.QUERY_STRING = request.query_string.decode("utf-8")
|
||||
# self.REQUEST_METHOD = request.method
|
||||
# self.AUTHENTICATED_USER = current_user
|
||||
# self.REMOTE_ADDR = request.remote_addr
|
||||
if request.method == "POST":
|
||||
# request.form is a werkzeug.datastructures.ImmutableMultiDict
|
||||
# must copy to get a mutable version (needed by TrivialFormulator)
|
||||
self.form = request.form.copy()
|
||||
if request.files:
|
||||
# Add files in form:
|
||||
self.form.update(request.files)
|
||||
for k in request.form:
|
||||
if k.endswith(":list"):
|
||||
self.form[k[:-5]] = request.form.getlist(k)
|
||||
elif request.method == "GET":
|
||||
self.form = {}
|
||||
for k in request.args:
|
||||
# current_app.logger.debug("%s\t%s" % (k, request.args.getlist(k)))
|
||||
if k.endswith(":list"):
|
||||
self.form[k[:-5]] = request.args.getlist(k)
|
||||
else:
|
||||
values = request.args.getlist(k)
|
||||
self.form[k] = values[0] if len(values) == 1 else values
|
||||
# current_app.logger.info("ZRequest.form=%s" % str(self.form))
|
||||
self.RESPONSE = ZResponse()
|
||||
|
||||
def __str__(self):
|
||||
return """ZREQUEST
|
||||
form={r.form}
|
||||
""".format(
|
||||
r=self
|
||||
)
|
||||
|
||||
|
||||
class ZResponse(object):
|
||||
"Emulating Zope 2 RESPONSE"
|
||||
|
||||
def __init__(self):
|
||||
self.headers = {}
|
||||
|
||||
def redirect(self, url):
|
||||
# current_app.logger.debug("ZResponse redirect to:" + str(url))
|
||||
return flask.redirect(url) # http 302
|
||||
|
||||
def setHeader(self, header, value):
|
||||
self.headers[header.lower()] = value
|
||||
|
||||
|
||||
def scodoc(func):
|
||||
"""Décorateur pour toutes les fonctions ScoDoc
|
||||
Affecte le département à g
|
||||
@ -131,7 +69,6 @@ def permission_required(permission):
|
||||
def decorator(f):
|
||||
@wraps(f)
|
||||
def decorated_function(*args, **kwargs):
|
||||
# current_app.logger.info("PERMISSION; kwargs=%s" % str(kwargs))
|
||||
scodoc_dept = getattr(g, "scodoc_dept", None)
|
||||
if not current_user.has_permission(permission, scodoc_dept):
|
||||
abort(403)
|
||||
@ -192,7 +129,6 @@ def admin_required(f):
|
||||
|
||||
def scodoc7func(func):
|
||||
"""Décorateur pour intégrer les fonctions Zope 2 de ScoDoc 7.
|
||||
Ajoute l'argument REQUEST s'il est dans la signature de la fonction.
|
||||
Les paramètres de la query string deviennent des (keywords) paramètres de la fonction.
|
||||
"""
|
||||
|
||||
@ -209,15 +145,17 @@ def scodoc7func(func):
|
||||
"""
|
||||
# Détermine si on est appelé via une route ("toplevel")
|
||||
# ou par un appel de fonction python normal.
|
||||
top_level = not hasattr(g, "zrequest")
|
||||
top_level = not hasattr(g, "scodoc7_decorated")
|
||||
if not top_level:
|
||||
# ne "redécore" pas
|
||||
return func(*args, **kwargs)
|
||||
g.scodoc7_decorated = True
|
||||
# --- Emulate Zope's REQUEST
|
||||
REQUEST = ZRequest()
|
||||
g.zrequest = REQUEST
|
||||
req_args = REQUEST.form # args from query string (get) or form (post)
|
||||
# --- Add positional arguments
|
||||
# REQUEST = ZRequest()
|
||||
# g.zrequest = REQUEST
|
||||
# args from query string (get) or form (post)
|
||||
req_args = request.form if request.method == "POST" else request.args
|
||||
## --- Add positional arguments
|
||||
pos_arg_values = []
|
||||
argspec = inspect.getfullargspec(func)
|
||||
# current_app.logger.info("argspec=%s" % str(argspec))
|
||||
@ -228,7 +166,10 @@ def scodoc7func(func):
|
||||
arg_names = argspec.args
|
||||
for arg_name in arg_names:
|
||||
if arg_name == "REQUEST": # special case
|
||||
pos_arg_values.append(REQUEST)
|
||||
raise ValueError(
|
||||
"invalid REQUEST parameter !"
|
||||
) # debug check, TODO remove after tests
|
||||
# pos_arg_values.append(REQUEST)
|
||||
else:
|
||||
# peut produire une KeyError s'il manque un argument attendu:
|
||||
v = req_args[arg_name]
|
||||
@ -244,9 +185,9 @@ def scodoc7func(func):
|
||||
# Add keyword arguments
|
||||
if nb_default_args:
|
||||
for arg_name in argspec.args[-nb_default_args:]:
|
||||
if arg_name == "REQUEST": # special case
|
||||
kwargs[arg_name] = REQUEST
|
||||
elif arg_name in req_args:
|
||||
# if arg_name == "REQUEST": # special case
|
||||
# kwargs[arg_name] = REQUEST
|
||||
if arg_name in req_args:
|
||||
# set argument kw optionnel
|
||||
v = req_args[arg_name]
|
||||
# try to convert all arguments to INTEGERS
|
||||
@ -270,13 +211,13 @@ def scodoc7func(func):
|
||||
# Build response, adding collected http headers:
|
||||
headers = []
|
||||
kw = {"response": value, "status": 200}
|
||||
if g.zrequest:
|
||||
headers = g.zrequest.RESPONSE.headers
|
||||
if not headers:
|
||||
# no customized header, speedup:
|
||||
return value
|
||||
if "content-type" in headers:
|
||||
kw["mimetype"] = headers["content-type"]
|
||||
# if g.zrequest:
|
||||
# headers = g.zrequest.RESPONSE.headers
|
||||
# if not headers:
|
||||
# # no customized header, speedup:
|
||||
# return value
|
||||
# if "content-type" in headers:
|
||||
# kw["mimetype"] = headers["content-type"]
|
||||
r = flask.Response(**kw)
|
||||
for h in headers:
|
||||
r.headers[h] = headers[h]
|
||||
|
@ -135,7 +135,7 @@ class TF(object):
|
||||
is_submitted=False,
|
||||
):
|
||||
self.form_url = form_url
|
||||
self.values = values
|
||||
self.values = values.copy()
|
||||
self.formdescription = list(formdescription)
|
||||
self.initvalues = initvalues
|
||||
self.method = method
|
||||
|
@ -39,17 +39,11 @@ from app.scodoc.sco_permissions import Permission
|
||||
|
||||
def sidebar_common():
|
||||
"partie commune à toutes les sidebar"
|
||||
params = {
|
||||
"ScoURL": scu.ScoURL(),
|
||||
"UsersURL": scu.UsersURL(),
|
||||
"NotesURL": scu.NotesURL(),
|
||||
"AbsencesURL": scu.AbsencesURL(),
|
||||
"authuser": current_user.user_name,
|
||||
}
|
||||
H = [
|
||||
f"""<a class="scodoc_title" href="about">ScoDoc 9</a>
|
||||
<div id="authuser"><a id="authuserlink" href="{
|
||||
url_for("users.user_info_page", scodoc_dept=g.scodoc_dept, user_name=current_user.user_name)
|
||||
url_for("users.user_info_page",
|
||||
scodoc_dept=g.scodoc_dept, user_name=current_user.user_name)
|
||||
}">{current_user.user_name}</a>
|
||||
<br/><a id="deconnectlink" href="{url_for("auth.logout")}">déconnexion</a>
|
||||
</div>
|
||||
@ -70,7 +64,8 @@ def sidebar_common():
|
||||
|
||||
if current_user.has_permission(Permission.ScoChangePreferences):
|
||||
H.append(
|
||||
f"""<a href="{url_for("scolar.edit_preferences", scodoc_dept=g.scodoc_dept)}" class="sidebar">Paramétrage</a> <br/>"""
|
||||
f"""<a href="{url_for("scolar.edit_preferences", scodoc_dept=g.scodoc_dept)}"
|
||||
class="sidebar">Paramétrage</a> <br/>"""
|
||||
)
|
||||
|
||||
return "".join(H)
|
||||
@ -96,7 +91,8 @@ def sidebar():
|
||||
"""
|
||||
]
|
||||
# ---- Il y-a-t-il un etudiant selectionné ?
|
||||
etudid = None
|
||||
etudid = g.get("etudid", None)
|
||||
if not etudid:
|
||||
if request.method == "GET":
|
||||
etudid = request.args.get("etudid", None)
|
||||
elif request.method == "POST":
|
||||
|
@ -272,7 +272,6 @@ PVArchive = SemsArchiver()
|
||||
|
||||
|
||||
def do_formsemestre_archive(
|
||||
REQUEST,
|
||||
formsemestre_id,
|
||||
group_ids=[], # si indiqué, ne prend que ces groupes
|
||||
description="",
|
||||
@ -340,14 +339,12 @@ def do_formsemestre_archive(
|
||||
data = data.encode(scu.SCO_ENCODING)
|
||||
PVArchive.store(archive_id, "Bulletins.xml", data)
|
||||
# Decisions de jury, en XLS
|
||||
data = sco_pvjury.formsemestre_pvjury(
|
||||
formsemestre_id, format="xls", REQUEST=REQUEST, publish=False
|
||||
)
|
||||
data = sco_pvjury.formsemestre_pvjury(formsemestre_id, format="xls", publish=False)
|
||||
if data:
|
||||
PVArchive.store(archive_id, "Decisions_Jury" + scu.XLSX_SUFFIX, data)
|
||||
# Classeur bulletins (PDF)
|
||||
data, _ = sco_bulletins_pdf.get_formsemestre_bulletins_pdf(
|
||||
formsemestre_id, REQUEST, version=bulVersion
|
||||
formsemestre_id, version=bulVersion
|
||||
)
|
||||
if data:
|
||||
PVArchive.store(archive_id, "Bulletins.pdf", data)
|
||||
@ -378,7 +375,7 @@ def do_formsemestre_archive(
|
||||
PVArchive.store(archive_id, "PV_Jury%s.pdf" % groups_filename, data)
|
||||
|
||||
|
||||
def formsemestre_archive(REQUEST, formsemestre_id, group_ids=[]):
|
||||
def formsemestre_archive(formsemestre_id, group_ids=[]):
|
||||
"""Make and store new archive for this formsemestre.
|
||||
(all students or only selected groups)
|
||||
"""
|
||||
@ -456,7 +453,7 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement.
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
descr,
|
||||
cancelbutton="Annuler",
|
||||
method="POST",
|
||||
@ -478,7 +475,6 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement.
|
||||
else:
|
||||
tf[2]["anonymous"] = False
|
||||
do_formsemestre_archive(
|
||||
REQUEST,
|
||||
formsemestre_id,
|
||||
group_ids=group_ids,
|
||||
description=tf[2]["description"],
|
||||
@ -502,7 +498,7 @@ enregistrés et non modifiables, on peut les retrouver ultérieurement.
|
||||
)
|
||||
|
||||
|
||||
def formsemestre_list_archives(REQUEST, formsemestre_id):
|
||||
def formsemestre_list_archives(formsemestre_id):
|
||||
"""Page listing archives"""
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
sem_archive_id = formsemestre_id
|
||||
@ -552,9 +548,7 @@ def formsemestre_get_archived_file(formsemestre_id, archive_name, filename):
|
||||
return PVArchive.get_archived_file(sem_archive_id, archive_name, filename)
|
||||
|
||||
|
||||
def formsemestre_delete_archive(
|
||||
REQUEST, formsemestre_id, archive_name, dialog_confirmed=False
|
||||
):
|
||||
def formsemestre_delete_archive(formsemestre_id, archive_name, dialog_confirmed=False):
|
||||
"""Delete an archive"""
|
||||
if not sco_permissions_check.can_edit_pv(formsemestre_id):
|
||||
raise AccessDenied("opération non autorisée pour %s" % str(current_user))
|
||||
|
@ -59,7 +59,7 @@ def can_edit_etud_archive(authuser):
|
||||
return authuser.has_permission(Permission.ScoEtudAddAnnotations)
|
||||
|
||||
|
||||
def etud_list_archives_html(REQUEST, etudid):
|
||||
def etud_list_archives_html(etudid):
|
||||
"""HTML snippet listing archives"""
|
||||
can_edit = can_edit_etud_archive(current_user)
|
||||
etuds = sco_etud.get_etud_info(etudid=etudid)
|
||||
@ -131,7 +131,7 @@ def add_archives_info_to_etud_list(etuds):
|
||||
etud["etudarchive"] = ", ".join(l)
|
||||
|
||||
|
||||
def etud_upload_file_form(REQUEST, etudid):
|
||||
def etud_upload_file_form(etudid):
|
||||
"""Page with a form to choose and upload a file, with a description."""
|
||||
# check permission
|
||||
if not can_edit_etud_archive(current_user):
|
||||
@ -153,7 +153,7 @@ def etud_upload_file_form(REQUEST, etudid):
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("etudid", {"default": etudid, "input_type": "hidden"}),
|
||||
("datafile", {"input_type": "file", "title": "Fichier", "size": 30}),
|
||||
@ -198,7 +198,7 @@ def _store_etud_file_to_new_archive(etud_archive_id, data, filename, description
|
||||
EtudsArchive.store(archive_id, filename, data)
|
||||
|
||||
|
||||
def etud_delete_archive(REQUEST, etudid, archive_name, dialog_confirmed=False):
|
||||
def etud_delete_archive(etudid, archive_name, dialog_confirmed=False):
|
||||
"""Delete an archive"""
|
||||
# check permission
|
||||
if not can_edit_etud_archive(current_user):
|
||||
@ -250,7 +250,7 @@ def etud_get_archived_file(etudid, archive_name, filename):
|
||||
|
||||
|
||||
# --- Upload d'un ensemble de fichiers (pour un groupe d'étudiants)
|
||||
def etudarchive_generate_excel_sample(group_id=None, REQUEST=None):
|
||||
def etudarchive_generate_excel_sample(group_id=None):
|
||||
"""Feuille excel pour import fichiers etudiants (utilisé pour admissions)"""
|
||||
fmt = sco_import_etuds.sco_import_format()
|
||||
data = sco_import_etuds.sco_import_generate_excel_sample(
|
||||
@ -274,7 +274,7 @@ def etudarchive_generate_excel_sample(group_id=None, REQUEST=None):
|
||||
)
|
||||
|
||||
|
||||
def etudarchive_import_files_form(group_id, REQUEST=None):
|
||||
def etudarchive_import_files_form(group_id):
|
||||
"""Formulaire pour importation fichiers d'un groupe"""
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
@ -309,7 +309,7 @@ def etudarchive_import_files_form(group_id, REQUEST=None):
|
||||
F = html_sco_header.sco_footer()
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("xlsfile", {"title": "Fichier Excel:", "input_type": "file", "size": 40}),
|
||||
("zipfile", {"title": "Fichier zip:", "input_type": "file", "size": 40}),
|
||||
|
@ -766,7 +766,6 @@ def formsemestre_bulletinetud(
|
||||
xml_with_decisions=False,
|
||||
force_publishing=False, # force publication meme si semestre non publie sur "portail"
|
||||
prefer_mail_perso=False,
|
||||
REQUEST=None,
|
||||
):
|
||||
"page bulletin de notes"
|
||||
try:
|
||||
@ -786,7 +785,6 @@ def formsemestre_bulletinetud(
|
||||
xml_with_decisions=xml_with_decisions,
|
||||
force_publishing=force_publishing,
|
||||
prefer_mail_perso=prefer_mail_perso,
|
||||
REQUEST=REQUEST,
|
||||
)[0]
|
||||
if format not in {"html", "pdfmail"}:
|
||||
filename = scu.bul_filename(sem, etud, format)
|
||||
@ -795,7 +793,7 @@ def formsemestre_bulletinetud(
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
H = [
|
||||
_formsemestre_bulletinetud_header_html(
|
||||
etud, etudid, sem, formsemestre_id, format, version, REQUEST
|
||||
etud, etudid, sem, formsemestre_id, format, version
|
||||
),
|
||||
bulletin,
|
||||
]
|
||||
@ -853,7 +851,6 @@ def do_formsemestre_bulletinetud(
|
||||
etudid,
|
||||
version="long", # short, long, selectedevals
|
||||
format="html",
|
||||
REQUEST=None,
|
||||
nohtml=False,
|
||||
xml_with_decisions=False, # force decisions dans XML
|
||||
force_publishing=False, # force publication meme si semestre non publie sur "portail"
|
||||
@ -1005,7 +1002,6 @@ def _formsemestre_bulletinetud_header_html(
|
||||
formsemestre_id=None,
|
||||
format=None,
|
||||
version=None,
|
||||
REQUEST=None,
|
||||
):
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
|
@ -164,7 +164,7 @@ def process_field(field, cdict, style, suppress_empty_pars=False, format="pdf"):
|
||||
return sco_pdf.makeParas(text, style, suppress_empty=suppress_empty_pars)
|
||||
|
||||
|
||||
def get_formsemestre_bulletins_pdf(formsemestre_id, REQUEST, version="selectedevals"):
|
||||
def get_formsemestre_bulletins_pdf(formsemestre_id, version="selectedevals"):
|
||||
"document pdf et filename"
|
||||
from app.scodoc import sco_bulletins
|
||||
|
||||
@ -184,7 +184,6 @@ def get_formsemestre_bulletins_pdf(formsemestre_id, REQUEST, version="selectedev
|
||||
etudid,
|
||||
format="pdfpart",
|
||||
version=version,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
fragments += frag
|
||||
filigrannes[i] = filigranne
|
||||
@ -192,7 +191,7 @@ def get_formsemestre_bulletins_pdf(formsemestre_id, REQUEST, version="selectedev
|
||||
i = i + 1
|
||||
#
|
||||
infos = {"DeptName": sco_preferences.get_preference("DeptName", formsemestre_id)}
|
||||
if REQUEST:
|
||||
if request:
|
||||
server_name = request.url_root
|
||||
else:
|
||||
server_name = ""
|
||||
@ -220,7 +219,7 @@ def get_formsemestre_bulletins_pdf(formsemestre_id, REQUEST, version="selectedev
|
||||
return pdfdoc, filename
|
||||
|
||||
|
||||
def get_etud_bulletins_pdf(etudid, REQUEST, version="selectedevals"):
|
||||
def get_etud_bulletins_pdf(etudid, version="selectedevals"):
|
||||
"Bulletins pdf de tous les semestres de l'étudiant, et filename"
|
||||
from app.scodoc import sco_bulletins
|
||||
|
||||
@ -235,14 +234,13 @@ def get_etud_bulletins_pdf(etudid, REQUEST, version="selectedevals"):
|
||||
etudid,
|
||||
format="pdfpart",
|
||||
version=version,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
fragments += frag
|
||||
filigrannes[i] = filigranne
|
||||
bookmarks[i] = sem["session_id"] # eg RT-DUT-FI-S1-2015
|
||||
i = i + 1
|
||||
infos = {"DeptName": sco_preferences.get_preference("DeptName")}
|
||||
if REQUEST:
|
||||
if request:
|
||||
server_name = request.url_root
|
||||
else:
|
||||
server_name = ""
|
||||
|
@ -56,7 +56,7 @@ et sur page "réglages bulletin" (avec formsemestre_id)
|
||||
# import os
|
||||
|
||||
|
||||
# def form_change_bul_sig(side, formsemestre_id=None, REQUEST=None):
|
||||
# def form_change_bul_sig(side, formsemestre_id=None):
|
||||
# """Change pdf signature"""
|
||||
# filename = _get_sig_existing_filename(
|
||||
# side, formsemestre_id=formsemestre_id
|
||||
@ -69,7 +69,7 @@ et sur page "réglages bulletin" (avec formsemestre_id)
|
||||
# raise ValueError("invalid value for 'side' parameter")
|
||||
# signatureloc = get_bul_sig_img()
|
||||
# H = [
|
||||
# self.sco_header(REQUEST, page_title="Changement de signature"),
|
||||
# self.sco_header(page_title="Changement de signature"),
|
||||
# """<h2>Changement de la signature bulletin de %(sidetxt)s</h2>
|
||||
# """
|
||||
# % (sidetxt,),
|
||||
|
@ -47,7 +47,6 @@ def formsemestre_table_estim_cost(
|
||||
n_group_tp=1,
|
||||
coef_tp=1,
|
||||
coef_cours=1.5,
|
||||
REQUEST=None,
|
||||
):
|
||||
"""
|
||||
Rapports estimation coût de formation basé sur le programme pédagogique
|
||||
@ -158,7 +157,6 @@ def formsemestre_estim_cost(
|
||||
coef_tp=1,
|
||||
coef_cours=1.5,
|
||||
format="html",
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Page (formulaire) estimation coûts"""
|
||||
|
||||
@ -173,7 +171,6 @@ def formsemestre_estim_cost(
|
||||
n_group_tp=n_group_tp,
|
||||
coef_tp=coef_tp,
|
||||
coef_cours=coef_cours,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
h = """
|
||||
<form name="f" method="get" action="%s">
|
||||
|
@ -46,7 +46,7 @@ from app.scodoc import sco_up_to_date
|
||||
from app.scodoc import sco_users
|
||||
|
||||
|
||||
def index_html(REQUEST=None, showcodes=0, showsemtable=0):
|
||||
def index_html(showcodes=0, showsemtable=0):
|
||||
"Page accueil département (liste des semestres)"
|
||||
showsemtable = int(showsemtable)
|
||||
H = []
|
||||
|
@ -119,12 +119,12 @@ def do_formation_delete(oid):
|
||||
)
|
||||
|
||||
|
||||
def formation_create(REQUEST=None):
|
||||
def formation_create():
|
||||
"""Creation d'une formation"""
|
||||
return formation_edit(create=True, REQUEST=REQUEST)
|
||||
return formation_edit(create=True)
|
||||
|
||||
|
||||
def formation_edit(formation_id=None, create=False, REQUEST=None):
|
||||
def formation_edit(formation_id=None, create=False):
|
||||
"""Edit or create a formation"""
|
||||
if create:
|
||||
H = [
|
||||
@ -160,7 +160,7 @@ def formation_edit(formation_id=None, create=False, REQUEST=None):
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("formation_id", {"default": formation_id, "input_type": "hidden"}),
|
||||
(
|
||||
|
@ -92,7 +92,7 @@ def do_matiere_create(args):
|
||||
return r
|
||||
|
||||
|
||||
def matiere_create(ue_id=None, REQUEST=None):
|
||||
def matiere_create(ue_id=None):
|
||||
"""Creation d'une matiere"""
|
||||
from app.scodoc import sco_edit_ue
|
||||
|
||||
@ -117,7 +117,7 @@ associé.
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("ue_id", {"input_type": "hidden", "default": ue_id}),
|
||||
("titre", {"size": 30, "explanation": "nom de la matière."}),
|
||||
@ -189,7 +189,7 @@ def do_matiere_delete(oid):
|
||||
)
|
||||
|
||||
|
||||
def matiere_delete(matiere_id=None, REQUEST=None):
|
||||
def matiere_delete(matiere_id=None):
|
||||
"""Delete an UE"""
|
||||
from app.scodoc import sco_edit_ue
|
||||
|
||||
@ -203,7 +203,7 @@ def matiere_delete(matiere_id=None, REQUEST=None):
|
||||
dest_url = scu.NotesURL() + "/ue_list?formation_id=" + str(UE["formation_id"])
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(("matiere_id", {"input_type": "hidden"}),),
|
||||
initvalues=M,
|
||||
submitlabel="Confirmer la suppression",
|
||||
@ -218,7 +218,7 @@ def matiere_delete(matiere_id=None, REQUEST=None):
|
||||
return flask.redirect(dest_url)
|
||||
|
||||
|
||||
def matiere_edit(matiere_id=None, REQUEST=None):
|
||||
def matiere_edit(matiere_id=None):
|
||||
"""Edit matiere"""
|
||||
from app.scodoc import sco_formations
|
||||
from app.scodoc import sco_edit_ue
|
||||
@ -257,7 +257,7 @@ associé.
|
||||
</p>"""
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("matiere_id", {"input_type": "hidden"}),
|
||||
(
|
||||
|
@ -119,7 +119,7 @@ def do_module_create(args) -> int:
|
||||
return r
|
||||
|
||||
|
||||
def module_create(matiere_id=None, REQUEST=None):
|
||||
def module_create(matiere_id=None):
|
||||
"""Creation d'un module"""
|
||||
from app.scodoc import sco_formations
|
||||
from app.scodoc import sco_edit_ue
|
||||
@ -145,7 +145,7 @@ def module_create(matiere_id=None, REQUEST=None):
|
||||
default_num = 10
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
(
|
||||
"code",
|
||||
@ -281,7 +281,7 @@ def do_module_delete(oid):
|
||||
)
|
||||
|
||||
|
||||
def module_delete(module_id=None, REQUEST=None):
|
||||
def module_delete(module_id=None):
|
||||
"""Delete a module"""
|
||||
if not module_id:
|
||||
raise ScoValueError("invalid module !")
|
||||
@ -297,7 +297,7 @@ def module_delete(module_id=None, REQUEST=None):
|
||||
dest_url = scu.NotesURL() + "/ue_list?formation_id=" + str(Mod["formation_id"])
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(("module_id", {"input_type": "hidden"}),),
|
||||
initvalues=Mod,
|
||||
submitlabel="Confirmer la suppression",
|
||||
@ -339,7 +339,7 @@ def check_module_code_unicity(code, field, formation_id, module_id=None):
|
||||
return len(Mods) == 0
|
||||
|
||||
|
||||
def module_edit(module_id=None, REQUEST=None):
|
||||
def module_edit(module_id=None):
|
||||
"""Edit a module"""
|
||||
from app.scodoc import sco_formations
|
||||
from app.scodoc import sco_tag_module
|
||||
@ -391,7 +391,7 @@ def module_edit(module_id=None, REQUEST=None):
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
(
|
||||
"code",
|
||||
@ -515,7 +515,7 @@ def module_edit(module_id=None, REQUEST=None):
|
||||
|
||||
|
||||
# Edition en ligne du code Apogee
|
||||
def edit_module_set_code_apogee(id=None, value=None, REQUEST=None):
|
||||
def edit_module_set_code_apogee(id=None, value=None):
|
||||
"Set UE code apogee"
|
||||
module_id = id
|
||||
value = value.strip("-_ \t")
|
||||
@ -531,7 +531,7 @@ def edit_module_set_code_apogee(id=None, value=None, REQUEST=None):
|
||||
return value
|
||||
|
||||
|
||||
def module_list(formation_id, REQUEST=None):
|
||||
def module_list(formation_id):
|
||||
"""Liste des modules de la formation
|
||||
(XXX inutile ou a revoir)
|
||||
"""
|
||||
@ -584,7 +584,7 @@ def module_count_moduleimpls(module_id):
|
||||
return len(mods)
|
||||
|
||||
|
||||
def formation_add_malus_modules(formation_id, titre=None, REQUEST=None):
|
||||
def formation_add_malus_modules(formation_id, titre=None, redirect=True):
|
||||
"""Création d'un module de "malus" dans chaque UE d'une formation"""
|
||||
from app.scodoc import sco_edit_ue
|
||||
|
||||
@ -600,13 +600,13 @@ def formation_add_malus_modules(formation_id, titre=None, REQUEST=None):
|
||||
]
|
||||
)
|
||||
if nb_mod_malus == 0:
|
||||
ue_add_malus_module(ue["ue_id"], titre=titre, REQUEST=REQUEST)
|
||||
ue_add_malus_module(ue["ue_id"], titre=titre)
|
||||
|
||||
if REQUEST:
|
||||
if redirect:
|
||||
return flask.redirect("ue_list?formation_id=" + str(formation_id))
|
||||
|
||||
|
||||
def ue_add_malus_module(ue_id, titre=None, code=None, REQUEST=None):
|
||||
def ue_add_malus_module(ue_id, titre=None, code=None):
|
||||
"""Add a malus module in this ue"""
|
||||
from app.scodoc import sco_edit_ue
|
||||
|
||||
|
@ -186,12 +186,12 @@ def do_ue_delete(ue_id, delete_validations=False, force=False):
|
||||
return None
|
||||
|
||||
|
||||
def ue_create(formation_id=None, REQUEST=None):
|
||||
def ue_create(formation_id=None):
|
||||
"""Creation d'une UE"""
|
||||
return ue_edit(create=True, formation_id=formation_id, REQUEST=REQUEST)
|
||||
return ue_edit(create=True, formation_id=formation_id)
|
||||
|
||||
|
||||
def ue_edit(ue_id=None, create=False, formation_id=None, REQUEST=None):
|
||||
def ue_edit(ue_id=None, create=False, formation_id=None):
|
||||
"""Modification ou creation d'une UE"""
|
||||
from app.scodoc import sco_formations
|
||||
|
||||
@ -328,7 +328,7 @@ def ue_edit(ue_id=None, create=False, formation_id=None, REQUEST=None):
|
||||
)
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
fw,
|
||||
initvalues=initvalues,
|
||||
submitlabel=submitlabel,
|
||||
@ -958,7 +958,7 @@ def ue_is_locked(ue_id):
|
||||
|
||||
|
||||
# ---- Table recap formation
|
||||
def formation_table_recap(formation_id, format="html", REQUEST=None):
|
||||
def formation_table_recap(formation_id, format="html"):
|
||||
"""Table recapitulant formation."""
|
||||
from app.scodoc import sco_formations
|
||||
|
||||
|
@ -123,7 +123,7 @@ def get_edt_transcodage_groups(formsemestre_id):
|
||||
return edt2sco, sco2edt, msg
|
||||
|
||||
|
||||
def group_edt_json(group_id, start="", end="", REQUEST=None): # actuellement inutilisé
|
||||
def group_edt_json(group_id, start="", end=""): # actuellement inutilisé
|
||||
"""EDT complet du semestre, au format JSON
|
||||
TODO: indiquer un groupe
|
||||
TODO: utiliser start et end (2 dates au format ISO YYYY-MM-DD)
|
||||
@ -159,9 +159,7 @@ for e in events:
|
||||
"""
|
||||
|
||||
|
||||
def experimental_calendar(
|
||||
group_id=None, formsemestre_id=None, REQUEST=None
|
||||
): # inutilisé
|
||||
def experimental_calendar(group_id=None, formsemestre_id=None): # inutilisé
|
||||
"""experimental page"""
|
||||
return "\n".join(
|
||||
[
|
||||
|
@ -62,7 +62,6 @@ def apo_semset_maq_status(
|
||||
block_export_res_ues=False,
|
||||
block_export_res_modules=False,
|
||||
block_export_res_sdj=True,
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Page statut / tableau de bord"""
|
||||
if not semset_id:
|
||||
@ -83,7 +82,7 @@ def apo_semset_maq_status(
|
||||
|
||||
prefs = sco_preferences.SemPreferences()
|
||||
|
||||
tab_archives = table_apo_csv_list(semset, REQUEST=REQUEST)
|
||||
tab_archives = table_apo_csv_list(semset)
|
||||
|
||||
(
|
||||
ok_for_export,
|
||||
@ -430,7 +429,7 @@ def apo_semset_maq_status(
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
def table_apo_csv_list(semset, REQUEST=None):
|
||||
def table_apo_csv_list(semset):
|
||||
"""Table des archives (triée par date d'archivage)"""
|
||||
annee_scolaire = semset["annee_scolaire"]
|
||||
sem_id = semset["sem_id"]
|
||||
@ -484,7 +483,7 @@ def table_apo_csv_list(semset, REQUEST=None):
|
||||
return tab
|
||||
|
||||
|
||||
def view_apo_etuds(semset_id, title="", nip_list="", format="html", REQUEST=None):
|
||||
def view_apo_etuds(semset_id, title="", nip_list="", format="html"):
|
||||
"""Table des étudiants Apogée par nips
|
||||
nip_list est une chaine, codes nip séparés par des ,
|
||||
"""
|
||||
@ -517,11 +516,10 @@ def view_apo_etuds(semset_id, title="", nip_list="", format="html", REQUEST=None
|
||||
etuds=list(etuds.values()),
|
||||
keys=("nip", "etape_apo", "nom", "prenom", "inscriptions_scodoc"),
|
||||
format=format,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
def view_scodoc_etuds(semset_id, title="", nip_list="", format="html", REQUEST=None):
|
||||
def view_scodoc_etuds(semset_id, title="", nip_list="", format="html"):
|
||||
"""Table des étudiants ScoDoc par nips ou etudids"""
|
||||
if not isinstance(nip_list, str):
|
||||
nip_list = str(nip_list)
|
||||
@ -541,13 +539,10 @@ def view_scodoc_etuds(semset_id, title="", nip_list="", format="html", REQUEST=N
|
||||
etuds=etuds,
|
||||
keys=("code_nip", "nom", "prenom"),
|
||||
format=format,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
def _view_etuds_page(
|
||||
semset_id, title="", etuds=[], keys=(), format="html", REQUEST=None
|
||||
):
|
||||
def _view_etuds_page(semset_id, title="", etuds=[], keys=(), format="html"):
|
||||
# Tri les étudiants par nom:
|
||||
if etuds:
|
||||
etuds.sort(key=lambda x: (x["nom"], x["prenom"]))
|
||||
@ -590,9 +585,7 @@ def _view_etuds_page(
|
||||
return "\n".join(H) + html_sco_header.sco_footer()
|
||||
|
||||
|
||||
def view_apo_csv_store(
|
||||
semset_id="", csvfile=None, data="", autodetect=False, REQUEST=None
|
||||
):
|
||||
def view_apo_csv_store(semset_id="", csvfile=None, data="", autodetect=False):
|
||||
"""Store CSV data
|
||||
Le semset identifie l'annee scolaire et le semestre
|
||||
Si csvfile, lit depuis FILE, sinon utilise data
|
||||
@ -627,7 +620,7 @@ def view_apo_csv_store(
|
||||
return flask.redirect("apo_semset_maq_status?semset_id=" + semset_id)
|
||||
|
||||
|
||||
def view_apo_csv_download_and_store(etape_apo="", semset_id="", REQUEST=None):
|
||||
def view_apo_csv_download_and_store(etape_apo="", semset_id=""):
|
||||
"""Download maquette and store it"""
|
||||
if not semset_id:
|
||||
raise ValueError("invalid null semset_id")
|
||||
@ -639,12 +632,10 @@ def view_apo_csv_download_and_store(etape_apo="", semset_id="", REQUEST=None):
|
||||
# here, data is utf8
|
||||
# but we store and generate latin1 files, to ease further import in Apogée
|
||||
data = data.decode(APO_PORTAL_ENCODING).encode(APO_INPUT_ENCODING) # XXX #py3
|
||||
return view_apo_csv_store(semset_id, data=data, autodetect=False, REQUEST=REQUEST)
|
||||
return view_apo_csv_store(semset_id, data=data, autodetect=False)
|
||||
|
||||
|
||||
def view_apo_csv_delete(
|
||||
etape_apo="", semset_id="", dialog_confirmed=False, REQUEST=None
|
||||
):
|
||||
def view_apo_csv_delete(etape_apo="", semset_id="", dialog_confirmed=False):
|
||||
"""Delete CSV file"""
|
||||
if not semset_id:
|
||||
raise ValueError("invalid null semset_id")
|
||||
@ -667,7 +658,7 @@ def view_apo_csv_delete(
|
||||
return flask.redirect(dest_url + "&head_message=Archive%20supprimée")
|
||||
|
||||
|
||||
def view_apo_csv(etape_apo="", semset_id="", format="html", REQUEST=None):
|
||||
def view_apo_csv(etape_apo="", semset_id="", format="html"):
|
||||
"""Visualise une maquette stockée
|
||||
Si format="raw", renvoie le fichier maquette tel quel
|
||||
"""
|
||||
|
@ -314,9 +314,7 @@ def check_nom_prenom(cnx, nom="", prenom="", etudid=None):
|
||||
return True, len(res)
|
||||
|
||||
|
||||
def _check_duplicate_code(
|
||||
cnx, args, code_name, disable_notify=False, edit=True, REQUEST=None
|
||||
):
|
||||
def _check_duplicate_code(cnx, args, code_name, disable_notify=False, edit=True):
|
||||
etudid = args.get("etudid", None)
|
||||
if args.get(code_name, None):
|
||||
etuds = identite_list(cnx, {code_name: str(args[code_name])})
|
||||
@ -374,15 +372,15 @@ def _check_civilite(args):
|
||||
args["civilite"] = input_civilite(civilite) # TODO: A faire valider
|
||||
|
||||
|
||||
def identite_edit(cnx, args, disable_notify=False, REQUEST=None):
|
||||
def identite_edit(cnx, args, disable_notify=False):
|
||||
"""Modifie l'identite d'un étudiant.
|
||||
Si pref notification et difference, envoie message notification, sauf si disable_notify
|
||||
"""
|
||||
_check_duplicate_code(
|
||||
cnx, args, "code_nip", disable_notify=disable_notify, edit=True, REQUEST=REQUEST
|
||||
cnx, args, "code_nip", disable_notify=disable_notify, edit=True
|
||||
)
|
||||
_check_duplicate_code(
|
||||
cnx, args, "code_ine", disable_notify=disable_notify, edit=True, REQUEST=REQUEST
|
||||
cnx, args, "code_ine", disable_notify=disable_notify, edit=True
|
||||
)
|
||||
notify_to = None
|
||||
if not disable_notify:
|
||||
@ -410,10 +408,10 @@ def identite_edit(cnx, args, disable_notify=False, REQUEST=None):
|
||||
)
|
||||
|
||||
|
||||
def identite_create(cnx, args, REQUEST=None):
|
||||
def identite_create(cnx, args):
|
||||
"check unique etudid, then create"
|
||||
_check_duplicate_code(cnx, args, "code_nip", edit=False, REQUEST=REQUEST)
|
||||
_check_duplicate_code(cnx, args, "code_ine", edit=False, REQUEST=REQUEST)
|
||||
_check_duplicate_code(cnx, args, "code_nip", edit=False)
|
||||
_check_duplicate_code(cnx, args, "code_ine", edit=False)
|
||||
_check_civilite(args)
|
||||
|
||||
if "etudid" in args:
|
||||
@ -577,8 +575,8 @@ admission_edit = _admissionEditor.edit
|
||||
|
||||
# Edition simultanee de identite et admission
|
||||
class EtudIdentEditor(object):
|
||||
def create(self, cnx, args, REQUEST=None):
|
||||
etudid = identite_create(cnx, args, REQUEST)
|
||||
def create(self, cnx, args):
|
||||
etudid = identite_create(cnx, args)
|
||||
args["etudid"] = etudid
|
||||
admission_create(cnx, args)
|
||||
return etudid
|
||||
@ -609,8 +607,8 @@ class EtudIdentEditor(object):
|
||||
res.sort(key=itemgetter("nom", "prenom"))
|
||||
return res
|
||||
|
||||
def edit(self, cnx, args, disable_notify=False, REQUEST=None):
|
||||
identite_edit(cnx, args, disable_notify=disable_notify, REQUEST=REQUEST)
|
||||
def edit(self, cnx, args, disable_notify=False):
|
||||
identite_edit(cnx, args, disable_notify=disable_notify)
|
||||
if "adm_id" in args: # safety net
|
||||
admission_edit(cnx, args)
|
||||
|
||||
@ -659,8 +657,8 @@ def log_unknown_etud():
|
||||
def get_etud_info(etudid=False, code_nip=False, filled=False) -> list:
|
||||
"""infos sur un etudiant (API). If not foud, returns empty list.
|
||||
On peut specifier etudid ou code_nip
|
||||
ou bien cherche dans REQUEST.form: etudid, code_nip, code_ine
|
||||
(dans cet ordre).
|
||||
ou bien cherche dans les argumenst de la requête courante:
|
||||
etudid, code_nip, code_ine (dans cet ordre).
|
||||
"""
|
||||
if etudid is None:
|
||||
return []
|
||||
@ -673,7 +671,7 @@ def get_etud_info(etudid=False, code_nip=False, filled=False) -> list:
|
||||
return etud
|
||||
|
||||
|
||||
def create_etud(cnx, args={}, REQUEST=None):
|
||||
def create_etud(cnx, args={}):
|
||||
"""Creation d'un étudiant. génère aussi évenement et "news".
|
||||
|
||||
Args:
|
||||
@ -685,7 +683,7 @@ def create_etud(cnx, args={}, REQUEST=None):
|
||||
from app.scodoc import sco_news
|
||||
|
||||
# creation d'un etudiant
|
||||
etudid = etudident_create(cnx, args, REQUEST=REQUEST)
|
||||
etudid = etudident_create(cnx, args)
|
||||
# crée une adresse vide (chaque etudiant doit etre dans la table "adresse" !)
|
||||
_ = adresse_create(
|
||||
cnx,
|
||||
|
@ -250,7 +250,6 @@ def do_evaluation_create(
|
||||
publish_incomplete=None,
|
||||
evaluation_type=None,
|
||||
numero=None,
|
||||
REQUEST=None,
|
||||
**kw, # ceci pour absorber les arguments excedentaires de tf #sco8
|
||||
):
|
||||
"""Create an evaluation"""
|
||||
@ -713,7 +712,7 @@ def do_evaluation_etat_in_mod(nt, moduleimpl_id):
|
||||
return etat
|
||||
|
||||
|
||||
def formsemestre_evaluations_cal(formsemestre_id, REQUEST=None):
|
||||
def formsemestre_evaluations_cal(formsemestre_id):
|
||||
"""Page avec calendrier de toutes les evaluations de ce semestre"""
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > liste evaluations
|
||||
@ -843,9 +842,7 @@ def evaluation_date_first_completion(evaluation_id):
|
||||
return max(date_premiere_note.values())
|
||||
|
||||
|
||||
def formsemestre_evaluations_delai_correction(
|
||||
formsemestre_id, format="html", REQUEST=None
|
||||
):
|
||||
def formsemestre_evaluations_delai_correction(formsemestre_id, format="html"):
|
||||
"""Experimental: un tableau indiquant pour chaque évaluation
|
||||
le nombre de jours avant la publication des notes.
|
||||
|
||||
@ -1109,7 +1106,6 @@ def evaluation_describe(evaluation_id="", edit_in_place=True):
|
||||
def evaluation_create_form(
|
||||
moduleimpl_id=None,
|
||||
evaluation_id=None,
|
||||
REQUEST=None,
|
||||
edit=False,
|
||||
readonly=False,
|
||||
page_title="Evaluation",
|
||||
@ -1231,11 +1227,9 @@ def evaluation_create_form(
|
||||
initvalues["visibulletinlist"] = ["X"]
|
||||
else:
|
||||
initvalues["visibulletinlist"] = []
|
||||
if (
|
||||
REQUEST.form.get("tf_submitted", False)
|
||||
and "visibulletinlist" not in REQUEST.form
|
||||
):
|
||||
REQUEST.form["visibulletinlist"] = []
|
||||
vals = request.form if request.method == "POST" else request.args
|
||||
if vals.get("tf_submitted", False) and "visibulletinlist" not in vals:
|
||||
request.form["visibulletinlist"] = []
|
||||
#
|
||||
form = [
|
||||
("evaluation_id", {"default": evaluation_id, "input_type": "hidden"}),
|
||||
@ -1346,7 +1340,7 @@ def evaluation_create_form(
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
vals,
|
||||
form,
|
||||
cancelbutton="Annuler",
|
||||
submitlabel=submitlabel,
|
||||
@ -1368,7 +1362,7 @@ def evaluation_create_form(
|
||||
tf[2]["visibulletin"] = False
|
||||
if not edit:
|
||||
# creation d'une evaluation
|
||||
evaluation_id = do_evaluation_create(REQUEST=REQUEST, **tf[2])
|
||||
evaluation_id = do_evaluation_create(**tf[2])
|
||||
return flask.redirect(dest_url)
|
||||
else:
|
||||
do_evaluation_edit(tf[2])
|
||||
|
@ -216,9 +216,7 @@ def get_set_formsemestre_id_dates(start_date, end_date):
|
||||
return {x["id"] for x in s}
|
||||
|
||||
|
||||
def scodoc_table_results(
|
||||
start_date="", end_date="", types_parcours=[], format="html", REQUEST=None
|
||||
):
|
||||
def scodoc_table_results(start_date="", end_date="", types_parcours=[], format="html"):
|
||||
"""Page affichant la table des résultats
|
||||
Les dates sont en dd/mm/yyyy (datepicker javascript)
|
||||
types_parcours est la liste des types de parcours à afficher
|
||||
|
@ -362,7 +362,7 @@ def table_etud_in_accessible_depts(expnom=None):
|
||||
)
|
||||
|
||||
|
||||
def search_inscr_etud_by_nip(code_nip, REQUEST=None, format="json"):
|
||||
def search_inscr_etud_by_nip(code_nip, format="json"):
|
||||
"""Recherche multi-departement d'un étudiant par son code NIP
|
||||
Seuls les départements accessibles par l'utilisateur sont cherchés.
|
||||
|
||||
|
@ -77,7 +77,7 @@ def formsemestre_custommenu_html(formsemestre_id):
|
||||
return htmlutils.make_menu("Liens", menu)
|
||||
|
||||
|
||||
def formsemestre_custommenu_edit(formsemestre_id, REQUEST=None):
|
||||
def formsemestre_custommenu_edit(formsemestre_id):
|
||||
"""Dialog to edit the custom menu"""
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
dest_url = (
|
||||
@ -118,7 +118,7 @@ def formsemestre_custommenu_edit(formsemestre_id, REQUEST=None):
|
||||
initvalues["url_" + str(item["custommenu_id"])] = item["url"]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
descr,
|
||||
initvalues=initvalues,
|
||||
cancelbutton="Annuler",
|
||||
|
@ -66,7 +66,7 @@ def _default_sem_title(F):
|
||||
return F["titre"]
|
||||
|
||||
|
||||
def formsemestre_createwithmodules(REQUEST=None):
|
||||
def formsemestre_createwithmodules():
|
||||
"""Page création d'un semestre"""
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
@ -77,7 +77,7 @@ def formsemestre_createwithmodules(REQUEST=None):
|
||||
),
|
||||
"""<h2>Mise en place d'un semestre de formation</h2>""",
|
||||
]
|
||||
r = do_formsemestre_createwithmodules(REQUEST=REQUEST)
|
||||
r = do_formsemestre_createwithmodules()
|
||||
if isinstance(r, str):
|
||||
H.append(r)
|
||||
else:
|
||||
@ -85,7 +85,7 @@ def formsemestre_createwithmodules(REQUEST=None):
|
||||
return "\n".join(H) + html_sco_header.sco_footer()
|
||||
|
||||
|
||||
def formsemestre_editwithmodules(REQUEST, formsemestre_id):
|
||||
def formsemestre_editwithmodules(formsemestre_id):
|
||||
"""Page modification semestre"""
|
||||
# portage from dtml
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
@ -104,12 +104,13 @@ def formsemestre_editwithmodules(REQUEST, formsemestre_id):
|
||||
% scu.icontag("lock_img", border="0", title="Semestre verrouillé")
|
||||
)
|
||||
else:
|
||||
r = do_formsemestre_createwithmodules(REQUEST=REQUEST, edit=1)
|
||||
r = do_formsemestre_createwithmodules(edit=1)
|
||||
if isinstance(r, str):
|
||||
H.append(r)
|
||||
else:
|
||||
return r # response redirect
|
||||
if not REQUEST.form.get("tf_submitted", False):
|
||||
vals = request.form if request.method == "POST" else request.args
|
||||
if not vals.get("tf_submitted", False):
|
||||
H.append(
|
||||
"""<p class="help">Seuls les modules cochés font partie de ce semestre. Pour les retirer, les décocher et appuyer sur le bouton "modifier".
|
||||
</p>
|
||||
@ -120,7 +121,7 @@ def formsemestre_editwithmodules(REQUEST, formsemestre_id):
|
||||
return "\n".join(H) + html_sco_header.sco_footer()
|
||||
|
||||
|
||||
def can_edit_sem(REQUEST, formsemestre_id="", sem=None):
|
||||
def can_edit_sem(formsemestre_id="", sem=None):
|
||||
"""Return sem if user can edit it, False otherwise"""
|
||||
sem = sem or sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
if not current_user.has_permission(Permission.ScoImplement): # pas chef
|
||||
@ -129,11 +130,12 @@ def can_edit_sem(REQUEST, formsemestre_id="", sem=None):
|
||||
return sem
|
||||
|
||||
|
||||
def do_formsemestre_createwithmodules(REQUEST=None, edit=False):
|
||||
def do_formsemestre_createwithmodules(edit=False):
|
||||
"Form choix modules / responsables et creation formsemestre"
|
||||
# Fonction accessible à tous, controle acces à la main:
|
||||
vals = request.form if request.method == "POST" else request.args
|
||||
if edit:
|
||||
formsemestre_id = int(REQUEST.form["formsemestre_id"])
|
||||
formsemestre_id = int(vals["formsemestre_id"])
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
if not current_user.has_permission(Permission.ScoImplement):
|
||||
if not edit:
|
||||
@ -155,14 +157,14 @@ def do_formsemestre_createwithmodules(REQUEST=None, edit=False):
|
||||
uid2display[u.id] = u.get_nomplogin()
|
||||
allowed_user_names = list(uid2display.values()) + [""]
|
||||
#
|
||||
formation_id = int(REQUEST.form["formation_id"])
|
||||
formation_id = int(vals["formation_id"])
|
||||
F = sco_formations.formation_list(args={"formation_id": formation_id})
|
||||
if not F:
|
||||
raise ScoValueError("Formation inexistante !")
|
||||
F = F[0]
|
||||
if not edit:
|
||||
initvalues = {"titre": _default_sem_title(F)}
|
||||
semestre_id = int(REQUEST.form["semestre_id"])
|
||||
semestre_id = int(vals["semestre_id"])
|
||||
sem_module_ids = set()
|
||||
else:
|
||||
# setup form init values
|
||||
@ -308,7 +310,9 @@ def do_formsemestre_createwithmodules(REQUEST=None, edit=False):
|
||||
{
|
||||
"size": 40,
|
||||
"title": "Nom de ce semestre",
|
||||
"explanation": """n'indiquez pas les dates, ni le semestre, ni la modalité dans le titre: ils seront automatiquement ajoutés <input type="button" value="remettre titre par défaut" onClick="document.tf.titre.value='%s';"/>"""
|
||||
"explanation": """n'indiquez pas les dates, ni le semestre, ni la modalité dans
|
||||
le titre: ils seront automatiquement ajoutés <input type="button"
|
||||
value="remettre titre par défaut" onClick="document.tf.titre.value='%s';"/>"""
|
||||
% _default_sem_title(F),
|
||||
},
|
||||
),
|
||||
@ -541,7 +545,7 @@ def do_formsemestre_createwithmodules(REQUEST=None, edit=False):
|
||||
select_name = "%s!group_id" % mod["module_id"]
|
||||
|
||||
def opt_selected(gid):
|
||||
if gid == REQUEST.form.get(select_name):
|
||||
if gid == vals.get(select_name):
|
||||
return "selected"
|
||||
else:
|
||||
return ""
|
||||
@ -630,38 +634,29 @@ def do_formsemestre_createwithmodules(REQUEST=None, edit=False):
|
||||
initvalues["gestion_compensation_lst"] = ["X"]
|
||||
else:
|
||||
initvalues["gestion_compensation_lst"] = []
|
||||
if (
|
||||
REQUEST.form.get("tf_submitted", False)
|
||||
and "gestion_compensation_lst" not in REQUEST.form
|
||||
):
|
||||
REQUEST.form["gestion_compensation_lst"] = []
|
||||
if vals.get("tf_submitted", False) and "gestion_compensation_lst" not in vals:
|
||||
vals["gestion_compensation_lst"] = []
|
||||
|
||||
initvalues["gestion_semestrielle"] = initvalues.get("gestion_semestrielle", False)
|
||||
if initvalues["gestion_semestrielle"]:
|
||||
initvalues["gestion_semestrielle_lst"] = ["X"]
|
||||
else:
|
||||
initvalues["gestion_semestrielle_lst"] = []
|
||||
if (
|
||||
REQUEST.form.get("tf_submitted", False)
|
||||
and "gestion_semestrielle_lst" not in REQUEST.form
|
||||
):
|
||||
REQUEST.form["gestion_semestrielle_lst"] = []
|
||||
if vals.get("tf_submitted", False) and "gestion_semestrielle_lst" not in vals:
|
||||
vals["gestion_semestrielle_lst"] = []
|
||||
|
||||
initvalues["bul_hide_xml"] = initvalues.get("bul_hide_xml", False)
|
||||
if not initvalues["bul_hide_xml"]:
|
||||
initvalues["bul_publish_xml_lst"] = ["X"]
|
||||
else:
|
||||
initvalues["bul_publish_xml_lst"] = []
|
||||
if (
|
||||
REQUEST.form.get("tf_submitted", False)
|
||||
and "bul_publish_xml_lst" not in REQUEST.form
|
||||
):
|
||||
REQUEST.form["bul_publish_xml_lst"] = []
|
||||
if vals.get("tf_submitted", False) and "bul_publish_xml_lst" not in vals:
|
||||
vals["bul_publish_xml_lst"] = []
|
||||
|
||||
#
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
vals,
|
||||
modform,
|
||||
submitlabel=submitlabel,
|
||||
cancelbutton="Annuler",
|
||||
@ -792,7 +787,6 @@ def do_formsemestre_createwithmodules(REQUEST=None, edit=False):
|
||||
moduleimpl_id,
|
||||
formsemestre_id,
|
||||
etudids,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
msg += [
|
||||
"inscription de %d étudiants au module %s"
|
||||
@ -873,7 +867,7 @@ def formsemestre_delete_moduleimpls(formsemestre_id, module_ids_to_del):
|
||||
return ok, msg
|
||||
|
||||
|
||||
def formsemestre_clone(formsemestre_id, REQUEST=None):
|
||||
def formsemestre_clone(formsemestre_id):
|
||||
"""
|
||||
Formulaire clonage d'un semestre
|
||||
"""
|
||||
@ -965,7 +959,7 @@ def formsemestre_clone(formsemestre_id, REQUEST=None):
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
descr,
|
||||
submitlabel="Dupliquer ce semestre",
|
||||
cancelbutton="Annuler",
|
||||
@ -990,7 +984,6 @@ def formsemestre_clone(formsemestre_id, REQUEST=None):
|
||||
tf[2]["date_fin"],
|
||||
clone_evaluations=tf[2]["clone_evaluations"],
|
||||
clone_partitions=tf[2]["clone_partitions"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
return flask.redirect(
|
||||
"formsemestre_status?formsemestre_id=%s&head_message=Nouveau%%20semestre%%20créé"
|
||||
@ -1005,7 +998,6 @@ def do_formsemestre_clone(
|
||||
date_fin, # 'dd/mm/yyyy'
|
||||
clone_evaluations=False,
|
||||
clone_partitions=False,
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Clone a semestre: make copy, same modules, same options, same resps, same partitions.
|
||||
New dates, responsable_id
|
||||
@ -1045,7 +1037,7 @@ def do_formsemestre_clone(
|
||||
args = e.copy()
|
||||
del args["jour"] # erase date
|
||||
args["moduleimpl_id"] = mid
|
||||
_ = sco_evaluations.do_evaluation_create(REQUEST=REQUEST, **args)
|
||||
_ = sco_evaluations.do_evaluation_create(**args)
|
||||
|
||||
# 3- copy uecoefs
|
||||
objs = sco_formsemestre.formsemestre_uecoef_list(
|
||||
@ -1240,7 +1232,7 @@ def _reassociate_moduleimpls(cnx, formsemestre_id, ues_old2new, modules_old2new)
|
||||
sco_parcours_dut.scolar_formsemestre_validation_edit(cnx, e)
|
||||
|
||||
|
||||
def formsemestre_delete(formsemestre_id, REQUEST=None):
|
||||
def formsemestre_delete(formsemestre_id):
|
||||
"""Delete a formsemestre (affiche avertissements)"""
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
F = sco_formations.formation_list(args={"formation_id": sem["formation_id"]})[0]
|
||||
@ -1272,7 +1264,7 @@ def formsemestre_delete(formsemestre_id, REQUEST=None):
|
||||
submit_label = "Confirmer la suppression du semestre"
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(("formsemestre_id", {"input_type": "hidden"}),),
|
||||
initvalues=F,
|
||||
submitlabel=submit_label,
|
||||
@ -1431,7 +1423,7 @@ def do_formsemestre_delete(formsemestre_id):
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
def formsemestre_edit_options(formsemestre_id, REQUEST=None):
|
||||
def formsemestre_edit_options(formsemestre_id):
|
||||
"""dialog to change formsemestre options
|
||||
(accessible par ScoImplement ou dir. etudes)
|
||||
"""
|
||||
@ -1439,12 +1431,10 @@ def formsemestre_edit_options(formsemestre_id, REQUEST=None):
|
||||
ok, err = sco_permissions_check.check_access_diretud(formsemestre_id)
|
||||
if not ok:
|
||||
return err
|
||||
return sco_preferences.SemPreferences(formsemestre_id).edit(
|
||||
REQUEST=REQUEST, categories=["bul"]
|
||||
)
|
||||
return sco_preferences.SemPreferences(formsemestre_id).edit(categories=["bul"])
|
||||
|
||||
|
||||
def formsemestre_change_lock(formsemestre_id, REQUEST=None, dialog_confirmed=False):
|
||||
def formsemestre_change_lock(formsemestre_id, dialog_confirmed=False) -> None:
|
||||
"""Change etat (verrouille si ouvert, déverrouille si fermé)
|
||||
nota: etat (1 ouvert, 0 fermé)
|
||||
"""
|
||||
@ -1454,7 +1444,7 @@ def formsemestre_change_lock(formsemestre_id, REQUEST=None, dialog_confirmed=Fal
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
etat = not sem["etat"]
|
||||
|
||||
if REQUEST and not dialog_confirmed:
|
||||
if not dialog_confirmed:
|
||||
if etat:
|
||||
msg = "déverrouillage"
|
||||
else:
|
||||
@ -1474,14 +1464,10 @@ def formsemestre_change_lock(formsemestre_id, REQUEST=None, dialog_confirmed=Fal
|
||||
|
||||
args = {"formsemestre_id": formsemestre_id, "etat": etat}
|
||||
sco_formsemestre.do_formsemestre_edit(args)
|
||||
if REQUEST:
|
||||
return flask.redirect(
|
||||
"formsemestre_status?formsemestre_id=%s" % formsemestre_id
|
||||
)
|
||||
|
||||
|
||||
def formsemestre_change_publication_bul(
|
||||
formsemestre_id, REQUEST=None, dialog_confirmed=False
|
||||
formsemestre_id, dialog_confirmed=False, redirect=True
|
||||
):
|
||||
"""Change etat publication bulletins sur portail"""
|
||||
ok, err = sco_permissions_check.check_access_diretud(formsemestre_id)
|
||||
@ -1490,7 +1476,7 @@ def formsemestre_change_publication_bul(
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
etat = not sem["bul_hide_xml"]
|
||||
|
||||
if REQUEST and not dialog_confirmed:
|
||||
if not dialog_confirmed:
|
||||
if etat:
|
||||
msg = "non"
|
||||
else:
|
||||
@ -1509,14 +1495,14 @@ def formsemestre_change_publication_bul(
|
||||
|
||||
args = {"formsemestre_id": formsemestre_id, "bul_hide_xml": etat}
|
||||
sco_formsemestre.do_formsemestre_edit(args)
|
||||
if REQUEST:
|
||||
if redirect:
|
||||
return flask.redirect(
|
||||
"formsemestre_status?formsemestre_id=%s" % formsemestre_id
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
def formsemestre_edit_uecoefs(formsemestre_id, err_ue_id=None, REQUEST=None):
|
||||
def formsemestre_edit_uecoefs(formsemestre_id, err_ue_id=None):
|
||||
"""Changement manuel des coefficients des UE capitalisées."""
|
||||
from app.scodoc import notes_table
|
||||
|
||||
@ -1585,7 +1571,7 @@ def formsemestre_edit_uecoefs(formsemestre_id, err_ue_id=None, REQUEST=None):
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
form,
|
||||
submitlabel="Changer les coefficients",
|
||||
cancelbutton="Annuler",
|
||||
|
@ -52,7 +52,7 @@ from app.scodoc import sco_parcours_dut
|
||||
from app.scodoc import sco_etud
|
||||
|
||||
|
||||
def formsemestre_ext_create(etudid, sem_params, REQUEST=None):
|
||||
def formsemestre_ext_create(etudid, sem_params):
|
||||
"""Crée un formsemestre exterieur et y inscrit l'étudiant.
|
||||
sem_params: dict nécessaire à la création du formsemestre
|
||||
"""
|
||||
@ -79,7 +79,7 @@ def formsemestre_ext_create(etudid, sem_params, REQUEST=None):
|
||||
return formsemestre_id
|
||||
|
||||
|
||||
def formsemestre_ext_create_form(etudid, formsemestre_id, REQUEST=None):
|
||||
def formsemestre_ext_create_form(etudid, formsemestre_id):
|
||||
"""Formulaire creation/inscription à un semestre extérieur"""
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
||||
H = [
|
||||
@ -182,7 +182,7 @@ def formsemestre_ext_create_form(etudid, formsemestre_id, REQUEST=None):
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
descr,
|
||||
cancelbutton="Annuler",
|
||||
method="post",
|
||||
@ -204,13 +204,13 @@ def formsemestre_ext_create_form(etudid, formsemestre_id, REQUEST=None):
|
||||
)
|
||||
else:
|
||||
tf[2]["formation_id"] = orig_sem["formation_id"]
|
||||
formsemestre_ext_create(etudid, tf[2], REQUEST=REQUEST)
|
||||
formsemestre_ext_create(etudid, tf[2])
|
||||
return flask.redirect(
|
||||
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||
)
|
||||
|
||||
|
||||
def formsemestre_ext_edit_ue_validations(formsemestre_id, etudid, REQUEST=None):
|
||||
def formsemestre_ext_edit_ue_validations(formsemestre_id, etudid):
|
||||
"""Edition des validations d'UE et de semestre (jury)
|
||||
pour un semestre extérieur.
|
||||
On peut saisir pour chaque UE du programme de formation
|
||||
@ -222,8 +222,10 @@ def formsemestre_ext_edit_ue_validations(formsemestre_id, etudid, REQUEST=None):
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
||||
ue_list = _list_ue_with_coef_and_validations(sem, etudid)
|
||||
descr = _ue_form_description(ue_list, REQUEST.form)
|
||||
if REQUEST and REQUEST.method == "GET":
|
||||
descr = _ue_form_description(
|
||||
ue_list, request.form if request.method == "POST" else request.args
|
||||
)
|
||||
if request.method == "GET":
|
||||
initvalues = {
|
||||
"note_" + str(ue["ue_id"]): ue["validation"].get("moy_ue", "")
|
||||
for ue in ue_list
|
||||
@ -232,7 +234,7 @@ def formsemestre_ext_edit_ue_validations(formsemestre_id, etudid, REQUEST=None):
|
||||
initvalues = {}
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
descr,
|
||||
cssclass="tf_ext_edit_ue_validations",
|
||||
submitlabel="Enregistrer ces validations",
|
||||
@ -242,19 +244,19 @@ def formsemestre_ext_edit_ue_validations(formsemestre_id, etudid, REQUEST=None):
|
||||
if tf[0] == -1:
|
||||
return "<h4>annulation</h4>"
|
||||
else:
|
||||
H = _make_page(etud, sem, tf, REQUEST=REQUEST)
|
||||
H = _make_page(etud, sem, tf)
|
||||
if tf[0] == 0: # premier affichage
|
||||
return "\n".join(H)
|
||||
else: # soumission
|
||||
# simule erreur
|
||||
ok, message = _check_values(ue_list, tf[2])
|
||||
if not ok:
|
||||
H = _make_page(etud, sem, tf, message=message, REQUEST=REQUEST)
|
||||
H = _make_page(etud, sem, tf, message=message)
|
||||
return "\n".join(H)
|
||||
else:
|
||||
# Submit
|
||||
_record_ue_validations_and_coefs(
|
||||
formsemestre_id, etudid, ue_list, tf[2], REQUEST=REQUEST
|
||||
formsemestre_id, etudid, ue_list, tf[2]
|
||||
)
|
||||
return flask.redirect(
|
||||
"formsemestre_bulletinetud?formsemestre_id=%s&etudid=%s"
|
||||
@ -262,7 +264,7 @@ def formsemestre_ext_edit_ue_validations(formsemestre_id, etudid, REQUEST=None):
|
||||
)
|
||||
|
||||
|
||||
def _make_page(etud, sem, tf, message="", REQUEST=None):
|
||||
def _make_page(etud, sem, tf, message=""):
|
||||
nt = sco_cache.NotesTableCache.get(sem["formsemestre_id"])
|
||||
moy_gen = nt.get_etud_moy_gen(etud["etudid"])
|
||||
H = [
|
||||
@ -465,9 +467,7 @@ def _list_ue_with_coef_and_validations(sem, etudid):
|
||||
return ue_list
|
||||
|
||||
|
||||
def _record_ue_validations_and_coefs(
|
||||
formsemestre_id, etudid, ue_list, values, REQUEST=None
|
||||
):
|
||||
def _record_ue_validations_and_coefs(formsemestre_id, etudid, ue_list, values):
|
||||
for ue in ue_list:
|
||||
code = values.get("valid_" + str(ue["ue_id"]), False)
|
||||
if code == "None":
|
||||
@ -492,5 +492,4 @@ def _record_ue_validations_and_coefs(
|
||||
now_dmy,
|
||||
code=code,
|
||||
ue_coefficient=coef,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
@ -248,7 +248,7 @@ def do_formsemestre_inscription_with_modules(
|
||||
|
||||
|
||||
def formsemestre_inscription_with_modules_etud(
|
||||
formsemestre_id, etudid=None, group_ids=None, REQUEST=None
|
||||
formsemestre_id, etudid=None, group_ids=None
|
||||
):
|
||||
"""Form. inscription d'un étudiant au semestre.
|
||||
Si etudid n'est pas specifié, form. choix etudiant.
|
||||
@ -263,7 +263,7 @@ def formsemestre_inscription_with_modules_etud(
|
||||
)
|
||||
|
||||
return formsemestre_inscription_with_modules(
|
||||
etudid, formsemestre_id, REQUEST=REQUEST, group_ids=group_ids
|
||||
etudid, formsemestre_id, group_ids=group_ids
|
||||
)
|
||||
|
||||
|
||||
@ -318,7 +318,7 @@ def formsemestre_inscription_with_modules_form(etudid, only_ext=False):
|
||||
|
||||
|
||||
def formsemestre_inscription_with_modules(
|
||||
etudid, formsemestre_id, group_ids=None, multiple_ok=False, REQUEST=None
|
||||
etudid, formsemestre_id, group_ids=None, multiple_ok=False
|
||||
):
|
||||
"""
|
||||
Inscription de l'etud dans ce semestre.
|
||||
@ -430,7 +430,7 @@ def formsemestre_inscription_with_modules(
|
||||
return "\n".join(H) + F
|
||||
|
||||
|
||||
def formsemestre_inscription_option(etudid, formsemestre_id, REQUEST=None):
|
||||
def formsemestre_inscription_option(etudid, formsemestre_id):
|
||||
"""Dialogue pour (dés)inscription à des modules optionnels."""
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
if not sem["etat"]:
|
||||
@ -467,7 +467,8 @@ def formsemestre_inscription_option(etudid, formsemestre_id, REQUEST=None):
|
||||
modimpls_by_ue_names[ue_id].append(
|
||||
"%s %s" % (mod["module"]["code"], mod["module"]["titre"])
|
||||
)
|
||||
if not REQUEST.form.get("tf_submitted", False):
|
||||
vals = request.form if request.method == "POST" else request.args
|
||||
if not vals.get("tf_submitted", False):
|
||||
# inscrit ?
|
||||
for ins in inscr:
|
||||
if ins["moduleimpl_id"] == mod["moduleimpl_id"]:
|
||||
@ -533,7 +534,7 @@ function chkbx_select(field_id, state) {
|
||||
)
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
descr,
|
||||
initvalues,
|
||||
cancelbutton="Annuler",
|
||||
@ -658,7 +659,7 @@ function chkbx_select(field_id, state) {
|
||||
|
||||
|
||||
def do_moduleimpl_incription_options(
|
||||
etudid, modulesimpls_ainscrire, modulesimpls_adesinscrire, REQUEST=None
|
||||
etudid, modulesimpls_ainscrire, modulesimpls_adesinscrire
|
||||
):
|
||||
"""
|
||||
Effectue l'inscription et la description aux modules optionnels
|
||||
@ -710,7 +711,6 @@ def do_moduleimpl_incription_options(
|
||||
oid, formsemestre_id=mod["formsemestre_id"]
|
||||
)
|
||||
|
||||
if REQUEST:
|
||||
H = [
|
||||
html_sco_header.sco_header(),
|
||||
"""<h3>Modifications effectuées</h3>
|
||||
@ -755,7 +755,7 @@ def list_inscrits_ailleurs(formsemestre_id):
|
||||
return d
|
||||
|
||||
|
||||
def formsemestre_inscrits_ailleurs(formsemestre_id, REQUEST=None):
|
||||
def formsemestre_inscrits_ailleurs(formsemestre_id):
|
||||
"""Page listant les étudiants inscrits dans un autre semestre
|
||||
dont les dates recouvrent le semestre indiqué.
|
||||
"""
|
||||
|
@ -488,7 +488,7 @@ def retreive_formsemestre_from_request() -> int:
|
||||
# Element HTML decrivant un semestre (barre de menu et infos)
|
||||
def formsemestre_page_title():
|
||||
"""Element HTML decrivant un semestre (barre de menu et infos)
|
||||
Cherche dans REQUEST si un semestre est défini (formsemestre_id ou moduleimpl ou evaluation ou group)
|
||||
Cherche dans la requete si un semestre est défini (formsemestre_id ou moduleimpl ou evaluation ou group)
|
||||
"""
|
||||
formsemestre_id = retreive_formsemestre_from_request()
|
||||
#
|
||||
@ -568,7 +568,7 @@ def fill_formsemestre(sem):
|
||||
|
||||
|
||||
# Description du semestre sous forme de table exportable
|
||||
def formsemestre_description_table(formsemestre_id, REQUEST=None, with_evals=False):
|
||||
def formsemestre_description_table(formsemestre_id, with_evals=False):
|
||||
"""Description du semestre sous forme de table exportable
|
||||
Liste des modules et de leurs coefficients
|
||||
"""
|
||||
@ -610,7 +610,7 @@ def formsemestre_description_table(formsemestre_id, REQUEST=None, with_evals=Fal
|
||||
moduleimpl_id=M["moduleimpl_id"]
|
||||
)
|
||||
enseignants = ", ".join(
|
||||
[sco_users.user_info(m["ens_id"], REQUEST)["nomprenom"] for m in M["ens"]]
|
||||
[sco_users.user_info(m["ens_id"])["nomprenom"] for m in M["ens"]]
|
||||
)
|
||||
l = {
|
||||
"UE": M["ue"]["acronyme"],
|
||||
@ -708,16 +708,12 @@ def formsemestre_description_table(formsemestre_id, REQUEST=None, with_evals=Fal
|
||||
)
|
||||
|
||||
|
||||
def formsemestre_description(
|
||||
formsemestre_id, format="html", with_evals=False, REQUEST=None
|
||||
):
|
||||
def formsemestre_description(formsemestre_id, format="html", with_evals=False):
|
||||
"""Description du semestre sous forme de table exportable
|
||||
Liste des modules et de leurs coefficients
|
||||
"""
|
||||
with_evals = int(with_evals)
|
||||
tab = formsemestre_description_table(
|
||||
formsemestre_id, REQUEST, with_evals=with_evals
|
||||
)
|
||||
tab = formsemestre_description_table(formsemestre_id, with_evals=with_evals)
|
||||
tab.html_before_table = """<form name="f" method="get" action="%s">
|
||||
<input type="hidden" name="formsemestre_id" value="%s"></input>
|
||||
<input type="checkbox" name="with_evals" value="1" onchange="document.f.submit()" """ % (
|
||||
@ -732,7 +728,7 @@ def formsemestre_description(
|
||||
|
||||
|
||||
# genere liste html pour accès aux groupes de ce semestre
|
||||
def _make_listes_sem(sem, REQUEST=None, with_absences=True):
|
||||
def _make_listes_sem(sem, with_absences=True):
|
||||
# construit l'URL "destination"
|
||||
# (a laquelle on revient apres saisie absences)
|
||||
destination = url_for(
|
||||
@ -897,7 +893,7 @@ def html_expr_diagnostic(diagnostics):
|
||||
return "".join(H)
|
||||
|
||||
|
||||
def formsemestre_status_head(formsemestre_id=None, REQUEST=None, page_title=None):
|
||||
def formsemestre_status_head(formsemestre_id=None, page_title=None):
|
||||
"""En-tête HTML des pages "semestre" """
|
||||
semlist = sco_formsemestre.do_formsemestre_list(
|
||||
args={"formsemestre_id": formsemestre_id}
|
||||
@ -965,7 +961,7 @@ Il y a des notes en attente ! Le classement des étudiants n'a qu'une valeur ind
|
||||
return "".join(H)
|
||||
|
||||
|
||||
def formsemestre_status(formsemestre_id=None, REQUEST=None):
|
||||
def formsemestre_status(formsemestre_id=None):
|
||||
"""Tableau de bord semestre HTML"""
|
||||
# porté du DTML
|
||||
cnx = ndb.GetDBConnexion()
|
||||
@ -978,7 +974,7 @@ def formsemestre_status(formsemestre_id=None, REQUEST=None):
|
||||
# )
|
||||
prev_ue_id = None
|
||||
|
||||
can_edit = sco_formsemestre_edit.can_edit_sem(REQUEST, formsemestre_id, sem=sem)
|
||||
can_edit = sco_formsemestre_edit.can_edit_sem(formsemestre_id, sem=sem)
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(page_title="Semestre %s" % sem["titreannee"]),
|
||||
@ -1021,11 +1017,9 @@ def formsemestre_status(formsemestre_id=None, REQUEST=None):
|
||||
ModInscrits = sco_moduleimpl.do_moduleimpl_inscription_list(
|
||||
moduleimpl_id=M["moduleimpl_id"]
|
||||
)
|
||||
mails_enseignants.add(
|
||||
sco_users.user_info(M["responsable_id"], REQUEST)["email"]
|
||||
)
|
||||
mails_enseignants.add(sco_users.user_info(M["responsable_id"])["email"])
|
||||
mails_enseignants |= set(
|
||||
[sco_users.user_info(m["ens_id"], REQUEST)["email"] for m in M["ens"]]
|
||||
[sco_users.user_info(m["ens_id"])["email"] for m in M["ens"]]
|
||||
)
|
||||
ue = M["ue"]
|
||||
if prev_ue_id != ue["ue_id"]:
|
||||
@ -1150,7 +1144,7 @@ def formsemestre_status(formsemestre_id=None, REQUEST=None):
|
||||
# --- LISTE DES ETUDIANTS
|
||||
H += [
|
||||
'<div id="groupes">',
|
||||
_make_listes_sem(sem, REQUEST),
|
||||
_make_listes_sem(sem),
|
||||
"</div>",
|
||||
]
|
||||
# --- Lien mail enseignants:
|
||||
|
@ -64,7 +64,6 @@ def formsemestre_validation_etud_form(
|
||||
desturl=None,
|
||||
sortcol=None,
|
||||
readonly=True,
|
||||
REQUEST=None,
|
||||
):
|
||||
nt = sco_cache.NotesTableCache.get(
|
||||
formsemestre_id
|
||||
@ -336,7 +335,6 @@ def formsemestre_validation_etud(
|
||||
codechoice=None, # required
|
||||
desturl="",
|
||||
sortcol=None,
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Enregistre validation"""
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
||||
@ -352,7 +350,7 @@ def formsemestre_validation_etud(
|
||||
if not selected_choice:
|
||||
raise ValueError("code choix invalide ! (%s)" % codechoice)
|
||||
#
|
||||
Se.valide_decision(selected_choice, REQUEST) # enregistre
|
||||
Se.valide_decision(selected_choice) # enregistre
|
||||
return _redirect_valid_choice(
|
||||
formsemestre_id, etudid, Se, selected_choice, desturl, sortcol
|
||||
)
|
||||
@ -367,7 +365,6 @@ def formsemestre_validation_etud_manu(
|
||||
assidu=False,
|
||||
desturl="",
|
||||
sortcol=None,
|
||||
REQUEST=None,
|
||||
redirect=True,
|
||||
):
|
||||
"""Enregistre validation"""
|
||||
@ -397,7 +394,7 @@ def formsemestre_validation_etud_manu(
|
||||
formsemestre_id_utilise_pour_compenser=formsemestre_id_utilise_pour_compenser,
|
||||
)
|
||||
#
|
||||
Se.valide_decision(choice, REQUEST) # enregistre
|
||||
Se.valide_decision(choice) # enregistre
|
||||
if redirect:
|
||||
return _redirect_valid_choice(
|
||||
formsemestre_id, etudid, Se, choice, desturl, sortcol
|
||||
@ -817,7 +814,7 @@ def form_decision_manuelle(Se, formsemestre_id, etudid, desturl="", sortcol=None
|
||||
|
||||
|
||||
# -----------
|
||||
def formsemestre_validation_auto(formsemestre_id, REQUEST):
|
||||
def formsemestre_validation_auto(formsemestre_id):
|
||||
"Formulaire saisie automatisee des decisions d'un semestre"
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
H = [
|
||||
@ -847,7 +844,7 @@ def formsemestre_validation_auto(formsemestre_id, REQUEST):
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
def do_formsemestre_validation_auto(formsemestre_id, REQUEST):
|
||||
def do_formsemestre_validation_auto(formsemestre_id):
|
||||
"Saisie automatisee des decisions d'un semestre"
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
next_semestre_id = sem["semestre_id"] + 1
|
||||
@ -903,7 +900,6 @@ def do_formsemestre_validation_auto(formsemestre_id, REQUEST):
|
||||
code_etat=ADM,
|
||||
devenir="NEXT",
|
||||
assidu=True,
|
||||
REQUEST=REQUEST,
|
||||
redirect=False,
|
||||
)
|
||||
nb_valid += 1
|
||||
@ -968,7 +964,7 @@ def formsemestre_validation_suppress_etud(formsemestre_id, etudid):
|
||||
) # > suppr. decision jury (peut affecter de plusieurs semestres utilisant UE capitalisée)
|
||||
|
||||
|
||||
def formsemestre_validate_previous_ue(formsemestre_id, etudid, REQUEST=None):
|
||||
def formsemestre_validate_previous_ue(formsemestre_id, etudid):
|
||||
"""Form. saisie UE validée hors ScoDoc
|
||||
(pour étudiants arrivant avec un UE antérieurement validée).
|
||||
"""
|
||||
@ -1012,7 +1008,7 @@ def formsemestre_validate_previous_ue(formsemestre_id, etudid, REQUEST=None):
|
||||
ue_ids = [""] + [ue["ue_id"] for ue in ues]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("etudid", {"input_type": "hidden"}),
|
||||
("formsemestre_id", {"input_type": "hidden"}),
|
||||
@ -1085,7 +1081,6 @@ def formsemestre_validate_previous_ue(formsemestre_id, etudid, REQUEST=None):
|
||||
tf[2]["moy_ue"],
|
||||
tf[2]["date"],
|
||||
semestre_id=semestre_id,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
return flask.redirect(
|
||||
scu.ScoURL()
|
||||
@ -1103,7 +1098,6 @@ def do_formsemestre_validate_previous_ue(
|
||||
code=ADM,
|
||||
semestre_id=None,
|
||||
ue_coefficient=None,
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Enregistre (ou modifie) validation d'UE (obtenue hors ScoDoc).
|
||||
Si le coefficient est spécifié, modifie le coefficient de
|
||||
@ -1159,7 +1153,7 @@ def _invalidate_etud_formation_caches(etudid, formation_id):
|
||||
) # > modif decision UE (inval tous semestres avec cet etudiant, ok mais conservatif)
|
||||
|
||||
|
||||
def get_etud_ue_cap_html(etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
def get_etud_ue_cap_html(etudid, formsemestre_id, ue_id):
|
||||
"""Ramene bout de HTML pour pouvoir supprimer une validation de cette UE"""
|
||||
valids = ndb.SimpleDictFetch(
|
||||
"""SELECT SFV.*
|
||||
@ -1195,7 +1189,7 @@ def get_etud_ue_cap_html(etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
def etud_ue_suppress_validation(etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
def etud_ue_suppress_validation(etudid, formsemestre_id, ue_id):
|
||||
"""Suppress a validation (ue_id, etudid) and redirect to formsemestre"""
|
||||
log("etud_ue_suppress_validation( %s, %s, %s)" % (etudid, formsemestre_id, ue_id))
|
||||
cnx = ndb.GetDBConnexion()
|
||||
|
@ -43,7 +43,7 @@ from xml.etree.ElementTree import Element
|
||||
|
||||
import flask
|
||||
from flask import g, request
|
||||
from flask import url_for
|
||||
from flask import url_for, make_response
|
||||
|
||||
import app.scodoc.sco_utils as scu
|
||||
import app.scodoc.notesdb as ndb
|
||||
@ -468,7 +468,7 @@ def get_etud_groups_in_partition(partition_id):
|
||||
return R
|
||||
|
||||
|
||||
def formsemestre_partition_list(formsemestre_id, format="xml", REQUEST=None):
|
||||
def formsemestre_partition_list(formsemestre_id, format="xml"):
|
||||
"""Get partitions and groups in this semestre
|
||||
Supported formats: xml, json
|
||||
"""
|
||||
@ -480,7 +480,7 @@ def formsemestre_partition_list(formsemestre_id, format="xml", REQUEST=None):
|
||||
|
||||
|
||||
# Encore utilisé par groupmgr.js
|
||||
def XMLgetGroupsInPartition(partition_id, REQUEST=None): # was XMLgetGroupesTD
|
||||
def XMLgetGroupsInPartition(partition_id): # was XMLgetGroupesTD
|
||||
"""
|
||||
Deprecated: use group_list
|
||||
Liste des étudiants dans chaque groupe de cette partition.
|
||||
@ -499,8 +499,7 @@ def XMLgetGroupsInPartition(partition_id, REQUEST=None): # was XMLgetGroupesTD
|
||||
groups = get_partition_groups(partition)
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > inscrdict
|
||||
etuds_set = set(nt.inscrdict)
|
||||
# XML response:
|
||||
REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE)
|
||||
# Build XML:
|
||||
doc = Element("ajax-response")
|
||||
x_response = Element("response", type="object", id="MyUpdater")
|
||||
doc.append(x_response)
|
||||
@ -552,7 +551,11 @@ def XMLgetGroupsInPartition(partition_id, REQUEST=None): # was XMLgetGroupesTD
|
||||
)
|
||||
)
|
||||
log("XMLgetGroupsInPartition: %s seconds" % (time.time() - t0))
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING)
|
||||
# XML response:
|
||||
data = sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING)
|
||||
response = make_response(data)
|
||||
response.headers["Content-Type"] = scu.XML_MIMETYPE
|
||||
return response
|
||||
|
||||
|
||||
def comp_origin(etud, cur_sem):
|
||||
@ -652,7 +655,6 @@ def setGroups(
|
||||
groupsLists="", # members of each existing group
|
||||
groupsToCreate="", # name and members of new groups
|
||||
groupsToDelete="", # groups to delete
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Affect groups (Ajax request)
|
||||
groupsLists: lignes de la forme "group_id;etudid;...\n"
|
||||
@ -716,7 +718,7 @@ def setGroups(
|
||||
|
||||
# Supprime les groupes indiqués comme supprimés:
|
||||
for group_id in groupsToDelete:
|
||||
suppressGroup(group_id, partition_id=partition_id, REQUEST=REQUEST)
|
||||
suppressGroup(group_id, partition_id=partition_id)
|
||||
|
||||
# Crée les nouveaux groupes
|
||||
for line in groupsToCreate.split("\n"): # for each group_name (one per line)
|
||||
@ -733,10 +735,12 @@ def setGroups(
|
||||
for etudid in fs[1:-1]:
|
||||
change_etud_group_in_partition(etudid, group_id, partition)
|
||||
|
||||
REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE)
|
||||
return (
|
||||
data = (
|
||||
'<?xml version="1.0" encoding="utf-8"?><response>Groupes enregistrés</response>'
|
||||
)
|
||||
response = make_response(data)
|
||||
response.headers["Content-Type"] = scu.XML_MIMETYPE
|
||||
return response
|
||||
|
||||
|
||||
def createGroup(partition_id, group_name="", default=False):
|
||||
@ -764,7 +768,7 @@ def createGroup(partition_id, group_name="", default=False):
|
||||
return group_id
|
||||
|
||||
|
||||
def suppressGroup(group_id, partition_id=None, REQUEST=None):
|
||||
def suppressGroup(group_id, partition_id=None):
|
||||
"""form suppression d'un groupe.
|
||||
(ne desinscrit pas les etudiants, change juste leur
|
||||
affectation aux groupes)
|
||||
@ -840,7 +844,7 @@ def getArrowIconsTags():
|
||||
return arrow_up, arrow_down, arrow_none
|
||||
|
||||
|
||||
def editPartitionForm(formsemestre_id=None, REQUEST=None):
|
||||
def editPartitionForm(formsemestre_id=None):
|
||||
"""Form to create/suppress partitions"""
|
||||
# ad-hoc form
|
||||
if not sco_permissions_check.can_change_groups(formsemestre_id):
|
||||
@ -968,7 +972,7 @@ def editPartitionForm(formsemestre_id=None, REQUEST=None):
|
||||
return "\n".join(H) + html_sco_header.sco_footer()
|
||||
|
||||
|
||||
def partition_set_attr(partition_id, attr, value, REQUEST=None):
|
||||
def partition_set_attr(partition_id, attr, value):
|
||||
"""Set partition attribute: bul_show_rank or show_in_lists"""
|
||||
if attr not in {"bul_show_rank", "show_in_lists"}:
|
||||
raise ValueError("invalid partition attribute: %s" % attr)
|
||||
@ -991,9 +995,7 @@ def partition_set_attr(partition_id, attr, value, REQUEST=None):
|
||||
return "enregistré"
|
||||
|
||||
|
||||
def partition_delete(
|
||||
partition_id, REQUEST=None, force=False, redirect=1, dialog_confirmed=False
|
||||
):
|
||||
def partition_delete(partition_id, force=False, redirect=1, dialog_confirmed=False):
|
||||
"""Suppress a partition (and all groups within).
|
||||
default partition cannot be suppressed (unless force)"""
|
||||
partition = get_partition(partition_id)
|
||||
@ -1036,7 +1038,7 @@ def partition_delete(
|
||||
)
|
||||
|
||||
|
||||
def partition_move(partition_id, after=0, REQUEST=None, redirect=1):
|
||||
def partition_move(partition_id, after=0, redirect=1):
|
||||
"""Move before/after previous one (decrement/increment numero)"""
|
||||
partition = get_partition(partition_id)
|
||||
formsemestre_id = partition["formsemestre_id"]
|
||||
@ -1071,7 +1073,7 @@ def partition_move(partition_id, after=0, REQUEST=None, redirect=1):
|
||||
)
|
||||
|
||||
|
||||
def partition_rename(partition_id, REQUEST=None):
|
||||
def partition_rename(partition_id):
|
||||
"""Form to rename a partition"""
|
||||
partition = get_partition(partition_id)
|
||||
formsemestre_id = partition["formsemestre_id"]
|
||||
@ -1080,7 +1082,7 @@ def partition_rename(partition_id, REQUEST=None):
|
||||
H = ["<h2>Renommer une partition</h2>"]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("partition_id", {"default": partition_id, "input_type": "hidden"}),
|
||||
(
|
||||
@ -1110,12 +1112,10 @@ def partition_rename(partition_id, REQUEST=None):
|
||||
)
|
||||
else:
|
||||
# form submission
|
||||
return partition_set_name(
|
||||
partition_id, tf[2]["partition_name"], REQUEST=REQUEST, redirect=1
|
||||
)
|
||||
return partition_set_name(partition_id, tf[2]["partition_name"])
|
||||
|
||||
|
||||
def partition_set_name(partition_id, partition_name, REQUEST=None, redirect=1):
|
||||
def partition_set_name(partition_id, partition_name, redirect=1):
|
||||
"""Set partition name"""
|
||||
partition_name = partition_name.strip()
|
||||
if not partition_name:
|
||||
@ -1153,7 +1153,7 @@ def partition_set_name(partition_id, partition_name, REQUEST=None, redirect=1):
|
||||
)
|
||||
|
||||
|
||||
def group_set_name(group_id, group_name, REQUEST=None, redirect=1):
|
||||
def group_set_name(group_id, group_name, redirect=1):
|
||||
"""Set group name"""
|
||||
if group_name:
|
||||
group_name = group_name.strip()
|
||||
@ -1180,7 +1180,7 @@ def group_set_name(group_id, group_name, REQUEST=None, redirect=1):
|
||||
)
|
||||
|
||||
|
||||
def group_rename(group_id, REQUEST=None):
|
||||
def group_rename(group_id):
|
||||
"""Form to rename a group"""
|
||||
group = get_group(group_id)
|
||||
formsemestre_id = group["formsemestre_id"]
|
||||
@ -1189,7 +1189,7 @@ def group_rename(group_id, REQUEST=None):
|
||||
H = ["<h2>Renommer un groupe de %s</h2>" % group["partition_name"]]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("group_id", {"default": group_id, "input_type": "hidden"}),
|
||||
(
|
||||
@ -1223,12 +1223,10 @@ def group_rename(group_id, REQUEST=None):
|
||||
)
|
||||
else:
|
||||
# form submission
|
||||
return group_set_name(
|
||||
group_id, tf[2]["group_name"], REQUEST=REQUEST, redirect=1
|
||||
)
|
||||
return group_set_name(group_id, tf[2]["group_name"], redirect=1)
|
||||
|
||||
|
||||
def groups_auto_repartition(partition_id=None, REQUEST=None):
|
||||
def groups_auto_repartition(partition_id=None):
|
||||
"""Reparti les etudiants dans des groupes dans une partition, en respectant le niveau
|
||||
et la mixité.
|
||||
"""
|
||||
@ -1269,7 +1267,7 @@ def groups_auto_repartition(partition_id=None, REQUEST=None):
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
descr,
|
||||
{},
|
||||
cancelbutton="Annuler",
|
||||
@ -1299,7 +1297,7 @@ def groups_auto_repartition(partition_id=None, REQUEST=None):
|
||||
# checkGroupName(group_name)
|
||||
# except:
|
||||
# H.append('<p class="warning">Nom de groupe invalide: %s</p>'%group_name)
|
||||
# return '\n'.join(H) + tf[1] + html_sco_header.sco_footer( REQUEST)
|
||||
# return '\n'.join(H) + tf[1] + html_sco_header.sco_footer()
|
||||
group_ids.append(createGroup(partition_id, group_name))
|
||||
#
|
||||
nt = sco_cache.NotesTableCache.get(formsemestre_id) # > identdict
|
||||
|
@ -33,7 +33,7 @@ from app.scodoc import sco_groups
|
||||
from app.scodoc.sco_exceptions import AccessDenied
|
||||
|
||||
|
||||
def affectGroups(partition_id, REQUEST=None):
|
||||
def affectGroups(partition_id):
|
||||
"""Formulaire affectation des etudiants aux groupes de la partition.
|
||||
Permet aussi la creation et la suppression de groupes.
|
||||
"""
|
||||
|
@ -219,21 +219,20 @@ def sco_import_generate_excel_sample(
|
||||
|
||||
def students_import_excel(
|
||||
csvfile,
|
||||
REQUEST=None,
|
||||
formsemestre_id=None,
|
||||
check_homonyms=True,
|
||||
require_ine=False,
|
||||
return_html=True,
|
||||
):
|
||||
"import students from Excel file"
|
||||
diag = scolars_import_excel_file(
|
||||
csvfile,
|
||||
REQUEST,
|
||||
formsemestre_id=formsemestre_id,
|
||||
check_homonyms=check_homonyms,
|
||||
require_ine=require_ine,
|
||||
exclude_cols=["photo_filename"],
|
||||
)
|
||||
if REQUEST:
|
||||
if return_html:
|
||||
if formsemestre_id:
|
||||
dest = url_for(
|
||||
"notes.formsemestre_status",
|
||||
@ -254,7 +253,6 @@ def students_import_excel(
|
||||
|
||||
def scolars_import_excel_file(
|
||||
datafile,
|
||||
REQUEST,
|
||||
formsemestre_id=None,
|
||||
check_homonyms=True,
|
||||
require_ine=False,
|
||||
@ -419,7 +417,6 @@ def scolars_import_excel_file(
|
||||
formsemestre_to_invalidate.add(
|
||||
_import_one_student(
|
||||
cnx,
|
||||
REQUEST,
|
||||
formsemestre_id,
|
||||
values,
|
||||
GroupIdInferers,
|
||||
@ -492,16 +489,15 @@ def scolars_import_excel_file(
|
||||
|
||||
|
||||
def students_import_admission(
|
||||
csvfile, type_admission="", REQUEST=None, formsemestre_id=None
|
||||
csvfile, type_admission="", formsemestre_id=None, return_html=True
|
||||
):
|
||||
"import donnees admission from Excel file (v2016)"
|
||||
diag = scolars_import_admission(
|
||||
csvfile,
|
||||
REQUEST,
|
||||
formsemestre_id=formsemestre_id,
|
||||
type_admission=type_admission,
|
||||
)
|
||||
if REQUEST:
|
||||
if return_html:
|
||||
H = [html_sco_header.sco_header(page_title="Import données admissions")]
|
||||
H.append("<p>Import terminé !</p>")
|
||||
H.append(
|
||||
@ -520,7 +516,6 @@ def students_import_admission(
|
||||
|
||||
def _import_one_student(
|
||||
cnx,
|
||||
REQUEST,
|
||||
formsemestre_id,
|
||||
values,
|
||||
GroupIdInferers,
|
||||
@ -538,7 +533,7 @@ def _import_one_student(
|
||||
)
|
||||
# Identite
|
||||
args = values.copy()
|
||||
etudid = sco_etud.identite_create(cnx, args, REQUEST=REQUEST)
|
||||
etudid = sco_etud.identite_create(cnx, args)
|
||||
created_etudids.append(etudid)
|
||||
# Admissions
|
||||
args["etudid"] = etudid
|
||||
@ -587,9 +582,7 @@ def _is_new_ine(cnx, code_ine):
|
||||
|
||||
|
||||
# ------ Fonction ré-écrite en nov 2016 pour lire des fichiers sans etudid (fichiers APB)
|
||||
def scolars_import_admission(
|
||||
datafile, REQUEST, formsemestre_id=None, type_admission=None
|
||||
):
|
||||
def scolars_import_admission(datafile, formsemestre_id=None, type_admission=None):
|
||||
"""Importe données admission depuis un fichier Excel quelconque
|
||||
par exemple ceux utilisés avec APB
|
||||
|
||||
|
@ -265,7 +265,6 @@ def formsemestre_inscr_passage(
|
||||
inscrit_groupes=False,
|
||||
submitted=False,
|
||||
dialog_confirmed=False,
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Form. pour inscription des etudiants d'un semestre dans un autre
|
||||
(donné par formsemestre_id).
|
||||
@ -313,7 +312,6 @@ def formsemestre_inscr_passage(
|
||||
|
||||
if not submitted:
|
||||
H += build_page(
|
||||
REQUEST,
|
||||
sem,
|
||||
auth_etuds_by_sem,
|
||||
inscrits,
|
||||
@ -398,7 +396,6 @@ def formsemestre_inscr_passage(
|
||||
|
||||
|
||||
def build_page(
|
||||
REQUEST,
|
||||
sem,
|
||||
auth_etuds_by_sem,
|
||||
inscrits,
|
||||
|
@ -56,7 +56,7 @@ from app.scodoc.gen_tables import GenTable
|
||||
from app.scodoc.htmlutils import histogram_notes
|
||||
|
||||
|
||||
def do_evaluation_listenotes(REQUEST):
|
||||
def do_evaluation_listenotes():
|
||||
"""
|
||||
Affichage des notes d'une évaluation
|
||||
|
||||
@ -64,12 +64,13 @@ def do_evaluation_listenotes(REQUEST):
|
||||
(si moduleimpl_id, affiche toutes les évaluatons du module)
|
||||
"""
|
||||
mode = None
|
||||
if "evaluation_id" in REQUEST.form:
|
||||
evaluation_id = int(REQUEST.form["evaluation_id"])
|
||||
vals = request.form if request.method == "POST" else request.args
|
||||
if "evaluation_id" in vals:
|
||||
evaluation_id = int(vals["evaluation_id"])
|
||||
mode = "eval"
|
||||
evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
|
||||
if "moduleimpl_id" in REQUEST.form:
|
||||
moduleimpl_id = int(REQUEST.form["moduleimpl_id"])
|
||||
if "moduleimpl_id" in vals:
|
||||
moduleimpl_id = int(vals["moduleimpl_id"])
|
||||
mode = "module"
|
||||
evals = sco_evaluations.do_evaluation_list({"moduleimpl_id": moduleimpl_id})
|
||||
if not mode:
|
||||
@ -77,7 +78,7 @@ def do_evaluation_listenotes(REQUEST):
|
||||
if not evals:
|
||||
return "<p>Aucune évaluation !</p>"
|
||||
|
||||
format = REQUEST.form.get("format", "html")
|
||||
format = vals.get("format", "html")
|
||||
E = evals[0] # il y a au moins une evaluation
|
||||
# description de l'evaluation
|
||||
if mode == "eval":
|
||||
@ -178,7 +179,7 @@ def do_evaluation_listenotes(REQUEST):
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
descr,
|
||||
cancelbutton=None,
|
||||
submitbutton=None,
|
||||
@ -201,7 +202,6 @@ def do_evaluation_listenotes(REQUEST):
|
||||
hide_groups = tf[2]["hide_groups"]
|
||||
with_emails = tf[2]["with_emails"]
|
||||
return _make_table_notes(
|
||||
REQUEST,
|
||||
tf[1],
|
||||
evals,
|
||||
format=format,
|
||||
@ -214,7 +214,6 @@ def do_evaluation_listenotes(REQUEST):
|
||||
|
||||
|
||||
def _make_table_notes(
|
||||
REQUEST,
|
||||
html_form,
|
||||
evals,
|
||||
format="",
|
||||
@ -760,9 +759,7 @@ def evaluation_check_absences(evaluation_id):
|
||||
return ValButAbs, AbsNonSignalee, ExcNonSignalee, ExcNonJust, AbsButExc
|
||||
|
||||
|
||||
def evaluation_check_absences_html(
|
||||
evaluation_id, with_header=True, show_ok=True, REQUEST=None
|
||||
):
|
||||
def evaluation_check_absences_html(evaluation_id, with_header=True, show_ok=True):
|
||||
"""Affiche etat verification absences d'une evaluation"""
|
||||
|
||||
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
|
||||
@ -859,7 +856,7 @@ def evaluation_check_absences_html(
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
def formsemestre_check_absences_html(formsemestre_id, REQUEST=None):
|
||||
def formsemestre_check_absences_html(formsemestre_id):
|
||||
"""Affiche etat verification absences pour toutes les evaluations du semestre !"""
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
H = [
|
||||
@ -891,7 +888,6 @@ def formsemestre_check_absences_html(formsemestre_id, REQUEST=None):
|
||||
E["evaluation_id"],
|
||||
with_header=False,
|
||||
show_ok=False,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
)
|
||||
if evals:
|
||||
|
@ -63,7 +63,7 @@ def formsemestre_table_etuds_lycees(
|
||||
)
|
||||
|
||||
|
||||
def scodoc_table_etuds_lycees(format="html", REQUEST=None):
|
||||
def scodoc_table_etuds_lycees(format="html"):
|
||||
"""Table avec _tous_ les étudiants des semestres non verrouillés
|
||||
de _tous_ les départements.
|
||||
"""
|
||||
@ -181,7 +181,6 @@ def formsemestre_etuds_lycees(
|
||||
format="html",
|
||||
only_primo=False,
|
||||
no_grouping=False,
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Table des lycées d'origine"""
|
||||
tab, etuds_by_lycee = formsemestre_table_etuds_lycees(
|
||||
@ -197,7 +196,7 @@ def formsemestre_etuds_lycees(
|
||||
return t
|
||||
F = [
|
||||
sco_report.tsp_form_primo_group(
|
||||
REQUEST, only_primo, no_grouping, formsemestre_id, format
|
||||
only_primo, no_grouping, formsemestre_id, format
|
||||
)
|
||||
]
|
||||
H = [
|
||||
|
@ -88,14 +88,14 @@ def do_modalite_list(*args, **kw):
|
||||
return _modaliteEditor.list(cnx, *args, **kw)
|
||||
|
||||
|
||||
def do_modalite_create(args, REQUEST=None):
|
||||
def do_modalite_create(args):
|
||||
"create a modalite"
|
||||
cnx = ndb.GetDBConnexion()
|
||||
r = _modaliteEditor.create(cnx, args)
|
||||
return r
|
||||
|
||||
|
||||
def do_modalite_delete(oid, REQUEST=None):
|
||||
def do_modalite_delete(oid):
|
||||
"delete a modalite"
|
||||
cnx = ndb.GetDBConnexion()
|
||||
log("do_modalite_delete: form_modalite_id=%s" % oid)
|
||||
|
@ -100,9 +100,7 @@ def do_moduleimpl_delete(oid, formsemestre_id=None):
|
||||
) # > moduleimpl_delete
|
||||
|
||||
|
||||
def do_moduleimpl_list(
|
||||
moduleimpl_id=None, formsemestre_id=None, module_id=None, REQUEST=None
|
||||
):
|
||||
def do_moduleimpl_list(moduleimpl_id=None, formsemestre_id=None, module_id=None):
|
||||
"list moduleimpls"
|
||||
args = locals()
|
||||
cnx = ndb.GetDBConnexion()
|
||||
@ -110,7 +108,7 @@ def do_moduleimpl_list(
|
||||
# Ajoute la liste des enseignants
|
||||
for mo in modimpls:
|
||||
mo["ens"] = do_ens_list(args={"moduleimpl_id": mo["moduleimpl_id"]})
|
||||
return scu.return_text_if_published(modimpls, REQUEST)
|
||||
return modimpls
|
||||
|
||||
|
||||
def do_moduleimpl_edit(args, formsemestre_id=None, cnx=None):
|
||||
@ -125,7 +123,7 @@ def do_moduleimpl_edit(args, formsemestre_id=None, cnx=None):
|
||||
|
||||
|
||||
def do_moduleimpl_withmodule_list(
|
||||
moduleimpl_id=None, formsemestre_id=None, module_id=None, REQUEST=None
|
||||
moduleimpl_id=None, formsemestre_id=None, module_id=None
|
||||
):
|
||||
"""Liste les moduleimpls et ajoute dans chacun le module correspondant
|
||||
Tri la liste par semestre/UE/numero_matiere/numero_module.
|
||||
@ -137,7 +135,6 @@ def do_moduleimpl_withmodule_list(
|
||||
from app.scodoc import sco_edit_module
|
||||
|
||||
args = locals()
|
||||
del args["REQUEST"]
|
||||
modimpls = do_moduleimpl_list(
|
||||
**{
|
||||
"moduleimpl_id": moduleimpl_id,
|
||||
@ -166,16 +163,14 @@ def do_moduleimpl_withmodule_list(
|
||||
)
|
||||
)
|
||||
|
||||
return scu.return_text_if_published(modimpls, REQUEST)
|
||||
return modimpls
|
||||
|
||||
|
||||
def do_moduleimpl_inscription_list(moduleimpl_id=None, etudid=None, REQUEST=None):
|
||||
def do_moduleimpl_inscription_list(moduleimpl_id=None, etudid=None):
|
||||
"list moduleimpl_inscriptions"
|
||||
args = locals()
|
||||
cnx = ndb.GetDBConnexion()
|
||||
return scu.return_text_if_published(
|
||||
_moduleimpl_inscriptionEditor.list(cnx, args), REQUEST
|
||||
)
|
||||
return _moduleimpl_inscriptionEditor.list(cnx, args)
|
||||
|
||||
|
||||
def do_moduleimpl_listeetuds(moduleimpl_id):
|
||||
@ -244,9 +239,7 @@ def do_moduleimpl_inscription_delete(oid, formsemestre_id=None):
|
||||
) # > moduleimpl_inscription
|
||||
|
||||
|
||||
def do_moduleimpl_inscrit_etuds(
|
||||
moduleimpl_id, formsemestre_id, etudids, reset=False, REQUEST=None
|
||||
):
|
||||
def do_moduleimpl_inscrit_etuds(moduleimpl_id, formsemestre_id, etudids, reset=False):
|
||||
"""Inscrit les etudiants (liste d'etudids) a ce module.
|
||||
Si reset, desinscrit tous les autres.
|
||||
"""
|
||||
@ -309,7 +302,7 @@ def do_ens_create(args):
|
||||
return r
|
||||
|
||||
|
||||
def can_change_module_resp(REQUEST, moduleimpl_id):
|
||||
def can_change_module_resp(moduleimpl_id):
|
||||
"""Check if current user can modify module resp. (raise exception if not).
|
||||
= Admin, et dir des etud. (si option l'y autorise)
|
||||
"""
|
||||
|
@ -51,9 +51,7 @@ from app.scodoc.sco_exceptions import ScoValueError
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
|
||||
|
||||
def moduleimpl_inscriptions_edit(
|
||||
moduleimpl_id, etuds=[], submitted=False, REQUEST=None
|
||||
):
|
||||
def moduleimpl_inscriptions_edit(moduleimpl_id, etuds=[], submitted=False):
|
||||
"""Formulaire inscription des etudiants a ce module
|
||||
* Gestion des inscriptions
|
||||
Nom TD TA TP (triable)
|
||||
@ -200,7 +198,7 @@ def moduleimpl_inscriptions_edit(
|
||||
else: # SUBMISSION
|
||||
# inscrit a ce module tous les etuds selectionnes
|
||||
sco_moduleimpl.do_moduleimpl_inscrit_etuds(
|
||||
moduleimpl_id, formsemestre_id, etuds, reset=True, REQUEST=REQUEST
|
||||
moduleimpl_id, formsemestre_id, etuds, reset=True
|
||||
)
|
||||
return flask.redirect("moduleimpl_status?moduleimpl_id=%s" % (moduleimpl_id))
|
||||
#
|
||||
@ -231,7 +229,7 @@ def _make_menu(partitions, title="", check="true"):
|
||||
)
|
||||
|
||||
|
||||
def moduleimpl_inscriptions_stats(formsemestre_id, REQUEST=None):
|
||||
def moduleimpl_inscriptions_stats(formsemestre_id):
|
||||
"""Affiche quelques informations sur les inscriptions
|
||||
aux modules de ce semestre.
|
||||
|
||||
@ -523,7 +521,7 @@ def is_inscrit_ue(etudid, formsemestre_id, ue_id):
|
||||
return r
|
||||
|
||||
|
||||
def do_etud_desinscrit_ue(etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
def do_etud_desinscrit_ue(etudid, formsemestre_id, ue_id):
|
||||
"""Desincrit l'etudiant de tous les modules de cette UE dans ce semestre."""
|
||||
cnx = ndb.GetDBConnexion()
|
||||
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
||||
@ -543,7 +541,6 @@ def do_etud_desinscrit_ue(etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
""",
|
||||
{"etudid": etudid, "formsemestre_id": formsemestre_id, "ue_id": ue_id},
|
||||
)
|
||||
if REQUEST:
|
||||
logdb(
|
||||
cnx,
|
||||
method="etud_desinscrit_ue",
|
||||
@ -556,7 +553,7 @@ def do_etud_desinscrit_ue(etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
) # > desinscription etudiant des modules
|
||||
|
||||
|
||||
def do_etud_inscrit_ue(etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
def do_etud_inscrit_ue(etudid, formsemestre_id, ue_id):
|
||||
"""Incrit l'etudiant de tous les modules de cette UE dans ce semestre."""
|
||||
# Verifie qu'il est bien inscrit au semestre
|
||||
insem = sco_formsemestre_inscriptions.do_formsemestre_inscription_list(
|
||||
|
@ -55,7 +55,7 @@ from app.scodoc import sco_users
|
||||
# ported from old DTML code in oct 2009
|
||||
|
||||
# menu evaluation dans moduleimpl
|
||||
def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0, REQUEST=None):
|
||||
def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0):
|
||||
"Menu avec actions sur une evaluation"
|
||||
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
|
||||
modimpl = sco_moduleimpl.do_moduleimpl_list(moduleimpl_id=E["moduleimpl_id"])[0]
|
||||
@ -154,7 +154,7 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0, REQUEST=None):
|
||||
return htmlutils.make_menu("actions", menuEval, alone=True)
|
||||
|
||||
|
||||
def moduleimpl_status(moduleimpl_id=None, partition_id=None, REQUEST=None):
|
||||
def moduleimpl_status(moduleimpl_id=None, partition_id=None):
|
||||
"""Tableau de bord module (liste des evaluations etc)"""
|
||||
M = sco_moduleimpl.do_moduleimpl_list(moduleimpl_id=moduleimpl_id)[0]
|
||||
formsemestre_id = M["formsemestre_id"]
|
||||
@ -190,7 +190,7 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None, REQUEST=None):
|
||||
f"""<span class="blacktt">({module_resp.user_name})</span>""",
|
||||
]
|
||||
try:
|
||||
sco_moduleimpl.can_change_module_resp(REQUEST, moduleimpl_id)
|
||||
sco_moduleimpl.can_change_module_resp(moduleimpl_id)
|
||||
H.append(
|
||||
"""<a class="stdlink" href="edit_moduleimpl_resp?moduleimpl_id=%s">modifier</a>"""
|
||||
% moduleimpl_id
|
||||
@ -514,7 +514,6 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None, REQUEST=None):
|
||||
moduleimpl_evaluation_menu(
|
||||
eval["evaluation_id"],
|
||||
nbnotes=etat["nb_notes"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
)
|
||||
H.append("</td>")
|
||||
|
@ -30,7 +30,7 @@
|
||||
Fiche description d'un étudiant et de son parcours
|
||||
|
||||
"""
|
||||
from flask import url_for, g
|
||||
from flask import url_for, g, request
|
||||
from flask_login import current_user
|
||||
|
||||
import app.scodoc.sco_utils as scu
|
||||
@ -143,18 +143,18 @@ def _menuScolarite(authuser, sem, etudid):
|
||||
)
|
||||
|
||||
|
||||
def ficheEtud(etudid=None, REQUEST=None):
|
||||
def ficheEtud(etudid=None):
|
||||
"fiche d'informations sur un etudiant"
|
||||
authuser = current_user
|
||||
cnx = ndb.GetDBConnexion()
|
||||
if etudid and REQUEST:
|
||||
if etudid:
|
||||
# la sidebar est differente s'il y a ou pas un etudid
|
||||
# voir html_sidebar.sidebar()
|
||||
REQUEST.form["etudid"] = etudid
|
||||
g.etudid = etudid
|
||||
args = sco_etud.make_etud_args(etudid=etudid)
|
||||
etuds = sco_etud.etudident_list(cnx, args)
|
||||
if not etuds:
|
||||
log("ficheEtud: etudid=%s REQUEST.form=%s" % (etudid, REQUEST.form))
|
||||
log("ficheEtud: etudid=%s request.args=%s" % (etudid, request.args))
|
||||
raise ScoValueError("Etudiant inexistant !")
|
||||
etud = etuds[0]
|
||||
etudid = etud["etudid"]
|
||||
@ -356,7 +356,7 @@ def ficheEtud(etudid=None, REQUEST=None):
|
||||
# Fichiers archivés:
|
||||
info["fichiers_archive_htm"] = (
|
||||
'<div class="fichetitre">Fichiers associés</div>'
|
||||
+ sco_archives_etud.etud_list_archives_html(REQUEST, etudid)
|
||||
+ sco_archives_etud.etud_list_archives_html(etudid)
|
||||
)
|
||||
|
||||
# Devenir de l'étudiant:
|
||||
@ -417,7 +417,7 @@ def ficheEtud(etudid=None, REQUEST=None):
|
||||
)
|
||||
else:
|
||||
info["groupes_row"] = ""
|
||||
info["menus_etud"] = menus_etud(REQUEST)
|
||||
info["menus_etud"] = menus_etud(etudid)
|
||||
tmpl = """<div class="menus_etud">%(menus_etud)s</div>
|
||||
<div class="ficheEtud" id="ficheEtud"><table>
|
||||
<tr><td>
|
||||
@ -499,13 +499,11 @@ def ficheEtud(etudid=None, REQUEST=None):
|
||||
return header + tmpl % info + html_sco_header.sco_footer()
|
||||
|
||||
|
||||
def menus_etud(REQUEST=None):
|
||||
def menus_etud(etudid):
|
||||
"""Menu etudiant (operations sur l'etudiant)"""
|
||||
if "etudid" not in REQUEST.form:
|
||||
return ""
|
||||
authuser = current_user
|
||||
|
||||
etud = sco_etud.get_etud_info(filled=True)[0]
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
||||
|
||||
menuEtud = [
|
||||
{
|
||||
@ -544,7 +542,7 @@ def menus_etud(REQUEST=None):
|
||||
return htmlutils.make_menu("Etudiant", menuEtud, alone=True)
|
||||
|
||||
|
||||
def etud_info_html(etudid, with_photo="1", REQUEST=None, debug=False):
|
||||
def etud_info_html(etudid, with_photo="1", debug=False):
|
||||
"""An HTML div with basic information and links about this etud.
|
||||
Used for popups information windows.
|
||||
"""
|
||||
|
@ -535,7 +535,7 @@ class SituationEtudParcoursGeneric(object):
|
||||
validated = True
|
||||
return s
|
||||
|
||||
def valide_decision(self, decision, REQUEST):
|
||||
def valide_decision(self, decision):
|
||||
"""Enregistre la decision (instance de DecisionSem)
|
||||
Enregistre codes semestre et UE, et autorisations inscription.
|
||||
"""
|
||||
|
@ -43,6 +43,7 @@ Les images sont servies par ScoDoc, via la méthode getphotofile?etudid=xxx
|
||||
|
||||
"""
|
||||
|
||||
from flask.helpers import make_response
|
||||
from app.scodoc.sco_exceptions import ScoGenError
|
||||
import datetime
|
||||
import glob
|
||||
@ -120,7 +121,7 @@ def etud_photo_url(etud, size="small", fast=False):
|
||||
return photo_url
|
||||
|
||||
|
||||
def get_photo_image(etudid=None, size="small", REQUEST=None):
|
||||
def get_photo_image(etudid=None, size="small"):
|
||||
"""Returns photo image (HTTP response)
|
||||
If not etudid, use "unknown" image
|
||||
"""
|
||||
@ -131,24 +132,14 @@ def get_photo_image(etudid=None, size="small", REQUEST=None):
|
||||
filename = photo_pathname(etud, size=size)
|
||||
if not filename:
|
||||
filename = UNKNOWN_IMAGE_PATH
|
||||
return _http_jpeg_file(filename, REQUEST=REQUEST)
|
||||
return _http_jpeg_file(filename)
|
||||
|
||||
|
||||
def _http_jpeg_file(filename, REQUEST=None):
|
||||
"""returns an image.
|
||||
This function will be modified when we kill #zope
|
||||
"""
|
||||
def _http_jpeg_file(filename):
|
||||
"""returns an image as a Flask response"""
|
||||
st = os.stat(filename)
|
||||
last_modified = st.st_mtime # float timestamp
|
||||
last_modified_str = time.strftime(
|
||||
"%a, %d %b %Y %H:%M:%S GMT", time.gmtime(last_modified)
|
||||
)
|
||||
file_size = st.st_size
|
||||
RESPONSE = REQUEST.RESPONSE
|
||||
RESPONSE.setHeader("Content-Type", "image/jpeg")
|
||||
RESPONSE.setHeader("Last-Modified", last_modified_str)
|
||||
RESPONSE.setHeader("Cache-Control", "max-age=3600")
|
||||
RESPONSE.setHeader("Content-Length", str(file_size))
|
||||
header = request.headers.get("If-Modified-Since")
|
||||
if header is not None:
|
||||
header = header.split(";")[0]
|
||||
@ -161,13 +152,20 @@ def _http_jpeg_file(filename, REQUEST=None):
|
||||
try:
|
||||
dt = datetime.datetime.strptime(header, "%a, %d %b %Y %H:%M:%S GMT")
|
||||
mod_since = dt.timestamp()
|
||||
except:
|
||||
except ValueError:
|
||||
mod_since = None
|
||||
if (mod_since is not None) and last_modified <= mod_since:
|
||||
RESPONSE.setStatus(304) # not modified
|
||||
return ""
|
||||
|
||||
return open(filename, mode="rb").read()
|
||||
return "", 304 # not modified
|
||||
#
|
||||
last_modified_str = time.strftime(
|
||||
"%a, %d %b %Y %H:%M:%S GMT", time.gmtime(last_modified)
|
||||
)
|
||||
response = make_response(open(filename, mode="rb").read())
|
||||
response.headers["Content-Type"] = "image/jpeg"
|
||||
response.headers["Last-Modified"] = last_modified_str
|
||||
response.headers["Cache-Control"] = "max-age=3600"
|
||||
response.headers["Content-Length"] = str(file_size)
|
||||
return response
|
||||
|
||||
|
||||
def etud_photo_is_local(etud, size="small"):
|
||||
@ -206,7 +204,7 @@ def etud_photo_html(etud=None, etudid=None, title=None, size="small"):
|
||||
)
|
||||
|
||||
|
||||
def etud_photo_orig_html(etud=None, etudid=None, title=None, REQUEST=None):
|
||||
def etud_photo_orig_html(etud=None, etudid=None, title=None):
|
||||
"""HTML img tag for the photo, in full size.
|
||||
Full-size images are always stored locally in the filesystem.
|
||||
They are the original uploaded images, converted in jpeg.
|
||||
@ -263,7 +261,7 @@ def store_photo(etud, data):
|
||||
return 1, "ok"
|
||||
|
||||
|
||||
def suppress_photo(etud, REQUEST=None):
|
||||
def suppress_photo(etud):
|
||||
"""Suppress a photo"""
|
||||
log("suppress_photo etudid=%s" % etud["etudid"])
|
||||
rel_path = photo_pathname(etud)
|
||||
@ -281,7 +279,6 @@ def suppress_photo(etud, REQUEST=None):
|
||||
log("removing file %s" % filename)
|
||||
os.remove(filename)
|
||||
# 3- log
|
||||
if REQUEST:
|
||||
logdb(cnx, method="changePhoto", msg="suppression", etudid=etud["etudid"])
|
||||
|
||||
|
||||
|
@ -164,7 +164,7 @@ def _getEtudInfoGroupes(group_ids, etat=None):
|
||||
return etuds
|
||||
|
||||
|
||||
def formsemestre_poursuite_report(formsemestre_id, format="html", REQUEST=None):
|
||||
def formsemestre_poursuite_report(formsemestre_id, format="html"):
|
||||
"""Table avec informations "poursuite" """
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
etuds = _getEtudInfoGroupes([sco_groups.get_default_group(formsemestre_id)])
|
||||
|
@ -77,7 +77,7 @@ sinon, elle ne concerne que le semestre indiqué.
|
||||
- avoir un mapping (read only) de toutes les valeurs:
|
||||
sco_preferences.SemPreferences(formsemestre_id)
|
||||
- editer les preferences globales:
|
||||
sco_preferences.get_base_preferences(self).edit(REQUEST=REQUEST)
|
||||
sco_preferences.get_base_preferences(self).edit()
|
||||
- editer les preferences d'un semestre:
|
||||
SemPreferences(formsemestre_id).edit()
|
||||
|
||||
@ -2014,7 +2014,7 @@ class BasePreferences(object):
|
||||
self._editor.delete(cnx, pdb[0]["pref_id"])
|
||||
sco_cache.invalidate_formsemestre() # > modif preferences
|
||||
|
||||
def edit(self, REQUEST):
|
||||
def edit(self):
|
||||
"""HTML dialog: edit global preferences"""
|
||||
from app.scodoc import html_sco_header
|
||||
|
||||
@ -2033,7 +2033,7 @@ class BasePreferences(object):
|
||||
form = self.build_tf_form()
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
form,
|
||||
initvalues=self.prefs[None],
|
||||
submitlabel="Enregistrer les modifications",
|
||||
@ -2143,7 +2143,7 @@ class SemPreferences(object):
|
||||
return self.base_prefs.is_global(self.formsemestre_id, name)
|
||||
|
||||
# The dialog
|
||||
def edit(self, categories=[], REQUEST=None):
|
||||
def edit(self, categories=[]):
|
||||
"""Dialog to edit semestre preferences in given categories"""
|
||||
from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_formsemestre
|
||||
@ -2198,7 +2198,7 @@ function set_global_pref(el, pref_name) {
|
||||
form.append(("formsemestre_id", {"input_type": "hidden"}))
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
form,
|
||||
initvalues=self,
|
||||
cssclass="sco_pref",
|
||||
|
@ -48,7 +48,7 @@ from app.scodoc import sco_preferences
|
||||
from app.scodoc.sco_excel import ScoExcelSheet
|
||||
|
||||
|
||||
def feuille_preparation_jury(formsemestre_id, REQUEST):
|
||||
def feuille_preparation_jury(formsemestre_id):
|
||||
"Feuille excel pour preparation des jurys"
|
||||
nt = sco_cache.NotesTableCache.get(
|
||||
formsemestre_id
|
||||
|
@ -495,7 +495,7 @@ def pvjury_table(
|
||||
return lines, titles, columns_ids
|
||||
|
||||
|
||||
def formsemestre_pvjury(formsemestre_id, format="html", publish=True, REQUEST=None):
|
||||
def formsemestre_pvjury(formsemestre_id, format="html", publish=True):
|
||||
"""Page récapitulant les décisions de jury
|
||||
dpv: result of dict_pvjury
|
||||
"""
|
||||
@ -597,7 +597,7 @@ def formsemestre_pvjury(formsemestre_id, format="html", publish=True, REQUEST=No
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def formsemestre_pvjury_pdf(formsemestre_id, group_ids=[], etudid=None, REQUEST=None):
|
||||
def formsemestre_pvjury_pdf(formsemestre_id, group_ids=[], etudid=None):
|
||||
"""Generation PV jury en PDF: saisie des paramètres
|
||||
Si etudid, PV pour un seul etudiant. Sinon, tout les inscrits au groupe indiqué.
|
||||
"""
|
||||
@ -656,7 +656,7 @@ def formsemestre_pvjury_pdf(formsemestre_id, group_ids=[], etudid=None, REQUEST=
|
||||
menu_choix_groupe = "" # un seul etudiant à editer
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
descr,
|
||||
cancelbutton="Annuler",
|
||||
method="get",
|
||||
@ -790,7 +790,7 @@ def descrform_pvjury(sem):
|
||||
]
|
||||
|
||||
|
||||
def formsemestre_lettres_individuelles(formsemestre_id, group_ids=[], REQUEST=None):
|
||||
def formsemestre_lettres_individuelles(formsemestre_id, group_ids=[]):
|
||||
"Lettres avis jury en PDF"
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
if not group_ids:
|
||||
@ -824,7 +824,7 @@ def formsemestre_lettres_individuelles(formsemestre_id, group_ids=[], REQUEST=No
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
descr,
|
||||
cancelbutton="Annuler",
|
||||
method="POST",
|
||||
|
@ -33,6 +33,7 @@ import time
|
||||
from xml.etree import ElementTree
|
||||
|
||||
from flask import request
|
||||
from flask import make_response
|
||||
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app import log
|
||||
@ -68,7 +69,6 @@ def formsemestre_recapcomplet(
|
||||
rank_partition_id=None, # si None, calcul rang global
|
||||
pref_override=True, # si vrai, les prefs ont la priorite sur le param hidebac
|
||||
force_publishing=True, # publie les XML/JSON meme si bulletins non publiés
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Page récapitulant les notes d'un semestre.
|
||||
Grand tableau récapitulatif avec toutes les notes de modules
|
||||
@ -101,7 +101,7 @@ def formsemestre_recapcomplet(
|
||||
javascripts=["libjs/sorttable.js", "js/etud_info.js"],
|
||||
),
|
||||
sco_formsemestre_status.formsemestre_status_head(
|
||||
formsemestre_id=formsemestre_id, REQUEST=REQUEST
|
||||
formsemestre_id=formsemestre_id
|
||||
),
|
||||
'<form name="f" method="get" action="%s">' % request.base_url,
|
||||
'<input type="hidden" name="formsemestre_id" value="%s"></input>'
|
||||
@ -147,11 +147,7 @@ def formsemestre_recapcomplet(
|
||||
if hidebac:
|
||||
H.append("checked")
|
||||
H.append(""" >cacher bac</input>""")
|
||||
if tabformat == "xml":
|
||||
REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE)
|
||||
H.append(
|
||||
do_formsemestre_recapcomplet(
|
||||
REQUEST,
|
||||
data = do_formsemestre_recapcomplet(
|
||||
formsemestre_id,
|
||||
format=tabformat,
|
||||
hidemodules=hidemodules,
|
||||
@ -162,7 +158,11 @@ def formsemestre_recapcomplet(
|
||||
rank_partition_id=rank_partition_id,
|
||||
force_publishing=force_publishing,
|
||||
)
|
||||
)
|
||||
if tabformat == "xml":
|
||||
response = make_response(data)
|
||||
response.headers["Content-Type"] = scu.XML_MIMETYPE
|
||||
return response
|
||||
H.append(data)
|
||||
|
||||
if not isFile:
|
||||
H.append("</form>")
|
||||
@ -200,7 +200,6 @@ def formsemestre_recapcomplet(
|
||||
|
||||
|
||||
def do_formsemestre_recapcomplet(
|
||||
REQUEST=None,
|
||||
formsemestre_id=None,
|
||||
format="html", # html, xml, xls, xlsall, json
|
||||
hidemodules=False, # ne pas montrer les modules (ignoré en XML)
|
||||
@ -959,7 +958,7 @@ def _formsemestre_recapcomplet_json(
|
||||
return J, "", "json"
|
||||
|
||||
|
||||
def formsemestres_bulletins(annee_scolaire, REQUEST=None):
|
||||
def formsemestres_bulletins(annee_scolaire):
|
||||
"""Tous les bulletins des semestres publiés des semestres de l'année indiquée.
|
||||
:param annee_scolaire(int): année de début de l'année scoalaire
|
||||
:returns: JSON
|
||||
|
@ -210,7 +210,6 @@ def _results_by_category(
|
||||
def formsemestre_report(
|
||||
formsemestre_id,
|
||||
etuds,
|
||||
REQUEST=None,
|
||||
category="bac",
|
||||
result="codedecision",
|
||||
category_name="",
|
||||
@ -253,26 +252,25 @@ def formsemestre_report(
|
||||
return tab
|
||||
|
||||
|
||||
# def formsemestre_report_bacs(formsemestre_id, format='html', REQUEST=None):
|
||||
# def formsemestre_report_bacs(formsemestre_id, format='html'):
|
||||
# """
|
||||
# Tableau sur résultats par type de bac
|
||||
# """
|
||||
# sem = sco_formsemestre.get_formsemestre( formsemestre_id)
|
||||
# title = 'Statistiques bacs ' + sem['titreannee']
|
||||
# etuds = formsemestre_etuds_stats(sem)
|
||||
# tab = formsemestre_report(formsemestre_id, etuds, REQUEST=REQUEST,
|
||||
# tab = formsemestre_report(formsemestre_id, etuds,
|
||||
# category='bac', result='codedecision',
|
||||
# category_name='Bac',
|
||||
# title=title)
|
||||
# return tab.make_page(
|
||||
# title = """<h2>Résultats de <a href="formsemestre_status?formsemestre_id=%(formsemestre_id)s">%(titreannee)s</a></h2>""" % sem,
|
||||
# format=format, page_title = title, REQUEST=REQUEST )
|
||||
# format=format, page_title = title)
|
||||
|
||||
|
||||
def formsemestre_report_counts(
|
||||
formsemestre_id,
|
||||
format="html",
|
||||
REQUEST=None,
|
||||
category="bac",
|
||||
result="codedecision",
|
||||
allkeys=False,
|
||||
@ -288,7 +286,6 @@ def formsemestre_report_counts(
|
||||
tab = formsemestre_report(
|
||||
formsemestre_id,
|
||||
etuds,
|
||||
REQUEST=REQUEST,
|
||||
category=category,
|
||||
result=result,
|
||||
category_name=category_name,
|
||||
@ -692,7 +689,6 @@ def formsemestre_suivi_cohorte(
|
||||
civilite=None,
|
||||
statut="",
|
||||
only_primo=False,
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Affiche suivi cohortes par numero de semestre"""
|
||||
annee_bac = str(annee_bac)
|
||||
@ -755,7 +751,6 @@ def formsemestre_suivi_cohorte(
|
||||
"""<h2 class="formsemestre">Suivi cohorte: devenir des étudiants de ce semestre</h2>""",
|
||||
_gen_form_selectetuds(
|
||||
formsemestre_id,
|
||||
REQUEST=REQUEST,
|
||||
only_primo=only_primo,
|
||||
bac=bac,
|
||||
bacspecialite=bacspecialite,
|
||||
@ -779,7 +774,6 @@ def formsemestre_suivi_cohorte(
|
||||
|
||||
def _gen_form_selectetuds(
|
||||
formsemestre_id,
|
||||
REQUEST=None,
|
||||
percent=None,
|
||||
only_primo=None,
|
||||
bac=None,
|
||||
@ -1164,7 +1158,7 @@ def table_suivi_parcours(formsemestre_id, only_primo=False, grouped_parcours=Tru
|
||||
return tab
|
||||
|
||||
|
||||
def tsp_form_primo_group(REQUEST, only_primo, no_grouping, formsemestre_id, format):
|
||||
def tsp_form_primo_group(only_primo, no_grouping, formsemestre_id, format):
|
||||
"""Element de formulaire pour choisir si restriction aux primos entrants et groupement par lycees"""
|
||||
F = ["""<form name="f" method="get" action="%s">""" % request.base_url]
|
||||
if only_primo:
|
||||
@ -1196,7 +1190,6 @@ def formsemestre_suivi_parcours(
|
||||
format="html",
|
||||
only_primo=False,
|
||||
no_grouping=False,
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Effectifs dans les differents parcours possibles."""
|
||||
tab = table_suivi_parcours(
|
||||
@ -1212,9 +1205,7 @@ def formsemestre_suivi_parcours(
|
||||
t = tab.make_page(format=format, with_html_headers=False)
|
||||
if format != "html":
|
||||
return t
|
||||
F = [
|
||||
tsp_form_primo_group(REQUEST, only_primo, no_grouping, formsemestre_id, format)
|
||||
]
|
||||
F = [tsp_form_primo_group(only_primo, no_grouping, formsemestre_id, format)]
|
||||
|
||||
H = [
|
||||
html_sco_header.sco_header(
|
||||
@ -1465,7 +1456,6 @@ def formsemestre_graph_parcours(
|
||||
civilite="",
|
||||
statut="",
|
||||
allkeys=False, # unused
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Graphe suivi cohortes"""
|
||||
annee_bac = str(annee_bac)
|
||||
@ -1512,12 +1502,13 @@ def formsemestre_graph_parcours(
|
||||
civilite=civilite,
|
||||
statut=statut,
|
||||
)
|
||||
filename = scu.make_filename("flux " + sem["titreannee"])
|
||||
REQUEST.RESPONSE.setHeader(
|
||||
"content-disposition", 'attachment; filename="%s"' % filename
|
||||
return scu.send_file(
|
||||
doc,
|
||||
filename="flux " + sem["titreannee"],
|
||||
suffix=".png",
|
||||
attached=True,
|
||||
mime="image/png",
|
||||
)
|
||||
REQUEST.RESPONSE.setHeader("content-type", "image/png")
|
||||
return doc
|
||||
elif format == "html":
|
||||
url_kw = {
|
||||
"scodoc_dept": g.scodoc_dept,
|
||||
@ -1557,7 +1548,6 @@ def formsemestre_graph_parcours(
|
||||
"<p>%d étudiants sélectionnés</p>" % len(etuds),
|
||||
_gen_form_selectetuds(
|
||||
formsemestre_id,
|
||||
REQUEST=REQUEST,
|
||||
only_primo=only_primo,
|
||||
bac=bac,
|
||||
bacspecialite=bacspecialite,
|
||||
|
@ -164,13 +164,14 @@ def _check_notes(notes, evaluation, mod):
|
||||
return L, invalids, withoutnotes, absents, tosuppress
|
||||
|
||||
|
||||
def do_evaluation_upload_xls(REQUEST):
|
||||
def do_evaluation_upload_xls():
|
||||
"""
|
||||
Soumission d'un fichier XLS (evaluation_id, notefile)
|
||||
"""
|
||||
authuser = current_user
|
||||
evaluation_id = int(REQUEST.form["evaluation_id"])
|
||||
comment = REQUEST.form["comment"]
|
||||
vals = request.form if request.method == "POST" else request.args
|
||||
evaluation_id = int(vals["evaluation_id"])
|
||||
comment = vals["comment"]
|
||||
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
|
||||
M = sco_moduleimpl.do_moduleimpl_withmodule_list(moduleimpl_id=E["moduleimpl_id"])[
|
||||
0
|
||||
@ -181,7 +182,7 @@ def do_evaluation_upload_xls(REQUEST):
|
||||
# XXX imaginer un redirect + msg erreur
|
||||
raise AccessDenied("Modification des notes impossible pour %s" % authuser)
|
||||
#
|
||||
diag, lines = sco_excel.excel_file_to_list(REQUEST.form["notefile"])
|
||||
diag, lines = sco_excel.excel_file_to_list(vals["notefile"])
|
||||
try:
|
||||
if not lines:
|
||||
raise InvalidNoteValue()
|
||||
@ -287,7 +288,6 @@ def do_evaluation_upload_xls(REQUEST):
|
||||
|
||||
def do_evaluation_set_missing(evaluation_id, value, dialog_confirmed=False):
|
||||
"""Initialisation des notes manquantes"""
|
||||
# ? evaluation_id = REQUEST.form["evaluation_id"]
|
||||
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
|
||||
M = sco_moduleimpl.do_moduleimpl_withmodule_list(moduleimpl_id=E["moduleimpl_id"])[
|
||||
0
|
||||
@ -588,7 +588,7 @@ def _notes_add(user, evaluation_id: int, notes: list, comment=None, do_it=True):
|
||||
return nb_changed, nb_suppress, existing_decisions
|
||||
|
||||
|
||||
def saisie_notes_tableur(evaluation_id, group_ids=[], REQUEST=None):
|
||||
def saisie_notes_tableur(evaluation_id, group_ids=[]):
|
||||
"""Saisie des notes via un fichier Excel"""
|
||||
evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
|
||||
if not evals:
|
||||
@ -658,7 +658,7 @@ def saisie_notes_tableur(evaluation_id, group_ids=[], REQUEST=None):
|
||||
|
||||
nf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("evaluation_id", {"default": evaluation_id, "input_type": "hidden"}),
|
||||
(
|
||||
@ -687,7 +687,7 @@ def saisie_notes_tableur(evaluation_id, group_ids=[], REQUEST=None):
|
||||
elif nf[0] == -1:
|
||||
H.append("<p>Annulation</p>")
|
||||
elif nf[0] == 1:
|
||||
updiag = do_evaluation_upload_xls(REQUEST)
|
||||
updiag = do_evaluation_upload_xls()
|
||||
if updiag[0]:
|
||||
H.append(updiag[1])
|
||||
H.append(
|
||||
@ -759,7 +759,7 @@ def saisie_notes_tableur(evaluation_id, group_ids=[], REQUEST=None):
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
def feuille_saisie_notes(evaluation_id, group_ids=[], REQUEST=None):
|
||||
def feuille_saisie_notes(evaluation_id, group_ids=[]):
|
||||
"""Document Excel pour saisie notes dans l'évaluation et les groupes indiqués"""
|
||||
evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
|
||||
if not evals:
|
||||
@ -830,7 +830,7 @@ def feuille_saisie_notes(evaluation_id, group_ids=[], REQUEST=None):
|
||||
filename = "notes_%s_%s.xlsx" % (evalname, gr_title_filename)
|
||||
xls = sco_excel.excel_feuille_saisie(E, sem["titreannee"], description, lines=L)
|
||||
return scu.send_file(xls, filename, scu.XLSX_SUFFIX, mime=scu.XLSX_MIMETYPE)
|
||||
# return sco_excel.send_excel_file(REQUEST, xls, filename)
|
||||
# return sco_excel.send_excel_file(xls, filename)
|
||||
|
||||
|
||||
def has_existing_decision(M, E, etudid):
|
||||
@ -857,7 +857,7 @@ def has_existing_decision(M, E, etudid):
|
||||
# Nouveau formulaire saisie notes (2016)
|
||||
|
||||
|
||||
def saisie_notes(evaluation_id, group_ids=[], REQUEST=None):
|
||||
def saisie_notes(evaluation_id, group_ids=[]):
|
||||
"""Formulaire saisie notes d'une évaluation pour un groupe"""
|
||||
group_ids = [int(group_id) for group_id in group_ids]
|
||||
evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
|
||||
@ -946,9 +946,7 @@ def saisie_notes(evaluation_id, group_ids=[], REQUEST=None):
|
||||
moduleimpl_id=E["moduleimpl_id"],
|
||||
)
|
||||
|
||||
form = _form_saisie_notes(
|
||||
E, M, groups_infos.group_ids, destination=destination, REQUEST=REQUEST
|
||||
)
|
||||
form = _form_saisie_notes(E, M, groups_infos.group_ids, destination=destination)
|
||||
if form is None:
|
||||
log(f"redirecting to {destination}")
|
||||
return flask.redirect(destination)
|
||||
@ -1039,7 +1037,7 @@ def _get_sorted_etuds(E, etudids, formsemestre_id):
|
||||
return etuds
|
||||
|
||||
|
||||
def _form_saisie_notes(E, M, group_ids, destination="", REQUEST=None):
|
||||
def _form_saisie_notes(E, M, group_ids, destination=""):
|
||||
"""Formulaire HTML saisie des notes dans l'évaluation E du moduleimpl M
|
||||
pour les groupes indiqués.
|
||||
|
||||
@ -1181,7 +1179,7 @@ def _form_saisie_notes(E, M, group_ids, destination="", REQUEST=None):
|
||||
|
||||
tf = TF(
|
||||
destination,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
descr,
|
||||
initvalues=initvalues,
|
||||
submitbutton=False,
|
||||
@ -1220,7 +1218,7 @@ def _form_saisie_notes(E, M, group_ids, destination="", REQUEST=None):
|
||||
return None
|
||||
|
||||
|
||||
def save_note(etudid=None, evaluation_id=None, value=None, comment="", REQUEST=None):
|
||||
def save_note(etudid=None, evaluation_id=None, value=None, comment=""):
|
||||
"""Enregistre une note (ajax)"""
|
||||
authuser = current_user
|
||||
log(
|
||||
|
@ -199,7 +199,7 @@ class ModuleTag(ScoTag):
|
||||
# API
|
||||
|
||||
|
||||
def module_tag_search(term, REQUEST=None):
|
||||
def module_tag_search(term):
|
||||
"""List all used tag names (for auto-completion)"""
|
||||
# restrict charset to avoid injections
|
||||
if not scu.ALPHANUM_EXP.match(term):
|
||||
|
@ -66,7 +66,6 @@ from app.scodoc import sco_etud
|
||||
|
||||
|
||||
def trombino(
|
||||
REQUEST=None,
|
||||
group_ids=[], # liste des groupes à afficher
|
||||
formsemestre_id=None, # utilisé si pas de groupes selectionné
|
||||
etat=None,
|
||||
@ -83,21 +82,19 @@ def trombino(
|
||||
|
||||
#
|
||||
if format != "html" and not dialog_confirmed:
|
||||
ok, dialog = check_local_photos_availability(
|
||||
groups_infos, REQUEST, format=format
|
||||
)
|
||||
ok, dialog = check_local_photos_availability(groups_infos, format=format)
|
||||
if not ok:
|
||||
return dialog
|
||||
|
||||
if format == "zip":
|
||||
return _trombino_zip(groups_infos)
|
||||
elif format == "pdf":
|
||||
return _trombino_pdf(groups_infos, REQUEST)
|
||||
return _trombino_pdf(groups_infos)
|
||||
elif format == "pdflist":
|
||||
return _listeappel_photos_pdf(groups_infos, REQUEST)
|
||||
return _listeappel_photos_pdf(groups_infos)
|
||||
else:
|
||||
raise Exception("invalid format")
|
||||
# return _trombino_html_header() + trombino_html( group, members, REQUEST=REQUEST) + html_sco_header.sco_footer( REQUEST)
|
||||
# return _trombino_html_header() + trombino_html( group, members) + html_sco_header.sco_footer()
|
||||
|
||||
|
||||
def _trombino_html_header():
|
||||
@ -183,7 +180,7 @@ def trombino_html(groups_infos):
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
def check_local_photos_availability(groups_infos, REQUEST, format=""):
|
||||
def check_local_photos_availability(groups_infos, format=""):
|
||||
"""Verifie que toutes les photos (des gropupes indiqués) sont copiées localement
|
||||
dans ScoDoc (seules les photos dont nous disposons localement peuvent être exportées
|
||||
en pdf ou en zip).
|
||||
@ -245,7 +242,7 @@ def _trombino_zip(groups_infos):
|
||||
|
||||
|
||||
# Copy photos from portal to ScoDoc
|
||||
def trombino_copy_photos(group_ids=[], REQUEST=None, dialog_confirmed=False):
|
||||
def trombino_copy_photos(group_ids=[], dialog_confirmed=False):
|
||||
"Copy photos from portal to ScoDoc (overwriting local copy)"
|
||||
groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids)
|
||||
back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args
|
||||
@ -316,7 +313,7 @@ def _get_etud_platypus_image(t, image_width=2 * cm):
|
||||
raise
|
||||
|
||||
|
||||
def _trombino_pdf(groups_infos, REQUEST):
|
||||
def _trombino_pdf(groups_infos):
|
||||
"Send photos as pdf page"
|
||||
# Generate PDF page
|
||||
filename = "trombino_%s" % groups_infos.groups_filename + ".pdf"
|
||||
@ -394,7 +391,7 @@ def _trombino_pdf(groups_infos, REQUEST):
|
||||
|
||||
|
||||
# --------------------- Sur une idée de l'IUT d'Orléans:
|
||||
def _listeappel_photos_pdf(groups_infos, REQUEST):
|
||||
def _listeappel_photos_pdf(groups_infos):
|
||||
"Doc pdf pour liste d'appel avec photos"
|
||||
filename = "trombino_%s" % groups_infos.groups_filename + ".pdf"
|
||||
sem = groups_infos.formsemestre # suppose 1 seul semestre
|
||||
@ -470,7 +467,7 @@ def _listeappel_photos_pdf(groups_infos, REQUEST):
|
||||
|
||||
|
||||
# --------------------- Upload des photos de tout un groupe
|
||||
def photos_generate_excel_sample(group_ids=[], REQUEST=None):
|
||||
def photos_generate_excel_sample(group_ids=[]):
|
||||
"""Feuille excel pour import fichiers photos"""
|
||||
fmt = sco_import_etuds.sco_import_format()
|
||||
data = sco_import_etuds.sco_import_generate_excel_sample(
|
||||
@ -489,10 +486,10 @@ def photos_generate_excel_sample(group_ids=[], REQUEST=None):
|
||||
return scu.send_file(
|
||||
data, "ImportPhotos", scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE, attached=True
|
||||
)
|
||||
# return sco_excel.send_excel_file(REQUEST, data, "ImportPhotos" + scu.XLSX_SUFFIX)
|
||||
# return sco_excel.send_excel_file(data, "ImportPhotos" + scu.XLSX_SUFFIX)
|
||||
|
||||
|
||||
def photos_import_files_form(group_ids=[], REQUEST=None):
|
||||
def photos_import_files_form(group_ids=[]):
|
||||
"""Formulaire pour importation photos"""
|
||||
groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids)
|
||||
back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args
|
||||
@ -517,10 +514,11 @@ def photos_import_files_form(group_ids=[], REQUEST=None):
|
||||
% groups_infos.groups_query_args,
|
||||
]
|
||||
F = html_sco_header.sco_footer()
|
||||
REQUEST.form["group_ids"] = groups_infos.group_ids
|
||||
vals = request.form if request.method == "POST" else request.args
|
||||
vals["group_ids"] = groups_infos.group_ids
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
vals,
|
||||
(
|
||||
("xlsfile", {"title": "Fichier Excel:", "input_type": "file", "size": 40}),
|
||||
("zipfile", {"title": "Fichier zip:", "input_type": "file", "size": 40}),
|
||||
@ -537,11 +535,10 @@ def photos_import_files_form(group_ids=[], REQUEST=None):
|
||||
group_ids=tf[2]["group_ids"],
|
||||
xlsfile=tf[2]["xlsfile"],
|
||||
zipfile=tf[2]["zipfile"],
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
def photos_import_files(group_ids=[], xlsfile=None, zipfile=None, REQUEST=None):
|
||||
def photos_import_files(group_ids=[], xlsfile=None, zipfile=None):
|
||||
"""Importation des photos"""
|
||||
groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids)
|
||||
back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args
|
||||
|
@ -56,7 +56,6 @@ N_PER_ROW = 5
|
||||
def pdf_trombino_tours(
|
||||
group_ids=[], # liste des groupes à afficher
|
||||
formsemestre_id=None, # utilisé si pas de groupes selectionné
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Generation du trombinoscope en fichier PDF"""
|
||||
# Informations sur les groupes à afficher:
|
||||
@ -281,7 +280,6 @@ def pdf_trombino_tours(
|
||||
def pdf_feuille_releve_absences(
|
||||
group_ids=[], # liste des groupes à afficher
|
||||
formsemestre_id=None, # utilisé si pas de groupes selectionné
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Generation de la feuille d'absence en fichier PDF, avec photos"""
|
||||
|
||||
|
@ -135,9 +135,7 @@ def external_ue_create(
|
||||
return moduleimpl_id
|
||||
|
||||
|
||||
def external_ue_inscrit_et_note(
|
||||
moduleimpl_id, formsemestre_id, notes_etuds, REQUEST=None
|
||||
):
|
||||
def external_ue_inscrit_et_note(moduleimpl_id, formsemestre_id, notes_etuds):
|
||||
log(
|
||||
"external_ue_inscrit_et_note(moduleimpl_id=%s, notes_etuds=%s)"
|
||||
% (moduleimpl_id, notes_etuds)
|
||||
@ -147,7 +145,6 @@ def external_ue_inscrit_et_note(
|
||||
moduleimpl_id,
|
||||
formsemestre_id,
|
||||
list(notes_etuds.keys()),
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
# Création d'une évaluation si il n'y en a pas déjà:
|
||||
@ -158,7 +155,6 @@ def external_ue_inscrit_et_note(
|
||||
else:
|
||||
# crée une évaluation:
|
||||
evaluation_id = sco_evaluations.do_evaluation_create(
|
||||
REQUEST=REQUEST,
|
||||
moduleimpl_id=moduleimpl_id,
|
||||
note_max=20.0,
|
||||
coefficient=1.0,
|
||||
@ -201,7 +197,7 @@ def get_external_moduleimpl_id(formsemestre_id, ue_id):
|
||||
|
||||
|
||||
# Web function
|
||||
def external_ue_create_form(formsemestre_id, etudid, REQUEST=None):
|
||||
def external_ue_create_form(formsemestre_id, etudid):
|
||||
"""Formulaire création UE externe + inscription étudiant et saisie note
|
||||
- Demande UE: peut-être existante (liste les UE externes de cette formation),
|
||||
ou sinon spécifier titre, acronyme, type, ECTS
|
||||
@ -249,7 +245,7 @@ def external_ue_create_form(formsemestre_id, etudid, REQUEST=None):
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("formsemestre_id", {"input_type": "hidden"}),
|
||||
("etudid", {"input_type": "hidden"}),
|
||||
@ -365,6 +361,5 @@ def external_ue_create_form(formsemestre_id, etudid, REQUEST=None):
|
||||
moduleimpl_id,
|
||||
formsemestre_id,
|
||||
{etudid: note_value},
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
return flask.redirect(bull_url + "&head_message=Ajout%20effectué")
|
||||
|
@ -146,7 +146,7 @@ def list_operations(evaluation_id):
|
||||
return Ops
|
||||
|
||||
|
||||
def evaluation_list_operations(evaluation_id, REQUEST=None):
|
||||
def evaluation_list_operations(evaluation_id):
|
||||
"""Page listing operations on evaluation"""
|
||||
E = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})[0]
|
||||
M = sco_moduleimpl.do_moduleimpl_list(moduleimpl_id=E["moduleimpl_id"])[0]
|
||||
@ -172,7 +172,7 @@ def evaluation_list_operations(evaluation_id, REQUEST=None):
|
||||
return tab.make_page()
|
||||
|
||||
|
||||
def formsemestre_list_saisies_notes(formsemestre_id, format="html", REQUEST=None):
|
||||
def formsemestre_list_saisies_notes(formsemestre_id, format="html"):
|
||||
"""Table listant toutes les opérations de saisies de notes, dans toutes
|
||||
les évaluations du semestre.
|
||||
"""
|
||||
@ -227,7 +227,7 @@ def formsemestre_list_saisies_notes(formsemestre_id, format="html", REQUEST=None
|
||||
return tab.make_page(format=format)
|
||||
|
||||
|
||||
def get_note_history(evaluation_id, etudid, REQUEST=None, fmt=""):
|
||||
def get_note_history(evaluation_id, etudid, fmt=""):
|
||||
"""Historique d'une note
|
||||
= liste chronologique d'opérations, la plus récente d'abord
|
||||
[ { 'value', 'date', 'comment', 'uid' } ]
|
||||
|
@ -77,7 +77,7 @@ def is_valid_password(cleartxt):
|
||||
# ---------------
|
||||
|
||||
|
||||
def index_html(REQUEST, all_depts=False, with_inactives=False, format="html"):
|
||||
def index_html(all_depts=False, with_inactives=False, format="html"):
|
||||
"gestion utilisateurs..."
|
||||
all_depts = int(all_depts)
|
||||
with_inactives = int(with_inactives)
|
||||
@ -121,7 +121,6 @@ def index_html(REQUEST, all_depts=False, with_inactives=False, format="html"):
|
||||
all_depts=all_depts,
|
||||
with_inactives=with_inactives,
|
||||
format=format,
|
||||
REQUEST=REQUEST,
|
||||
with_links=current_user.has_permission(Permission.ScoUsersAdmin, g.scodoc_dept),
|
||||
)
|
||||
if format != "html":
|
||||
@ -138,7 +137,6 @@ def list_users(
|
||||
with_inactives=False, # inclut les anciens utilisateurs (status "old")
|
||||
format="html",
|
||||
with_links=True,
|
||||
REQUEST=None,
|
||||
):
|
||||
"List users, returns a table in the specified format"
|
||||
from app.scodoc.sco_permissions_check import can_handle_passwd
|
||||
|
@ -50,7 +50,6 @@ from flask import g, current_app
|
||||
from PIL import Image as PILImage
|
||||
|
||||
from flask import g, url_for, request, make_response
|
||||
from werkzeug.wrappers import response
|
||||
|
||||
from config import Config
|
||||
from app import log
|
||||
@ -549,22 +548,12 @@ def bul_filename(sem, etud, format):
|
||||
return filename
|
||||
|
||||
|
||||
def sendCSVFile(REQUEST, data, filename): # DEPRECATED ne plus utiliser
|
||||
"""publication fichier.
|
||||
(on ne doit rien avoir émis avant, car ici sont générés les entetes)
|
||||
"""
|
||||
filename = (
|
||||
unescape_html(suppress_accents(filename)).replace("&", "").replace(" ", "_")
|
||||
)
|
||||
REQUEST.RESPONSE.setHeader("content-type", CSV_MIMETYPE)
|
||||
REQUEST.RESPONSE.setHeader(
|
||||
"content-disposition", 'attachment; filename="%s"' % filename
|
||||
)
|
||||
return data
|
||||
def sendCSVFile(data, filename): # DEPRECATED utiliser send_file
|
||||
"""publication fichier CSV."""
|
||||
return send_file(data, filename=filename, mime=CSV_MIMETYPE, attached=True)
|
||||
|
||||
|
||||
def sendPDFFile(data, filename):
|
||||
filename = make_filename(filename)
|
||||
def sendPDFFile(data, filename): # DEPRECATED utiliser send_file
|
||||
return send_file(data, filename=filename, mime=PDF_MIMETYPE, attached=True)
|
||||
|
||||
|
||||
@ -613,7 +602,7 @@ def sendResult(data, name=None, format=None, force_outer_xml_tag=True, attached=
|
||||
|
||||
def send_file(data, filename="", suffix="", mime=None, attached=None):
|
||||
"""Build Flask Response for file download of given type
|
||||
By default (attached is None), json and xml are inlined and otrher types are atteched.
|
||||
By default (attached is None), json and xml are inlined and otrher types are attached.
|
||||
"""
|
||||
if attached is None:
|
||||
if mime == XML_MIMETYPE or mime == JSON_MIMETYPE:
|
||||
@ -834,16 +823,6 @@ def AnneeScolaire(sco_year=None):
|
||||
return year
|
||||
|
||||
|
||||
def return_text_if_published(val, REQUEST):
|
||||
"""Pour les méthodes publiées qui ramènent soit du texte (HTML) soit du JSON
|
||||
sauf quand elles sont appellées depuis python.
|
||||
La présence de l'argument REQUEST indique la publication.
|
||||
"""
|
||||
if REQUEST and not isinstance(val, str):
|
||||
return sendJSON(val)
|
||||
return val
|
||||
|
||||
|
||||
def confirm_dialog(
|
||||
message="<p>Confirmer ?</p>",
|
||||
OK="OK",
|
||||
|
@ -1104,7 +1104,7 @@ def AddBilletAbsence(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoAbsAddBillet)
|
||||
@scodoc7func
|
||||
def AddBilletAbsenceForm(etudid, REQUEST=None):
|
||||
def AddBilletAbsenceForm(etudid):
|
||||
"""Formulaire ajout billet (pour tests seulement, le vrai formulaire accessible aux etudiants
|
||||
étant sur le portail étudiant).
|
||||
"""
|
||||
@ -1116,7 +1116,7 @@ def AddBilletAbsenceForm(etudid, REQUEST=None):
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("etudid", {"input_type": "hidden"}),
|
||||
("begin", {"input_type": "date"}),
|
||||
@ -1250,7 +1250,7 @@ def XMLgetBilletsEtud(etudid=False):
|
||||
@scodoc
|
||||
@permission_required_compat_scodoc7(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def listeBillets(REQUEST=None):
|
||||
def listeBillets():
|
||||
"""Page liste des billets non traités et formulaire recherche d'un billet"""
|
||||
cnx = ndb.GetDBConnexion()
|
||||
billets = sco_abs.billet_absence_list(cnx, {"etat": False})
|
||||
@ -1263,7 +1263,7 @@ def listeBillets(REQUEST=None):
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(("billet_id", {"input_type": "text", "title": "Numéro du billet"}),),
|
||||
submitbutton=False,
|
||||
)
|
||||
@ -1366,7 +1366,7 @@ def _ProcessBilletAbsence(billet, estjust, description):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoAbsChange)
|
||||
@scodoc7func
|
||||
def ProcessBilletAbsenceForm(billet_id, REQUEST=None):
|
||||
def ProcessBilletAbsenceForm(billet_id):
|
||||
"""Formulaire traitement d'un billet"""
|
||||
cnx = ndb.GetDBConnexion()
|
||||
billets = sco_abs.billet_absence_list(cnx, {"billet_id": billet_id})
|
||||
@ -1392,7 +1392,7 @@ def ProcessBilletAbsenceForm(billet_id, REQUEST=None):
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("billet_id", {"input_type": "hidden"}),
|
||||
(
|
||||
|
@ -56,20 +56,20 @@ from flask_login import current_user
|
||||
# import sco_entreprises
|
||||
|
||||
|
||||
def entreprise_header(REQUEST=None, page_title=""):
|
||||
def entreprise_header(page_title=""):
|
||||
"common header for all Entreprises pages"
|
||||
return html_sco_header.sco_header(page_title=page_title)
|
||||
|
||||
|
||||
def entreprise_footer(REQUEST):
|
||||
def entreprise_footer():
|
||||
"common entreprise footer"
|
||||
return html_sco_header.sco_footer(REQUEST)
|
||||
return html_sco_header.sco_footer()
|
||||
|
||||
|
||||
security.declareProtected(ScoEntrepriseView, "sidebar")
|
||||
|
||||
|
||||
def sidebar(REQUEST):
|
||||
def sidebar():
|
||||
"barre gauche (overide std sco sidebar)"
|
||||
# rewritten from legacy DTML code
|
||||
# XXX rare cas restant d'utilisation de l'acquisition Zope2: à revoir
|
||||
@ -94,8 +94,9 @@ def sidebar(REQUEST):
|
||||
)
|
||||
|
||||
# --- entreprise selectionnée:
|
||||
if "entreprise_id" in REQUEST.form:
|
||||
entreprise_id = REQUEST.form["entreprise_id"]
|
||||
vals = request.form if request.method == "POST" else request.args
|
||||
if "entreprise_id" in vals:
|
||||
entreprise_id = vals["entreprise_id"]
|
||||
E = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id})
|
||||
if E:
|
||||
E = E[0]
|
||||
@ -106,7 +107,7 @@ def sidebar(REQUEST):
|
||||
<ul class="insidebar">
|
||||
<li class="insidebar"><a href="%(ScoURL)s/Entreprises/entreprise_correspondant_list?entreprise_id=%(entreprise_id)s" class="sidebar">Corresp.</a></li>"""
|
||||
% params
|
||||
) # """
|
||||
)
|
||||
if current_user.has_permission(Permission.ScoEntrepriseChange):
|
||||
H.append(
|
||||
"""<li class="insidebar"><a href="%(ScoURL)s/Entreprises/entreprise_correspondant_create?entreprise_id=%(entreprise_id)s" class="sidebar">Nouveau Corresp.</a></li>"""
|
||||
@ -139,22 +140,22 @@ def sidebar(REQUEST):
|
||||
security.declareProtected(ScoEntrepriseView, "index_html")
|
||||
|
||||
|
||||
def index_html(REQUEST=None, etud_nom=None, limit=50, offset="", format="html"):
|
||||
def index_html(etud_nom=None, limit=50, offset="", format="html"):
|
||||
"""Accueil module entreprises"""
|
||||
# Traduit du DTML - utilise table standard
|
||||
if limit:
|
||||
limit = int(limit)
|
||||
if offset:
|
||||
offset = int(offset or 0)
|
||||
|
||||
vals = request.form if request.method == "POST" else request.args
|
||||
if etud_nom:
|
||||
entreprises = sco_entreprises.do_entreprise_list_by_etud(
|
||||
args=REQUEST.form, sort_on_contact=True
|
||||
args=vals, sort_on_contact=True
|
||||
)
|
||||
table_navigation = ""
|
||||
else:
|
||||
entreprises = sco_entreprises.do_entreprise_list(
|
||||
args=REQUEST.form,
|
||||
args=vals,
|
||||
test="~*",
|
||||
sort_on_contact=True,
|
||||
limit=limit,
|
||||
@ -226,12 +227,12 @@ def index_html(REQUEST=None, etud_nom=None, limit=50, offset="", format="html"):
|
||||
return tab.make_page(format=format)
|
||||
else:
|
||||
H = [
|
||||
entreprise_header(REQUEST=REQUEST, page_title="Suivi entreprises"),
|
||||
entreprise_header(page_title="Suivi entreprises"),
|
||||
"""<h2>Suivi relations entreprises</h2>""",
|
||||
"""<div class="entreprise_list_table">""",
|
||||
tab.html(),
|
||||
"""</div>""",
|
||||
entreprise_footer(REQUEST),
|
||||
entreprise_footer(),
|
||||
]
|
||||
return "\n".join(H)
|
||||
|
||||
@ -239,9 +240,9 @@ def index_html(REQUEST=None, etud_nom=None, limit=50, offset="", format="html"):
|
||||
security.declareProtected(ScoEntrepriseView, "entreprise_contact_list")
|
||||
|
||||
|
||||
def entreprise_contact_list(entreprise_id=None, format="html", REQUEST=None):
|
||||
def entreprise_contact_list(entreprise_id=None, format="html"):
|
||||
"""Liste des contacts de l'entreprise"""
|
||||
H = [entreprise_header(REQUEST=REQUEST, page_title="Suivi entreprises")]
|
||||
H = [entreprise_header(page_title="Suivi entreprises")]
|
||||
if entreprise_id:
|
||||
E = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id})[0]
|
||||
C = sco_entreprises.do_entreprise_contact_list(
|
||||
@ -308,7 +309,7 @@ def entreprise_contact_list(entreprise_id=None, format="html", REQUEST=None):
|
||||
% E
|
||||
)
|
||||
|
||||
H.append(entreprise_footer(REQUEST))
|
||||
H.append(entreprise_footer())
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
@ -318,12 +319,11 @@ security.declareProtected(ScoEntrepriseView, "entreprise_correspondant_list")
|
||||
def entreprise_correspondant_list(
|
||||
entreprise_id=None,
|
||||
format="html",
|
||||
REQUEST=None,
|
||||
):
|
||||
"""Liste des correspondants de l'entreprise"""
|
||||
E = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id})[0]
|
||||
H = [
|
||||
entreprise_header(REQUEST=REQUEST, page_title="Suivi entreprises"),
|
||||
entreprise_header(page_title="Suivi entreprises"),
|
||||
"""
|
||||
<h2>Listes des correspondants dans l'entreprise %(nom)s</h2>
|
||||
"""
|
||||
@ -413,14 +413,14 @@ def entreprise_correspondant_list(
|
||||
% E
|
||||
)
|
||||
|
||||
H.append(entreprise_footer(REQUEST))
|
||||
H.append(entreprise_footer())
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
security.declareProtected(ScoEntrepriseView, "entreprise_contact_edit")
|
||||
|
||||
|
||||
def entreprise_contact_edit(entreprise_contact_id, REQUEST=None):
|
||||
def entreprise_contact_edit(entreprise_contact_id):
|
||||
"""Form edit contact"""
|
||||
c = sco_entreprises.do_entreprise_contact_list(
|
||||
args={"entreprise_contact_id": entreprise_contact_id}
|
||||
@ -437,14 +437,14 @@ def entreprise_contact_edit(entreprise_contact_id, REQUEST=None):
|
||||
) + [("inconnu", "")]
|
||||
|
||||
H = [
|
||||
entreprise_header(REQUEST=REQUEST, page_title="Suivi entreprises"),
|
||||
entreprise_header(page_title="Suivi entreprises"),
|
||||
"""<h2 class="entreprise_contact">Suivi entreprises</h2>
|
||||
<h3>Contact avec entreprise %(nom)s</h3>"""
|
||||
% E,
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
(
|
||||
"entreprise_contact_id",
|
||||
@ -540,25 +540,25 @@ def entreprise_contact_edit(entreprise_contact_id, REQUEST=None):
|
||||
+ "/entreprise_contact_list?entreprise_id="
|
||||
+ str(c["entreprise_id"])
|
||||
)
|
||||
H.append(entreprise_footer(REQUEST))
|
||||
H.append(entreprise_footer())
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
security.declareProtected(ScoEntrepriseView, "entreprise_correspondant_edit")
|
||||
|
||||
|
||||
def entreprise_correspondant_edit(entreprise_corresp_id, REQUEST=None):
|
||||
def entreprise_correspondant_edit(entreprise_corresp_id):
|
||||
"""Form édition d'un correspondant"""
|
||||
c = sco_entreprises.do_entreprise_correspondant_list(
|
||||
args={"entreprise_corresp_id": entreprise_corresp_id}
|
||||
)[0]
|
||||
H = [
|
||||
entreprise_header(REQUEST=REQUEST, page_title="Suivi entreprises"),
|
||||
entreprise_header(page_title="Suivi entreprises"),
|
||||
"""<h2 class="entreprise_correspondant">Édition contact entreprise</h2>""",
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
(
|
||||
"entreprise_corresp_id",
|
||||
@ -653,14 +653,14 @@ def entreprise_correspondant_edit(entreprise_corresp_id, REQUEST=None):
|
||||
"%s/entreprise_correspondant_list?entreprise_id=%s"
|
||||
% (scu.EntreprisesURL(), c["entreprise_id"])
|
||||
)
|
||||
H.append(entreprise_footer(REQUEST))
|
||||
H.append(entreprise_footer())
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
security.declareProtected(ScoEntrepriseChange, "entreprise_contact_create")
|
||||
|
||||
|
||||
def entreprise_contact_create(entreprise_id, REQUEST=None):
|
||||
def entreprise_contact_create(entreprise_id):
|
||||
"""Form création contact"""
|
||||
E = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id})[0]
|
||||
correspondants = sco_entreprises.do_entreprise_correspondant_listnames(
|
||||
@ -674,13 +674,13 @@ def entreprise_contact_create(entreprise_id, REQUEST=None):
|
||||
% (scu.EntreprisesURL(), entreprise_id)
|
||||
)
|
||||
H = [
|
||||
entreprise_header(REQUEST=REQUEST, page_title="Suivi entreprises"),
|
||||
entreprise_header(page_title="Suivi entreprises"),
|
||||
"""<h2 class="entreprise_contact">Nouveau "contact" avec l'entreprise %(nom)s</h2>"""
|
||||
% E,
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("entreprise_id", {"input_type": "hidden", "default": entreprise_id}),
|
||||
(
|
||||
@ -759,25 +759,25 @@ def entreprise_contact_create(entreprise_id, REQUEST=None):
|
||||
tf[2].update({"etudid": etudok[1]})
|
||||
sco_entreprises.do_entreprise_contact_create(tf[2])
|
||||
return flask.redirect(scu.EntreprisesURL())
|
||||
H.append(entreprise_footer(REQUEST))
|
||||
H.append(entreprise_footer())
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
security.declareProtected(ScoEntrepriseChange, "entreprise_contact_delete")
|
||||
|
||||
|
||||
def entreprise_contact_delete(entreprise_contact_id, REQUEST=None):
|
||||
def entreprise_contact_delete(entreprise_contact_id):
|
||||
"""Form delete contact"""
|
||||
c = sco_entreprises.do_entreprise_contact_list(
|
||||
args={"entreprise_contact_id": entreprise_contact_id}
|
||||
)[0]
|
||||
H = [
|
||||
entreprise_header(REQUEST=REQUEST, page_title="Suivi entreprises"),
|
||||
entreprise_header(page_title="Suivi entreprises"),
|
||||
"""<h2>Suppression du contact</h2>""",
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(("entreprise_contact_id", {"input_type": "hidden"}),),
|
||||
initvalues=c,
|
||||
submitlabel="Confirmer la suppression",
|
||||
@ -791,24 +791,24 @@ def entreprise_contact_delete(entreprise_contact_id, REQUEST=None):
|
||||
else:
|
||||
sco_entreprises.do_entreprise_contact_delete(c["entreprise_contact_id"])
|
||||
return flask.redirect(scu.EntreprisesURL(context))
|
||||
H.append(entreprise_footer(REQUEST))
|
||||
H.append(entreprise_footer())
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
security.declareProtected(ScoEntrepriseChange, "entreprise_correspondant_create")
|
||||
|
||||
|
||||
def entreprise_correspondant_create(entreprise_id, REQUEST=None):
|
||||
def entreprise_correspondant_create(entreprise_id):
|
||||
"""Form création correspondant"""
|
||||
E = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id})[0]
|
||||
H = [
|
||||
entreprise_header(REQUEST=REQUEST, page_title="Suivi entreprises"),
|
||||
entreprise_header(page_title="Suivi entreprises"),
|
||||
"""<h2 class="entreprise_contact">Nouveau correspondant l'entreprise %(nom)s</h2>"""
|
||||
% E,
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("entreprise_id", {"input_type": "hidden", "default": entreprise_id}),
|
||||
(
|
||||
@ -894,25 +894,25 @@ def entreprise_correspondant_create(entreprise_id, REQUEST=None):
|
||||
else:
|
||||
sco_entreprises.do_entreprise_correspondant_create(tf[2])
|
||||
return flask.redirect(scu.EntreprisesURL(context))
|
||||
H.append(entreprise_footer(REQUEST))
|
||||
H.append(entreprise_footer())
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
security.declareProtected(ScoEntrepriseChange, "entreprise_correspondant_delete")
|
||||
|
||||
|
||||
def entreprise_correspondant_delete(entreprise_corresp_id, REQUEST=None):
|
||||
def entreprise_correspondant_delete(entreprise_corresp_id):
|
||||
"""Form delete correspondant"""
|
||||
c = sco_entreprises.do_entreprise_correspondant_list(
|
||||
args={"entreprise_corresp_id": entreprise_corresp_id}
|
||||
)[0]
|
||||
H = [
|
||||
entreprise_header(REQUEST=REQUEST, page_title="Suivi entreprises"),
|
||||
entreprise_header(page_title="Suivi entreprises"),
|
||||
"""<h2>Suppression du correspondant %(nom)s %(prenom)s</h2>""" % c,
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(("entreprise_corresp_id", {"input_type": "hidden"}),),
|
||||
initvalues=c,
|
||||
submitlabel="Confirmer la suppression",
|
||||
@ -926,18 +926,18 @@ def entreprise_correspondant_delete(entreprise_corresp_id, REQUEST=None):
|
||||
else:
|
||||
sco_entreprises.do_entreprise_correspondant_delete(c["entreprise_corresp_id"])
|
||||
return flask.redirect(scu.EntreprisesURL())
|
||||
H.append(entreprise_footer(REQUEST))
|
||||
H.append(entreprise_footer())
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
security.declareProtected(ScoEntrepriseChange, "entreprise_delete")
|
||||
|
||||
|
||||
def entreprise_delete(entreprise_id, REQUEST=None):
|
||||
def entreprise_delete(entreprise_id):
|
||||
"""Form delete entreprise"""
|
||||
E = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id})[0]
|
||||
H = [
|
||||
entreprise_header(REQUEST=REQUEST, page_title="Suivi entreprises"),
|
||||
entreprise_header(page_title="Suivi entreprises"),
|
||||
"""<h2>Suppression de l'entreprise %(nom)s</h2>
|
||||
<p class="entreprise_warning">Attention: supression définitive de l'entreprise, de ses correspondants et contacts.
|
||||
</p>"""
|
||||
@ -966,7 +966,7 @@ def entreprise_delete(entreprise_id, REQUEST=None):
|
||||
H.append("""</ul>""")
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(("entreprise_id", {"input_type": "hidden"}),),
|
||||
initvalues=E,
|
||||
submitlabel="Confirmer la suppression",
|
||||
@ -980,7 +980,7 @@ def entreprise_delete(entreprise_id, REQUEST=None):
|
||||
else:
|
||||
sco_entreprises.do_entreprise_delete(E["entreprise_id"])
|
||||
return flask.redirect(scu.EntreprisesURL())
|
||||
H.append(entreprise_footer(REQUEST))
|
||||
H.append(entreprise_footer())
|
||||
return "\n".join(H)
|
||||
|
||||
|
||||
@ -988,15 +988,15 @@ def entreprise_delete(entreprise_id, REQUEST=None):
|
||||
security.declareProtected(ScoEntrepriseChange, "entreprise_create")
|
||||
|
||||
|
||||
def entreprise_create(REQUEST=None):
|
||||
def entreprise_create():
|
||||
"""Form. création entreprise"""
|
||||
H = [
|
||||
entreprise_header(REQUEST, page_title="Création d'une entreprise"),
|
||||
entreprise_header(page_title="Création d'une entreprise"),
|
||||
"""<h2 class="entreprise_new">Création d'une entreprise</h2>""",
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("nom", {"size": 25, "title": "Nom de l'entreprise"}),
|
||||
(
|
||||
@ -1069,7 +1069,7 @@ def entreprise_create(REQUEST=None):
|
||||
readonly=not current_user.has_permission(Permission.ScoEntrepriseChange),
|
||||
)
|
||||
if tf[0] == 0:
|
||||
return "\n".join(H) + tf[1] + entreprise_footer(REQUEST)
|
||||
return "\n".join(H) + tf[1] + entreprise_footer()
|
||||
elif tf[0] == -1:
|
||||
return flask.redirect(scu.EntreprisesURL())
|
||||
else:
|
||||
@ -1080,18 +1080,18 @@ def entreprise_create(REQUEST=None):
|
||||
security.declareProtected(ScoEntrepriseView, "entreprise_edit")
|
||||
|
||||
|
||||
def entreprise_edit(entreprise_id, REQUEST=None, start=1):
|
||||
def entreprise_edit(entreprise_id, start=1):
|
||||
"""Form. edit entreprise"""
|
||||
authuser = current_user
|
||||
readonly = not authuser.has_permission(Permission.ScoEntrepriseChange)
|
||||
F = sco_entreprises.do_entreprise_list(args={"entreprise_id": entreprise_id})[0]
|
||||
H = [
|
||||
entreprise_header(REQUEST, page_title="Entreprise"),
|
||||
entreprise_header(page_title="Entreprise"),
|
||||
"""<h2 class="entreprise">%(nom)s</h2>""" % F,
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("entreprise_id", {"default": entreprise_id, "input_type": "hidden"}),
|
||||
("start", {"default": 1, "input_type": "hidden"}),
|
||||
@ -1242,7 +1242,7 @@ def entreprise_edit(entreprise_id, REQUEST=None, start=1):
|
||||
H.append("(%s)" % c["description"])
|
||||
H.append("</li>")
|
||||
H.append("</ul>")
|
||||
return "\n".join(H) + entreprise_footer(REQUEST)
|
||||
return "\n".join(H) + entreprise_footer()
|
||||
elif tf[0] == -1:
|
||||
return flask.redirect(scu.EntreprisesURL() + "?start=" + start)
|
||||
else:
|
||||
|
@ -147,12 +147,12 @@ def sco_publish(route, function, permission, methods=["GET"]):
|
||||
# @scodoc
|
||||
# @permission_required(Permission.ScoView)
|
||||
# @scodoc7func
|
||||
# def essai(REQUEST=None):
|
||||
# return essai_(REQUEST)
|
||||
# def essai():
|
||||
# return essai_()
|
||||
|
||||
|
||||
# def essai_(REQUEST):
|
||||
# return "<html><body><h2>essai !</h2><p>%s</p></body></html>" % (REQUEST,)
|
||||
# def essai_():
|
||||
# return "<html><body><h2>essai !</h2><p>%s</p></body></html>" % ()
|
||||
|
||||
|
||||
# def essai2():
|
||||
@ -262,7 +262,7 @@ sco_publish(
|
||||
|
||||
@bp.route(
|
||||
"formsemestre_bulletinetud", methods=["GET", "POST"]
|
||||
) # pour compat anciens clients PHP
|
||||
) # POST pour compat anciens clients PHP (deprecated)
|
||||
@scodoc
|
||||
@permission_required_compat_scodoc7(Permission.ScoView)
|
||||
@scodoc7func
|
||||
@ -274,7 +274,6 @@ def formsemestre_bulletinetud(
|
||||
xml_with_decisions=False,
|
||||
force_publishing=False,
|
||||
prefer_mail_perso=False,
|
||||
REQUEST=None,
|
||||
):
|
||||
return sco_bulletins.formsemestre_bulletinetud(
|
||||
etudid=etudid,
|
||||
@ -284,7 +283,6 @@ def formsemestre_bulletinetud(
|
||||
xml_with_decisions=xml_with_decisions,
|
||||
force_publishing=force_publishing,
|
||||
prefer_mail_perso=prefer_mail_perso,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
@ -408,7 +406,7 @@ sco_publish(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def index_html(REQUEST=None):
|
||||
def index_html():
|
||||
"Page accueil formations"
|
||||
|
||||
editable = current_user.has_permission(Permission.ScoChangeFormation)
|
||||
@ -495,7 +493,7 @@ def formation_import_xml(file):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoChangeFormation)
|
||||
@scodoc7func
|
||||
def formation_import_xml_form(REQUEST):
|
||||
def formation_import_xml_form():
|
||||
"form import d'une formation en XML"
|
||||
H = [
|
||||
html_sco_header.sco_header(page_title="Import d'une formation"),
|
||||
@ -507,7 +505,7 @@ def formation_import_xml_form(REQUEST):
|
||||
footer = html_sco_header.sco_footer()
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(("xmlfile", {"input_type": "file", "title": "Fichier XML", "size": 30}),),
|
||||
submitlabel="Importer",
|
||||
cancelbutton="Annuler",
|
||||
@ -618,7 +616,7 @@ def formsemestre_list(
|
||||
):
|
||||
"""List formsemestres in given format.
|
||||
kw can specify some conditions: examples:
|
||||
formsemestre_list( format='json', formation_id='F777', REQUEST=REQUEST)
|
||||
formsemestre_list( format='json', formation_id='F777')
|
||||
"""
|
||||
# XAPI: new json api
|
||||
args = {}
|
||||
@ -637,7 +635,7 @@ def formsemestre_list(
|
||||
@scodoc
|
||||
@permission_required_compat_scodoc7(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def XMLgetFormsemestres(etape_apo=None, formsemestre_id=None, REQUEST=None):
|
||||
def XMLgetFormsemestres(etape_apo=None, formsemestre_id=None):
|
||||
"""List all formsemestres matching etape, XML format
|
||||
DEPRECATED: use formsemestre_list()
|
||||
"""
|
||||
@ -647,8 +645,7 @@ def XMLgetFormsemestres(etape_apo=None, formsemestre_id=None, REQUEST=None):
|
||||
args["etape_apo"] = etape_apo
|
||||
if formsemestre_id:
|
||||
args["formsemestre_id"] = formsemestre_id
|
||||
if REQUEST:
|
||||
REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE)
|
||||
|
||||
doc = ElementTree.Element("formsemestrelist")
|
||||
for sem in sco_formsemestre.do_formsemestre_list(args=args):
|
||||
for k in sem:
|
||||
@ -657,7 +654,8 @@ def XMLgetFormsemestres(etape_apo=None, formsemestre_id=None, REQUEST=None):
|
||||
sem_elt = ElementTree.Element("formsemestre", **sem)
|
||||
doc.append(sem_elt)
|
||||
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING)
|
||||
data = sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING)
|
||||
return scu.send_file(data, mime=scu.XML_MIMETYPE)
|
||||
|
||||
|
||||
sco_publish(
|
||||
@ -671,12 +669,25 @@ sco_publish(
|
||||
Permission.ScoView,
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
sco_publish(
|
||||
"/formsemestre_change_lock",
|
||||
sco_formsemestre_edit.formsemestre_change_lock,
|
||||
Permission.ScoView,
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/formsemestre_change_lock", methods=["GET", "POST"])
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView) # acces vérifié dans la fonction
|
||||
@scodoc7func
|
||||
def formsemestre_change_lock(formsemestre_id, dialog_confirmed=False):
|
||||
sco_formsemestre_edit.formsemestre_change_lock(
|
||||
formsemestre_id, dialog_confirmed=dialog_confirmed
|
||||
)
|
||||
return flask.redirect(
|
||||
url_for(
|
||||
"notes.formsemestre_status",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
formsemestre_id=formsemestre_id,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
sco_publish(
|
||||
"/formsemestre_change_publication_bul",
|
||||
sco_formsemestre_edit.formsemestre_change_publication_bul,
|
||||
@ -694,12 +705,10 @@ sco_publish(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def formsemestre_custommenu_edit(REQUEST, formsemestre_id):
|
||||
def formsemestre_custommenu_edit(formsemestre_id):
|
||||
"Dialogue modif menu"
|
||||
# accessible à tous !
|
||||
return sco_formsemestre_custommenu.formsemestre_custommenu_edit(
|
||||
formsemestre_id, REQUEST=REQUEST
|
||||
)
|
||||
return sco_formsemestre_custommenu.formsemestre_custommenu_edit(formsemestre_id)
|
||||
|
||||
|
||||
# --- dialogue modif enseignants/moduleimpl
|
||||
@ -707,7 +716,7 @@ def formsemestre_custommenu_edit(REQUEST, formsemestre_id):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def edit_enseignants_form(REQUEST, moduleimpl_id):
|
||||
def edit_enseignants_form(moduleimpl_id):
|
||||
"modif liste enseignants/moduleimpl"
|
||||
M, sem = sco_moduleimpl.can_change_ens(moduleimpl_id)
|
||||
# --
|
||||
@ -782,7 +791,7 @@ def edit_enseignants_form(REQUEST, moduleimpl_id):
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
modform,
|
||||
submitlabel="Ajouter enseignant",
|
||||
cancelbutton="Annuler",
|
||||
@ -826,11 +835,11 @@ def edit_enseignants_form(REQUEST, moduleimpl_id):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def edit_moduleimpl_resp(REQUEST, moduleimpl_id):
|
||||
def edit_moduleimpl_resp(moduleimpl_id):
|
||||
"""Changement d'un enseignant responsable de module
|
||||
Accessible par Admin et dir des etud si flag resp_can_change_ens
|
||||
"""
|
||||
M, sem = sco_moduleimpl.can_change_module_resp(REQUEST, moduleimpl_id)
|
||||
M, sem = sco_moduleimpl.can_change_module_resp(moduleimpl_id)
|
||||
H = [
|
||||
html_sco_header.html_sem_header(
|
||||
'Modification du responsable du <a href="moduleimpl_status?moduleimpl_id=%s">module %s</a>'
|
||||
@ -878,7 +887,7 @@ def edit_moduleimpl_resp(REQUEST, moduleimpl_id):
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
form,
|
||||
submitlabel="Changer responsable",
|
||||
cancelbutton="Annuler",
|
||||
@ -947,7 +956,7 @@ _EXPR_HELP = """<p class="help">Expérimental: formule de calcul de la moyenne %
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def edit_moduleimpl_expr(REQUEST, moduleimpl_id):
|
||||
def edit_moduleimpl_expr(moduleimpl_id):
|
||||
"""Edition formule calcul moyenne module
|
||||
Accessible par Admin, dir des etud et responsable module
|
||||
"""
|
||||
@ -981,7 +990,7 @@ def edit_moduleimpl_expr(REQUEST, moduleimpl_id):
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
form,
|
||||
submitlabel="Modifier formule de calcul",
|
||||
cancelbutton="Annuler",
|
||||
@ -1022,7 +1031,7 @@ def edit_moduleimpl_expr(REQUEST, moduleimpl_id):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def view_module_abs(REQUEST, moduleimpl_id, format="html"):
|
||||
def view_module_abs(moduleimpl_id, format="html"):
|
||||
"""Visualisation des absences a un module"""
|
||||
M = sco_moduleimpl.do_moduleimpl_withmodule_list(moduleimpl_id=moduleimpl_id)[0]
|
||||
sem = sco_formsemestre.get_formsemestre(M["formsemestre_id"])
|
||||
@ -1099,10 +1108,10 @@ def view_module_abs(REQUEST, moduleimpl_id, format="html"):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def edit_ue_expr(REQUEST, formsemestre_id, ue_id):
|
||||
def edit_ue_expr(formsemestre_id, ue_id):
|
||||
"""Edition formule calcul moyenne UE"""
|
||||
# Check access
|
||||
sem = sco_formsemestre_edit.can_edit_sem(REQUEST, formsemestre_id)
|
||||
sem = sco_formsemestre_edit.can_edit_sem(formsemestre_id)
|
||||
if not sem:
|
||||
raise AccessDenied("vous n'avez pas le droit d'effectuer cette opération")
|
||||
cnx = ndb.GetDBConnexion()
|
||||
@ -1139,7 +1148,7 @@ def edit_ue_expr(REQUEST, formsemestre_id, ue_id):
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
form,
|
||||
submitlabel="Modifier formule de calcul",
|
||||
cancelbutton="Annuler",
|
||||
@ -1172,7 +1181,7 @@ def edit_ue_expr(REQUEST, formsemestre_id, ue_id):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def formsemestre_enseignants_list(REQUEST, formsemestre_id, format="html"):
|
||||
def formsemestre_enseignants_list(formsemestre_id, format="html"):
|
||||
"""Liste les enseignants intervenants dans le semestre (resp. modules et chargés de TD)
|
||||
et indique les absences saisies par chacun.
|
||||
"""
|
||||
@ -1312,9 +1321,7 @@ sco_publish(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def do_formsemestre_inscription_listinscrits(
|
||||
formsemestre_id, format=None, REQUEST=None
|
||||
):
|
||||
def do_formsemestre_inscription_listinscrits(formsemestre_id, format=None):
|
||||
"""Liste les inscrits (état I) à ce semestre et cache le résultat"""
|
||||
r = sco_formsemestre_inscriptions.do_formsemestre_inscription_listinscrits(
|
||||
formsemestre_id
|
||||
@ -1326,9 +1333,7 @@ def do_formsemestre_inscription_listinscrits(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoImplement)
|
||||
@scodoc7func
|
||||
def formsemestre_desinscription(
|
||||
etudid, formsemestre_id, REQUEST=None, dialog_confirmed=False
|
||||
):
|
||||
def formsemestre_desinscription(etudid, formsemestre_id, dialog_confirmed=False):
|
||||
"""desinscrit l'etudiant de ce semestre (et donc de tous les modules).
|
||||
A n'utiliser qu'en cas d'erreur de saisie.
|
||||
S'il s'agit d'un semestre extérieur et qu'il n'y a plus d'inscrit,
|
||||
@ -1414,11 +1419,9 @@ sco_publish(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def etud_desinscrit_ue(etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
def etud_desinscrit_ue(etudid, formsemestre_id, ue_id):
|
||||
"""Desinscrit l'etudiant de tous les modules de cette UE dans ce semestre."""
|
||||
sco_moduleimpl_inscriptions.do_etud_desinscrit_ue(
|
||||
etudid, formsemestre_id, ue_id, REQUEST=REQUEST
|
||||
)
|
||||
sco_moduleimpl_inscriptions.do_etud_desinscrit_ue(etudid, formsemestre_id, ue_id)
|
||||
return flask.redirect(
|
||||
scu.ScoURL()
|
||||
+ "/Notes/moduleimpl_inscriptions_stats?formsemestre_id="
|
||||
@ -1430,11 +1433,9 @@ def etud_desinscrit_ue(etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def etud_inscrit_ue(etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
def etud_inscrit_ue(etudid, formsemestre_id, ue_id):
|
||||
"""Inscrit l'etudiant de tous les modules de cette UE dans ce semestre."""
|
||||
sco_moduleimpl_inscriptions.do_etud_inscrit_ue(
|
||||
etudid, formsemestre_id, ue_id, REQUEST=REQUEST
|
||||
)
|
||||
sco_moduleimpl_inscriptions.do_etud_inscrit_ue(etudid, formsemestre_id, ue_id)
|
||||
return flask.redirect(
|
||||
scu.ScoURL()
|
||||
+ "/Notes/moduleimpl_inscriptions_stats?formsemestre_id="
|
||||
@ -1494,7 +1495,7 @@ sco_publish(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEnsView)
|
||||
@scodoc7func
|
||||
def evaluation_delete(REQUEST, evaluation_id):
|
||||
def evaluation_delete(evaluation_id):
|
||||
"""Form delete evaluation"""
|
||||
El = sco_evaluations.do_evaluation_list(args={"evaluation_id": evaluation_id})
|
||||
if not El:
|
||||
@ -1538,7 +1539,7 @@ def evaluation_delete(REQUEST, evaluation_id):
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(("evaluation_id", {"input_type": "hidden"}),),
|
||||
initvalues=E,
|
||||
submitlabel="Confirmer la suppression",
|
||||
@ -1578,10 +1579,10 @@ sco_publish(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEnsView)
|
||||
@scodoc7func
|
||||
def evaluation_edit(evaluation_id, REQUEST):
|
||||
def evaluation_edit(evaluation_id):
|
||||
"form edit evaluation"
|
||||
return sco_evaluations.evaluation_create_form(
|
||||
evaluation_id=evaluation_id, REQUEST=REQUEST, edit=True
|
||||
evaluation_id=evaluation_id, edit=True
|
||||
)
|
||||
|
||||
|
||||
@ -1589,10 +1590,10 @@ def evaluation_edit(evaluation_id, REQUEST):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEnsView)
|
||||
@scodoc7func
|
||||
def evaluation_create(moduleimpl_id, REQUEST):
|
||||
def evaluation_create(moduleimpl_id):
|
||||
"form create evaluation"
|
||||
return sco_evaluations.evaluation_create_form(
|
||||
moduleimpl_id=moduleimpl_id, REQUEST=REQUEST, edit=False
|
||||
moduleimpl_id=moduleimpl_id, edit=False
|
||||
)
|
||||
|
||||
|
||||
@ -1600,9 +1601,9 @@ def evaluation_create(moduleimpl_id, REQUEST):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def evaluation_listenotes(REQUEST=None):
|
||||
def evaluation_listenotes():
|
||||
"""Affichage des notes d'une évaluation"""
|
||||
if REQUEST.form.get("format", "html") == "html":
|
||||
if request.args.get("format", "html") == "html":
|
||||
H = html_sco_header.sco_header(
|
||||
cssstyles=["css/verticalhisto.css"],
|
||||
javascripts=["js/etud_info.js"],
|
||||
@ -1611,7 +1612,7 @@ def evaluation_listenotes(REQUEST=None):
|
||||
F = html_sco_header.sco_footer()
|
||||
else:
|
||||
H, F = "", ""
|
||||
B = sco_liste_notes.do_evaluation_listenotes(REQUEST)
|
||||
B = sco_liste_notes.do_evaluation_listenotes()
|
||||
if H:
|
||||
return H + B + F
|
||||
else:
|
||||
@ -1685,10 +1686,10 @@ sco_publish(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def formsemestre_bulletins_pdf(formsemestre_id, REQUEST, version="selectedevals"):
|
||||
def formsemestre_bulletins_pdf(formsemestre_id, version="selectedevals"):
|
||||
"Publie les bulletins dans un classeur PDF"
|
||||
pdfdoc, filename = sco_bulletins_pdf.get_formsemestre_bulletins_pdf(
|
||||
formsemestre_id, REQUEST, version=version
|
||||
formsemestre_id, version=version
|
||||
)
|
||||
return scu.sendPDFFile(pdfdoc, filename)
|
||||
|
||||
@ -1700,15 +1701,14 @@ _EXPL_BULL = """Versions des bulletins:<ul><li><bf>courte</bf>: moyennes des mod
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def formsemestre_bulletins_pdf_choice(REQUEST, formsemestre_id, version=None):
|
||||
def formsemestre_bulletins_pdf_choice(formsemestre_id, version=None):
|
||||
"""Choix version puis envois classeur bulletins pdf"""
|
||||
if version:
|
||||
pdfdoc, filename = sco_bulletins_pdf.get_formsemestre_bulletins_pdf(
|
||||
formsemestre_id, REQUEST, version=version
|
||||
formsemestre_id, version=version
|
||||
)
|
||||
return scu.sendPDFFile(pdfdoc, filename)
|
||||
return formsemestre_bulletins_choice(
|
||||
REQUEST,
|
||||
formsemestre_id,
|
||||
title="Choisir la version des bulletins à générer",
|
||||
explanation=_EXPL_BULL,
|
||||
@ -1719,11 +1719,9 @@ def formsemestre_bulletins_pdf_choice(REQUEST, formsemestre_id, version=None):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def etud_bulletins_pdf(etudid, REQUEST, version="selectedevals"):
|
||||
def etud_bulletins_pdf(etudid, version="selectedevals"):
|
||||
"Publie tous les bulletins d'un etudiants dans un classeur PDF"
|
||||
pdfdoc, filename = sco_bulletins_pdf.get_etud_bulletins_pdf(
|
||||
etudid, REQUEST, version=version
|
||||
)
|
||||
pdfdoc, filename = sco_bulletins_pdf.get_etud_bulletins_pdf(etudid, version=version)
|
||||
return scu.sendPDFFile(pdfdoc, filename)
|
||||
|
||||
|
||||
@ -1732,7 +1730,6 @@ def etud_bulletins_pdf(etudid, REQUEST, version="selectedevals"):
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def formsemestre_bulletins_mailetuds_choice(
|
||||
REQUEST,
|
||||
formsemestre_id,
|
||||
version=None,
|
||||
dialog_confirmed=False,
|
||||
@ -1754,7 +1751,6 @@ def formsemestre_bulletins_mailetuds_choice(
|
||||
|
||||
expl_bull = """Versions des bulletins:<ul><li><bf>courte</bf>: moyennes des modules</li><li><bf>intermédiaire</bf>: moyennes des modules et notes des évaluations sélectionnées</li><li><bf>complète</bf>: toutes les notes</li><ul>"""
|
||||
return formsemestre_bulletins_choice(
|
||||
REQUEST,
|
||||
formsemestre_id,
|
||||
title="Choisir la version des bulletins à envoyer par mail",
|
||||
explanation="Chaque étudiant ayant une adresse mail connue de ScoDoc recevra une copie PDF de son bulletin de notes, dans la version choisie.</p><p>"
|
||||
@ -1765,7 +1761,7 @@ def formsemestre_bulletins_mailetuds_choice(
|
||||
|
||||
# not published
|
||||
def formsemestre_bulletins_choice(
|
||||
REQUEST, formsemestre_id, title="", explanation="", choose_mail=False
|
||||
formsemestre_id, title="", explanation="", choose_mail=False
|
||||
):
|
||||
"""Choix d'une version de bulletin"""
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
@ -1802,7 +1798,6 @@ def formsemestre_bulletins_choice(
|
||||
@scodoc7func
|
||||
def formsemestre_bulletins_mailetuds(
|
||||
formsemestre_id,
|
||||
REQUEST,
|
||||
version="long",
|
||||
dialog_confirmed=False,
|
||||
prefer_mail_perso=0,
|
||||
@ -1837,7 +1832,6 @@ def formsemestre_bulletins_mailetuds(
|
||||
prefer_mail_perso=prefer_mail_perso,
|
||||
format="pdfmail",
|
||||
nohtml=True,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
if h:
|
||||
nb_send += 1
|
||||
@ -1867,7 +1861,6 @@ def appreciation_add_form(
|
||||
formsemestre_id=None,
|
||||
id=None, # si id, edit
|
||||
suppress=False, # si true, supress id
|
||||
REQUEST=None,
|
||||
):
|
||||
"form ajout ou edition d'une appreciation"
|
||||
cnx = ndb.GetDBConnexion()
|
||||
@ -1878,8 +1871,9 @@ def appreciation_add_form(
|
||||
app = apps[0]
|
||||
formsemestre_id = app["formsemestre_id"]
|
||||
etudid = app["etudid"]
|
||||
if "edit" in REQUEST.form:
|
||||
edit = int(REQUEST.form["edit"])
|
||||
vals = request.form if request.method == "POST" else request.args
|
||||
if "edit" in vals:
|
||||
edit = int(vals["edit"])
|
||||
elif id:
|
||||
edit = 1
|
||||
else:
|
||||
@ -1928,7 +1922,7 @@ def appreciation_add_form(
|
||||
initvalues = {}
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
descr,
|
||||
initvalues=initvalues,
|
||||
cancelbutton="Annuler",
|
||||
@ -1978,7 +1972,6 @@ def formsemestre_validation_etud_form(
|
||||
check=0,
|
||||
desturl="",
|
||||
sortcol=None,
|
||||
REQUEST=None,
|
||||
):
|
||||
"Formulaire choix jury pour un étudiant"
|
||||
readonly = not sco_permissions_check.can_validate_sem(formsemestre_id)
|
||||
@ -1990,7 +1983,6 @@ def formsemestre_validation_etud_form(
|
||||
readonly=readonly,
|
||||
desturl=desturl,
|
||||
sortcol=sortcol,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
@ -2004,7 +1996,6 @@ def formsemestre_validation_etud(
|
||||
codechoice=None,
|
||||
desturl="",
|
||||
sortcol=None,
|
||||
REQUEST=None,
|
||||
):
|
||||
"Enregistre choix jury pour un étudiant"
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
@ -2019,7 +2010,6 @@ def formsemestre_validation_etud(
|
||||
codechoice=codechoice,
|
||||
desturl=desturl,
|
||||
sortcol=sortcol,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
@ -2036,7 +2026,6 @@ def formsemestre_validation_etud_manu(
|
||||
assidu=False,
|
||||
desturl="",
|
||||
sortcol=None,
|
||||
REQUEST=None,
|
||||
):
|
||||
"Enregistre choix jury pour un étudiant"
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
@ -2054,7 +2043,6 @@ def formsemestre_validation_etud_manu(
|
||||
assidu=assidu,
|
||||
desturl=desturl,
|
||||
sortcol=sortcol,
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
@ -2062,7 +2050,7 @@ def formsemestre_validation_etud_manu(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def formsemestre_validate_previous_ue(formsemestre_id, etudid=None, REQUEST=None):
|
||||
def formsemestre_validate_previous_ue(formsemestre_id, etudid=None):
|
||||
"Form. saisie UE validée hors ScoDoc"
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
return scu.confirm_dialog(
|
||||
@ -2070,7 +2058,7 @@ def formsemestre_validate_previous_ue(formsemestre_id, etudid=None, REQUEST=None
|
||||
dest_url=scu.ScoURL(),
|
||||
)
|
||||
return sco_formsemestre_validation.formsemestre_validate_previous_ue(
|
||||
formsemestre_id, etudid, REQUEST=REQUEST
|
||||
formsemestre_id, etudid
|
||||
)
|
||||
|
||||
|
||||
@ -2086,7 +2074,7 @@ sco_publish(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def formsemestre_ext_edit_ue_validations(formsemestre_id, etudid=None, REQUEST=None):
|
||||
def formsemestre_ext_edit_ue_validations(formsemestre_id, etudid=None):
|
||||
"Form. edition UE semestre extérieur"
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
return scu.confirm_dialog(
|
||||
@ -2094,7 +2082,7 @@ def formsemestre_ext_edit_ue_validations(formsemestre_id, etudid=None, REQUEST=N
|
||||
dest_url=scu.ScoURL(),
|
||||
)
|
||||
return sco_formsemestre_exterieurs.formsemestre_ext_edit_ue_validations(
|
||||
formsemestre_id, etudid, REQUEST=REQUEST
|
||||
formsemestre_id, etudid
|
||||
)
|
||||
|
||||
|
||||
@ -2109,7 +2097,7 @@ sco_publish(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def etud_ue_suppress_validation(etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
def etud_ue_suppress_validation(etudid, formsemestre_id, ue_id):
|
||||
"""Suppress a validation (ue_id, etudid) and redirect to formsemestre"""
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
return scu.confirm_dialog(
|
||||
@ -2117,7 +2105,7 @@ def etud_ue_suppress_validation(etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
dest_url=scu.ScoURL(),
|
||||
)
|
||||
return sco_formsemestre_validation.etud_ue_suppress_validation(
|
||||
etudid, formsemestre_id, ue_id, REQUEST=REQUEST
|
||||
etudid, formsemestre_id, ue_id
|
||||
)
|
||||
|
||||
|
||||
@ -2125,7 +2113,7 @@ def etud_ue_suppress_validation(etudid, formsemestre_id, ue_id, REQUEST=None):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def formsemestre_validation_auto(formsemestre_id, REQUEST):
|
||||
def formsemestre_validation_auto(formsemestre_id):
|
||||
"Formulaire saisie automatisee des decisions d'un semestre"
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
return scu.confirm_dialog(
|
||||
@ -2133,16 +2121,14 @@ def formsemestre_validation_auto(formsemestre_id, REQUEST):
|
||||
dest_url=scu.ScoURL(),
|
||||
)
|
||||
|
||||
return sco_formsemestre_validation.formsemestre_validation_auto(
|
||||
formsemestre_id, REQUEST
|
||||
)
|
||||
return sco_formsemestre_validation.formsemestre_validation_auto(formsemestre_id)
|
||||
|
||||
|
||||
@bp.route("/do_formsemestre_validation_auto")
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def do_formsemestre_validation_auto(formsemestre_id, REQUEST):
|
||||
def do_formsemestre_validation_auto(formsemestre_id):
|
||||
"Formulaire saisie automatisee des decisions d'un semestre"
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
return scu.confirm_dialog(
|
||||
@ -2150,9 +2136,7 @@ def do_formsemestre_validation_auto(formsemestre_id, REQUEST):
|
||||
dest_url=scu.ScoURL(),
|
||||
)
|
||||
|
||||
return sco_formsemestre_validation.do_formsemestre_validation_auto(
|
||||
formsemestre_id, REQUEST
|
||||
)
|
||||
return sco_formsemestre_validation.do_formsemestre_validation_auto(formsemestre_id)
|
||||
|
||||
|
||||
@bp.route("/formsemestre_validation_suppress_etud", methods=["GET", "POST"])
|
||||
@ -2160,7 +2144,7 @@ def do_formsemestre_validation_auto(formsemestre_id, REQUEST):
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def formsemestre_validation_suppress_etud(
|
||||
formsemestre_id, etudid, REQUEST=None, dialog_confirmed=False
|
||||
formsemestre_id, etudid, dialog_confirmed=False
|
||||
):
|
||||
"""Suppression des decisions de jury pour un etudiant."""
|
||||
if not sco_permissions_check.can_validate_sem(formsemestre_id):
|
||||
@ -2407,7 +2391,7 @@ sco_publish(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoImplement)
|
||||
@scodoc7func
|
||||
def check_sem_integrity(formsemestre_id, REQUEST, fix=False):
|
||||
def check_sem_integrity(formsemestre_id, fix=False):
|
||||
"""Debug.
|
||||
Check that ue and module formations are consistents
|
||||
"""
|
||||
@ -2476,7 +2460,7 @@ def check_sem_integrity(formsemestre_id, REQUEST, fix=False):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def check_form_integrity(formation_id, fix=False, REQUEST=None):
|
||||
def check_form_integrity(formation_id, fix=False):
|
||||
"debug"
|
||||
log("check_form_integrity: formation_id=%s fix=%s" % (formation_id, fix))
|
||||
ues = sco_edit_ue.do_ue_list(args={"formation_id": formation_id})
|
||||
@ -2514,7 +2498,7 @@ def check_form_integrity(formation_id, fix=False, REQUEST=None):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def check_formsemestre_integrity(formsemestre_id, REQUEST=None):
|
||||
def check_formsemestre_integrity(formsemestre_id):
|
||||
"debug"
|
||||
log("check_formsemestre_integrity: formsemestre_id=%s" % (formsemestre_id))
|
||||
# verifie que tous les moduleimpl d'un formsemestre
|
||||
@ -2564,14 +2548,14 @@ def check_formsemestre_integrity(formsemestre_id, REQUEST=None):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def check_integrity_all(REQUEST=None):
|
||||
def check_integrity_all():
|
||||
"debug: verifie tous les semestres et tt les formations"
|
||||
# formations
|
||||
for F in sco_formations.formation_list():
|
||||
check_form_integrity(F["formation_id"], REQUEST=REQUEST)
|
||||
check_form_integrity(F["formation_id"])
|
||||
# semestres
|
||||
for sem in sco_formsemestre.do_formsemestre_list():
|
||||
check_formsemestre_integrity(sem["formsemestre_id"], REQUEST=REQUEST)
|
||||
check_formsemestre_integrity(sem["formsemestre_id"])
|
||||
return (
|
||||
html_sco_header.sco_header()
|
||||
+ "<p>empty page: see logs and mails</p>"
|
||||
@ -2582,11 +2566,32 @@ def check_integrity_all(REQUEST=None):
|
||||
# --------------------------------------------------------------------
|
||||
# Support for legacy ScoDoc 7 API
|
||||
# --------------------------------------------------------------------
|
||||
sco_publish(
|
||||
"/do_moduleimpl_list", sco_moduleimpl.do_moduleimpl_list, Permission.ScoView
|
||||
)
|
||||
sco_publish(
|
||||
"/do_moduleimpl_withmodule_list",
|
||||
sco_moduleimpl.do_moduleimpl_withmodule_list,
|
||||
Permission.ScoView,
|
||||
)
|
||||
@bp.route("/do_moduleimpl_list")
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def do_moduleimpl_list(
|
||||
moduleimpl_id=None, formsemestre_id=None, module_id=None, format="json"
|
||||
):
|
||||
data = sco_moduleimpl.do_moduleimpl_list(
|
||||
moduleimpl_id=moduleimpl_id,
|
||||
formsemestre_id=formsemestre_id,
|
||||
module_id=module_id,
|
||||
)
|
||||
return scu.sendResult(data, format=format)
|
||||
|
||||
|
||||
@bp.route("/do_moduleimpl_withmodule_list")
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def do_moduleimpl_withmodule_list(
|
||||
moduleimpl_id=None, formsemestre_id=None, module_id=None
|
||||
):
|
||||
"""API ScoDoc 7"""
|
||||
data = sco_moduleimpl.do_moduleimpl_withmodule_list(
|
||||
moduleimpl_id=moduleimpl_id,
|
||||
formsemestre_id=formsemestre_id,
|
||||
module_id=module_id,
|
||||
)
|
||||
return scu.sendResult(data, format=format)
|
||||
|
@ -139,9 +139,7 @@ def get_etud_dept():
|
||||
) # pour compat anciens clients PHP
|
||||
@scodoc
|
||||
@scodoc7func
|
||||
def search_inscr_etud_by_nip(
|
||||
code_nip, REQUEST=None, format="json", __ac_name="", __ac_password=""
|
||||
):
|
||||
def search_inscr_etud_by_nip(code_nip, format="json", __ac_name="", __ac_password=""):
|
||||
auth_ok = False
|
||||
user_name = __ac_name
|
||||
user_password = __ac_password
|
||||
@ -153,9 +151,7 @@ def search_inscr_etud_by_nip(
|
||||
if not auth_ok:
|
||||
abort(403)
|
||||
else:
|
||||
return sco_find_etud.search_inscr_etud_by_nip(
|
||||
code_nip=code_nip, REQUEST=REQUEST, format=format
|
||||
)
|
||||
return sco_find_etud.search_inscr_etud_by_nip(code_nip=code_nip, format=format)
|
||||
|
||||
|
||||
@bp.route("/ScoDoc/about")
|
||||
|
@ -31,23 +31,16 @@ issu de ScoDoc7 / ZScolar.py
|
||||
Emmanuel Viennet, 2021
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
from io import StringIO
|
||||
|
||||
from zipfile import ZipFile
|
||||
import psycopg2
|
||||
|
||||
import flask
|
||||
from flask import jsonify, url_for, flash, redirect, render_template
|
||||
from flask import jsonify, url_for, flash, redirect, render_template, make_response
|
||||
from flask import current_app, g, request
|
||||
from flask_login import current_user
|
||||
from flask_wtf import FlaskForm
|
||||
from flask_wtf.file import FileField, FileAllowed
|
||||
from wtforms import SubmitField
|
||||
|
||||
from config import Config
|
||||
from app.decorators import (
|
||||
scodoc,
|
||||
scodoc7func,
|
||||
@ -137,16 +130,16 @@ def sco_publish(route, function, permission, methods=["GET"]):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoChangePreferences)
|
||||
@scodoc7func
|
||||
def edit_preferences(REQUEST):
|
||||
def edit_preferences():
|
||||
"""Edit global preferences (lien "Paramétrage" département)"""
|
||||
return sco_preferences.get_base_preferences().edit(REQUEST=REQUEST)
|
||||
return sco_preferences.get_base_preferences().edit()
|
||||
|
||||
|
||||
@bp.route("/formsemestre_edit_preferences", methods=["GET", "POST"])
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def formsemestre_edit_preferences(formsemestre_id, REQUEST):
|
||||
def formsemestre_edit_preferences(formsemestre_id):
|
||||
"""Edit preferences for a semestre"""
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
ok = (
|
||||
@ -154,9 +147,7 @@ def formsemestre_edit_preferences(formsemestre_id, REQUEST):
|
||||
or ((current_user.id in sem["responsables"]) and sem["resp_can_edit"])
|
||||
) and (sem["etat"])
|
||||
if ok:
|
||||
return sco_preferences.SemPreferences(formsemestre_id=formsemestre_id).edit(
|
||||
REQUEST=REQUEST
|
||||
)
|
||||
return sco_preferences.SemPreferences(formsemestre_id=formsemestre_id).edit()
|
||||
else:
|
||||
raise AccessDenied(
|
||||
"Modification impossible pour %s" % current_user.get_nomplogin()
|
||||
@ -167,10 +158,11 @@ def formsemestre_edit_preferences(formsemestre_id, REQUEST):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def doc_preferences(REQUEST):
|
||||
def doc_preferences():
|
||||
"""List preferences for wiki documentation"""
|
||||
REQUEST.RESPONSE.setHeader("content-type", "text/plain")
|
||||
return sco_preferences.doc_preferences()
|
||||
response = make_response(sco_preferences.doc_preferences())
|
||||
response.headers["Content-Type"] = "text/plain"
|
||||
return response
|
||||
|
||||
|
||||
class DeptLogosConfigurationForm(FlaskForm):
|
||||
@ -244,7 +236,7 @@ def config_logos(scodoc_dept):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def showEtudLog(etudid, format="html", REQUEST=None):
|
||||
def showEtudLog(etudid, format="html"):
|
||||
"""Display log of operations on this student"""
|
||||
etud = sco_etud.get_etud_info(filled=True)[0]
|
||||
|
||||
@ -285,10 +277,8 @@ def showEtudLog(etudid, format="html", REQUEST=None):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def index_html(REQUEST=None, showcodes=0, showsemtable=0):
|
||||
return sco_dept.index_html(
|
||||
REQUEST=REQUEST, showcodes=showcodes, showsemtable=showsemtable
|
||||
)
|
||||
def index_html(showcodes=0, showsemtable=0):
|
||||
return sco_dept.index_html(showcodes=showcodes, showsemtable=showsemtable)
|
||||
|
||||
|
||||
sco_publish(
|
||||
@ -326,10 +316,10 @@ sco_publish(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def getEtudInfo(etudid=False, code_nip=False, filled=False, REQUEST=None, format=None):
|
||||
def getEtudInfo(etudid=False, code_nip=False, filled=False, format=None):
|
||||
"""infos sur un etudiant (API)
|
||||
On peut specifier etudid ou code_nip
|
||||
ou bien cherche dans REQUEST.form: etudid, code_nip, code_ine
|
||||
ou bien cherche dans les arguments de la requête: etudid, code_nip, code_ine
|
||||
(dans cet ordre).
|
||||
"""
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, code_nip=code_nip, filled=filled)
|
||||
@ -371,7 +361,7 @@ def search_etud_by_name():
|
||||
@scodoc
|
||||
@permission_required_compat_scodoc7(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def etud_info(etudid=None, format="xml", REQUEST=None):
|
||||
def etud_info(etudid=None, format="xml"):
|
||||
"Donne les informations sur un etudiant"
|
||||
t0 = time.time()
|
||||
args = sco_etud.make_etud_args(etudid=etudid)
|
||||
@ -564,7 +554,7 @@ def doAddAnnotation(etudid, comment):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def doSuppressAnnotation(etudid, annotation_id, REQUEST):
|
||||
def doSuppressAnnotation(etudid, annotation_id):
|
||||
"""Suppression annotation."""
|
||||
if not sco_permissions_check.can_suppress_annotation(annotation_id):
|
||||
raise AccessDenied("Vous n'avez pas le droit d'effectuer cette opération !")
|
||||
@ -592,7 +582,7 @@ def doSuppressAnnotation(etudid, annotation_id, REQUEST):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudChangeAdr)
|
||||
@scodoc7func
|
||||
def formChangeCoordonnees(etudid, REQUEST):
|
||||
def formChangeCoordonnees(etudid):
|
||||
"edit coordonnees etudiant"
|
||||
cnx = ndb.GetDBConnexion()
|
||||
etud = sco_etud.get_etud_info(filled=True, etudid=etudid)[0]
|
||||
@ -611,7 +601,7 @@ def formChangeCoordonnees(etudid, REQUEST):
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("adresse_id", {"input_type": "hidden"}),
|
||||
("etudid", {"input_type": "hidden"}),
|
||||
@ -778,7 +768,7 @@ sco_publish("/etud_photo_html", sco_photos.etud_photo_html, Permission.ScoView)
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def etud_photo_orig_page(etudid=None, REQUEST=None):
|
||||
def etud_photo_orig_page(etudid=None):
|
||||
"Page with photo in orig. size"
|
||||
etud = sco_etud.get_etud_info(filled=True, etudid=etudid)[0]
|
||||
H = [
|
||||
@ -797,7 +787,7 @@ def etud_photo_orig_page(etudid=None, REQUEST=None):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudChangeAdr)
|
||||
@scodoc7func
|
||||
def formChangePhoto(etudid=None, REQUEST=None):
|
||||
def formChangePhoto(etudid=None):
|
||||
"""Formulaire changement photo étudiant"""
|
||||
etud = sco_etud.get_etud_info(filled=True)[0]
|
||||
if sco_photos.etud_photo_is_local(etud):
|
||||
@ -817,7 +807,7 @@ def formChangePhoto(etudid=None, REQUEST=None):
|
||||
]
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
("etudid", {"default": etudid, "input_type": "hidden"}),
|
||||
(
|
||||
@ -855,7 +845,7 @@ def formChangePhoto(etudid=None, REQUEST=None):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudChangeAdr)
|
||||
@scodoc7func
|
||||
def formSuppressPhoto(etudid=None, REQUEST=None, dialog_confirmed=False):
|
||||
def formSuppressPhoto(etudid=None, dialog_confirmed=False):
|
||||
"""Formulaire suppression photo étudiant"""
|
||||
etud = sco_etud.get_etud_info(filled=True)[0]
|
||||
if not dialog_confirmed:
|
||||
@ -868,7 +858,7 @@ def formSuppressPhoto(etudid=None, REQUEST=None, dialog_confirmed=False):
|
||||
parameters={"etudid": etudid},
|
||||
)
|
||||
|
||||
sco_photos.suppress_photo(etud, REQUEST=REQUEST)
|
||||
sco_photos.suppress_photo(etud)
|
||||
|
||||
return flask.redirect(
|
||||
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||
@ -880,12 +870,11 @@ def formSuppressPhoto(etudid=None, REQUEST=None, dialog_confirmed=False):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def formDem(etudid, formsemestre_id, REQUEST):
|
||||
def formDem(etudid, formsemestre_id):
|
||||
"Formulaire Démission Etudiant"
|
||||
return _formDem_of_Def(
|
||||
etudid,
|
||||
formsemestre_id,
|
||||
REQUEST=REQUEST,
|
||||
operation_name="Démission",
|
||||
operation_method="doDemEtudiant",
|
||||
)
|
||||
@ -895,12 +884,11 @@ def formDem(etudid, formsemestre_id, REQUEST):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def formDef(etudid, formsemestre_id, REQUEST):
|
||||
def formDef(etudid, formsemestre_id):
|
||||
"Formulaire Défaillance Etudiant"
|
||||
return _formDem_of_Def(
|
||||
etudid,
|
||||
formsemestre_id,
|
||||
REQUEST=REQUEST,
|
||||
operation_name="Défaillance",
|
||||
operation_method="doDefEtudiant",
|
||||
)
|
||||
@ -909,7 +897,6 @@ def formDef(etudid, formsemestre_id, REQUEST):
|
||||
def _formDem_of_Def(
|
||||
etudid,
|
||||
formsemestre_id,
|
||||
REQUEST=None,
|
||||
operation_name="",
|
||||
operation_method="",
|
||||
):
|
||||
@ -955,7 +942,7 @@ def _formDem_of_Def(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def doDemEtudiant(etudid, formsemestre_id, event_date=None, REQUEST=None):
|
||||
def doDemEtudiant(etudid, formsemestre_id, event_date=None):
|
||||
"Déclare la démission d'un etudiant dans le semestre"
|
||||
return _do_dem_or_def_etud(
|
||||
etudid,
|
||||
@ -964,7 +951,6 @@ def doDemEtudiant(etudid, formsemestre_id, event_date=None, REQUEST=None):
|
||||
etat_new="D",
|
||||
operation_method="demEtudiant",
|
||||
event_type="DEMISSION",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
@ -972,7 +958,7 @@ def doDemEtudiant(etudid, formsemestre_id, event_date=None, REQUEST=None):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def doDefEtudiant(etudid, formsemestre_id, event_date=None, REQUEST=None):
|
||||
def doDefEtudiant(etudid, formsemestre_id, event_date=None):
|
||||
"Déclare la défaillance d'un etudiant dans le semestre"
|
||||
return _do_dem_or_def_etud(
|
||||
etudid,
|
||||
@ -981,7 +967,6 @@ def doDefEtudiant(etudid, formsemestre_id, event_date=None, REQUEST=None):
|
||||
etat_new=sco_codes_parcours.DEF,
|
||||
operation_method="defailleEtudiant",
|
||||
event_type="DEFAILLANCE",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
@ -992,7 +977,7 @@ def _do_dem_or_def_etud(
|
||||
etat_new="D", # 'D' or DEF
|
||||
operation_method="demEtudiant",
|
||||
event_type="DEMISSION",
|
||||
REQUEST=None,
|
||||
redirect=True,
|
||||
):
|
||||
"Démission ou défaillance d'un étudiant"
|
||||
# marque 'D' ou DEF dans l'inscription au semestre et ajoute
|
||||
@ -1022,7 +1007,7 @@ def _do_dem_or_def_etud(
|
||||
"event_type": event_type,
|
||||
},
|
||||
)
|
||||
if REQUEST:
|
||||
if redirect:
|
||||
return flask.redirect(
|
||||
url_for("scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=etudid)
|
||||
)
|
||||
@ -1032,9 +1017,7 @@ def _do_dem_or_def_etud(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def doCancelDem(
|
||||
etudid, formsemestre_id, dialog_confirmed=False, args=None, REQUEST=None
|
||||
):
|
||||
def doCancelDem(etudid, formsemestre_id, dialog_confirmed=False, args=None):
|
||||
"Annule une démission"
|
||||
return _do_cancel_dem_or_def(
|
||||
etudid,
|
||||
@ -1046,7 +1029,6 @@ def doCancelDem(
|
||||
etat_new="I",
|
||||
operation_method="cancelDem",
|
||||
event_type="DEMISSION",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
@ -1054,9 +1036,7 @@ def doCancelDem(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def doCancelDef(
|
||||
etudid, formsemestre_id, dialog_confirmed=False, args=None, REQUEST=None
|
||||
):
|
||||
def doCancelDef(etudid, formsemestre_id, dialog_confirmed=False, args=None):
|
||||
"Annule la défaillance de l'étudiant"
|
||||
return _do_cancel_dem_or_def(
|
||||
etudid,
|
||||
@ -1068,7 +1048,6 @@ def doCancelDef(
|
||||
etat_new="I",
|
||||
operation_method="cancelDef",
|
||||
event_type="DEFAILLANCE",
|
||||
REQUEST=REQUEST,
|
||||
)
|
||||
|
||||
|
||||
@ -1082,7 +1061,6 @@ def _do_cancel_dem_or_def(
|
||||
etat_new="I",
|
||||
operation_method="cancelDem",
|
||||
event_type="DEMISSION",
|
||||
REQUEST=None,
|
||||
):
|
||||
"Annule une demission ou une défaillance"
|
||||
# check lock
|
||||
@ -1138,25 +1116,26 @@ def _do_cancel_dem_or_def(
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def etudident_create_form(REQUEST=None):
|
||||
def etudident_create_form():
|
||||
"formulaire creation individuelle etudiant"
|
||||
return _etudident_create_or_edit_form(REQUEST, edit=False)
|
||||
return _etudident_create_or_edit_form(edit=False)
|
||||
|
||||
|
||||
@bp.route("/etudident_edit_form", methods=["GET", "POST"])
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def etudident_edit_form(REQUEST=None):
|
||||
def etudident_edit_form():
|
||||
"formulaire edition individuelle etudiant"
|
||||
return _etudident_create_or_edit_form(REQUEST, edit=True)
|
||||
return _etudident_create_or_edit_form(edit=True)
|
||||
|
||||
|
||||
def _etudident_create_or_edit_form(REQUEST, edit):
|
||||
def _etudident_create_or_edit_form(edit):
|
||||
"Le formulaire HTML"
|
||||
H = [html_sco_header.sco_header(init_jquery_ui=True)]
|
||||
F = html_sco_header.sco_footer()
|
||||
etudid = REQUEST.form.get("etudid", None)
|
||||
vals = request.form if request.method == "POST" else request.args
|
||||
etudid = vals.get("etudid", None)
|
||||
cnx = ndb.GetDBConnexion()
|
||||
descr = []
|
||||
if not edit:
|
||||
@ -1198,14 +1177,15 @@ def _etudident_create_or_edit_form(REQUEST, edit):
|
||||
# except ValueError:
|
||||
# infos = None
|
||||
# pass # XXX a terminer
|
||||
nom = REQUEST.form.get("nom", None)
|
||||
vals = request.form if request.method == "POST" else request.args
|
||||
nom = vals.get("nom", None)
|
||||
if nom is None:
|
||||
nom = initvalues.get("nom", None)
|
||||
if nom is None:
|
||||
infos = []
|
||||
else:
|
||||
prenom = REQUEST.form.get("prenom", "")
|
||||
if REQUEST.form.get("tf_submitted", False) and not prenom:
|
||||
prenom = vals.get("prenom", "")
|
||||
if vals.get("tf_submitted", False) and not prenom:
|
||||
prenom = initvalues.get("prenom", "")
|
||||
infos = sco_portal_apogee.get_infos_apogee(nom, prenom)
|
||||
|
||||
@ -1490,7 +1470,7 @@ def _etudident_create_or_edit_form(REQUEST, edit):
|
||||
initvalues["dont_check_homonyms"] = False
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
descr,
|
||||
submitlabel=submitlabel,
|
||||
cancelbutton="Re-interroger Apogee",
|
||||
@ -1533,11 +1513,11 @@ def _etudident_create_or_edit_form(REQUEST, edit):
|
||||
)
|
||||
|
||||
if not edit:
|
||||
etud = sco_etud.create_etud(cnx, args=tf[2], REQUEST=REQUEST)
|
||||
etud = sco_etud.create_etud(cnx, args=tf[2])
|
||||
etudid = etud["etudid"]
|
||||
else:
|
||||
# modif d'un etudiant
|
||||
sco_etud.etudident_edit(cnx, tf[2], REQUEST=REQUEST)
|
||||
sco_etud.etudident_edit(cnx, tf[2])
|
||||
etud = sco_etud.etudident_list(cnx, {"etudid": etudid})[0]
|
||||
sco_etud.fill_etuds_info([etud])
|
||||
# Inval semesters with this student:
|
||||
@ -1554,7 +1534,7 @@ def _etudident_create_or_edit_form(REQUEST, edit):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def etudident_delete(etudid, dialog_confirmed=False, REQUEST=None):
|
||||
def etudident_delete(etudid, dialog_confirmed=False):
|
||||
"Delete a student"
|
||||
cnx = ndb.GetDBConnexion()
|
||||
etuds = sco_etud.etudident_list(cnx, {"etudid": etudid})
|
||||
@ -1627,7 +1607,7 @@ def etudident_delete(etudid, dialog_confirmed=False, REQUEST=None):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def check_group_apogee(group_id, REQUEST=None, etat=None, fix=False, fixmail=False):
|
||||
def check_group_apogee(group_id, etat=None, fix=False, fixmail=False):
|
||||
"""Verification des codes Apogee et mail de tout un groupe.
|
||||
Si fix == True, change les codes avec Apogée.
|
||||
|
||||
@ -1774,7 +1754,7 @@ def check_group_apogee(group_id, REQUEST=None, etat=None, fix=False, fixmail=Fal
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def form_students_import_excel(REQUEST, formsemestre_id=None):
|
||||
def form_students_import_excel(formsemestre_id=None):
|
||||
"formulaire import xls"
|
||||
if formsemestre_id:
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
@ -1849,7 +1829,7 @@ def form_students_import_excel(REQUEST, formsemestre_id=None):
|
||||
F = html_sco_header.sco_footer()
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
(
|
||||
"csvfile",
|
||||
@ -1908,7 +1888,6 @@ Les champs avec un astérisque (*) doivent être présents (nulls non autorisés
|
||||
else:
|
||||
return sco_import_etuds.students_import_excel(
|
||||
tf[2]["csvfile"],
|
||||
REQUEST=REQUEST,
|
||||
formsemestre_id=formsemestre_id,
|
||||
check_homonyms=tf[2]["check_homonyms"],
|
||||
require_ine=tf[2]["require_ine"],
|
||||
@ -1919,7 +1898,7 @@ Les champs avec un astérisque (*) doivent être présents (nulls non autorisés
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudInscrit)
|
||||
@scodoc7func
|
||||
def import_generate_excel_sample(REQUEST, with_codesemestre="1"):
|
||||
def import_generate_excel_sample(with_codesemestre="1"):
|
||||
"une feuille excel pour importation etudiants"
|
||||
if with_codesemestre:
|
||||
with_codesemestre = int(with_codesemestre)
|
||||
@ -1932,7 +1911,7 @@ def import_generate_excel_sample(REQUEST, with_codesemestre="1"):
|
||||
return scu.send_file(
|
||||
data, "ImportEtudiants", scu.XLSX_SUFFIX, mime=scu.XLSX_MIMETYPE
|
||||
)
|
||||
# return sco_excel.send_excel_file(REQUEST, data, "ImportEtudiants" + scu.XLSX_SUFFIX)
|
||||
# return sco_excel.send_excel_file(data, "ImportEtudiants" + scu.XLSX_SUFFIX)
|
||||
|
||||
|
||||
# --- Données admission
|
||||
@ -1940,7 +1919,7 @@ def import_generate_excel_sample(REQUEST, with_codesemestre="1"):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def import_generate_admission_sample(REQUEST, formsemestre_id):
|
||||
def import_generate_admission_sample(formsemestre_id):
|
||||
"une feuille excel pour importation données admissions"
|
||||
group = sco_groups.get_group(sco_groups.get_default_group(formsemestre_id))
|
||||
fmt = sco_import_etuds.sco_import_format()
|
||||
@ -1953,7 +1932,7 @@ def import_generate_admission_sample(REQUEST, formsemestre_id):
|
||||
return scu.send_file(
|
||||
data, "AdmissionEtudiants", scu.XLSX_SUFFIX, mime=scu.XLSX_MIMETYPE
|
||||
)
|
||||
# return sco_excel.send_excel_file(REQUEST, data, "AdmissionEtudiants" + scu.XLSX_SUFFIX)
|
||||
# return sco_excel.send_excel_file(data, "AdmissionEtudiants" + scu.XLSX_SUFFIX)
|
||||
|
||||
|
||||
# --- Données admission depuis fichier excel (version nov 2016)
|
||||
@ -1961,7 +1940,7 @@ def import_generate_admission_sample(REQUEST, formsemestre_id):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def form_students_import_infos_admissions(REQUEST, formsemestre_id=None):
|
||||
def form_students_import_infos_admissions(formsemestre_id=None):
|
||||
"formulaire import xls"
|
||||
authuser = current_user
|
||||
F = html_sco_header.sco_footer()
|
||||
@ -2018,7 +1997,7 @@ def form_students_import_infos_admissions(REQUEST, formsemestre_id=None):
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
(
|
||||
"csvfile",
|
||||
@ -2059,7 +2038,6 @@ def form_students_import_infos_admissions(REQUEST, formsemestre_id=None):
|
||||
return sco_import_etuds.students_import_admission(
|
||||
tf[2]["csvfile"],
|
||||
type_admission=tf[2]["type_admission"],
|
||||
REQUEST=REQUEST,
|
||||
formsemestre_id=formsemestre_id,
|
||||
)
|
||||
|
||||
@ -2068,9 +2046,7 @@ def form_students_import_infos_admissions(REQUEST, formsemestre_id=None):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoEtudChangeAdr)
|
||||
@scodoc7func
|
||||
def formsemestre_import_etud_admission(
|
||||
formsemestre_id, import_email=True, REQUEST=None
|
||||
):
|
||||
def formsemestre_import_etud_admission(formsemestre_id, import_email=True):
|
||||
"""Reimporte donnees admissions par synchro Portail Apogée"""
|
||||
(
|
||||
no_nip,
|
||||
|
@ -73,9 +73,8 @@ from app.views import users_bp as bp
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoUsersView)
|
||||
@scodoc7func
|
||||
def index_html(REQUEST, all_depts=False, with_inactives=False, format="html"):
|
||||
def index_html(all_depts=False, with_inactives=False, format="html"):
|
||||
return sco_users.index_html(
|
||||
REQUEST=REQUEST,
|
||||
all_depts=all_depts,
|
||||
with_inactives=with_inactives,
|
||||
format=format,
|
||||
@ -86,7 +85,7 @@ def index_html(REQUEST, all_depts=False, with_inactives=False, format="html"):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoUsersView)
|
||||
@scodoc7func
|
||||
def user_info(user_name, format="json", REQUEST=None):
|
||||
def user_info(user_name, format="json"):
|
||||
info = sco_users.user_info(user_name)
|
||||
return scu.sendResult(info, name="user", format=format)
|
||||
|
||||
@ -95,7 +94,7 @@ def user_info(user_name, format="json", REQUEST=None):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoUsersAdmin)
|
||||
@scodoc7func
|
||||
def create_user_form(REQUEST, user_name=None, edit=0, all_roles=1):
|
||||
def create_user_form(user_name=None, edit=0, all_roles=1):
|
||||
"form. création ou edition utilisateur"
|
||||
auth_dept = current_user.dept
|
||||
initvalues = {}
|
||||
@ -331,19 +330,18 @@ def create_user_form(REQUEST, user_name=None, edit=0, all_roles=1):
|
||||
},
|
||||
),
|
||||
]
|
||||
if "tf_submitted" in REQUEST.form and not "roles" in REQUEST.form:
|
||||
REQUEST.form["roles"] = []
|
||||
if "tf_submitted" in REQUEST.form:
|
||||
vals = request.form if request.method == "POST" else request.args
|
||||
if "tf_submitted" in vals and not "roles" in vals:
|
||||
vals["roles"] = []
|
||||
if "tf_submitted" in vals:
|
||||
# Ajoute roles existants mais non modifiables (disabled dans le form)
|
||||
REQUEST.form["roles"] = list(
|
||||
set(REQUEST.form["roles"]).union(
|
||||
orig_roles_strings - editable_roles_strings
|
||||
)
|
||||
vals["roles"] = list(
|
||||
set(vals["roles"]).union(orig_roles_strings - editable_roles_strings)
|
||||
)
|
||||
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
vals,
|
||||
descr,
|
||||
initvalues=initvalues,
|
||||
submitlabel=submitlabel,
|
||||
@ -356,8 +354,8 @@ def create_user_form(REQUEST, user_name=None, edit=0, all_roles=1):
|
||||
else:
|
||||
vals = tf[2]
|
||||
roles = set(vals["roles"]).intersection(editable_roles_strings)
|
||||
if "edit" in REQUEST.form:
|
||||
edit = int(REQUEST.form["edit"])
|
||||
if "edit" in vals:
|
||||
edit = int(vals["edit"])
|
||||
else:
|
||||
edit = 0
|
||||
try:
|
||||
@ -485,7 +483,7 @@ def create_user_form(REQUEST, user_name=None, edit=0, all_roles=1):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoUsersAdmin)
|
||||
@scodoc7func
|
||||
def import_users_generate_excel_sample(REQUEST):
|
||||
def import_users_generate_excel_sample():
|
||||
"une feuille excel pour importation utilisateurs"
|
||||
data = sco_import_users.generate_excel_sample()
|
||||
return scu.send_file(data, "ImportUtilisateurs", scu.XLSX_SUFFIX, scu.XLSX_MIMETYPE)
|
||||
@ -495,7 +493,7 @@ def import_users_generate_excel_sample(REQUEST):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoUsersAdmin)
|
||||
@scodoc7func
|
||||
def import_users_form(REQUEST=None):
|
||||
def import_users_form():
|
||||
"""Import utilisateurs depuis feuille Excel"""
|
||||
head = html_sco_header.sco_header(page_title="Import utilisateurs")
|
||||
H = [
|
||||
@ -529,7 +527,7 @@ def import_users_form(REQUEST=None):
|
||||
F = html_sco_header.sco_footer()
|
||||
tf = TrivialFormulator(
|
||||
request.base_url,
|
||||
REQUEST.form,
|
||||
request.form if request.method == "POST" else request.args,
|
||||
(
|
||||
(
|
||||
"xlsfile",
|
||||
@ -574,7 +572,7 @@ def user_info_page(user_name):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def get_user_list_xml(dept=None, start="", limit=25, REQUEST=None):
|
||||
def get_user_list_xml(dept=None, start="", limit=25):
|
||||
"""Returns XML list of users with name (nomplogin) starting with start.
|
||||
Used for forms auto-completion.
|
||||
"""
|
||||
@ -588,21 +586,21 @@ def get_user_list_xml(dept=None, start="", limit=25, REQUEST=None):
|
||||
for user in userlist
|
||||
if scu.suppress_accents((user.nom or "").lower()).startswith(start)
|
||||
]
|
||||
if REQUEST:
|
||||
REQUEST.RESPONSE.setHeader("content-type", scu.XML_MIMETYPE)
|
||||
doc = ElementTree.Element("results")
|
||||
for user in userlist[:limit]:
|
||||
x_rs = ElementTree.Element("rs", id=str(user.id), info="")
|
||||
x_rs.text = user.get_nomplogin()
|
||||
doc.append(x_rs)
|
||||
return sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING)
|
||||
|
||||
data = sco_xml.XML_HEADER + ElementTree.tostring(doc).decode(scu.SCO_ENCODING)
|
||||
return scu.send_file(data, mime=scu.XML_MIMETYPE)
|
||||
|
||||
|
||||
@bp.route("/form_change_password")
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def form_change_password(REQUEST, user_name=None):
|
||||
def form_change_password(user_name=None):
|
||||
"""Formulaire de changement mot de passe de l'utilisateur user_name.
|
||||
Un utilisateur peut toujours changer son propre mot de passe.
|
||||
"""
|
||||
@ -643,7 +641,7 @@ def form_change_password(REQUEST, user_name=None):
|
||||
@scodoc
|
||||
@permission_required(Permission.ScoView)
|
||||
@scodoc7func
|
||||
def change_password(user_name, password, password2, REQUEST):
|
||||
def change_password(user_name, password, password2):
|
||||
"Change the password for user given by user_name"
|
||||
u = User.query.filter_by(user_name=user_name).first()
|
||||
# Check access permission
|
||||
|
@ -281,8 +281,8 @@ def test_formations(test_client):
|
||||
|
||||
# on doit d'abbord supprimer le semestre
|
||||
|
||||
# sco_formsemestre_edit.formsemestre_delete( formsemestre_id=sem2["formsemestre_id"], REQUEST=REQUEST)
|
||||
# sco_formsemestre_edit.formsemestre_createwithmodules( formsemestre_id=sem2["formsemestre_id"], REQUEST=REQUEST)
|
||||
# sco_formsemestre_edit.formsemestre_delete( formsemestre_id=sem2["formsemestre_id"])
|
||||
# sco_formsemestre_edit.formsemestre_createwithmodules( formsemestre_id=sem2["formsemestre_id"])
|
||||
|
||||
# RIEN NE SE PASSE AVEC CES FONCTIONS
|
||||
|
||||
@ -290,9 +290,9 @@ def test_formations(test_client):
|
||||
formsemestre_id=sem2["formsemestre_id"]
|
||||
)
|
||||
|
||||
# sco_edit_module.module_delete( module_id=modt["module_id"], REQUEST=REQUEST)
|
||||
# sco_edit_matiere.matiere_delete( matiere_id=matt["matiere_id"], REQUEST=REQUEST)
|
||||
# sco_edit_ue.ue_delete( ue_id=uet["ue_id"], REQUEST=REQUEST)
|
||||
# sco_edit_module.module_delete( module_id=modt["module_id"])
|
||||
# sco_edit_matiere.matiere_delete( matiere_id=matt["matiere_id"])
|
||||
# sco_edit_ue.ue_delete( ue_id=uet["ue_id"])
|
||||
|
||||
# RIEN NE SE PASSE AVEC CES FONCTIONS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user