js/ : prettification (vscode prettier) avec tabs=2

This commit is contained in:
Emmanuel Viennet 2023-11-17 13:53:17 +01:00
parent a7935d375a
commit 1b54d7c22c
31 changed files with 1227 additions and 1141 deletions

View File

@ -67,18 +67,24 @@ CSSSTYLES = html_sco_header.BOOTSTRAP_MULTISELECT_CSS
def groups_view(
group_ids=(),
fmt="html",
# Options pour listes:
with_codes=0,
etat=None,
with_paiement=0, # si vrai, ajoute colonnes infos paiement droits et finalisation inscription (lent car interrogation portail)
with_archives=0, # ajoute colonne avec noms fichiers archivés
with_paiement=0,
with_archives=0,
with_annotations=0,
with_bourse=0,
formsemestre_id=None, # utilise si aucun groupe selectionné
formsemestre_id=None,
):
"""Affichage des étudiants des groupes indiqués
group_ids: liste de group_id
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:
groups_infos = DisplayedGroupsInfos(

View File

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

View File

@ -1,7 +1,6 @@
// Affichage anciens (non BUT) bulletin de notes
// (uses jQuery)
// Change visibility of UE details (les <tr> de classe "notes_bulletin_row_mod" suivant)
// La table a la structure suivante:
// <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;
if (new_state == undefined) {
// current state: use alt attribute of current image
if (e.childNodes[0].alt == '+') {
if (e.childNodes[0].alt == "+") {
new_state = false;
} else {
new_state = true;
@ -25,26 +24,30 @@ function toggle_vis_ue(e, new_state) {
var tr = tr.nextSibling;
//while ((tr != null) && sibl.tagName == 'TR') {
var current = true;
while ((tr != null) && current) {
if ((tr.nodeType == 1) && (tr.tagName == 'TR')) {
while (tr != null && current) {
if (tr.nodeType == 1 && tr.tagName == "TR") {
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;
}
if (current) {
if (new_state) {
tr.style.display = 'none';
tr.style.display = "none";
} else {
tr.style.display = 'table-row';
tr.style.display = "table-row";
}
}
}
tr = tr.nextSibling;
}
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 {
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
// (no getElementBuClassName)
function getTRweek( week ) {
var tablecal = document.getElementById('maincalendar');
var all = tablecal.getElementsByTagName('tr');
var res = [] ;
for(var i=0; i < all.length; i++) {
if (all[i].className == week)
res[res.length] = all[i];
function getTRweek(week) {
var tablecal = document.getElementById("maincalendar");
var all = tablecal.getElementsByTagName("tr");
var res = [];
for (var i = 0; i < all.length; i++) {
if (all[i].className == week) res[res.length] = all[i];
}
return res;
}
@ -26,11 +25,10 @@ function getTRweek( week ) {
var HIGHLIGHTEDCELLS = [];
function deselectweeks() {
for(var i=0; i < HIGHLIGHTEDCELLS.length; i++) {
for (var i = 0; i < HIGHLIGHTEDCELLS.length; i++) {
var row = rows[i];
if (row) {
if (row.className.match('currentweek')) {
if (row.className.match("currentweek")) {
row.style.backgroundColor = CURRENTWEEKCOLOR;
} else {
row.style.backgroundColor = WEEKDAYCOLOR;
@ -44,11 +42,11 @@ function deselectweeks() {
function highlightweek(el) {
deselectweeks();
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 */
}
rows = getTRweek(week);
for (var i=0; i < rows.length; i++) {
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
row.style.backgroundColor = DAYHIGHLIGHT;
HIGHLIGHTEDCELLS[HIGHLIGHTEDCELLS.length] = row;
@ -58,7 +56,7 @@ function highlightweek(el) {
// click on a day
function wclick(el) {
monday = el.className;
form = document.getElementById('formw');
form.datelundi.value = monday.substr(2).replace(/_/g,'/').split(' ')[0];
form = document.getElementById("formw");
form.datelundi.value = monday.substr(2).replace(/_/g, "/").split(" ")[0];
form.submit();
}

View File

@ -2,5 +2,4 @@ function submit_form() {
$("#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) {
let id = "ds_" + idnum;
@ -47,7 +47,7 @@ function restore_detail(detail, id) {
}
function add_listener(detail) {
detail.addEventListener('toggle', (e) => {
detail.addEventListener("toggle", (e) => {
let id = e.target.getAttribute(ID_ATTRIBUTE);
let ante = e.target.getAttribute("open");
if (ante == null) {
@ -56,16 +56,16 @@ function add_listener(detail) {
localStorage.setItem(id, true);
}
e.stopPropagation();
})
});
}
function reset_ds() {
let idnum = 0;
keepDetails = true;
details = document.querySelectorAll("details")
details = document.querySelectorAll("details");
details.forEach(function (detail) {
let id = genere_id(detail, idnum);
console.log("Processing " + id)
console.log("Processing " + id);
if (keepDetails) {
restore_detail(detail, id);
} else {
@ -76,7 +76,7 @@ function reset_ds() {
});
}
window.addEventListener('load', function() {
window.addEventListener("load", function () {
console.log("details/summary persistence ON");
reset_ds();
})
});

View File

@ -1,38 +1,32 @@
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,
'attr': attr_name,
'value': attr_value
partition_id: partition_id,
attr: attr_name,
value: attr_value,
},
function (result) {
sco_message(result);
});
}
);
return;
}
// Met à jour bul_show_rank lorsque checkbox modifiees:
function update_rk(e) {
var partition_id = $(e).attr('data-partition_id');
var partition_id = $(e).attr("data-partition_id");
var v;
if (e.checked)
v = '1';
else
v = '0';
_partition_set_attr(partition_id, 'bul_show_rank', v);
if (e.checked) v = "1";
else v = "0";
_partition_set_attr(partition_id, "bul_show_rank", v);
}
function update_show_in_list(e) {
var partition_id = $(e).attr('data-partition_id');
var partition_id = $(e).attr("data-partition_id");
var v;
if (e.checked)
v = '1';
else
v = '0';
if (e.checked) v = "1";
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() {
var ue_type = $("#tf_type")[0].value;
if (ue_type == "1") { /* UE SPORT */
if (ue_type == "1") {
/* UE SPORT */
$("#bonus_description").show();
var query = "/ScoDoc/get_bonus_description/default";
$.get(query, '', function (data) {
$.get(query, "", function (data) {
$("#bonus_description").html(data);
});
} else {
@ -30,29 +31,38 @@ function update_bonus_description() {
function update_ue_list() {
let ue_id = $("#tf_ue_id")[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;
$.get(query, '', function (data) {
let query =
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);
});
}
function set_ue_parcour(checkbox) {
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 = [];
checkboxes.forEach(function (checkbox) {
parcours_ids.push(checkbox.value);
});
fetch(url, {
method: 'POST',
method: "POST",
headers: {
'Content-Type': 'application/json'
"Content-Type": "application/json",
},
body: JSON.stringify(parcours_ids)
body: JSON.stringify(parcours_ids),
})
.then(response => response.json())
.then(data => {
.then((response) => response.json())
.then((data) => {
if (data.status == 404) {
sco_error_message(data.message);
} 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
// 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
@ -22,19 +21,21 @@ function etud_autocomplete_config(with_dept = false) {
}
},
// Data source 'Object' key to be searched
keys: ["nom"]
keys: ["nom"],
},
events: {
input: {
selection: (event) => {
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
const etudidField = document.getElementById('etudid');
const etudidField = document.getElementById("etudid");
etudidField.value = event.detail.selection.value.id;
autoCompleteJS.input.value = selection;
}
}
},
},
},
resultsList: {
element: (list, data) => {
@ -48,7 +49,7 @@ function etud_autocomplete_config(with_dept = false) {
// Append message element to the results list
list.prepend(message);
// Efface l'etudid
const etudidField = document.getElementById('etudid');
const etudidField = document.getElementById("etudid");
etudidField.value = "";
}
},
@ -58,8 +59,10 @@ function etud_autocomplete_config(with_dept = false) {
highlight: true,
element: (item, data) => {
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
$(function () {
$('table.evaluations_recap').DataTable(
{
$("table.evaluations_recap").DataTable({
paging: false,
searching: true,
info: false,
autoWidth: false,
fixedHeader: {
header: true,
footer: false
footer: false,
},
orderCellsTop: true, // cellules ligne 1 pour tri
aaSorting: [], // Prevent initial sorting
colReorder: true,
"columnDefs": [
columnDefs: [
{
// colonne date, triable (XXX ne fonctionne pas)
targets: ["date"],
"type": "string",
type: "string",
},
],
dom: 'Bfrtip',
dom: "Bfrtip",
buttons: [
{
extend: 'copyHtml5',
text: 'Copier',
exportOptions: { orthogonal: 'export' }
extend: "copyHtml5",
text: "Copier",
exportOptions: { orthogonal: "export" },
},
{
extend: 'excelHtml5',
exportOptions: { orthogonal: 'export' },
title: document.querySelector('table.evaluations_recap').dataset.filename
extend: "excelHtml5",
exportOptions: { orthogonal: "export" },
title: document.querySelector("table.evaluations_recap").dataset
.filename,
},
],
})
});
});

View File

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

View File

@ -4,25 +4,37 @@ var apo_mod_editor = null;
$(document).ready(function () {
var table_options = {
"paging": false,
"searching": false,
"info": false,
paging: false,
searching: false,
info: false,
/* "autoWidth" : false, */
"fixedHeader": {
"header": true,
"footer": true
fixedHeader: {
header: true,
footer: true,
},
"orderCellsTop": true, // cellules ligne 1 pour tri
"aaSorting": [], // Prevent initial sorting
orderCellsTop: true, // cellules ligne 1 pour tri
aaSorting: [], // Prevent initial sorting
};
$('table#formation_table_recap').DataTable(table_options);
let table_editable = document.querySelector("table#formation_table_recap.apo_editable");
$("table#formation_table_recap").DataTable(table_options);
let table_editable = document.querySelector(
"table#formation_table_recap.apo_editable"
);
if (table_editable) {
let apo_ue_save_url = document.querySelector("table#formation_table_recap.apo_editable").dataset.apo_ue_save_url;
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);
let apo_ue_save_url = document.querySelector(
"table#formation_table_recap.apo_editable"
).dataset.apo_ue_save_url;
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();
}
$(window).on('load', function () {
$(window).on("load", function () {
change_semestre_id();
});

View File

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

View File

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

View File

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

View File

@ -2,33 +2,42 @@
var ScoMarkerIcons = {};
$().ready(function(){
$('#lyc_map_canvas').gmap(
{ 'center': '48.955741,2.34141',
'zoom' : 8,
'mapTypeId': google.maps.MapTypeId.ROADMAP
}).bind('init', function(event, map) {
for (var i =0; i < lycees_coords.length; i++) {
$().ready(function () {
$("#lyc_map_canvas")
.gmap({
center: "48.955741,2.34141",
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP,
})
.bind("init", function (event, map) {
for (var i = 0; i < lycees_coords.length; i++) {
var lycee = lycees_coords[i];
var nb = lycee['number'];
var nb = lycee["number"];
var icon;
if (nb in ScoMarkerIcons) {
icon = ScoMarkerIcons[nb];
} 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
}
$('#lyc_map_canvas').gmap(
'addMarker',
{'position': lycee['position'], 'bounds': true, 'nomlycee' : lycee['name'], 'icon' : icon }
).click(
function() {
$('#lyc_map_canvas').gmap('openInfoWindow', {'content': this.nomlycee}, this);
}
$("#lyc_map_canvas")
.gmap("addMarker", {
position: lycee["position"],
bounds: true,
nomlycee: lycee["name"],
icon: icon,
})
.click(function () {
$("#lyc_map_canvas").gmap(
"openInfoWindow",
{ content: this.nomlycee },
this
);
});
}
});
});

View File

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

View File

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

View File

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

View File

@ -1,42 +1,48 @@
// Affichage parcours etudiant
// (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
var formsemestre_class = e.classList[1];
var tr = e.parentNode.parentNode;
if (new_state == undefined) {
// current state: use alt attribute of current image
if (e.childNodes[0].alt == '+') {
new_state=false;
if (e.childNodes[0].alt == "+") {
new_state = false;
} else {
new_state=true;
new_state = true;
}
}
if (new_state) {
new_tr_display = 'none';
new_tr_display = "none";
} 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)
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;
}
if (sibl) {
var td_disp = 'none';
var td_disp = "none";
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 {
e.innerHTML = '<img width="13" height="13" border="0" title="" alt="-" src="/ScoDoc/static/icons/minus_img.png"/>';
td_disp = 'inline';
e.innerHTML =
'<img width="13" height="13" border="0" title="" alt="-" src="/ScoDoc/static/icons/minus_img.png"/>';
td_disp = "inline";
}
// acronymes d'UE
sibl = e.parentNode.nextSibling;
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 = sibl.nextSibling;
}
@ -47,13 +53,15 @@ var sems_state = false;
function toggle_all_sems(e) {
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);
}
sems_state = !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 {
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 {
constructor() {
super();
this.shadow = this.attachShadow({ mode: 'open' });
this.shadow = this.attachShadow({ mode: "open" });
/* Template de base */
this.shadow.innerHTML = `
@ -13,9 +12,13 @@ class ref_competences extends HTMLElement {
`;
/* Style du module */
const styles = document.createElement('link');
styles.setAttribute('rel', 'stylesheet');
styles.setAttribute('href', removeLastTwoComponents(getCurrentScriptPath()) + '/css/ref-competences.css');
const styles = document.createElement("link");
styles.setAttribute("rel", "stylesheet");
styles.setAttribute(
"href",
removeLastTwoComponents(getCurrentScriptPath()) +
"/css/ref-competences.css"
);
this.shadow.appendChild(styles);
}
@ -30,18 +33,20 @@ class ref_competences extends HTMLElement {
Object.entries(this.data.parcours).forEach(([cle, parcours]) => {
let div = document.createElement("div");
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);
})
});
this.initCompetences();
}
initCompetences() {
this.competencesNumber = {};
let i = 0;
Object.keys(this.data.competences).forEach(competence => {
this.competencesNumber[competence] = 1 + i++ % 6;
})
Object.keys(this.data.competences).forEach((competence) => {
this.competencesNumber[competence] = 1 + (i++ % 6);
});
}
competences(event, cle) {
@ -53,54 +58,74 @@ class ref_competences extends HTMLElement {
/* Création des compétences */
let competencesBucket = [];
Object.entries(this.data.parcours[cle].annees).forEach(([annee, dataAnnee]) => {
Object.entries(dataAnnee.competences).forEach(([competence, niveauCle]) => {
Object.entries(this.data.parcours[cle].annees).forEach(
([annee, dataAnnee]) => {
Object.entries(dataAnnee.competences).forEach(
([competence, niveauCle]) => {
let numComp = this.competencesNumber[competence];
let divCompetence = document.createElement("div");
divCompetence.innerText = `${competence} ${niveauCle.niveau}`;
divCompetence.style.gridRowStart = annee;
divCompetence.style.gridColumnStart = competence.replaceAll(" ", "_");
divCompetence.style.gridColumnStart = competence.replaceAll(
" ",
"_"
);
divCompetence.className = "comp" + numComp;
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);
competencesBucket.push(competence);
})
})
}
);
}
);
/* Affectation de la taille des éléments */
//divCompetences.style.setProperty("--competence-size", `calc(${100 / competencesBucket.length}% )`);
let gridTemplate = "";
Object.keys(this.data.competences).forEach(competence => {
Object.keys(this.data.competences).forEach((competence) => {
if (competencesBucket.indexOf(competence) == -1) {
gridTemplate += `[${competence.replaceAll(" ", "_")}] 0`;
} else {
gridTemplate += `[${competence.replaceAll(" ", "_")}] 1fr`;
}
})
this.shadow.querySelector(".competences").style.gridTemplateColumns = gridTemplate;
});
this.shadow.querySelector(".competences").style.gridTemplateColumns =
gridTemplate;
/* Réaffectation des focus */
this.shadow.querySelectorAll(".AC").forEach(ac => {
this.shadow.querySelector(`[data-competence="${ac.dataset.competence}"]`).classList.add("focus");
this.shadow.querySelectorAll(".AC").forEach((ac) => {
this.shadow
.querySelector(`[data-competence="${ac.dataset.competence}"]`)
.classList.add("focus");
});
}
AC(event, competence, niveau, annee, numComp) {
event.currentTarget.classList.toggle("focus");
if (this.shadow.querySelector(`.ACs [data-competence="${competence} ${niveau}"]`)) {
this.shadow.querySelector(`.ACs [data-competence="${competence} ${niveau}"]`).remove();
if (
this.shadow.querySelector(
`.ACs [data-competence="${competence} ${niveau}"]`
)
) {
this.shadow
.querySelector(`.ACs [data-competence="${competence} ${niveau}"]`)
.remove();
} else {
let output = `
<ul class=AC data-competence="${competence} ${niveau}">
<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>`;
})
});
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>`;
if (!dataUE.date_capitalisation) {
output += ` Bonus&nbsp;:&nbsp;${dataUE.bonus || 0}&nbsp;- `;
if(dataUE.malus >= 0) {
if (dataUE.malus >= 0) {
output += `Malus&nbsp;:&nbsp;${dataUE.malus || 0}`;
} else {
output += `Bonus&nbsp;complémentaire&nbsp;:&nbsp;${-dataUE.malus || 0}`;
output += `Bonus&nbsp;complémentaire&nbsp;:&nbsp;${
-dataUE.malus || 0
}`;
}
} else {
output += ` le ${this.ISOToDate(

View File

@ -4,30 +4,25 @@ function toggle_new_ue_form(state) {
// active/desactive le formulaire "nouvelle UE"
var text_color;
if (state) {
text_color = 'rgb(180,160,160)';
text_color = "rgb(180,160,160)";
} 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").css('color', text_color)
$("#tf_extue_titre").css("color", text_color);
$("#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").css('color', text_color)
$("#tf_extue_type").css("color", text_color);
$("#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() {
var state = (tf.existing_ue.value != "");
var state = tf.existing_ue.value != "";
toggle_new_ue_form(state);
}

View File

@ -5,29 +5,34 @@ var elt_sem_apo_editor = null;
$(document).ready(function () {
var table_options = {
"paging": false,
"searching": false,
"info": false,
paging: false,
searching: false,
info: false,
/* "autoWidth" : false, */
"fixedHeader": {
"header": true,
"footer": true
fixedHeader: {
header: true,
footer: true,
},
"orderCellsTop": true, // cellules ligne 1 pour tri
"aaSorting": [], // Prevent initial sorting
orderCellsTop: true, // cellules ligne 1 pour tri
aaSorting: [], // Prevent initial sorting
};
$('table.semlist').DataTable(table_options);
$("table.semlist").DataTable(table_options);
let table_editable = document.querySelector("table#semlist.apo_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);
save_url = document.querySelector("table#semlist.apo_editable").dataset.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_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);
}
});

View File

@ -43,7 +43,7 @@ function build_table(data) {
sumsRessources[cellule.y] = (sumsRessources[cellule.y] ?? 0) + value;
sumsUE[cellule.x] = (sumsUE[cellule.x] ?? 0) + value;
}
})
});
output += showSums(sumsRessources, sumsUE);
document.querySelector(".tableau").innerHTML = output;
@ -71,7 +71,7 @@ function showSums(sumsRessources, sumsUE) {
">
${value / 100}
</div>`;
})
});
Object.entries(sumsRessources).forEach(([num, value]) => {
output += `
@ -88,7 +88,7 @@ function showSums(sumsRessources, sumsUE) {
">
${value / 100}
</div>`;
})
});
return output;
}
@ -102,9 +102,13 @@ function installListeners() {
return;
}
document.body.addEventListener("keydown", key);
document.querySelectorAll("[data-editable=true]").forEach(cellule => {
cellule.addEventListener("click", function () { selectCell(this) });
cellule.addEventListener("dblclick", function () { modifCell(this) });
document.querySelectorAll("[data-editable=true]").forEach((cellule) => {
cellule.addEventListener("click", function () {
selectCell(this);
});
cellule.addEventListener("dblclick", function () {
modifCell(this);
});
cellule.addEventListener("blur", function () {
let currentModif = document.querySelector(".modifying");
if (currentModif) {
@ -117,7 +121,6 @@ function installListeners() {
});
}
/*********************************/
/* 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.removeAttribute("contentEditable");
cellule.removeEventListener("keydown", keyCell);
})
});
obj.classList.add("selected");
}
@ -151,21 +154,39 @@ function modifCell(obj) {
function key(event) {
switch (event.key) {
case "Enter": modifCell(document.querySelector(".selected")); event.preventDefault(); 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;
case "Enter":
modifCell(document.querySelector(".selected"));
event.preventDefault();
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) {
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
}
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) {
selectCell(next);
@ -177,7 +198,7 @@ function keyCell(event) {
event.preventDefault();
event.stopPropagation();
if (!save(this)) {
return
return;
}
this.classList.remove("modifying");
let selected = document.querySelector(".selected");
@ -190,22 +211,34 @@ function keyCell(event) {
function processSums() {
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);
if (!isNaN(val)) {
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;
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);
if (!isNaN(val)) {
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);
}
});

View File

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

View File

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

View File

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