1
0
forked from ScoDoc/ScoDoc
This commit is contained in:
Emmanuel Viennet 2022-03-15 23:09:41 +01:00
parent 6de3d32c25
commit cd299169e0
5 changed files with 30 additions and 16 deletions

View File

@ -724,13 +724,16 @@ du programme" (menu "Semestre") si vous avez un semestre en cours);
{formation.referentiel_competence.type_titre} {formation.referentiel_competence.specialite_long} {formation.referentiel_competence.type_titre} {formation.referentiel_competence.specialite_long}
</a>&nbsp;""" </a>&nbsp;"""
msg_refcomp = "changer" msg_refcomp = "changer"
H.append( H.append(f"""<ul><li>{descr_refcomp}""")
f""" if current_user.has_permission(Permission.ScoChangeFormation):
<ul> H.append(
<li>{descr_refcomp} <a class="stdlink" href="{url_for('notes.refcomp_assoc_formation', f"""<a class="stdlink" href="{url_for('notes.refcomp_assoc_formation',
scodoc_dept=g.scodoc_dept, formation_id=formation_id) scodoc_dept=g.scodoc_dept, formation_id=formation_id)
}">{msg_refcomp}</a> }">{msg_refcomp}</a>"""
</li> )
H.append(
f"""</li>
<li> <a class="stdlink" href="{ <li> <a class="stdlink" href="{
url_for('notes.edit_modules_ue_coefs', scodoc_dept=g.scodoc_dept, formation_id=formation_id, semestre_idx=semestre_idx) url_for('notes.edit_modules_ue_coefs', scodoc_dept=g.scodoc_dept, formation_id=formation_id, semestre_idx=semestre_idx)
}">éditer les coefficients des ressources et SAÉs</a> }">éditer les coefficients des ressources et SAÉs</a>

View File

@ -328,11 +328,15 @@ def formation_list_table(formation_id=None, args={}):
"session_id)s<a> " % s "session_id)s<a> " % s
for s in f["sems"] for s in f["sems"]
] ]
+ [ + (
'<a class="stdlink" id="add-semestre-%s" ' [
'href="formsemestre_createwithmodules?formation_id=%s&semestre_id=1">ajouter</a> ' '<a class="stdlink" id="add-semestre-%s" '
% (f["acronyme"].lower().replace(" ", "-"), f["formation_id"]) 'href="formsemestre_createwithmodules?formation_id=%s&semestre_id=1">ajouter</a> '
] % (f["acronyme"].lower().replace(" ", "-"), f["formation_id"])
]
if current_user.has_permission(Permission.ScoImplement)
else []
)
) )
if f["sems"]: if f["sems"]:
f["date_fin_dernier_sem"] = max([s["date_fin_iso"] for s in f["sems"]]) f["date_fin_dernier_sem"] = max([s["date_fin_iso"] for s in f["sems"]])

View File

@ -36,10 +36,12 @@ function build_table(data) {
/*****************************/ /*****************************/
/* Gestion des évènements */ /* Gestion des évènements */
/*****************************/ /*****************************/
$(function () {
document.body.addEventListener("keydown", key);
});
function installListeners() { function installListeners() {
if (read_only) {
return;
}
document.body.addEventListener("keydown", key);
document.querySelectorAll("[data-editable=true]").forEach(cellule => { document.querySelectorAll("[data-editable=true]").forEach(cellule => {
cellule.addEventListener("click", function () { selectCell(this) }); cellule.addEventListener("click", function () { selectCell(this) });
cellule.addEventListener("dblclick", function () { modifCell(this) }); cellule.addEventListener("dblclick", function () { modifCell(this) });

View File

@ -1,8 +1,11 @@
{# -*- mode: jinja-html -*- #} {# -*- mode: jinja-html -*- #}
<h2>Édition des coefficients des modules vers les UEs</h2> <h2>{% if not read_only %}Édition des c{% else %}C{%endif%}oefficients des modules vers les UEs</h2>
<div class="help"> <div class="help">
{% if not read_only %}
Double-cliquer pour changer une valeur. Double-cliquer pour changer une valeur.
Les valeurs sont automatiquement enregistrées au fur et à mesure. Les valeurs sont automatiquement enregistrées au fur et à mesure.
{% endif %}
</div> </div>
<form class="semestre_selector">Semestre: <form class="semestre_selector">Semestre:
<select onchange="this.form.submit()"" name="semestre_idx" id="semestre_idx"> <select onchange="this.form.submit()"" name="semestre_idx" id="semestre_idx">
@ -21,6 +24,7 @@
<div class="tableau"></div> <div class="tableau"></div>
<script> <script>
var read_only={{"true" if read_only else "false"}};
$(function () { $(function () {
let data_url = "{{data_source}}"; let data_url = "{{data_source}}";
$.getJSON(data_url, function (data) { $.getJSON(data_url, function (data) {

View File

@ -151,7 +151,7 @@ def set_module_ue_coef():
@bp.route("/edit_modules_ue_coefs") @bp.route("/edit_modules_ue_coefs")
@scodoc @scodoc
@permission_required(Permission.ScoChangeFormation) @permission_required(Permission.ScoView)
def edit_modules_ue_coefs(): def edit_modules_ue_coefs():
"""Formulaire édition grille coefs EU/modules""" """Formulaire édition grille coefs EU/modules"""
formation_id = int(request.args["formation_id"]) formation_id = int(request.args["formation_id"])
@ -194,6 +194,7 @@ def edit_modules_ue_coefs():
"notes.set_module_ue_coef", "notes.set_module_ue_coef",
scodoc_dept=g.scodoc_dept, scodoc_dept=g.scodoc_dept,
), ),
read_only=not current_user.has_permission(Permission.ScoChangeFormation),
semestre_idx=semestre_idx, semestre_idx=semestre_idx,
semestre_ids=range(1, formation.get_parcours().NB_SEM + 1), semestre_ids=range(1, formation.get_parcours().NB_SEM + 1),
), ),