Update opolka/ScoDoc from ScoDoc/ScoDoc #2

Merged
opolka merged 1272 commits from ScoDoc/ScoDoc:master into master 2024-05-27 09:11:04 +02:00
31 changed files with 1227 additions and 1141 deletions
Showing only changes of commit 1b54d7c22c - Show all commits

View File

@ -67,18 +67,24 @@ CSSSTYLES = html_sco_header.BOOTSTRAP_MULTISELECT_CSS
def groups_view( def groups_view(
group_ids=(), group_ids=(),
fmt="html", fmt="html",
# Options pour listes:
with_codes=0, with_codes=0,
etat=None, etat=None,
with_paiement=0, # si vrai, ajoute colonnes infos paiement droits et finalisation inscription (lent car interrogation portail) with_paiement=0,
with_archives=0, # ajoute colonne avec noms fichiers archivés with_archives=0,
with_annotations=0, with_annotations=0,
with_bourse=0, with_bourse=0,
formsemestre_id=None, # utilise si aucun groupe selectionné formsemestre_id=None,
): ):
"""Affichage des étudiants des groupes indiqués """Affichage des étudiants des groupes indiqués
group_ids: liste de group_id group_ids: liste de group_id
fmt: csv, json, xml, xls, allxls, xlsappel, moodlecsv, pdf fmt: csv, json, xml, xls, allxls, xlsappel, moodlecsv, pdf
Options pour listes:
with_paiement: si vrai, ajoute colonnes infos paiement droits
et finalisation inscription (lent car interrogation portail)
with_archives: ajoute colonne avec noms fichiers archivés
formsemestre_id est utilisé si aucun groupe selectionné pour construire la liste des groupes.
""" """
# Informations sur les groupes à afficher: # Informations sur les groupes à afficher:
groups_infos = DisplayedGroupsInfos( groups_infos = DisplayedGroupsInfos(

View File

@ -1,4 +1,3 @@
$(function () { $(function () {
$("div#export_help").accordion({ $("div#export_help").accordion({
heightStyle: "content", heightStyle: "content",
@ -14,36 +13,36 @@ $(function () {
// -> surligne le cas sélectionné // -> surligne le cas sélectionné
function display(r, c, row, col) { function display(r, c, row, col) {
if ((row != r) && (row != '*')) return 'none'; if (row != r && row != "*") return "none";
if ((col != c) && (col != '*')) return 'none'; if (col != c && col != "*") return "none";
return ''; return "";
} }
function show_tag(all_rows, all_cols, tag) { function show_tag(all_rows, all_cols, tag) {
// Filtrer tous les étudiants // Filtrer tous les étudiants
all_rows.split(',').forEach(function (r) { all_rows.split(",").forEach(function (r) {
all_cols.split(',').forEach(function (c) { all_cols.split(",").forEach(function (c) {
etudiants = r + c.substring(1); etudiants = r + c.substring(1);
$(etudiants).css("display", "none"); $(etudiants).css("display", "none");
}) });
}) });
// sauf le tag // sauf le tag
$('.' + tag).css('display', ''); $("." + tag).css("display", "");
} }
function show_filtres(effectifs, filtre_row, filtre_col) { function show_filtres(effectifs, filtre_row, filtre_col) {
$("#compte").html(effectifs); $("#compte").html(effectifs);
if ((filtre_row == '') && (filtre_col == '')) { if (filtre_row == "" && filtre_col == "") {
$("#sans_filtre").css("display", ""); $("#sans_filtre").css("display", "");
$("#filtre_row").css("display", "none"); $("#filtre_row").css("display", "none");
$("#filtre_col").css("display", "none"); $("#filtre_col").css("display", "none");
} else { } else {
$("#sans_filtre").css("display", "none"); $("#sans_filtre").css("display", "none");
if (filtre_row == '') { if (filtre_row == "") {
$("#filtre_row").css("display", "none"); $("#filtre_row").css("display", "none");
$("#filtre_col").css("display", ""); $("#filtre_col").css("display", "");
$("#filtre_col").html("Filtre sur code étape: " + filtre_col); $("#filtre_col").html("Filtre sur code étape: " + filtre_col);
} else if (filtre_col == '') { } else if (filtre_col == "") {
$("#filtre_row").css("display", ""); $("#filtre_row").css("display", "");
$("#filtre_col").css("display", "none"); $("#filtre_col").css("display", "none");
$("#filtre_row").html("Filtre sur semestre: " + filtre_row); $("#filtre_row").html("Filtre sur semestre: " + filtre_row);
@ -56,26 +55,38 @@ function show_filtres(effectifs, filtre_row, filtre_col) {
} }
} }
function doFiltrage(all_rows, all_cols, row, col, effectifs, filtre_row, filtre_col) { function doFiltrage(
show_filtres(effectifs, filtre_row, filtre_col) all_rows,
all_rows.split(',').forEach(function (r) { all_cols,
all_cols.split(',').forEach(function (c) { row,
col,
effectifs,
filtre_row,
filtre_col
) {
show_filtres(effectifs, filtre_row, filtre_col);
all_rows.split(",").forEach(function (r) {
all_cols.split(",").forEach(function (c) {
etudiants = r + c.substring(1); etudiants = r + c.substring(1);
$(etudiants).css("display", display(r, c, row, col)); $(etudiants).css("display", display(r, c, row, col));
}); });
}); });
$('.repartition td').css("background-color", ""); $(".repartition td").css("background-color", "");
$('.repartition th').css("background-color", ""); $(".repartition th").css("background-color", "");
if (row == '*' && col == '*') { // Aucun filtre if (row == "*" && col == "*") {
} else if (row == '*') { // filtrage sur 1 colonne // Aucun filtre
} else if (row == "*") {
// filtrage sur 1 colonne
$(col).css("background-color", "lightblue"); $(col).css("background-color", "lightblue");
} else if (col == '*') { // Filtrage sur 1 ligne } else if (col == "*") {
$(row + '>td').css("background-color", "lightblue"); // Filtrage sur 1 ligne
$(row + '>th').css("background-color", "lightblue"); $(row + ">td").css("background-color", "lightblue");
} else { // filtrage sur 1 case $(row + ">th").css("background-color", "lightblue");
$(row + '>td' + col).css("background-color", "lightblue"); } else {
// filtrage sur 1 case
$(row + ">td" + col).css("background-color", "lightblue");
} }
// Modifie le titre de la section pour indiquer la sélection: // Modifie le titre de la section pour indiquer la sélection:

View File

@ -1,7 +1,6 @@
// Affichage anciens (non BUT) bulletin de notes // Affichage anciens (non BUT) bulletin de notes
// (uses jQuery) // (uses jQuery)
// Change visibility of UE details (les <tr> de classe "notes_bulletin_row_mod" suivant) // Change visibility of UE details (les <tr> de classe "notes_bulletin_row_mod" suivant)
// La table a la structure suivante: // La table a la structure suivante:
// <tr class="notes_bulletin_row_ue"><td><span class="toggle_ue">+/-</span>...</td>...</tr> // <tr class="notes_bulletin_row_ue"><td><span class="toggle_ue">+/-</span>...</td>...</tr>
@ -15,7 +14,7 @@ function toggle_vis_ue(e, new_state) {
var tr = e.parentNode.parentNode; var tr = e.parentNode.parentNode;
if (new_state == undefined) { if (new_state == undefined) {
// current state: use alt attribute of current image // current state: use alt attribute of current image
if (e.childNodes[0].alt == '+') { if (e.childNodes[0].alt == "+") {
new_state = false; new_state = false;
} else { } else {
new_state = true; new_state = true;
@ -25,26 +24,30 @@ function toggle_vis_ue(e, new_state) {
var tr = tr.nextSibling; var tr = tr.nextSibling;
//while ((tr != null) && sibl.tagName == 'TR') { //while ((tr != null) && sibl.tagName == 'TR') {
var current = true; var current = true;
while ((tr != null) && current) { while (tr != null && current) {
if ((tr.nodeType == 1) && (tr.tagName == 'TR')) { if (tr.nodeType == 1 && tr.tagName == "TR") {
for (var i = 0; i < tr.classList.length; i++) { for (var i = 0; i < tr.classList.length; i++) {
if ((tr.classList[i] == 'notes_bulletin_row_ue') || (tr.classList[i] == 'notes_bulletin_row_sum_ects')) if (
tr.classList[i] == "notes_bulletin_row_ue" ||
tr.classList[i] == "notes_bulletin_row_sum_ects"
)
current = false; current = false;
} }
if (current) { if (current) {
if (new_state) { if (new_state) {
tr.style.display = 'none'; tr.style.display = "none";
} else { } else {
tr.style.display = 'table-row'; tr.style.display = "table-row";
} }
} }
} }
tr = tr.nextSibling; tr = tr.nextSibling;
} }
if (new_state) { if (new_state) {
e.innerHTML = '<img width="13" height="13" border="0" title="" alt="+" src="/ScoDoc/static/icons/plus_img.png"/>'; e.innerHTML =
'<img width="13" height="13" border="0" title="" alt="+" src="/ScoDoc/static/icons/plus_img.png"/>';
} else { } else {
e.innerHTML = '<img width="13" height="13" border="0" title="" alt="-" src="/ScoDoc/static/icons/minus_img.png"/>'; e.innerHTML =
'<img width="13" height="13" border="0" title="" alt="-" src="/ScoDoc/static/icons/minus_img.png"/>';
} }
} }

View File

@ -12,13 +12,12 @@ var CURRENTWEEKCOLOR = "yellow";
// get all tr elements from this class // get all tr elements from this class
// (no getElementBuClassName) // (no getElementBuClassName)
function getTRweek( week ) { function getTRweek(week) {
var tablecal = document.getElementById('maincalendar'); var tablecal = document.getElementById("maincalendar");
var all = tablecal.getElementsByTagName('tr'); var all = tablecal.getElementsByTagName("tr");
var res = [] ; var res = [];
for(var i=0; i < all.length; i++) { for (var i = 0; i < all.length; i++) {
if (all[i].className == week) if (all[i].className == week) res[res.length] = all[i];
res[res.length] = all[i];
} }
return res; return res;
} }
@ -26,11 +25,10 @@ function getTRweek( week ) {
var HIGHLIGHTEDCELLS = []; var HIGHLIGHTEDCELLS = [];
function deselectweeks() { function deselectweeks() {
for (var i = 0; i < HIGHLIGHTEDCELLS.length; i++) {
for(var i=0; i < HIGHLIGHTEDCELLS.length; i++) {
var row = rows[i]; var row = rows[i];
if (row) { if (row) {
if (row.className.match('currentweek')) { if (row.className.match("currentweek")) {
row.style.backgroundColor = CURRENTWEEKCOLOR; row.style.backgroundColor = CURRENTWEEKCOLOR;
} else { } else {
row.style.backgroundColor = WEEKDAYCOLOR; row.style.backgroundColor = WEEKDAYCOLOR;
@ -44,11 +42,11 @@ function deselectweeks() {
function highlightweek(el) { function highlightweek(el) {
deselectweeks(); deselectweeks();
var week = el.className; var week = el.className;
if ((week == 'wkend') || (week.substring(0,2) != 'wk')) { if (week == "wkend" || week.substring(0, 2) != "wk") {
return; /* does not hightlight weekends */ return; /* does not hightlight weekends */
} }
rows = getTRweek(week); rows = getTRweek(week);
for (var i=0; i < rows.length; i++) { for (var i = 0; i < rows.length; i++) {
var row = rows[i]; var row = rows[i];
row.style.backgroundColor = DAYHIGHLIGHT; row.style.backgroundColor = DAYHIGHLIGHT;
HIGHLIGHTEDCELLS[HIGHLIGHTEDCELLS.length] = row; HIGHLIGHTEDCELLS[HIGHLIGHTEDCELLS.length] = row;
@ -58,7 +56,7 @@ function highlightweek(el) {
// click on a day // click on a day
function wclick(el) { function wclick(el) {
monday = el.className; monday = el.className;
form = document.getElementById('formw'); form = document.getElementById("formw");
form.datelundi.value = monday.substr(2).replace(/_/g,'/').split(' ')[0]; form.datelundi.value = monday.substr(2).replace(/_/g, "/").split(" ")[0];
form.submit(); form.submit();
} }

View File

@ -2,5 +2,4 @@ function submit_form() {
$("#config_logos_form").submit(); $("#config_logos_form").submit();
} }
$(function () { $(function () {});
})

View File

@ -13,7 +13,7 @@ les balises (fermées par défaut sauf si attribut open déjà activé dans le c
*/ */
const ID_ATTRIBUTE = "ds_id" const ID_ATTRIBUTE = "ds_id";
function genere_id(detail, idnum) { function genere_id(detail, idnum) {
let id = "ds_" + idnum; let id = "ds_" + idnum;
@ -47,7 +47,7 @@ function restore_detail(detail, id) {
} }
function add_listener(detail) { function add_listener(detail) {
detail.addEventListener('toggle', (e) => { detail.addEventListener("toggle", (e) => {
let id = e.target.getAttribute(ID_ATTRIBUTE); let id = e.target.getAttribute(ID_ATTRIBUTE);
let ante = e.target.getAttribute("open"); let ante = e.target.getAttribute("open");
if (ante == null) { if (ante == null) {
@ -56,16 +56,16 @@ function add_listener(detail) {
localStorage.setItem(id, true); localStorage.setItem(id, true);
} }
e.stopPropagation(); e.stopPropagation();
}) });
} }
function reset_ds() { function reset_ds() {
let idnum = 0; let idnum = 0;
keepDetails = true; keepDetails = true;
details = document.querySelectorAll("details") details = document.querySelectorAll("details");
details.forEach(function (detail) { details.forEach(function (detail) {
let id = genere_id(detail, idnum); let id = genere_id(detail, idnum);
console.log("Processing " + id) console.log("Processing " + id);
if (keepDetails) { if (keepDetails) {
restore_detail(detail, id); restore_detail(detail, id);
} else { } else {
@ -76,7 +76,7 @@ function reset_ds() {
}); });
} }
window.addEventListener('load', function() { window.addEventListener("load", function () {
console.log("details/summary persistence ON"); console.log("details/summary persistence ON");
reset_ds(); reset_ds();
}) });

View File

@ -1,38 +1,32 @@
function _partition_set_attr(partition_id, attr_name, attr_value) { function _partition_set_attr(partition_id, attr_name, attr_value) {
$.post(SCO_URL + '/partition_set_attr', $.post(
SCO_URL + "/partition_set_attr",
{ {
'partition_id': partition_id, partition_id: partition_id,
'attr': attr_name, attr: attr_name,
'value': attr_value value: attr_value,
}, },
function (result) { function (result) {
sco_message(result); sco_message(result);
}); }
);
return; return;
} }
// Met à jour bul_show_rank lorsque checkbox modifiees: // Met à jour bul_show_rank lorsque checkbox modifiees:
function update_rk(e) { function update_rk(e) {
var partition_id = $(e).attr('data-partition_id'); var partition_id = $(e).attr("data-partition_id");
var v; var v;
if (e.checked) if (e.checked) v = "1";
v = '1'; else v = "0";
else _partition_set_attr(partition_id, "bul_show_rank", v);
v = '0';
_partition_set_attr(partition_id, 'bul_show_rank', v);
} }
function update_show_in_list(e) { function update_show_in_list(e) {
var partition_id = $(e).attr('data-partition_id'); var partition_id = $(e).attr("data-partition_id");
var v; var v;
if (e.checked) if (e.checked) v = "1";
v = '1'; else v = "0";
else
v = '0';
_partition_set_attr(partition_id, 'show_in_lists', v); _partition_set_attr(partition_id, "show_in_lists", v);
} }

View File

@ -15,10 +15,11 @@ $().ready(function () {
function update_bonus_description() { function update_bonus_description() {
var ue_type = $("#tf_type")[0].value; var ue_type = $("#tf_type")[0].value;
if (ue_type == "1") { /* UE SPORT */ if (ue_type == "1") {
/* UE SPORT */
$("#bonus_description").show(); $("#bonus_description").show();
var query = "/ScoDoc/get_bonus_description/default"; var query = "/ScoDoc/get_bonus_description/default";
$.get(query, '', function (data) { $.get(query, "", function (data) {
$("#bonus_description").html(data); $("#bonus_description").html(data);
}); });
} else { } else {
@ -30,29 +31,38 @@ function update_bonus_description() {
function update_ue_list() { function update_ue_list() {
let ue_id = $("#tf_ue_id")[0].value; let ue_id = $("#tf_ue_id")[0].value;
let ue_code = $("#tf_ue_code")[0].value; let ue_code = $("#tf_ue_code")[0].value;
let query = SCO_URL + "/Notes/ue_sharing_code?ue_code=" + ue_code + "&hide_ue_id=" + ue_id + "&ue_id=" + ue_id; let query =
$.get(query, '', function (data) { SCO_URL +
"/Notes/ue_sharing_code?ue_code=" +
ue_code +
"&hide_ue_id=" +
ue_id +
"&ue_id=" +
ue_id;
$.get(query, "", function (data) {
$("#ue_list_code").html(data); $("#ue_list_code").html(data);
}); });
} }
function set_ue_parcour(checkbox) { function set_ue_parcour(checkbox) {
let url = checkbox.dataset.setter; let url = checkbox.dataset.setter;
const checkboxes = document.querySelectorAll('#choix_parcours input[type="checkbox"]:checked'); const checkboxes = document.querySelectorAll(
'#choix_parcours input[type="checkbox"]:checked'
);
const parcours_ids = []; const parcours_ids = [];
checkboxes.forEach(function (checkbox) { checkboxes.forEach(function (checkbox) {
parcours_ids.push(checkbox.value); parcours_ids.push(checkbox.value);
}); });
fetch(url, { fetch(url, {
method: 'POST', method: "POST",
headers: { headers: {
'Content-Type': 'application/json' "Content-Type": "application/json",
}, },
body: JSON.stringify(parcours_ids) body: JSON.stringify(parcours_ids),
}) })
.then(response => response.json()) .then((response) => response.json())
.then(data => { .then((data) => {
if (data.status == 404) { if (data.status == 404) {
sco_error_message(data.message); sco_error_message(data.message);
} else { } else {
@ -60,4 +70,3 @@ function set_ue_parcour(checkbox) {
} }
}); });
} }

View File

@ -1,4 +1,3 @@
// Mécanisme d'auto-complétion (choix) d'un étudiant // Mécanisme d'auto-complétion (choix) d'un étudiant
// Il faut un champs #etudiant (text input) et à coté un champ hidden etudid qui sera rempli. // Il faut un champs #etudiant (text input) et à coté un champ hidden etudid qui sera rempli.
// utilise autoComplete.js, source https://tarekraafat.github.io/autoComplete.js // utilise autoComplete.js, source https://tarekraafat.github.io/autoComplete.js
@ -22,19 +21,21 @@ function etud_autocomplete_config(with_dept = false) {
} }
}, },
// Data source 'Object' key to be searched // Data source 'Object' key to be searched
keys: ["nom"] keys: ["nom"],
}, },
events: { events: {
input: { input: {
selection: (event) => { selection: (event) => {
const prenom = sco_capitalize(event.detail.selection.value.prenom); const prenom = sco_capitalize(event.detail.selection.value.prenom);
const selection = with_dept ? `${event.detail.selection.value.nom} ${prenom} (${event.detail.selection.value.dept_acronym})` : `${event.detail.selection.value.nom} ${prenom}`; const selection = with_dept
? `${event.detail.selection.value.nom} ${prenom} (${event.detail.selection.value.dept_acronym})`
: `${event.detail.selection.value.nom} ${prenom}`;
// store etudid // store etudid
const etudidField = document.getElementById('etudid'); const etudidField = document.getElementById("etudid");
etudidField.value = event.detail.selection.value.id; etudidField.value = event.detail.selection.value.id;
autoCompleteJS.input.value = selection; autoCompleteJS.input.value = selection;
} },
} },
}, },
resultsList: { resultsList: {
element: (list, data) => { element: (list, data) => {
@ -48,7 +49,7 @@ function etud_autocomplete_config(with_dept = false) {
// Append message element to the results list // Append message element to the results list
list.prepend(message); list.prepend(message);
// Efface l'etudid // Efface l'etudid
const etudidField = document.getElementById('etudid'); const etudidField = document.getElementById("etudid");
etudidField.value = ""; etudidField.value = "";
} }
}, },
@ -58,8 +59,10 @@ function etud_autocomplete_config(with_dept = false) {
highlight: true, highlight: true,
element: (item, data) => { element: (item, data) => {
const prenom = sco_capitalize(data.value.prenom); const prenom = sco_capitalize(data.value.prenom);
item.innerHTML += with_dept ? ` ${prenom} (${data.value.dept_acronym})` : ` ${prenom}`; item.innerHTML += with_dept
? ` ${prenom} (${data.value.dept_acronym})`
: ` ${prenom}`;
}, },
}, },
} };
} }

View File

@ -1,38 +1,37 @@
// Tableau recap evaluations du semestre // Tableau recap evaluations du semestre
$(function () { $(function () {
$('table.evaluations_recap').DataTable( $("table.evaluations_recap").DataTable({
{
paging: false, paging: false,
searching: true, searching: true,
info: false, info: false,
autoWidth: false, autoWidth: false,
fixedHeader: { fixedHeader: {
header: true, header: true,
footer: false footer: false,
}, },
orderCellsTop: true, // cellules ligne 1 pour tri orderCellsTop: true, // cellules ligne 1 pour tri
aaSorting: [], // Prevent initial sorting aaSorting: [], // Prevent initial sorting
colReorder: true, colReorder: true,
"columnDefs": [ columnDefs: [
{ {
// colonne date, triable (XXX ne fonctionne pas) // colonne date, triable (XXX ne fonctionne pas)
targets: ["date"], targets: ["date"],
"type": "string", type: "string",
}, },
], ],
dom: 'Bfrtip', dom: "Bfrtip",
buttons: [ buttons: [
{ {
extend: 'copyHtml5', extend: "copyHtml5",
text: 'Copier', text: "Copier",
exportOptions: { orthogonal: 'export' } exportOptions: { orthogonal: "export" },
}, },
{ {
extend: 'excelHtml5', extend: "excelHtml5",
exportOptions: { orthogonal: 'export' }, exportOptions: { orthogonal: "export" },
title: document.querySelector('table.evaluations_recap').dataset.filename title: document.querySelector("table.evaluations_recap").dataset
.filename,
}, },
], ],
});
})
}); });

View File

@ -1,14 +1,11 @@
// Export table tous les resultats // Export table tous les resultats
// Menu choix parcours: // Menu choix parcours:
$(function() { $(function () {
$('#parcours_sel').multiselect( $("#parcours_sel").multiselect({
{
includeSelectAllOption: true, includeSelectAllOption: true,
nonSelectedText:'Choisir le(s) parcours...', nonSelectedText: "Choisir le(s) parcours...",
selectAllValue: '', selectAllValue: "",
numberDisplayed: 3, numberDisplayed: 3,
} });
);
}); });

View File

@ -4,25 +4,37 @@ var apo_mod_editor = null;
$(document).ready(function () { $(document).ready(function () {
var table_options = { var table_options = {
"paging": false, paging: false,
"searching": false, searching: false,
"info": false, info: false,
/* "autoWidth" : false, */ /* "autoWidth" : false, */
"fixedHeader": { fixedHeader: {
"header": true, header: true,
"footer": true footer: true,
}, },
"orderCellsTop": true, // cellules ligne 1 pour tri orderCellsTop: true, // cellules ligne 1 pour tri
"aaSorting": [], // Prevent initial sorting aaSorting: [], // Prevent initial sorting
}; };
$('table#formation_table_recap').DataTable(table_options); $("table#formation_table_recap").DataTable(table_options);
let table_editable = document.querySelector("table#formation_table_recap.apo_editable"); let table_editable = document.querySelector(
"table#formation_table_recap.apo_editable"
);
if (table_editable) { if (table_editable) {
let apo_ue_save_url = document.querySelector("table#formation_table_recap.apo_editable").dataset.apo_ue_save_url; let apo_ue_save_url = document.querySelector(
apo_ue_editor = new ScoFieldEditor("table#formation_table_recap tr.ue td.apo", apo_ue_save_url, false); "table#formation_table_recap.apo_editable"
let apo_mod_save_url = document.querySelector("table#formation_table_recap.apo_editable").dataset.apo_mod_save_url; ).dataset.apo_ue_save_url;
apo_mod_editor = new ScoFieldEditor("table#formation_table_recap tr.mod td.apo", apo_mod_save_url, false); apo_ue_editor = new ScoFieldEditor(
"table#formation_table_recap tr.ue td.apo",
apo_ue_save_url,
false
);
let apo_mod_save_url = document.querySelector(
"table#formation_table_recap.apo_editable"
).dataset.apo_mod_save_url;
apo_mod_editor = new ScoFieldEditor(
"table#formation_table_recap tr.mod td.apo",
apo_mod_save_url,
false
);
} }
}); });

View File

@ -8,7 +8,6 @@ function change_semestre_id() {
$(".sem" + semestre_id).show(); $(".sem" + semestre_id).show();
} }
$(window).on("load", function () {
$(window).on('load', function () {
change_semestre_id(); change_semestre_id();
}); });

View File

@ -1,21 +1,22 @@
function compute_moyenne() { function compute_moyenne() {
var notes = $(".tf_field_note input").map( var notes = $(".tf_field_note input")
function () { return parseFloat($(this).val()); } .map(function () {
).get(); return parseFloat($(this).val());
})
.get();
// les coefs sont donnes (ECTS en BUT) // les coefs sont donnes (ECTS en BUT)
let coefs = $("form.tf_ext_edit_ue_validations").data("ue_coefs"); let coefs = $("form.tf_ext_edit_ue_validations").data("ue_coefs");
// ou saisis (formations classiques) // ou saisis (formations classiques)
if (coefs == 'undefined') { if (coefs == "undefined") {
coefs = $(".tf_field_coef input").map( coefs = $(".tf_field_coef input")
function () { return parseFloat($(this).val()); } .map(function () {
).get(); return parseFloat($(this).val());
})
.get();
} }
var N = notes.length; var N = notes.length;
var dp = 0.; var dp = 0;
var sum_coefs = 0.; var sum_coefs = 0;
for (var i = 0; i < N; i++) { for (var i = 0; i < N; i++) {
if (!(isNaN(notes[i]) || isNaN(coefs[i]))) { if (!(isNaN(notes[i]) || isNaN(coefs[i]))) {
dp += notes[i] * coefs[i]; dp += notes[i] * coefs[i];
@ -38,7 +39,10 @@ function enable_disable_fields_cb() {
} }
function enable_disable_fields(select_elt) { function enable_disable_fields(select_elt) {
// input fields controled by this menu // input fields controled by this menu
var input_fields = $(select_elt).parent().parent().find('input:not(.ext_coef_disabled)'); var input_fields = $(select_elt)
.parent()
.parent()
.find("input:not(.ext_coef_disabled)");
var disabled = false; var disabled = false;
if ($(select_elt).val() === "None") { if ($(select_elt).val() === "None") {
disabled = true; disabled = true;
@ -46,26 +50,24 @@ function enable_disable_fields(select_elt) {
input_fields.each(function () { input_fields.each(function () {
if (disabled) { if (disabled) {
let cur_value = $(this).val(); let cur_value = $(this).val();
$(this).data('saved-value', cur_value); $(this).data("saved-value", cur_value);
$(this).val(""); $(this).val("");
} else { } else {
let saved_value = $(this).data('saved-value'); let saved_value = $(this).data("saved-value");
if (typeof saved_value == 'undefined') { if (typeof saved_value == "undefined") {
saved_value = ''; saved_value = "";
} }
if (saved_value) { if (saved_value) {
$(this).val(saved_value); $(this).val(saved_value);
} }
} }
}); });
input_fields.prop('disabled', disabled); input_fields.prop("disabled", disabled);
} }
function setup_text_fields() { function setup_text_fields() {
$(".ueext_valid_select").each( $(".ueext_valid_select").each(function () {
function () {
enable_disable_fields(this); enable_disable_fields(this);
} });
);
} }
$().ready(function () { $().ready(function () {

View File

@ -61,7 +61,7 @@ function submit_group_selector() {
} }
function show_current_tab() { function show_current_tab() {
if (document.getElementsByClassName("nav-tabs").length < 0) { if (document.getElementsByClassName("nav-tabs").length > 0) {
$('.nav-tabs [href="#' + CURRENT_TAB_HASH + '"]').tab("show"); $('.nav-tabs [href="#' + CURRENT_TAB_HASH + '"]').tab("show");
} }
} }
@ -150,35 +150,23 @@ $().ready(function () {
if (element.hasClass("default_group")) { if (element.hasClass("default_group")) {
// click sur groupe "tous" // click sur groupe "tous"
// deselectionne les autres // deselectionne les autres
$("#group_ids_sel option:selected").each(function ( $("#group_ids_sel option:selected").each(function (index, opt) {
index,
opt
) {
if (opt.value != default_group_id) { if (opt.value != default_group_id) {
$("#group_ids_sel").multiselect( $("#group_ids_sel").multiselect("deselect", opt.value);
"deselect",
opt.value
);
} }
}); });
} else { } else {
// click sur un autre item // click sur un autre item
// si le groupe "tous" est selectionne et que l'on coche un autre, le deselectionner // si le groupe "tous" est selectionne et que l'on coche un autre, le deselectionner
var default_is_selected = false; var default_is_selected = false;
$("#group_ids_sel option:selected").each(function ( $("#group_ids_sel option:selected").each(function (index, opt) {
index,
opt
) {
if (opt.value == default_group_id) { if (opt.value == default_group_id) {
default_is_selected = true; default_is_selected = true;
return false; return false;
} }
}); });
if (default_is_selected) { if (default_is_selected) {
$("#group_ids_sel").multiselect( $("#group_ids_sel").multiselect("deselect", default_group_id);
"deselect",
default_group_id
);
} }
} }
} }

View File

@ -1,5 +1,3 @@
// active les menus des codes "manuels" (année, RCUEs) // active les menus des codes "manuels" (année, RCUEs)
function enable_manual_codes(elt) { function enable_manual_codes(elt) {
$(".jury_but select.manual").prop("disabled", !elt.checked); $(".jury_but select.manual").prop("disabled", !elt.checked);
@ -19,13 +17,17 @@ function change_menu_code(elt) {
elt.parentElement.parentElement.classList.remove("recorded"); elt.parentElement.parentElement.classList.remove("recorded");
} }
// Si RCUE passant en ADJ, change les menus des UEs associées ADJR // Si RCUE passant en ADJ, change les menus des UEs associées ADJR
if (elt.classList.contains("code_rcue") if (
&& elt.dataset.niveau_id elt.classList.contains("code_rcue") &&
&& elt.value == "ADJ" elt.dataset.niveau_id &&
&& elt.value != elt.dataset.orig_recorded) { elt.value == "ADJ" &&
let ue_selects = elt.parentElement.parentElement.parentElement.querySelectorAll( elt.value != elt.dataset.orig_recorded
"select.ue_rcue_" + elt.dataset.niveau_id); ) {
ue_selects.forEach(select => { let ue_selects =
elt.parentElement.parentElement.parentElement.querySelectorAll(
"select.ue_rcue_" + elt.dataset.niveau_id
);
ue_selects.forEach((select) => {
if (select.value != "ADM") { if (select.value != "ADM") {
select.value = "ADJR"; select.value = "ADJR";
change_menu_code(select); // pour changer les styles change_menu_code(select); // pour changer les styles
@ -51,7 +53,7 @@ $(function () {
const noms = JSON.parse(noms_str); const noms = JSON.parse(noms_str);
const cur_idx = etudids.indexOf(etudid); const cur_idx = etudids.indexOf(etudid);
let prev_idx = -1; let prev_idx = -1;
let next_idx = -1 let next_idx = -1;
if (cur_idx != -1) { if (cur_idx != -1) {
if (cur_idx > 0) { if (cur_idx > 0) {
prev_idx = cur_idx - 1; prev_idx = cur_idx - 1;
@ -93,13 +95,15 @@ let IS_SUBMITTING = false;
function get_form_state() { function get_form_state() {
let codes = []; let codes = [];
// il n'y a que des <select> // il n'y a que des <select>
document.querySelectorAll("select").forEach(sel => codes.push(sel.value)); document.querySelectorAll("select").forEach((sel) => codes.push(sel.value));
return codes.join(); return codes.join();
} }
$('document').ready(function () { $("document").ready(function () {
FORM_STATE = get_form_state(); FORM_STATE = get_form_state();
document.querySelector("form#jury_but").addEventListener('submit', jury_form_submit); document
.querySelector("form#jury_but")
.addEventListener("submit", jury_form_submit);
}); });
function is_modified() { function is_modified() {
@ -111,8 +115,8 @@ function jury_form_submit(event) {
} }
window.addEventListener("beforeunload", function (e) { window.addEventListener("beforeunload", function (e) {
if ((!IS_SUBMITTING) && is_modified()) { if (!IS_SUBMITTING && is_modified()) {
var confirmationMessage = 'Changements non enregistrés !'; var confirmationMessage = "Changements non enregistrés !";
(e || window.event).returnValue = confirmationMessage; (e || window.event).returnValue = confirmationMessage;
return confirmationMessage; return confirmationMessage;
} }

View File

@ -2,33 +2,42 @@
var ScoMarkerIcons = {}; var ScoMarkerIcons = {};
$().ready(function(){ $().ready(function () {
$('#lyc_map_canvas').gmap( $("#lyc_map_canvas")
{ 'center': '48.955741,2.34141', .gmap({
'zoom' : 8, center: "48.955741,2.34141",
'mapTypeId': google.maps.MapTypeId.ROADMAP zoom: 8,
}).bind('init', function(event, map) { mapTypeId: google.maps.MapTypeId.ROADMAP,
for (var i =0; i < lycees_coords.length; i++) { })
.bind("init", function (event, map) {
for (var i = 0; i < lycees_coords.length; i++) {
var lycee = lycees_coords[i]; var lycee = lycees_coords[i];
var nb = lycee['number']; var nb = lycee["number"];
var icon; var icon;
if (nb in ScoMarkerIcons) { if (nb in ScoMarkerIcons) {
icon = ScoMarkerIcons[nb]; icon = ScoMarkerIcons[nb];
} else { } else {
icon = new google.maps.MarkerImage( 'https://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + nb + '|FF0000|000000' ); icon = new google.maps.MarkerImage(
"https://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=" +
nb +
"|FF0000|000000"
);
ScoMarkerIcons[nb] = icon; // cache ScoMarkerIcons[nb] = icon; // cache
} }
$('#lyc_map_canvas').gmap( $("#lyc_map_canvas")
'addMarker', .gmap("addMarker", {
{'position': lycee['position'], 'bounds': true, 'nomlycee' : lycee['name'], 'icon' : icon } position: lycee["position"],
).click( bounds: true,
function() { nomlycee: lycee["name"],
$('#lyc_map_canvas').gmap('openInfoWindow', {'content': this.nomlycee}, this); icon: icon,
} })
.click(function () {
$("#lyc_map_canvas").gmap(
"openInfoWindow",
{ content: this.nomlycee },
this
); );
});
} }
}); });
}); });

View File

@ -1,8 +1,3 @@
/* Page édition module */ /* Page édition module */
$(document).ready(function () {});
$(document).ready(function () {
});

View File

@ -1,35 +1,31 @@
// Edition tags sur modules // Edition tags sur modules
$(function () {
$(function() { $(".module_tag_editor").tagEditor({
$('.module_tag_editor').tagEditor({ initialTags: "",
initialTags: '', placeholder: "Tags du module ...",
placeholder: 'Tags du module ...',
forceLowercase: false, forceLowercase: false,
onChange: function(field, editor, tags) { onChange: function (field, editor, tags) {
$.post('module_tag_set', $.post("module_tag_set", {
{
module_id: field.data("module_id"), module_id: field.data("module_id"),
taglist: tags.join() taglist: tags.join(),
}); });
}, },
autocomplete: { autocomplete: {
delay: 200, // ms before suggest delay: 200, // ms before suggest
position: { collision: 'flip' }, // automatic menu position up/down position: { collision: "flip" }, // automatic menu position up/down
source: "module_tag_search" source: "module_tag_search",
}, },
}); });
// version readonly // version readonly
readOnlyTags($('.module_tag_editor_ro')); readOnlyTags($(".module_tag_editor_ro"));
$(".sco_tag_checkbox").click(function () {
$('.sco_tag_checkbox').click(function() { if ($(this).is(":checked")) {
if( $(this).is(':checked')) {
$(".sco_tag_edit").show(); $(".sco_tag_edit").show();
} else { } else {
$(".sco_tag_edit").hide(); $(".sco_tag_edit").hide();
} }
}); });
}); });

View File

@ -8,30 +8,25 @@ function change_ue_inscr(elt) {
} else { } else {
url = elt.dataset.url_desinscr; url = elt.dataset.url_desinscr;
} }
$.post(url, $.post(url, {}, function (result) {
{},
function (result) {
sco_message("changement inscription UE enregistré"); sco_message("changement inscription UE enregistré");
} });
);
} }
$(function () { $(function () {
$("table#but_ue_inscriptions").DataTable( $("table#but_ue_inscriptions").DataTable({
{
paging: false, paging: false,
searching: true, searching: true,
info: false, info: false,
autoWidth: false, autoWidth: false,
fixedHeader: { fixedHeader: {
header: true, header: true,
footer: false footer: false,
}, },
orderCellsTop: true, // cellules ligne 1 pour tri orderCellsTop: true, // cellules ligne 1 pour tri
aaSorting: [], // Prevent initial sorting aaSorting: [], // Prevent initial sorting
"oLanguage": { oLanguage: {
"sSearch": "Chercher :" sSearch: "Chercher :",
} },
} });
);
}); });

View File

@ -1,42 +1,48 @@
// Affichage parcours etudiant // Affichage parcours etudiant
// (uses jQuery) // (uses jQuery)
function toggle_vis(e, new_state) { // change visibility of tr (UE in tr and next tr) function toggle_vis(e, new_state) {
// change visibility of tr (UE in tr and next tr)
// e is the span containg the clicked +/- icon // e is the span containg the clicked +/- icon
var formsemestre_class = e.classList[1]; var formsemestre_class = e.classList[1];
var tr = e.parentNode.parentNode; var tr = e.parentNode.parentNode;
if (new_state == undefined) { if (new_state == undefined) {
// current state: use alt attribute of current image // current state: use alt attribute of current image
if (e.childNodes[0].alt == '+') { if (e.childNodes[0].alt == "+") {
new_state=false; new_state = false;
} else { } else {
new_state=true; new_state = true;
} }
} }
if (new_state) { if (new_state) {
new_tr_display = 'none'; new_tr_display = "none";
} else { } else {
new_tr_display = 'table-row'; new_tr_display = "table-row";
} }
$("tr."+formsemestre_class+":not(.rcp_l1)").css('display', new_tr_display) $("tr." + formsemestre_class + ":not(.rcp_l1)").css(
"display",
new_tr_display
);
// find next tr in siblings (xxx legacy code, could be optimized) // find next tr in siblings (xxx legacy code, could be optimized)
var sibl = tr.nextSibling; var sibl = tr.nextSibling;
while ((sibl != null) && sibl.nodeType != 1 && sibl.tagName != 'TR') { while (sibl != null && sibl.nodeType != 1 && sibl.tagName != "TR") {
sibl = sibl.nextSibling; sibl = sibl.nextSibling;
} }
if (sibl) { if (sibl) {
var td_disp = 'none'; var td_disp = "none";
if (new_state) { if (new_state) {
e.innerHTML = '<img width="13" height="13" border="0" title="" alt="+" src="/ScoDoc/static/icons/plus_img.png"/>'; e.innerHTML =
'<img width="13" height="13" border="0" title="" alt="+" src="/ScoDoc/static/icons/plus_img.png"/>';
} else { } else {
e.innerHTML = '<img width="13" height="13" border="0" title="" alt="-" src="/ScoDoc/static/icons/minus_img.png"/>'; e.innerHTML =
td_disp = 'inline'; '<img width="13" height="13" border="0" title="" alt="-" src="/ScoDoc/static/icons/minus_img.png"/>';
td_disp = "inline";
} }
// acronymes d'UE // acronymes d'UE
sibl = e.parentNode.nextSibling; sibl = e.parentNode.nextSibling;
while (sibl != null) { while (sibl != null) {
if (sibl.nodeType == 1 && sibl.className == 'ue_acro') if (sibl.nodeType == 1 && sibl.className == "ue_acro")
sibl.childNodes[0].style.display = td_disp; sibl.childNodes[0].style.display = td_disp;
sibl = sibl.nextSibling; sibl = sibl.nextSibling;
} }
@ -47,13 +53,15 @@ var sems_state = false;
function toggle_all_sems(e) { function toggle_all_sems(e) {
var elems = $("span.toggle_sem"); var elems = $("span.toggle_sem");
for (var i=0; i < elems.length; i++) { for (var i = 0; i < elems.length; i++) {
toggle_vis(elems[i], sems_state); toggle_vis(elems[i], sems_state);
} }
sems_state = !sems_state; sems_state = !sems_state;
if (sems_state) { if (sems_state) {
e.innerHTML = '<img width="18" height="18" border="0" title="" alt="-" src="/ScoDoc/static/icons/minus18_img.png"/>'; e.innerHTML =
'<img width="18" height="18" border="0" title="" alt="-" src="/ScoDoc/static/icons/minus18_img.png"/>';
} else { } else {
e.innerHTML = '<img width="18" height="18" border="0" title="" alt="+" src="/ScoDoc/static/icons/plus18_img.png"/>'; e.innerHTML =
'<img width="18" height="18" border="0" title="" alt="+" src="/ScoDoc/static/icons/plus18_img.png"/>';
} }
} }

View File

@ -1,8 +1,7 @@
class ref_competences extends HTMLElement { class ref_competences extends HTMLElement {
constructor() { constructor() {
super(); super();
this.shadow = this.attachShadow({ mode: 'open' }); this.shadow = this.attachShadow({ mode: "open" });
/* Template de base */ /* Template de base */
this.shadow.innerHTML = ` this.shadow.innerHTML = `
@ -13,9 +12,13 @@ class ref_competences extends HTMLElement {
`; `;
/* Style du module */ /* Style du module */
const styles = document.createElement('link'); const styles = document.createElement("link");
styles.setAttribute('rel', 'stylesheet'); styles.setAttribute("rel", "stylesheet");
styles.setAttribute('href', removeLastTwoComponents(getCurrentScriptPath()) + '/css/ref-competences.css'); styles.setAttribute(
"href",
removeLastTwoComponents(getCurrentScriptPath()) +
"/css/ref-competences.css"
);
this.shadow.appendChild(styles); this.shadow.appendChild(styles);
} }
@ -30,18 +33,20 @@ class ref_competences extends HTMLElement {
Object.entries(this.data.parcours).forEach(([cle, parcours]) => { Object.entries(this.data.parcours).forEach(([cle, parcours]) => {
let div = document.createElement("div"); let div = document.createElement("div");
div.innerHTML = `<a title="${parcours.libelle}">${parcours.code}</a>`; div.innerHTML = `<a title="${parcours.libelle}">${parcours.code}</a>`;
div.addEventListener("click", (event) => { this.competences(event, cle) }) div.addEventListener("click", (event) => {
this.competences(event, cle);
});
parcoursDIV.appendChild(div); parcoursDIV.appendChild(div);
}) });
this.initCompetences(); this.initCompetences();
} }
initCompetences() { initCompetences() {
this.competencesNumber = {}; this.competencesNumber = {};
let i = 0; let i = 0;
Object.keys(this.data.competences).forEach(competence => { Object.keys(this.data.competences).forEach((competence) => {
this.competencesNumber[competence] = 1 + i++ % 6; this.competencesNumber[competence] = 1 + (i++ % 6);
}) });
} }
competences(event, cle) { competences(event, cle) {
@ -53,54 +58,74 @@ class ref_competences extends HTMLElement {
/* Création des compétences */ /* Création des compétences */
let competencesBucket = []; let competencesBucket = [];
Object.entries(this.data.parcours[cle].annees).forEach(([annee, dataAnnee]) => { Object.entries(this.data.parcours[cle].annees).forEach(
Object.entries(dataAnnee.competences).forEach(([competence, niveauCle]) => { ([annee, dataAnnee]) => {
Object.entries(dataAnnee.competences).forEach(
([competence, niveauCle]) => {
let numComp = this.competencesNumber[competence]; let numComp = this.competencesNumber[competence];
let divCompetence = document.createElement("div"); let divCompetence = document.createElement("div");
divCompetence.innerText = `${competence} ${niveauCle.niveau}`; divCompetence.innerText = `${competence} ${niveauCle.niveau}`;
divCompetence.style.gridRowStart = annee; divCompetence.style.gridRowStart = annee;
divCompetence.style.gridColumnStart = competence.replaceAll(" ", "_"); divCompetence.style.gridColumnStart = competence.replaceAll(
" ",
"_"
);
divCompetence.className = "comp" + numComp; divCompetence.className = "comp" + numComp;
divCompetence.dataset.competence = `${competence} ${niveauCle.niveau}`; divCompetence.dataset.competence = `${competence} ${niveauCle.niveau}`;
divCompetence.addEventListener("click", (event) => { this.AC(event, competence, niveauCle.niveau, annee, numComp) }) divCompetence.addEventListener("click", (event) => {
this.AC(event, competence, niveauCle.niveau, annee, numComp);
});
divCompetences.appendChild(divCompetence); divCompetences.appendChild(divCompetence);
competencesBucket.push(competence); competencesBucket.push(competence);
}) }
}) );
}
);
/* Affectation de la taille des éléments */ /* Affectation de la taille des éléments */
//divCompetences.style.setProperty("--competence-size", `calc(${100 / competencesBucket.length}% )`); //divCompetences.style.setProperty("--competence-size", `calc(${100 / competencesBucket.length}% )`);
let gridTemplate = ""; let gridTemplate = "";
Object.keys(this.data.competences).forEach(competence => { Object.keys(this.data.competences).forEach((competence) => {
if (competencesBucket.indexOf(competence) == -1) { if (competencesBucket.indexOf(competence) == -1) {
gridTemplate += `[${competence.replaceAll(" ", "_")}] 0`; gridTemplate += `[${competence.replaceAll(" ", "_")}] 0`;
} else { } else {
gridTemplate += `[${competence.replaceAll(" ", "_")}] 1fr`; gridTemplate += `[${competence.replaceAll(" ", "_")}] 1fr`;
} }
}) });
this.shadow.querySelector(".competences").style.gridTemplateColumns = gridTemplate; this.shadow.querySelector(".competences").style.gridTemplateColumns =
gridTemplate;
/* Réaffectation des focus */ /* Réaffectation des focus */
this.shadow.querySelectorAll(".AC").forEach(ac => { this.shadow.querySelectorAll(".AC").forEach((ac) => {
this.shadow.querySelector(`[data-competence="${ac.dataset.competence}"]`).classList.add("focus"); this.shadow
.querySelector(`[data-competence="${ac.dataset.competence}"]`)
.classList.add("focus");
}); });
} }
AC(event, competence, niveau, annee, numComp) { AC(event, competence, niveau, annee, numComp) {
event.currentTarget.classList.toggle("focus"); event.currentTarget.classList.toggle("focus");
if (this.shadow.querySelector(`.ACs [data-competence="${competence} ${niveau}"]`)) { if (
this.shadow.querySelector(`.ACs [data-competence="${competence} ${niveau}"]`).remove(); this.shadow.querySelector(
`.ACs [data-competence="${competence} ${niveau}"]`
)
) {
this.shadow
.querySelector(`.ACs [data-competence="${competence} ${niveau}"]`)
.remove();
} else { } else {
let output = ` let output = `
<ul class=AC data-competence="${competence} ${niveau}"> <ul class=AC data-competence="${competence} ${niveau}">
<h2 class=comp${numComp}>${competence} ${niveau}</h2> <h2 class=comp${numComp}>${competence} ${niveau}</h2>
`; `;
Object.entries(this.data.competences[competence].niveaux["BUT" + annee].app_critiques).forEach(([num, contenu]) => { Object.entries(
this.data.competences[competence].niveaux["BUT" + annee].app_critiques
).forEach(([num, contenu]) => {
output += `<li><div class=comp${numComp}>${num}</div><div>${contenu.libelle}</div></li>`; output += `<li><div class=comp${numComp}>${num}</div><div>${contenu.libelle}</div></li>`;
}) });
this.shadow.querySelector(".ACs").innerHTML += output + "</ul>"; this.shadow.querySelector(".ACs").innerHTML += output + "</ul>";
} }
} }
} }
customElements.define('ref-competences', ref_competences); customElements.define("ref-competences", ref_competences);

View File

@ -377,10 +377,12 @@ class releveBUT extends HTMLElement {
<div class=info>`; <div class=info>`;
if (!dataUE.date_capitalisation) { if (!dataUE.date_capitalisation) {
output += ` Bonus&nbsp;:&nbsp;${dataUE.bonus || 0}&nbsp;- `; output += ` Bonus&nbsp;:&nbsp;${dataUE.bonus || 0}&nbsp;- `;
if(dataUE.malus >= 0) { if (dataUE.malus >= 0) {
output += `Malus&nbsp;:&nbsp;${dataUE.malus || 0}`; output += `Malus&nbsp;:&nbsp;${dataUE.malus || 0}`;
} else { } else {
output += `Bonus&nbsp;complémentaire&nbsp;:&nbsp;${-dataUE.malus || 0}`; output += `Bonus&nbsp;complémentaire&nbsp;:&nbsp;${
-dataUE.malus || 0
}`;
} }
} else { } else {
output += ` le ${this.ISOToDate( output += ` le ${this.ISOToDate(

View File

@ -4,30 +4,25 @@ function toggle_new_ue_form(state) {
// active/desactive le formulaire "nouvelle UE" // active/desactive le formulaire "nouvelle UE"
var text_color; var text_color;
if (state) { if (state) {
text_color = 'rgb(180,160,160)'; text_color = "rgb(180,160,160)";
} else { } else {
text_color = 'rgb(0,0,0)'; text_color = "rgb(0,0,0)";
} }
$("#tf_extue_titre td:eq(1) input").prop("disabled", state); $("#tf_extue_titre td:eq(1) input").prop("disabled", state);
$("#tf_extue_titre").css('color', text_color) $("#tf_extue_titre").css("color", text_color);
$("#tf_extue_acronyme td:eq(1) input").prop("disabled", state); $("#tf_extue_acronyme td:eq(1) input").prop("disabled", state);
$("#tf_extue_acronyme").css('color', text_color) $("#tf_extue_acronyme").css("color", text_color);
$("#tf_extue_type td:eq(1) select").prop("disabled", state); $("#tf_extue_type td:eq(1) select").prop("disabled", state);
$("#tf_extue_type").css('color', text_color) $("#tf_extue_type").css("color", text_color);
$("#tf_extue_ects td:eq(1) input").prop("disabled", state); $("#tf_extue_ects td:eq(1) input").prop("disabled", state);
$("#tf_extue_ects").css('color', text_color) $("#tf_extue_ects").css("color", text_color);
} }
function update_external_ue_form() { function update_external_ue_form() {
var state = (tf.existing_ue.value != ""); var state = tf.existing_ue.value != "";
toggle_new_ue_form(state); toggle_new_ue_form(state);
} }

View File

@ -5,29 +5,34 @@ var elt_sem_apo_editor = null;
$(document).ready(function () { $(document).ready(function () {
var table_options = { var table_options = {
"paging": false, paging: false,
"searching": false, searching: false,
"info": false, info: false,
/* "autoWidth" : false, */ /* "autoWidth" : false, */
"fixedHeader": { fixedHeader: {
"header": true, header: true,
"footer": true footer: true,
}, },
"orderCellsTop": true, // cellules ligne 1 pour tri orderCellsTop: true, // cellules ligne 1 pour tri
"aaSorting": [], // Prevent initial sorting aaSorting: [], // Prevent initial sorting
}; };
$('table.semlist').DataTable(table_options); $("table.semlist").DataTable(table_options);
let table_editable = document.querySelector("table#semlist.apo_editable"); let table_editable = document.querySelector("table#semlist.apo_editable");
if (table_editable) { if (table_editable) {
let save_url = document.querySelector("table#semlist.apo_editable").dataset.apo_save_url; let save_url = document.querySelector("table#semlist.apo_editable").dataset
.apo_save_url;
apo_editor = new ScoFieldEditor(".etapes_apo_str", save_url, false); apo_editor = new ScoFieldEditor(".etapes_apo_str", save_url, false);
save_url = document.querySelector("table#semlist.apo_editable").dataset.elt_annee_apo_save_url; save_url = document.querySelector("table#semlist.apo_editable").dataset
elt_annee_apo_editor = new ScoFieldEditor(".elt_annee_apo", save_url, false); .elt_annee_apo_save_url;
elt_annee_apo_editor = new ScoFieldEditor(
".elt_annee_apo",
save_url,
false
);
save_url = document.querySelector("table#semlist.apo_editable").dataset.elt_sem_apo_save_url; save_url = document.querySelector("table#semlist.apo_editable").dataset
.elt_sem_apo_save_url;
elt_sem_apo_editor = new ScoFieldEditor(".elt_sem_apo", save_url, false); elt_sem_apo_editor = new ScoFieldEditor(".elt_sem_apo", save_url, false);
} }
}); });

View File

@ -43,7 +43,7 @@ function build_table(data) {
sumsRessources[cellule.y] = (sumsRessources[cellule.y] ?? 0) + value; sumsRessources[cellule.y] = (sumsRessources[cellule.y] ?? 0) + value;
sumsUE[cellule.x] = (sumsUE[cellule.x] ?? 0) + value; sumsUE[cellule.x] = (sumsUE[cellule.x] ?? 0) + value;
} }
}) });
output += showSums(sumsRessources, sumsUE); output += showSums(sumsRessources, sumsUE);
document.querySelector(".tableau").innerHTML = output; document.querySelector(".tableau").innerHTML = output;
@ -71,7 +71,7 @@ function showSums(sumsRessources, sumsUE) {
"> ">
${value / 100} ${value / 100}
</div>`; </div>`;
}) });
Object.entries(sumsRessources).forEach(([num, value]) => { Object.entries(sumsRessources).forEach(([num, value]) => {
output += ` output += `
@ -88,7 +88,7 @@ function showSums(sumsRessources, sumsUE) {
"> ">
${value / 100} ${value / 100}
</div>`; </div>`;
}) });
return output; return output;
} }
@ -102,9 +102,13 @@ function installListeners() {
return; return;
} }
document.body.addEventListener("keydown", key); 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 () {
cellule.addEventListener("dblclick", function () { modifCell(this) }); selectCell(this);
});
cellule.addEventListener("dblclick", function () {
modifCell(this);
});
cellule.addEventListener("blur", function () { cellule.addEventListener("blur", function () {
let currentModif = document.querySelector(".modifying"); let currentModif = document.querySelector(".modifying");
if (currentModif) { if (currentModif) {
@ -117,7 +121,6 @@ function installListeners() {
}); });
} }
/*********************************/ /*********************************/
/* Interaction avec les cellules */ /* Interaction avec les cellules */
/*********************************/ /*********************************/
@ -132,11 +135,11 @@ function selectCell(obj) {
} }
} }
document.querySelectorAll(".selected, .modifying").forEach(cellule => { document.querySelectorAll(".selected, .modifying").forEach((cellule) => {
cellule.classList.remove("selected", "modifying"); cellule.classList.remove("selected", "modifying");
cellule.removeAttribute("contentEditable"); cellule.removeAttribute("contentEditable");
cellule.removeEventListener("keydown", keyCell); cellule.removeEventListener("keydown", keyCell);
}) });
obj.classList.add("selected"); obj.classList.add("selected");
} }
@ -151,21 +154,39 @@ function modifCell(obj) {
function key(event) { function key(event) {
switch (event.key) { switch (event.key) {
case "Enter": modifCell(document.querySelector(".selected")); event.preventDefault(); break; case "Enter":
case "ArrowRight": ArrowMove(1, 0); break; modifCell(document.querySelector(".selected"));
case "ArrowLeft": ArrowMove(-1, 0); break; event.preventDefault();
case "ArrowUp": ArrowMove(0, -1); break; break;
case "ArrowDown": ArrowMove(0, 1); break; case "ArrowRight":
ArrowMove(1, 0);
break;
case "ArrowLeft":
ArrowMove(-1, 0);
break;
case "ArrowUp":
ArrowMove(0, -1);
break;
case "ArrowDown":
ArrowMove(0, 1);
break;
} }
} }
function ArrowMove(x, y) { function ArrowMove(x, y) {
if (document.querySelector(".modifying") || !document.querySelector(".selected")) { if (
document.querySelector(".modifying") ||
!document.querySelector(".selected")
) {
return; // S'il n'y a aucune cellule selectionnée ou si une cellule est encours de modification, on ne change pas return; // S'il n'y a aucune cellule selectionnée ou si une cellule est encours de modification, on ne change pas
} }
let selected = document.querySelector(".selected"); let selected = document.querySelector(".selected");
let next = document.querySelector(`[data-x="${parseInt(selected.dataset.x) + x}"][data-y="${parseInt(selected.dataset.y) + y}"][data-editable="true"]`); let next = document.querySelector(
`[data-x="${parseInt(selected.dataset.x) + x}"][data-y="${
parseInt(selected.dataset.y) + y
}"][data-editable="true"]`
);
if (next) { if (next) {
selectCell(next); selectCell(next);
@ -177,7 +198,7 @@ function keyCell(event) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
if (!save(this)) { if (!save(this)) {
return return;
} }
this.classList.remove("modifying"); this.classList.remove("modifying");
let selected = document.querySelector(".selected"); let selected = document.querySelector(".selected");
@ -190,22 +211,34 @@ function keyCell(event) {
function processSums() { function processSums() {
let sum = 0; let sum = 0;
document.querySelectorAll(`[data-editable="true"][data-x="${this.dataset.x}"]:not(:empty)`).forEach(e => { document
.querySelectorAll(
`[data-editable="true"][data-x="${this.dataset.x}"]:not(:empty)`
)
.forEach((e) => {
let val = parseFloat(e.innerText); let val = parseFloat(e.innerText);
if (!isNaN(val)) { if (!isNaN(val)) {
sum += val * 100; sum += val * 100;
} }
}) });
document.querySelector(`.sums[data-x="${this.dataset.x}"][data-y="${lastY}"]`).innerText = sum / 100; document.querySelector(
`.sums[data-x="${this.dataset.x}"][data-y="${lastY}"]`
).innerText = sum / 100;
sum = 0; sum = 0;
document.querySelectorAll(`[data-editable="true"][data-y="${this.dataset.y}"]:not(:empty)`).forEach(e => { document
.querySelectorAll(
`[data-editable="true"][data-y="${this.dataset.y}"]:not(:empty)`
)
.forEach((e) => {
let val = parseFloat(e.innerText); let val = parseFloat(e.innerText);
if (!isNaN(val)) { if (!isNaN(val)) {
sum += val * 100; sum += val * 100;
} }
}) });
document.querySelector(`.sums[data-x="${lastX}"][data-y="${this.dataset.y}"]`).innerText = sum / 100; document.querySelector(
`.sums[data-x="${lastX}"][data-y="${this.dataset.y}"]`
).innerText = sum / 100;
} }
/******************************/ /******************************/

View File

@ -8,4 +8,3 @@ $().ready(function () {
$(sp).load(SCO_URL + "/etud_photo_html?etudid=" + etudid); $(sp).load(SCO_URL + "/etud_photo_html?etudid=" + etudid);
} }
}); });

View File

@ -1,5 +1,5 @@
// Edition elements programme "en place" // Edition elements programme "en place"
$(function() { $(function () {
$('.span_apo_edit').jinplace(); $(".span_apo_edit").jinplace();
}); });

View File

@ -1,30 +1,30 @@
function refresh() { function refresh() {
if ($("input[name='welcome:list']").is(":checked")) { if ($("input[name='welcome:list']").is(":checked")) {
$("input[name='reset_password:list']").closest("tr").css("display", "table-row") $("input[name='reset_password:list']")
.closest("tr")
.css("display", "table-row");
if ($("input[name='reset_password:list']").is(":checked")) { if ($("input[name='reset_password:list']").is(":checked")) {
$("#tf_password").closest('tr').css("display", "none"); $("#tf_password").closest("tr").css("display", "none");
$("#tf_password2").closest('tr').css("display", "none"); $("#tf_password2").closest("tr").css("display", "none");
} else { } else {
// Le mot de passe doit être saisi // Le mot de passe doit être saisi
$("#tf_password").closest('tr').css("display", "table-row"); $("#tf_password").closest("tr").css("display", "table-row");
$("#tf_password2").closest('tr').css("display", "table-row"); $("#tf_password2").closest("tr").css("display", "table-row");
} }
} else { } else {
// Le mot de passe doit être saisi // Le mot de passe doit être saisi
$("input[name='reset_password:list']").closest("tr").css("display", "none") $("input[name='reset_password:list']").closest("tr").css("display", "none");
$("#tf_password").closest('tr').css("display", "table-row"); $("#tf_password").closest("tr").css("display", "table-row");
$("#tf_password2").closest('tr').css("display", "table-row"); $("#tf_password2").closest("tr").css("display", "table-row");
} }
} }
$(function () { $(function () {
$("input[name='welcome:list']").click(function () { $("input[name='welcome:list']").click(function () {
refresh(); refresh();
}) });
$("input[name='reset_password:list']").click(function () { $("input[name='reset_password:list']").click(function () {
refresh(); refresh();
}) });
refresh(); refresh();
}) });

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.6.55" SCOVERSION = "9.6.56"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"