forked from ScoDoc/ScoDoc
62 lines
2.2 KiB
JavaScript
62 lines
2.2 KiB
JavaScript
|
|
|
|
// active les menus des codes "manuels" (année, RCUEs)
|
|
function enable_manual_codes(elt) {
|
|
$(".jury_but select.manual").prop("disabled", !elt.checked);
|
|
}
|
|
|
|
// changement menu code:
|
|
function change_menu_code(elt) {
|
|
elt.parentElement.parentElement.classList.remove("recorded");
|
|
// TODO: comparer avec valeur enregistrée (à mettre en data-orig ?)
|
|
// et colorer en fonction
|
|
elt.parentElement.parentElement.classList.add("modified");
|
|
}
|
|
|
|
$(function () {
|
|
// Recupère la liste ordonnées des etudids
|
|
// pour avoir le "suivant" etr le "précédent"
|
|
// (liens de navigation)
|
|
const url = new URL(document.URL);
|
|
const frags = url.pathname.split("/"); // .../formsemestre_validation_but/formsemestre_id/etudid
|
|
const etudid = frags[frags.length - 1];
|
|
const formsemestre_id = frags[frags.length - 2];
|
|
const etudids_key = JSON.stringify(["etudids", url.origin, formsemestre_id]);
|
|
const etudids_str = localStorage.getItem(etudids_key);
|
|
const noms_key = JSON.stringify(["noms", url.origin, formsemestre_id]);
|
|
const noms_str = localStorage.getItem(noms_key);
|
|
if (etudids_str && noms_str) {
|
|
const etudids = JSON.parse(etudids_str);
|
|
const noms = JSON.parse(noms_str);
|
|
const cur_idx = etudids.indexOf(etudid);
|
|
let prev_idx = -1;
|
|
let next_idx = -1
|
|
if (cur_idx != -1) {
|
|
if (cur_idx > 0) {
|
|
prev_idx = cur_idx - 1;
|
|
}
|
|
if (cur_idx < etudids.length - 1) {
|
|
next_idx = cur_idx + 1;
|
|
}
|
|
}
|
|
if (prev_idx != -1) {
|
|
let elem = document.querySelector("div.prev a");
|
|
if (elem) {
|
|
elem.href = elem.href.replace("PREV", etudids[prev_idx]);
|
|
elem.innerHTML = noms[prev_idx];
|
|
}
|
|
} else {
|
|
document.querySelector("div.prev").innerHTML = "";
|
|
}
|
|
if (next_idx != -1) {
|
|
let elem = document.querySelector("div.next a");
|
|
if (elem) {
|
|
elem.href = elem.href.replace("NEXT", etudids[next_idx]);
|
|
elem.innerHTML = noms[next_idx];
|
|
}
|
|
} else {
|
|
document.querySelector("div.next").innerHTML = "";
|
|
}
|
|
|
|
}
|
|
}); |