|
|
|
@ -40,6 +40,7 @@ from app.comp.res_compat import NotesTableCompat
|
|
|
|
|
from app.models import (
|
|
|
|
|
FormSemestre,
|
|
|
|
|
Identite,
|
|
|
|
|
ModuleImpl,
|
|
|
|
|
Partition,
|
|
|
|
|
ScolarFormSemestreValidation,
|
|
|
|
|
UniteEns,
|
|
|
|
@ -52,7 +53,6 @@ from app.scodoc import codes_cursus
|
|
|
|
|
from app.scodoc import sco_edit_module
|
|
|
|
|
from app.scodoc import sco_edit_ue
|
|
|
|
|
from app.scodoc import sco_etud
|
|
|
|
|
from app.scodoc import sco_formsemestre
|
|
|
|
|
from app.scodoc import sco_formsemestre_inscriptions
|
|
|
|
|
from app.scodoc import sco_groups
|
|
|
|
|
from app.scodoc import sco_moduleimpl
|
|
|
|
@ -63,7 +63,9 @@ import app.scodoc.sco_utils as scu
|
|
|
|
|
from app.tables import list_etuds
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def moduleimpl_inscriptions_edit(moduleimpl_id, etuds=[], submitted=False):
|
|
|
|
|
def moduleimpl_inscriptions_edit(
|
|
|
|
|
moduleimpl_id, etudids: list[int] | None = None, submitted=False
|
|
|
|
|
):
|
|
|
|
|
"""Formulaire inscription des etudiants a ce module
|
|
|
|
|
* Gestion des inscriptions
|
|
|
|
|
Nom TD TA TP (triable)
|
|
|
|
@ -75,12 +77,12 @@ def moduleimpl_inscriptions_edit(moduleimpl_id, etuds=[], submitted=False):
|
|
|
|
|
|
|
|
|
|
* Si pas les droits: idem en readonly
|
|
|
|
|
"""
|
|
|
|
|
M = sco_moduleimpl.moduleimpl_list(moduleimpl_id=moduleimpl_id)[0]
|
|
|
|
|
formsemestre_id = M["formsemestre_id"]
|
|
|
|
|
mod = sco_edit_module.module_list(args={"module_id": M["module_id"]})[0]
|
|
|
|
|
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
|
|
|
|
etudids = etudids or []
|
|
|
|
|
modimpl = ModuleImpl.get_modimpl(moduleimpl_id)
|
|
|
|
|
module = modimpl.module
|
|
|
|
|
formsemestre = modimpl.formsemestre
|
|
|
|
|
# -- check lock
|
|
|
|
|
if not sem["etat"]:
|
|
|
|
|
if not formsemestre.etat:
|
|
|
|
|
raise ScoValueError("opération impossible: semestre verrouille")
|
|
|
|
|
header = html_sco_header.sco_header(
|
|
|
|
|
page_title="Inscription au module",
|
|
|
|
@ -90,25 +92,23 @@ def moduleimpl_inscriptions_edit(moduleimpl_id, etuds=[], submitted=False):
|
|
|
|
|
footer = html_sco_header.sco_footer()
|
|
|
|
|
H = [
|
|
|
|
|
header,
|
|
|
|
|
"""<h2>Inscriptions au module <a href="moduleimpl_status?moduleimpl_id=%s">%s</a> (%s)</a></h2>
|
|
|
|
|
f"""<h2>Inscriptions au module <a class="stdlink" href="{
|
|
|
|
|
url_for("notes.moduleimpl_status", scodoc_dept=g.scodoc_dept,
|
|
|
|
|
moduleimpl_id=moduleimpl_id)
|
|
|
|
|
}">{module.titre or "(module sans titre)"}</a> ({module.code})</a></h2>
|
|
|
|
|
<p class="help">Cette page permet d'éditer les étudiants inscrits à ce module
|
|
|
|
|
(ils doivent évidemment être inscrits au semestre).
|
|
|
|
|
Les étudiants cochés sont (ou seront) inscrits. Vous pouvez facilement inscrire ou
|
|
|
|
|
Les étudiants cochés sont (ou seront) inscrits. Vous pouvez inscrire ou
|
|
|
|
|
désinscrire tous les étudiants d'un groupe à l'aide des menus "Ajouter" et "Enlever".
|
|
|
|
|
</p>
|
|
|
|
|
<p class="help">Aucune modification n'est prise en compte tant que l'on n'appuie pas sur le bouton
|
|
|
|
|
"Appliquer les modifications".
|
|
|
|
|
<p class="help">Aucune modification n'est prise en compte tant que l'on n'appuie pas
|
|
|
|
|
sur le bouton "Appliquer les modifications".
|
|
|
|
|
</p>
|
|
|
|
|
"""
|
|
|
|
|
% (
|
|
|
|
|
moduleimpl_id,
|
|
|
|
|
mod["titre"] or "(module sans titre)",
|
|
|
|
|
mod["code"] or "(module sans code)",
|
|
|
|
|
),
|
|
|
|
|
""",
|
|
|
|
|
]
|
|
|
|
|
# Liste des inscrits à ce semestre
|
|
|
|
|
inscrits = sco_formsemestre_inscriptions.do_formsemestre_inscription_listinscrits(
|
|
|
|
|
formsemestre_id
|
|
|
|
|
formsemestre.id
|
|
|
|
|
)
|
|
|
|
|
for ins in inscrits:
|
|
|
|
|
etuds_info = sco_etud.get_etud_info(etudid=ins["etudid"], filled=1)
|
|
|
|
@ -121,12 +121,10 @@ def moduleimpl_inscriptions_edit(moduleimpl_id, etuds=[], submitted=False):
|
|
|
|
|
)
|
|
|
|
|
ins["etud"] = etuds_info[0]
|
|
|
|
|
inscrits.sort(key=lambda inscr: sco_etud.etud_sort_key(inscr["etud"]))
|
|
|
|
|
in_m = sco_moduleimpl.do_moduleimpl_inscription_list(
|
|
|
|
|
moduleimpl_id=M["moduleimpl_id"]
|
|
|
|
|
)
|
|
|
|
|
in_module = set([x["etudid"] for x in in_m])
|
|
|
|
|
in_m = sco_moduleimpl.do_moduleimpl_inscription_list(moduleimpl_id=modimpl.id)
|
|
|
|
|
in_module = {x["etudid"] for x in in_m}
|
|
|
|
|
#
|
|
|
|
|
partitions = sco_groups.get_partitions_list(formsemestre_id)
|
|
|
|
|
partitions = sco_groups.get_partitions_list(formsemestre.id)
|
|
|
|
|
#
|
|
|
|
|
if not submitted:
|
|
|
|
|
H.append(
|
|
|
|
@ -149,27 +147,32 @@ def moduleimpl_inscriptions_edit(moduleimpl_id, etuds=[], submitted=False):
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>"""
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
table.mi_table td, table.mi_table th {
|
|
|
|
|
text-align: left;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
"""
|
|
|
|
|
)
|
|
|
|
|
H.append(
|
|
|
|
|
f"""<form method="post" id="mi_form" action="{request.base_url}">
|
|
|
|
|
<input type="hidden" name="moduleimpl_id" value="{M['moduleimpl_id']}"/>
|
|
|
|
|
<input type="hidden" name="moduleimpl_id" value="{modimpl.id}"/>
|
|
|
|
|
<input type="submit" name="submitted" value="Appliquer les modifications"/>
|
|
|
|
|
<p></p>
|
|
|
|
|
<table><tr>
|
|
|
|
|
{ _make_menu(partitions, "Ajouter", "true") }
|
|
|
|
|
{ _make_menu(partitions, "Enlever", "false")}
|
|
|
|
|
</tr></table>
|
|
|
|
|
<p><br></p>
|
|
|
|
|
<table class="sortable" id="mi_table">
|
|
|
|
|
<div>
|
|
|
|
|
{ _make_menu(partitions, "Ajouter", "true") }
|
|
|
|
|
{ _make_menu(partitions, "Enlever", "false")}
|
|
|
|
|
</div>
|
|
|
|
|
<table class="gt_table mi_table">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>Nom</th>
|
|
|
|
|
<th class="etud">Nom</th>
|
|
|
|
|
"""
|
|
|
|
|
)
|
|
|
|
|
for partition in partitions:
|
|
|
|
|
if partition["partition_name"]:
|
|
|
|
|
H.append("<th>%s</th>" % partition["partition_name"])
|
|
|
|
|
H.append("</tr>")
|
|
|
|
|
H.append(f"<th>{partition['partition_name']}</th>")
|
|
|
|
|
H.append("</tr></thead><tbody>")
|
|
|
|
|
|
|
|
|
|
for ins in inscrits:
|
|
|
|
|
etud = ins["etud"]
|
|
|
|
@ -178,24 +181,20 @@ def moduleimpl_inscriptions_edit(moduleimpl_id, etuds=[], submitted=False):
|
|
|
|
|
else:
|
|
|
|
|
checked = ""
|
|
|
|
|
H.append(
|
|
|
|
|
"""<tr><td><input type="checkbox" name="etuds:list" value="%s" %s>"""
|
|
|
|
|
% (etud["etudid"], checked)
|
|
|
|
|
f"""<tr><td class="etud"><input type="checkbox" name="etudids:list" value="{etud['etudid']}" {checked}>"""
|
|
|
|
|
)
|
|
|
|
|
H.append(
|
|
|
|
|
"""<a class="discretelink etudinfo" href="%s" id="%s">%s</a>"""
|
|
|
|
|
% (
|
|
|
|
|
f"""<a class="discretelink etudinfo" href="{
|
|
|
|
|
url_for(
|
|
|
|
|
"scolar.ficheEtud",
|
|
|
|
|
scodoc_dept=g.scodoc_dept,
|
|
|
|
|
etudid=etud["etudid"],
|
|
|
|
|
),
|
|
|
|
|
etud["etudid"],
|
|
|
|
|
etud["nomprenom"],
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}" id="{etud['etudid']}">{etud['nomprenom']}</a>"""
|
|
|
|
|
)
|
|
|
|
|
H.append("""</input></td>""")
|
|
|
|
|
|
|
|
|
|
groups = sco_groups.get_etud_groups(etud["etudid"], formsemestre_id)
|
|
|
|
|
groups = sco_groups.get_etud_groups(etud["etudid"], formsemestre.id)
|
|
|
|
|
for partition in partitions:
|
|
|
|
|
if partition["partition_name"]:
|
|
|
|
|
gr_name = ""
|
|
|
|
@ -205,11 +204,11 @@ def moduleimpl_inscriptions_edit(moduleimpl_id, etuds=[], submitted=False):
|
|
|
|
|
break
|
|
|
|
|
# gr_name == '' si etud non inscrit dans un groupe de cette partition
|
|
|
|
|
H.append(f"<td>{gr_name}</td>")
|
|
|
|
|
H.append("""</table></form>""")
|
|
|
|
|
H.append("""</tbody></table></form>""")
|
|
|
|
|
else: # SUBMISSION
|
|
|
|
|
# inscrit a ce module tous les etuds selectionnes
|
|
|
|
|
sco_moduleimpl.do_moduleimpl_inscrit_etuds(
|
|
|
|
|
moduleimpl_id, formsemestre_id, etuds, reset=True
|
|
|
|
|
moduleimpl_id, formsemestre.id, etudids, reset=True
|
|
|
|
|
)
|
|
|
|
|
return flask.redirect(
|
|
|
|
|
url_for(
|
|
|
|
@ -225,10 +224,10 @@ def moduleimpl_inscriptions_edit(moduleimpl_id, etuds=[], submitted=False):
|
|
|
|
|
|
|
|
|
|
def _make_menu(partitions: list[dict], title="", check="true") -> str:
|
|
|
|
|
"""Menu with list of all groups"""
|
|
|
|
|
items = [{"title": "Tous", "attr": "onclick=\"group_select('', -1, %s)\"" % check}]
|
|
|
|
|
items = [{"title": "Tous", "attr": f"onclick=\"group_select('', -1, {check})\""}]
|
|
|
|
|
p_idx = 0
|
|
|
|
|
for partition in partitions:
|
|
|
|
|
if partition["partition_name"] != None:
|
|
|
|
|
if partition["partition_name"] is not None:
|
|
|
|
|
p_idx += 1
|
|
|
|
|
for group in sco_groups.get_partition_groups(partition):
|
|
|
|
|
items.append(
|
|
|
|
@ -240,9 +239,9 @@ def _make_menu(partitions: list[dict], title="", check="true") -> str:
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
return (
|
|
|
|
|
'<td class="inscr_addremove_menu">'
|
|
|
|
|
'<div class="inscr_addremove_menu">'
|
|
|
|
|
+ htmlutils.make_menu(title, items, alone=True)
|
|
|
|
|
+ "</td>"
|
|
|
|
|
+ "</div>"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|