Compare commits

...

10 Commits

44 changed files with 1407 additions and 1221 deletions

View File

@ -1014,7 +1014,7 @@ def _edit_one(assiduite_unique: Assiduite, data: dict) -> tuple[int, str]:
else assiduite_unique.external_data else assiduite_unique.external_data
) )
if force and not external_data.get("module", False): if force and not (external_data is not None and external_data.get("module", False) != ""):
errors.append( errors.append(
"param 'moduleimpl_id' : le moduleimpl_id ne peut pas être nul" "param 'moduleimpl_id' : le moduleimpl_id ne peut pas être nul"
) )

26
app/but/jury_export.py Normal file
View File

@ -0,0 +1,26 @@
##############################################################################
# ScoDoc
# Copyright (c) 1999 - 2023 Emmanuel Viennet. All rights reserved.
# See LICENSE
##############################################################################
"""Feuille d'export Jury BUT
"""
import datetime
from flask import render_template
from app.models import FormSemestre, FormSemestreInscription
from app.views import ScoData
def feuille_preparation_jury_but(formsemestre_id: int):
formsemestre: FormSemestre = FormSemestre.query.filter_by(
id=formsemestre_id
).first_or_404()
return render_template(
"but/jury_export.j2",
datetime=datetime,
formsemestre=formsemestre,
sco=ScoData(formsemestre=formsemestre),
)

View File

@ -300,7 +300,7 @@ def _load_and_convert_ics(formsemestre: FormSemestre) -> list[dict]:
.replace(tzinfo=timezone.utc) .replace(tzinfo=timezone.utc)
.astimezone(tz=None) .astimezone(tz=None)
.strftime("%H:%M"), .strftime("%H:%M"),
"jour": event.decoded("dtstart").isoformat(), "jour": event.decoded("dtstart").date().isoformat(),
"start": event.decoded("dtstart").isoformat(), "start": event.decoded("dtstart").isoformat(),
"end": event.decoded("dtend").isoformat(), "end": event.decoded("dtend").isoformat(),
} }

View File

@ -444,6 +444,12 @@ def formsemestre_status_menubar(formsemestre: FormSemestre) -> str:
"args": {"formsemestre_id": formsemestre_id}, "args": {"formsemestre_id": formsemestre_id},
"enabled": not formsemestre.formation.is_apc(), "enabled": not formsemestre.formation.is_apc(),
}, },
{
"title": "Générer feuille préparation Jury (BUT)",
"endpoint": "notes.feuille_preparation_jury_but",
"args": {"formsemestre_id": formsemestre_id},
"enabled": formsemestre.formation.is_apc(),
},
{ {
"title": "Éditer les PV et archiver les résultats", "title": "Éditer les PV et archiver les résultats",
"endpoint": "notes.formsemestre_archive", "endpoint": "notes.formsemestre_archive",

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(
@ -100,57 +106,52 @@ def groups_view(
with_bourse=with_bourse, with_bourse=with_bourse,
) )
H = [
html_sco_header.sco_header(
javascripts=JAVASCRIPTS,
cssstyles=CSSSTYLES,
init_qtip=True,
)
]
# Menu choix groupe
H.append("""<div id="group-tabs">""")
H.append(form_groups_choice(groups_infos, submit_on_change=True))
# Note: le formulaire est soumis a chaque modif des groupes # Note: le formulaire est soumis a chaque modif des groupes
# on pourrait faire comme pour le form de saisie des notes. Il faudrait pour cela: # on pourrait faire comme pour le form de saisie des notes. Il faudrait pour cela:
# - charger tous les etudiants au debut, quels que soient les groupes selectionnés # - charger tous les etudiants au debut, quels que soient les groupes selectionnés
# - ajouter du JS pour modifier les liens (arguments group_ids) quand le menu change # - ajouter du JS pour modifier les liens (arguments group_ids) quand le menu change
# Tabs return f"""
H.extend( { html_sco_header.sco_header(
( javascripts=JAVASCRIPTS,
"""<ul class="nav nav-tabs"> cssstyles=CSSSTYLES,
<li class="active"><a href="#tab-listes" data-toggle="tab">Listes</a></li> init_qtip=True,
<li><a href="#tab-photos" data-toggle="tab">Photos</a></li> )
<li><a href="#tab-abs" data-toggle="tab">Absences et feuilles...</a></li> }
</ul> <div id="group-tabs">
<!-- Menu choix groupe -->
{form_groups_choice(groups_infos, submit_on_change=True)}
<ul class="nav nav-tabs">
<li class="active"><a href="#tab-listes" data-toggle="tab">Listes</a></li>
<li><a href="#tab-photos" data-toggle="tab">Photos</a></li>
<li><a href="#tab-abs" data-toggle="tab">Absences et feuilles...</a></li>
</ul>
</div> </div>
<!-- Tab panes --> <!-- Tab panes -->
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane active" id="tab-listes"> <div class="tab-pane active" id="tab-listes">
""", {
groups_table( groups_table(
groups_infos=groups_infos, groups_infos=groups_infos,
fmt=fmt, fmt=fmt,
with_codes=with_codes, with_codes=with_codes,
etat=etat, etat=etat,
with_paiement=with_paiement, with_paiement=with_paiement,
with_archives=with_archives, with_archives=with_archives,
with_annotations=with_annotations, with_annotations=with_annotations,
with_bourse=with_bourse, with_bourse=with_bourse,
), )
"</div>", }
"""<div class="tab-pane" id="tab-photos">""", </div>
tab_photos_html(groups_infos, etat=etat), <div class="tab-pane" id="tab-photos">
#'<p>hello</p>', { tab_photos_html(groups_infos, etat=etat) }
"</div>", </div>
'<div class="tab-pane" id="tab-abs">', <div class="tab-pane" id="tab-abs">
tab_absences_html(groups_infos, etat=etat), { tab_absences_html(groups_infos, etat=etat) }
"</div>", </div>
) </div>
) { html_sco_header.sco_footer() }
"""
H.append(html_sco_header.sco_footer())
return "\n".join(H)
def form_groups_choice( def form_groups_choice(
@ -745,7 +746,7 @@ def groups_table(
H.append("</ul>") H.append("</ul>")
return "".join(H) + "</div>" return "".join(H)
elif ( elif (
fmt == "pdf" fmt == "pdf"

View File

@ -331,15 +331,16 @@ def moduleimpl_status(moduleimpl_id=None, partition_id=None):
>Saisie Absences journée</a></span> >Saisie Absences journée</a></span>
""" """
) )
year, week, day = datetime.date.today().isocalendar()
semaine: str = f"{year}-W{week}"
H.append( H.append(
f""" f"""
<span class="moduleimpl_abs_link"><a class="stdlink" href="{ <span class="moduleimpl_abs_link"><a class="stdlink" href="{
url_for( url_for(
"assiduites.signal_assiduites_group", "assiduites.signal_assiduites_diff",
scodoc_dept=g.scodoc_dept, scodoc_dept=g.scodoc_dept,
group_ids=group_id, group_ids=group_id,
jour=datetime.date.today().isoformat(), semaine=semaine,
formsemestre_id=formsemestre.id, formsemestre_id=formsemestre.id,
moduleimpl_id="" if moduleimpl_id is None else moduleimpl_id moduleimpl_id="" if moduleimpl_id is None else moduleimpl_id
)}" )}"

View File

@ -1,10 +1,9 @@
$(function () { $(function () {
$("div#export_help").accordion({ $("div#export_help").accordion({
heightStyle: "content", heightStyle: "content",
collapsible: true, collapsible: true,
active: false, active: false,
}); });
}); });
// Affichage des listes par type // Affichage des listes par type
@ -14,77 +13,89 @@ $(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 {
$("#sans_filtre").css("display", "none");
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 == "") {
$("#filtre_row").css("display", "");
$("#filtre_col").css("display", "none");
$("#filtre_row").html("Filtre sur semestre: " + filtre_row);
} else { } else {
$("#sans_filtre").css("display", "none"); $("#filtre_row").css("display", "");
if (filtre_row == '') { $("#filtre_col").css("display", "");
$("#filtre_row").css("display", "none"); $("#filtre_row").html("Filtre sur semestre: " + filtre_row);
$("#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 == '') {
$("#filtre_row").css("display", "");
$("#filtre_col").css("display", "none");
$("#filtre_row").html("Filtre sur semestre: " + filtre_row);
} else {
$("#filtre_row").css("display", "");
$("#filtre_col").css("display", "");
$("#filtre_row").html("Filtre sur semestre: " + filtre_row);
$("#filtre_col").html("Filtre sur code étape: " + 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,
etudiants = r + c.substring(1); col,
$(etudiants).css("display", display(r, 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).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
$(col).css("background-color", "lightblue"); } else if (row == "*") {
} else if (col == '*') { // Filtrage sur 1 ligne // filtrage sur 1 colonne
$(row + '>td').css("background-color", "lightblue"); $(col).css("background-color", "lightblue");
$(row + '>th').css("background-color", "lightblue"); } else if (col == "*") {
} else { // filtrage sur 1 case // Filtrage sur 1 ligne
$(row + '>td' + col).css("background-color", "lightblue"); $(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: // Modifie le titre de la section pour indiquer la sélection:
// elt est le lien cliqué // elt est le lien cliqué
// var td_class = elt.parentNode.className.trim(); // var td_class = elt.parentNode.className.trim();
// if (td_class) { // if (td_class) {
// var titre_col = $("table.repartition th.")[0].textContent.trim(); // var titre_col = $("table.repartition th.")[0].textContent.trim();
// if (titre_col) { // if (titre_col) {
// $("h4#effectifs").html("Liste des étudiants de " + titre_col); // $("h4#effectifs").html("Liste des étudiants de " + titre_col);
// } // }
// } // }
} }

View File

@ -1,6 +1,5 @@
// <=== CONSTANTS and GLOBALS ===> // <=== CONSTANTS and GLOBALS ===>
const TIMEZONE = "Europe/Paris";
let url; let url;
function getUrl() { function getUrl() {
@ -192,8 +191,9 @@ function sync_get(path, success, errors) {
*/ */
async function async_get(path, success, errors) { async function async_get(path, success, errors) {
console.log("async_get " + path); console.log("async_get " + path);
let response;
try { try {
const response = await fetch(path); response = await fetch(path);
if (response.ok) { if (response.ok) {
const data = await response.json(); const data = await response.json();
success(data); success(data);
@ -204,6 +204,8 @@ async function async_get(path, success, errors) {
console.error(error); console.error(error);
if (errors) errors(error); if (errors) errors(error);
} }
return response;
} }
/** /**
@ -234,8 +236,9 @@ function sync_post(path, data, success, errors) {
*/ */
async function async_post(path, data, success, errors) { async function async_post(path, data, success, errors) {
console.log("async_post " + path); console.log("async_post " + path);
let response;
try { try {
const response = await fetch(path, { response = await fetch(path, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@ -253,6 +256,8 @@ async function async_post(path, data, success, errors) {
console.error(error); console.error(error);
if (errors) errors(error); if (errors) errors(error);
} }
return response;
} }
// <<== Gestion des actions de masse ==>> // <<== Gestion des actions de masse ==>>
@ -611,7 +616,7 @@ function updateDate() {
} }
let dateStr = ""; let dateStr = "";
if (!verifyNonWorkDays(date.getDay(), nonWorkDays)) { if (!isNonWorkDay(date.getDay(), nonWorkDays)) {
dateStr = formatDate(date).capitalize(); dateStr = formatDate(date).capitalize();
} else { } else {
// On se rend au dernier jour travaillé disponible // On se rend au dernier jour travaillé disponible
@ -630,13 +635,17 @@ function updateDate() {
) )
); );
openAlertModal("Attention", div, "", "#eec660"); openAlertModal("Attention", div, "", "#eec660");
$(dateInput).datepicker( const date_fra = Date.toFRA(lastWorkDay.toIsoUtcString().split("T")[0]);
"setDate",
Date.toFRA(lastWorkDay.toIsoUtcString().split("T")[0]) $(dateInput).datepicker("setDate", date_fra);
); dateInput.value = date_fra;
date = lastWorkDay;
dateStr = formatDate(lastWorkDay).capitalize(); dateStr = formatDate(lastWorkDay).capitalize();
} }
console.warn(dateStr, date, date.toIsoUtcString());
document.querySelector("#datestr").textContent = dateStr; document.querySelector("#datestr").textContent = dateStr;
return true; return true;
} }
@ -645,7 +654,7 @@ function getNearestWorkDay(date) {
const aDay = 86400000; // 24 * 3600 * 1000 | H * s * ms const aDay = 86400000; // 24 * 3600 * 1000 | H * s * ms
let day = date; let day = date;
let count = 0; let count = 0;
while (verifyNonWorkDays(day.getDay(), nonWorkDays) && count++ < 7) { while (isNonWorkDay(day.getDay(), nonWorkDays) && count++ < 7) {
day = new Date(day - aDay); day = new Date(day - aDay);
} }
return day; return day;
@ -702,7 +711,7 @@ function formatDateModal(str, separator = " ") {
* Vérifie si la date sélectionnée n'est pas un jour non travaillé * Vérifie si la date sélectionnée n'est pas un jour non travaillé
* Renvoie Vrai si le jour est non travaillé * Renvoie Vrai si le jour est non travaillé
*/ */
function verifyNonWorkDays(day, nonWorkdays) { function isNonWorkDay(day, nonWorkdays) {
let d = ""; let d = "";
switch (day) { switch (day) {
case 0: case 0:

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>
@ -11,40 +10,44 @@
// On change la visi de tous les <tr> jusqu'au notes_bulletin_row_ue suivant. // On change la visi de tous les <tr> jusqu'au notes_bulletin_row_ue suivant.
// //
function toggle_vis_ue(e, new_state) { function toggle_vis_ue(e, new_state) {
// e is the span containg the clicked +/- icon // e is the span containg the clicked +/- icon
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;
} }
} }
// find next tr in siblings // find next tr in siblings
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 (
current = false; tr.classList[i] == "notes_bulletin_row_ue" ||
} tr.classList[i] == "notes_bulletin_row_sum_ects"
if (current) { )
if (new_state) { current = false;
tr.style.display = 'none'; }
} else { if (current) {
tr.style.display = 'table-row'; if (new_state) {
} tr.style.display = "none";
} } else {
} 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"/>'; tr = tr.nextSibling;
} else { }
e.innerHTML = '<img width="13" height="13" border="0" title="" alt="-" src="/ScoDoc/static/icons/minus_img.png"/>'; if (new_state) {
} 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"/>';
}
} }

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,14 +25,13 @@ 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;
} }
rows[i] = null; rows[i] = null;
} }
@ -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

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

View File

@ -13,70 +13,70 @@ 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;
if (detail.getAttribute("id")) { if (detail.getAttribute("id")) {
id = "#" + detail.getAttribute("id"); id = "#" + detail.getAttribute("id");
} }
detail.setAttribute(ID_ATTRIBUTE, id); detail.setAttribute(ID_ATTRIBUTE, id);
return id; return id;
} }
// remise à l'état initial. doit être exécuté dès le chargement de la page pour que l'état 'open' // remise à l'état initial. doit être exécuté dès le chargement de la page pour que l'état 'open'
// des balises soit celui indiqué par le serveur (et donc indépendant du localstorage) // des balises soit celui indiqué par le serveur (et donc indépendant du localstorage)
function reset_detail(detail, id) { function reset_detail(detail, id) {
let opened = detail.getAttribute("open"); let opened = detail.getAttribute("open");
if (opened) { if (opened) {
detail.setAttribute("open", true); detail.setAttribute("open", true);
localStorage.setItem(id, true); localStorage.setItem(id, true);
} else { } else {
detail.removeAttribute("open"); detail.removeAttribute("open");
localStorage.setItem(id, false); localStorage.setItem(id, false);
} }
} }
function restore_detail(detail, id) { function restore_detail(detail, id) {
let status = localStorage.getItem(id); let status = localStorage.getItem(id);
if (status == "true") { if (status == "true") {
detail.setAttribute("open", true); detail.setAttribute("open", true);
} else { } else {
detail.removeAttribute("open"); detail.removeAttribute("open");
} }
} }
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) {
localStorage.setItem(id, false); localStorage.setItem(id, false);
} else { } else {
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 {
reset_detail(detail, id); reset_detail(detail, id);
} }
add_listener(detail); add_listener(detail);
idnum++; idnum++;
}); });
} }
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, {
'attr': attr_name, partition_id: partition_id,
'value': attr_value attr: attr_name,
}, value: attr_value,
function (result) { },
sco_message(result); function (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

@ -1,63 +1,72 @@
// Affiche et met a jour la liste des UE partageant le meme code // Affiche et met a jour la liste des UE partageant le meme code
$().ready(function () { $().ready(function () {
if (document.querySelector("#tf_ue_id")) { if (document.querySelector("#tf_ue_id")) {
/* fonctions spécifiques pour edition UE */ /* fonctions spécifiques pour edition UE */
update_ue_list(); update_ue_list();
$("#tf_ue_code").bind("keyup", update_ue_list); $("#tf_ue_code").bind("keyup", update_ue_list);
$("select#tf_type").change(function () { $("select#tf_type").change(function () {
update_bonus_description(); update_bonus_description();
}); });
update_bonus_description(); update_bonus_description();
} }
}); });
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") {
$("#bonus_description").show(); /* UE SPORT */
var query = "/ScoDoc/get_bonus_description/default"; $("#bonus_description").show();
$.get(query, '', function (data) { var query = "/ScoDoc/get_bonus_description/default";
$("#bonus_description").html(data); $.get(query, "", function (data) {
}); $("#bonus_description").html(data);
} else { });
$("#bonus_description").html(""); } else {
$("#bonus_description").hide(); $("#bonus_description").html("");
} $("#bonus_description").hide();
}
} }
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 +
$("#ue_list_code").html(data); "/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) { 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(
const parcours_ids = []; '#choix_parcours input[type="checkbox"]:checked'
checkboxes.forEach(function (checkbox) { );
parcours_ids.push(checkbox.value); const parcours_ids = [];
checkboxes.forEach(function (checkbox) {
parcours_ids.push(checkbox.value);
});
fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(parcours_ids),
})
.then((response) => response.json())
.then((data) => {
if (data.status == 404) {
sco_error_message(data.message);
} else {
sco_message(data.message);
}
}); });
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(parcours_ids)
})
.then(response => response.json())
.then(data => {
if (data.status == 404) {
sco_error_message(data.message);
} else {
sco_message(data.message);
}
});
} }

View File

@ -1,65 +1,68 @@
// 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
// EV 2023-06-01 // EV 2023-06-01
function etud_autocomplete_config(with_dept = false) { function etud_autocomplete_config(with_dept = false) {
return { return {
selector: "#etudiant", selector: "#etudiant",
placeHolder: "Nom...", placeHolder: "Nom...",
threshold: 3, threshold: 3,
data: { data: {
src: async (query) => { src: async (query) => {
try { try {
// Fetch Data from external Source // Fetch Data from external Source
const source = await fetch(`/ScoDoc/api/etudiants/name/${query}`); const source = await fetch(`/ScoDoc/api/etudiants/name/${query}`);
// Data should be an array of `Objects` or `Strings` // Data should be an array of `Objects` or `Strings`
const data = await source.json(); const data = await source.json();
return data; return data;
} catch (error) { } catch (error) {
return error; return error;
} }
}, },
// Data source 'Object' key to be searched // 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}`;
// store etudid
const etudidField = document.getElementById("etudid");
etudidField.value = event.detail.selection.value.id;
autoCompleteJS.input.value = selection;
}, },
events: { },
input: { },
selection: (event) => { resultsList: {
const prenom = sco_capitalize(event.detail.selection.value.prenom); element: (list, data) => {
const selection = with_dept ? `${event.detail.selection.value.nom} ${prenom} (${event.detail.selection.value.dept_acronym})` : `${event.detail.selection.value.nom} ${prenom}`; if (!data.results.length) {
// store etudid // Create "No Results" message element
const etudidField = document.getElementById('etudid'); const message = document.createElement("div");
etudidField.value = event.detail.selection.value.id; // Add class to the created element
autoCompleteJS.input.value = selection; message.setAttribute("class", "no_result");
} // Add message text content
} message.innerHTML = `<span>Pas de résultat pour "${data.query}"</span>`;
}, // Append message element to the results list
resultsList: { list.prepend(message);
element: (list, data) => { // Efface l'etudid
if (!data.results.length) { const etudidField = document.getElementById("etudid");
// Create "No Results" message element etudidField.value = "";
const message = document.createElement("div"); }
// Add class to the created element },
message.setAttribute("class", "no_result"); noResults: true,
// Add message text content },
message.innerHTML = `<span>Pas de résultat pour "${data.query}"</span>`; resultItem: {
// Append message element to the results list highlight: true,
list.prepend(message); element: (item, data) => {
// Efface l'etudid const prenom = sco_capitalize(data.value.prenom);
const etudidField = document.getElementById('etudid'); item.innerHTML += with_dept
etudidField.value = ""; ? ` ${prenom} (${data.value.dept_acronym})`
} : ` ${prenom}`;
}, },
noResults: true, },
}, };
resultItem: {
highlight: true,
element: (item, data) => {
const prenom = sco_capitalize(data.value.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
title: document.querySelector('table.evaluations_recap').dataset.filename .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

@ -3,26 +3,38 @@ var apo_ue_editor = null;
var apo_mod_editor = null; 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(
if (table_editable) { "table#formation_table_recap.apo_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); if (table_editable) {
let apo_mod_save_url = document.querySelector("table#formation_table_recap.apo_editable").dataset.apo_mod_save_url; let apo_ue_save_url = document.querySelector(
apo_mod_editor = new ScoFieldEditor("table#formation_table_recap tr.mod td.apo", apo_mod_save_url, false); "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

@ -1,14 +1,13 @@
// Formulaire formsemestre_createwithmodules // Formulaire formsemestre_createwithmodules
function change_semestre_id() { function change_semestre_id() {
var semestre_id = $("#tf_semestre_id")[0].value; var semestre_id = $("#tf_semestre_id")[0].value;
for (var i = -1; i < 12; i++) { for (var i = -1; i < 12; i++) {
$(".sem" + i).hide(); $(".sem" + i).hide();
} }
$(".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,81 +1,83 @@
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());
// les coefs sont donnes (ECTS en BUT) })
let coefs = $("form.tf_ext_edit_ue_validations").data("ue_coefs"); .get();
// ou saisis (formations classiques) // les coefs sont donnes (ECTS en BUT)
if (coefs == 'undefined') { let coefs = $("form.tf_ext_edit_ue_validations").data("ue_coefs");
coefs = $(".tf_field_coef input").map( // ou saisis (formations classiques)
function () { return parseFloat($(this).val()); } if (coefs == "undefined") {
).get(); coefs = $(".tf_field_coef input")
.map(function () {
return parseFloat($(this).val());
})
.get();
}
var N = notes.length;
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];
sum_coefs += coefs[i];
} }
var N = notes.length; }
var dp = 0.; let moy = dp / sum_coefs;
var sum_coefs = 0.; if (isNaN(moy)) {
for (var i = 0; i < N; i++) { moy = "-";
if (!(isNaN(notes[i]) || isNaN(coefs[i]))) { }
dp += notes[i] * coefs[i]; if (typeof moy == "number") {
sum_coefs += coefs[i]; moy = moy.toFixed(2);
} }
} return moy;
let moy = dp / sum_coefs;
if (isNaN(moy)) {
moy = "-";
}
if (typeof moy == "number") {
moy = moy.toFixed(2);
}
return moy;
} }
// Callback select menu (UE code) // Callback select menu (UE code)
function enable_disable_fields_cb() { function enable_disable_fields_cb() {
enable_disable_fields(this); enable_disable_fields(this);
} }
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)
var disabled = false; .parent()
if ($(select_elt).val() === "None") { .parent()
disabled = true; .find("input:not(.ext_coef_disabled)");
var disabled = false;
if ($(select_elt).val() === "None") {
disabled = true;
}
input_fields.each(function () {
if (disabled) {
let cur_value = $(this).val();
$(this).data("saved-value", cur_value);
$(this).val("");
} else {
let saved_value = $(this).data("saved-value");
if (typeof saved_value == "undefined") {
saved_value = "";
}
if (saved_value) {
$(this).val(saved_value);
}
} }
input_fields.each(function () { });
if (disabled) { input_fields.prop("disabled", disabled);
let cur_value = $(this).val();
$(this).data('saved-value', cur_value);
$(this).val("");
} else {
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);
} }
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 () {
$(".tf_ext_edit_ue_validations").change(function () { $(".tf_ext_edit_ue_validations").change(function () {
$(".ext_sem_moy_val")[0].innerHTML = compute_moyenne(); $(".ext_sem_moy_val")[0].innerHTML = compute_moyenne();
}); });
$("form.tf_ext_edit_ue_validations input").blur(function () { $("form.tf_ext_edit_ue_validations input").blur(function () {
$(".ext_sem_moy_val")[0].innerHTML = compute_moyenne(); $(".ext_sem_moy_val")[0].innerHTML = compute_moyenne();
}); });
$(".ueext_valid_select").change(enable_disable_fields_cb); $(".ueext_valid_select").change(enable_disable_fields_cb);
setup_text_fields(); setup_text_fields();
}); });

View File

@ -1,225 +1,213 @@
// Affichage progressif du trombinoscope html // Affichage progressif du trombinoscope html
$().ready(function () { $().ready(function () {
var spans = $(".unloaded_img"); var spans = $(".unloaded_img");
for (var i = 0; i < spans.length; i++) { for (var i = 0; i < spans.length; i++) {
var sp = spans[i]; var sp = spans[i];
var etudid = sp.id; var etudid = sp.id;
$(sp).load(SCO_URL + "/etud_photo_html?etudid=" + etudid); $(sp).load(SCO_URL + "/etud_photo_html?etudid=" + etudid);
} }
}); });
// L'URL pour recharger l'état courant de la page (groupes et tab selectionnes) // L'URL pour recharger l'état courant de la page (groupes et tab selectionnes)
// (ne fonctionne que pour les requetes GET: manipule la query string) // (ne fonctionne que pour les requetes GET: manipule la query string)
function groups_view_url() { function groups_view_url() {
var url = $.url(); var url = $.url();
delete url.param()["group_ids"]; // retire anciens groupes de l'URL delete url.param()["group_ids"]; // retire anciens groupes de l'URL
delete url.param()["curtab"]; // retire ancien tab actif delete url.param()["curtab"]; // retire ancien tab actif
if (CURRENT_TAB_HASH) { if (CURRENT_TAB_HASH) {
url.param()["curtab"] = CURRENT_TAB_HASH; url.param()["curtab"] = CURRENT_TAB_HASH;
} }
delete url.param()["formsemestre_id"]; delete url.param()["formsemestre_id"];
url.param()["formsemestre_id"] = url.param()["formsemestre_id"] =
$("#group_selector")[0].formsemestre_id.value; $("#group_selector")[0].formsemestre_id.value;
var selected_groups = $("#group_selector select").val(); var selected_groups = $("#group_selector select").val();
url.param()["group_ids"] = selected_groups; // remplace par groupes selectionnes url.param()["group_ids"] = selected_groups; // remplace par groupes selectionnes
return url; return url;
} }
// Sélectionne le groupe "tous" et recharge la page: // Sélectionne le groupe "tous" et recharge la page:
function select_groupe_tous() { function select_groupe_tous() {
var url = groups_view_url(); var url = groups_view_url();
var default_group_id = $("#group_selector")[0].default_group_id.value; var default_group_id = $("#group_selector")[0].default_group_id.value;
delete url.param()["group_ids"]; delete url.param()["group_ids"];
url.param()["group_ids"] = [default_group_id]; url.param()["group_ids"] = [default_group_id];
var query_string = $.param(url.param(), (traditional = true)); var query_string = $.param(url.param(), (traditional = true));
window.location = url.attr("base") + url.attr("path") + "?" + query_string; window.location = url.attr("base") + url.attr("path") + "?" + query_string;
} }
// Recharge la page sans arguments group_ids // Recharge la page sans arguments group_ids
function remove_group_filter() { function remove_group_filter() {
var url = groups_view_url(); var url = groups_view_url();
delete url.param()["group_ids"]; delete url.param()["group_ids"];
var query_string = $.param(url.param(), (traditional = true)); var query_string = $.param(url.param(), (traditional = true));
window.location = url.attr("base") + url.attr("path") + "?" + query_string; window.location = url.attr("base") + url.attr("path") + "?" + query_string;
} }
// L'URL pour l'état courant de la page: // L'URL pour l'état courant de la page:
function get_current_url() { function get_current_url() {
var url = groups_view_url(); var url = groups_view_url();
var query_string = $.param(url.param(), (traditional = true)); var query_string = $.param(url.param(), (traditional = true));
return url.attr("base") + url.attr("path") + "?" + query_string; return url.attr("base") + url.attr("path") + "?" + query_string;
} }
// Recharge la page en changeant les groupes selectionnés et en conservant le tab actif: // Recharge la page en changeant les groupes selectionnés et en conservant le tab actif:
function submit_group_selector() { function submit_group_selector() {
window.location = get_current_url(); window.location = get_current_url();
} }
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");
} }
} }
var CURRENT_TAB_HASH = $.url().param()["curtab"]; var CURRENT_TAB_HASH = $.url().param()["curtab"];
$().ready(function () { $().ready(function () {
$(".nav-tabs a").on("shown.bs.tab", function (e) { $(".nav-tabs a").on("shown.bs.tab", function (e) {
CURRENT_TAB_HASH = e.target.hash.slice(1); // sans le # CURRENT_TAB_HASH = e.target.hash.slice(1); // sans le #
}); });
show_current_tab(); show_current_tab();
}); });
function change_list_options() { function change_list_options() {
var url = groups_view_url(); var url = groups_view_url();
var selected_options = $("#group_list_options").val(); var selected_options = $("#group_list_options").val();
var options = [ var options = [
"with_paiement", "with_paiement",
"with_archives", "with_archives",
"with_annotations", "with_annotations",
"with_codes", "with_codes",
"with_bourse", "with_bourse",
]; ];
for (var i = 0; i < options.length; i++) { for (var i = 0; i < options.length; i++) {
var option = options[i]; var option = options[i];
delete url.param()[option]; delete url.param()[option];
if ($.inArray(option, selected_options) >= 0) { if ($.inArray(option, selected_options) >= 0) {
url.param()[option] = 1; url.param()[option] = 1;
}
} }
var query_string = $.param(url.param(), (traditional = true)); }
window.location = url.attr("base") + url.attr("path") + "?" + query_string; var query_string = $.param(url.param(), (traditional = true));
window.location = url.attr("base") + url.attr("path") + "?" + query_string;
} }
// Menu choix groupe: // Menu choix groupe:
function toggle_visible_etuds() { function toggle_visible_etuds() {
// //
$(".etud_elem").hide(); $(".etud_elem").hide();
var qargs = ""; var qargs = "";
$("#group_ids_sel option:selected").each(function (index, opt) { $("#group_ids_sel option:selected").each(function (index, opt) {
var group_id = opt.value; var group_id = opt.value;
$(".group-" + group_id).show(); $(".group-" + group_id).show();
qargs += "&group_ids=" + group_id; qargs += "&group_ids=" + group_id;
}); });
// Update url saisie tableur: // Update url saisie tableur:
var input_eval = $("#formnotes_evaluation_id"); var input_eval = $("#formnotes_evaluation_id");
if (input_eval.length > 0) { if (input_eval.length > 0) {
var evaluation_id = input_eval[0].value; var evaluation_id = input_eval[0].value;
$("#menu_saisie_tableur a").attr( $("#menu_saisie_tableur a").attr(
"href", "href",
"saisie_notes_tableur?evaluation_id=" + evaluation_id + qargs "saisie_notes_tableur?evaluation_id=" + evaluation_id + qargs
); );
// lien feuille excel: // lien feuille excel:
$("#lnk_feuille_saisie").attr( $("#lnk_feuille_saisie").attr(
"href", "href",
"feuille_saisie_notes?evaluation_id=" + evaluation_id + qargs "feuille_saisie_notes?evaluation_id=" + evaluation_id + qargs
); );
} }
// Update champs form group_ids_str // Update champs form group_ids_str
let group_ids_str = Array.from( let group_ids_str = Array.from(
document.querySelectorAll("#group_ids_sel option:checked") document.querySelectorAll("#group_ids_sel option:checked")
) )
.map(function (elem) { .map(function (elem) {
return elem.value; return elem.value;
}) })
.join(); .join();
document document
.querySelectorAll("input.group_ids_str") .querySelectorAll("input.group_ids_str")
.forEach((elem) => (elem.value = group_ids_str)); .forEach((elem) => (elem.value = group_ids_str));
} }
$().ready(function () { $().ready(function () {
$("#group_ids_sel").multiselect({ $("#group_ids_sel").multiselect({
includeSelectAllOption: false, includeSelectAllOption: false,
nonSelectedText: "choisir...", nonSelectedText: "choisir...",
// buttonContainer: '<div id="group_ids_sel_container"/>', // buttonContainer: '<div id="group_ids_sel_container"/>',
onChange: function (element, checked) { onChange: function (element, checked) {
// Gestion du groupe "tous" // Gestion du groupe "tous"
if ( if (
checked == true && checked == true &&
$("#group_ids_sel").hasClass("default_deselect_others") $("#group_ids_sel").hasClass("default_deselect_others")
) { ) {
var default_group_id = $(".default_group")[0].value; var default_group_id = $(".default_group")[0].value;
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, if (opt.value != default_group_id) {
opt $("#group_ids_sel").multiselect("deselect", opt.value);
) {
if (opt.value != default_group_id) {
$("#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
) {
if (opt.value == default_group_id) {
default_is_selected = true;
return false;
}
});
if (default_is_selected) {
$("#group_ids_sel").multiselect(
"deselect",
default_group_id
);
}
}
} }
});
toggle_visible_etuds(); } else {
// referme le menu apres chaque choix: // click sur un autre item
$("#group_selector .btn-group").removeClass("open"); // si le groupe "tous" est selectionne et que l'on coche un autre, le deselectionner
var default_is_selected = false;
if ($("#group_ids_sel").hasClass("submit_on_change")) { $("#group_ids_sel option:selected").each(function (index, opt) {
submit_group_selector(); if (opt.value == default_group_id) {
default_is_selected = true;
return false;
} }
}, });
}); if (default_is_selected) {
$("#group_ids_sel").multiselect("deselect", default_group_id);
}
}
}
// initial setup toggle_visible_etuds();
toggle_visible_etuds(); // referme le menu apres chaque choix:
$("#group_selector .btn-group").removeClass("open");
if ($("#group_ids_sel").hasClass("submit_on_change")) {
submit_group_selector();
}
},
});
// initial setup
toggle_visible_etuds();
}); });
// Trombinoscope // Trombinoscope
$().ready(function () { $().ready(function () {
var elems = $(".trombi-photo"); var elems = $(".trombi-photo");
for (var i = 0; i < elems.length; i++) { for (var i = 0; i < elems.length; i++) {
$(elems[i]).qtip({ $(elems[i]).qtip({
content: { content: {
ajax: { ajax: {
url: url:
SCO_URL + SCO_URL +
"/etud_info_html?with_photo=0&etudid=" + "/etud_info_html?with_photo=0&etudid=" +
get_etudid_from_elem(elems[i]), get_etudid_from_elem(elems[i]),
}, },
text: "Loading...", text: "Loading...",
}, },
position: { position: {
at: "right", at: "right",
my: "left top", my: "left top",
}, },
style: { style: {
classes: "qtip-etud", classes: "qtip-etud",
}, },
// utile pour debugguer le css: // utile pour debugguer le css:
// hide: { event: 'unfocus' } // hide: { event: 'unfocus' }
}); });
} }
}); });

View File

@ -1,88 +1,90 @@
// 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);
} }
// changement d'un menu code: // changement d'un menu code:
function change_menu_code(elt) { function change_menu_code(elt) {
// Ajuste styles pour visualiser codes enregistrés/modifiés // Ajuste styles pour visualiser codes enregistrés/modifiés
if (elt.value != elt.dataset.orig_code) { if (elt.value != elt.dataset.orig_code) {
elt.parentElement.parentElement.classList.add("modified"); elt.parentElement.parentElement.classList.add("modified");
} else { } else {
elt.parentElement.parentElement.classList.remove("modified"); elt.parentElement.parentElement.classList.remove("modified");
} }
if (elt.value == elt.dataset.orig_recorded) { if (elt.value == elt.dataset.orig_recorded) {
elt.parentElement.parentElement.classList.add("recorded"); elt.parentElement.parentElement.classList.add("recorded");
} else { } else {
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 =
if (select.value != "ADM") { elt.parentElement.parentElement.parentElement.querySelectorAll(
select.value = "ADJR"; "select.ue_rcue_" + elt.dataset.niveau_id
change_menu_code(select); // pour changer les styles );
} ue_selects.forEach((select) => {
}); if (select.value != "ADM") {
} select.value = "ADJR";
change_menu_code(select); // pour changer les styles
}
});
}
} }
$(function () { $(function () {
// Recupère la liste ordonnées des etudids // Recupère la liste ordonnées des etudids
// pour avoir le "suivant" et le "précédent" // pour avoir le "suivant" et le "précédent"
// (liens de navigation) // (liens de navigation)
const url = new URL(document.URL); const url = new URL(document.URL);
const frags = url.pathname.split("/"); // .../formsemestre_validation_but/formsemestre_id/etudid const frags = url.pathname.split("/"); // .../formsemestre_validation_but/formsemestre_id/etudid
const etudid = frags[frags.length - 1]; const etudid = frags[frags.length - 1];
const formsemestre_id = frags[frags.length - 2]; const formsemestre_id = frags[frags.length - 2];
const etudids_key = JSON.stringify(["etudids", url.origin, formsemestre_id]); const etudids_key = JSON.stringify(["etudids", url.origin, formsemestre_id]);
const etudids_str = localStorage.getItem(etudids_key); const etudids_str = localStorage.getItem(etudids_key);
const noms_key = JSON.stringify(["noms", url.origin, formsemestre_id]); const noms_key = JSON.stringify(["noms", url.origin, formsemestre_id]);
const noms_str = localStorage.getItem(noms_key); const noms_str = localStorage.getItem(noms_key);
if (etudids_str && noms_str) { if (etudids_str && noms_str) {
const etudids = JSON.parse(etudids_str); const etudids = JSON.parse(etudids_str);
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;
} }
if (cur_idx < etudids.length - 1) { if (cur_idx < etudids.length - 1) {
next_idx = cur_idx + 1; next_idx = cur_idx + 1;
} }
}
if (prev_idx != -1) {
let elem = document.querySelector("div.prev a");
if (elem) {
elem.href = elem.href.replace("PREV", etudids[prev_idx]);
elem.innerHTML = noms[prev_idx];
}
} else {
document.querySelector("div.prev").innerHTML = "";
}
if (next_idx != -1) {
let elem = document.querySelector("div.next a");
if (elem) {
elem.href = elem.href.replace("NEXT", etudids[next_idx]);
elem.innerHTML = noms[next_idx];
}
} else {
document.querySelector("div.next").innerHTML = "";
}
} else {
// Supprime les liens de navigation
document.querySelector("div.prev").innerHTML = "";
document.querySelector("div.next").innerHTML = "";
} }
if (prev_idx != -1) {
let elem = document.querySelector("div.prev a");
if (elem) {
elem.href = elem.href.replace("PREV", etudids[prev_idx]);
elem.innerHTML = noms[prev_idx];
}
} else {
document.querySelector("div.prev").innerHTML = "";
}
if (next_idx != -1) {
let elem = document.querySelector("div.next a");
if (elem) {
elem.href = elem.href.replace("NEXT", etudids[next_idx]);
elem.innerHTML = noms[next_idx];
}
} else {
document.querySelector("div.next").innerHTML = "";
}
} else {
// Supprime les liens de navigation
document.querySelector("div.prev").innerHTML = "";
document.querySelector("div.next").innerHTML = "";
}
}); });
// ----- Etat du formulaire jury pour éviter sortie sans enregistrer // ----- Etat du formulaire jury pour éviter sortie sans enregistrer
@ -91,29 +93,31 @@ let IS_SUBMITTING = false;
// Une chaine décrivant l'état du form // Une chaine décrivant l'état du form
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() {
return FORM_STATE != get_form_state(); return FORM_STATE != get_form_state();
} }
function jury_form_submit(event) { function jury_form_submit(event) {
IS_SUBMITTING = true; IS_SUBMITTING = true;
} }
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++) { })
var lycee = lycees_coords[i]; .bind("init", function (event, map) {
var nb = lycee['number']; for (var i = 0; i < lycees_coords.length; i++) {
var icon; var lycee = lycees_coords[i];
if (nb in ScoMarkerIcons) { var nb = lycee["number"];
icon = ScoMarkerIcons[nb]; var icon;
} else { if (nb in ScoMarkerIcons) {
icon = new google.maps.MarkerImage( 'https://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + nb + '|FF0000|000000' ); icon = ScoMarkerIcons[nb];
ScoMarkerIcons[nb] = icon; // cache } else {
} icon = new google.maps.MarkerImage(
$('#lyc_map_canvas').gmap( "https://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=" +
'addMarker', nb +
{'position': lycee['position'], 'bounds': true, 'nomlycee' : lycee['name'], 'icon' : icon } "|FF0000|000000"
).click( );
function() { ScoMarkerIcons[nb] = icon; // cache
$('#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 */ /* Page édition module */
$(document).ready(function () {});
$(document).ready(function () {
});

View File

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

View File

@ -2,36 +2,31 @@
*/ */
function change_ue_inscr(elt) { function change_ue_inscr(elt) {
let url = ""; let url = "";
if (elt.checked) { if (elt.checked) {
url = elt.dataset.url_inscr; url = elt.dataset.url_inscr;
} else { } else {
url = elt.dataset.url_desinscr; url = elt.dataset.url_desinscr;
} }
$.post(url, $.post(url, {}, function (result) {
{}, sco_message("changement inscription UE enregistré");
function (result) { });
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

@ -25,7 +25,7 @@ var NB_TICS = R_TICS.length;
function get_notes_and_draw(formsemestre_id, etudid) { function get_notes_and_draw(formsemestre_id, etudid) {
console.log("get_notes(" + formsemestre_id + ", " + etudid + " )"); console.log("get_notes(" + formsemestre_id + ", " + etudid + " )");
/* Recupère le bulletin de note et extrait tableau de notes */ /* Recupère le bulletin de note et extrait tableau de notes */
/* /*
var notes = [ var notes = [
{ 'module' : 'E1', { 'module' : 'E1',
'note' : 13, 'note' : 13,

View File

@ -1,59 +1,67 @@
// 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) {
// e is the span containg the clicked +/- icon // change visibility of tr (UE in tr and next tr)
var formsemestre_class = e.classList[1]; // e is the span containg the clicked +/- icon
var tr = e.parentNode.parentNode; var formsemestre_class = e.classList[1];
if (new_state == undefined) { var tr = e.parentNode.parentNode;
// current state: use alt attribute of current image if (new_state == undefined) {
if (e.childNodes[0].alt == '+') { // current state: use alt attribute of current image
new_state=false; if (e.childNodes[0].alt == "+") {
} else { new_state = false;
new_state=true;
}
}
if (new_state) {
new_tr_display = 'none';
} else { } else {
new_tr_display = 'table-row'; new_state = true;
} }
$("tr."+formsemestre_class+":not(.rcp_l1)").css('display', new_tr_display) }
if (new_state) {
// find next tr in siblings (xxx legacy code, could be optimized) new_tr_display = "none";
var sibl = tr.nextSibling; } else {
while ((sibl != null) && sibl.nodeType != 1 && sibl.tagName != 'TR') { new_tr_display = "table-row";
sibl = sibl.nextSibling; }
$("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") {
sibl = sibl.nextSibling;
}
if (sibl) {
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"/>';
} else {
e.innerHTML =
'<img width="13" height="13" border="0" title="" alt="-" src="/ScoDoc/static/icons/minus_img.png"/>';
td_disp = "inline";
} }
if (sibl) { // acronymes d'UE
var td_disp = 'none'; sibl = e.parentNode.nextSibling;
if (new_state) { while (sibl != null) {
e.innerHTML = '<img width="13" height="13" border="0" title="" alt="+" src="/ScoDoc/static/icons/plus_img.png"/>'; if (sibl.nodeType == 1 && sibl.className == "ue_acro")
} else { sibl.childNodes[0].style.display = td_disp;
e.innerHTML = '<img width="13" height="13" border="0" title="" alt="-" src="/ScoDoc/static/icons/minus_img.png"/>'; sibl = sibl.nextSibling;
td_disp = 'inline';
}
// acronymes d'UE
sibl = e.parentNode.nextSibling;
while (sibl != null) {
if (sibl.nodeType == 1 && sibl.className == 'ue_acro')
sibl.childNodes[0].style.display = td_disp;
sibl = sibl.nextSibling;
}
} }
}
} }
var sems_state = false; 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 =
} else { '<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/plus18_img.png"/>'; } else {
} e.innerHTML =
} '<img width="18" height="18" border="0" title="" alt="+" src="/ScoDoc/static/icons/plus18_img.png"/>';
}
}

View File

@ -1,106 +1,131 @@
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 = `
<div class=titre>Cliquer sur un parcours pour afficher ses niveaux de compétences</div> <div class=titre>Cliquer sur un parcours pour afficher ses niveaux de compétences</div>
<div class=parcours></div> <div class=parcours></div>
<div class=competences></div> <div class=competences></div>
<div class=ACs></div> <div class=ACs></div>
`; `;
/* 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);
} }
set setData(data) { set setData(data) {
this.data = data; this.data = data;
this.parcours(); this.parcours();
} }
parcours() { parcours() {
let parcoursDIV = this.shadow.querySelector(".parcours"); let parcoursDIV = this.shadow.querySelector(".parcours");
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) => {
parcoursDIV.appendChild(div); this.competences(event, cle);
}) });
this.initCompetences(); parcoursDIV.appendChild(div);
} });
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) {
this.shadow.querySelector(".parcours>.focus")?.classList.remove("focus"); this.shadow.querySelector(".parcours>.focus")?.classList.remove("focus");
event.currentTarget.classList.add("focus"); event.currentTarget.classList.add("focus");
let divCompetences = this.shadow.querySelector(".competences"); let divCompetences = this.shadow.querySelector(".competences");
this.shadow.querySelector(".competences").innerHTML = ""; this.shadow.querySelector(".competences").innerHTML = "";
/* 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]) => {
let numComp = this.competencesNumber[competence]; Object.entries(dataAnnee.competences).forEach(
let divCompetence = document.createElement("div"); ([competence, niveauCle]) => {
divCompetence.innerText = `${competence} ${niveauCle.niveau}`; let numComp = this.competencesNumber[competence];
divCompetence.style.gridRowStart = annee; let divCompetence = document.createElement("div");
divCompetence.style.gridColumnStart = competence.replaceAll(" ", "_"); divCompetence.innerText = `${competence} ${niveauCle.niveau}`;
divCompetence.className = "comp" + numComp; divCompetence.style.gridRowStart = annee;
divCompetence.dataset.competence = `${competence} ${niveauCle.niveau}`; divCompetence.style.gridColumnStart = competence.replaceAll(
divCompetence.addEventListener("click", (event) => { this.AC(event, competence, niveauCle.niveau, annee, numComp) }) " ",
divCompetences.appendChild(divCompetence); "_"
);
divCompetence.className = "comp" + numComp;
divCompetence.dataset.competence = `${competence} ${niveauCle.niveau}`;
divCompetence.addEventListener("click", (event) => {
this.AC(event, competence, niveauCle.niveau, annee, numComp);
});
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(
} else { `.ACs [data-competence="${competence} ${niveau}"]`
let output = ` )
) {
this.shadow
.querySelector(`.ACs [data-competence="${competence} ${niveau}"]`)
.remove();
} else {
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(
output += `<li><div class=comp${numComp}>${num}</div><div>${contenu.libelle}</div></li>`; this.data.competences[competence].niveaux["BUT" + annee].app_critiques
}) ).forEach(([num, contenu]) => {
this.shadow.querySelector(".ACs").innerHTML += output + "</ul>"; 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

@ -74,10 +74,10 @@ class releveBUT extends HTMLElement {
template() { template() {
return ` return `
<div> <div>
<div class="wait"></div> <div class="wait"></div>
<main class="releve"> <main class="releve">
<!---------------------------------------------------------------------------------------> <!--------------------------------------------------------------------------------------->
<!-- Zone spéciale pour que les IUT puisse ajouter des infos locales sur la passerelle --> <!-- Zone spéciale pour que les IUT puisse ajouter des infos locales sur la passerelle -->
@ -99,7 +99,7 @@ class releveBUT extends HTMLElement {
<em>Les moyennes ci-dessus servent à situer l'étudiant dans la promotion et ne correspondent pas à des validations de compétences ou d'UE.</em> <em>Les moyennes ci-dessus servent à situer l'étudiant dans la promotion et ne correspondent pas à des validations de compétences ou d'UE.</em>
</div> </div>
</div> </div>
</section> </section>
<!---------------------------> <!--------------------------->
@ -181,7 +181,7 @@ class releveBUT extends HTMLElement {
output += ` output += `
</div> </div>
<div class=numerosEtudiant> <div class=numerosEtudiant>
Numéro étudiant : ${data.etudiant.code_nip || "~"} - Numéro étudiant : ${data.etudiant.code_nip || "~"} -
Code INE : ${data.etudiant.code_ine || "~"} Code INE : ${data.etudiant.code_ine || "~"}
</div> </div>
<div>${data.formation.titre}</div> <div>${data.formation.titre}</div>
@ -376,12 +376,14 @@ class releveBUT extends HTMLElement {
}</div> }</div>
<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(
dataUE.date_capitalisation.split("T")[0] dataUE.date_capitalisation.split("T")[0]
@ -468,9 +470,9 @@ class releveBUT extends HTMLElement {
content.moyenne.value content.moyenne.value
}</div> }</div>
<div class=info> <div class=info>
Classe&nbsp;:&nbsp;${content.moyenne.moy}&nbsp;- Classe&nbsp;:&nbsp;${content.moyenne.moy}&nbsp;-
Max&nbsp;:&nbsp;${content.moyenne.max}&nbsp;- Max&nbsp;:&nbsp;${content.moyenne.max}&nbsp;-
Min&nbsp;:&nbsp;${content.moyenne.min} Min&nbsp;:&nbsp;${content.moyenne.min}
</div> </div>
</div> </div>
<div class=absences> <div class=absences>

View File

@ -1,33 +1,28 @@
// Gestion formulaire UE externes // Gestion formulaire UE externes
function toggle_new_ue_form(state) { 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

@ -4,30 +4,35 @@ var elt_annee_apo_editor = null;
var elt_sem_apo_editor = null; 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_editor = new ScoFieldEditor(".etapes_apo_str", save_url, false); .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; 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_editor = new ScoFieldEditor(".elt_sem_apo", save_url, false); .elt_sem_apo_save_url;
} elt_sem_apo_editor = new ScoFieldEditor(".elt_sem_apo", save_url, false);
}
}); });

View File

@ -8,14 +8,14 @@ let lastX;
let lastY; let lastY;
function build_table(data) { function build_table(data) {
let output = ""; let output = "";
let sumsUE = {}; let sumsUE = {};
let sumsRessources = {}; let sumsRessources = {};
let value; let value;
data.forEach((cellule) => { data.forEach((cellule) => {
output += ` output += `
<div <div
class="${cellule.style || ""}" class="${cellule.style || ""}"
data-editable="${cellule.editable || "false"}" data-editable="${cellule.editable || "false"}"
data-module_id="${cellule.module_id}" data-module_id="${cellule.module_id}"
@ -34,31 +34,31 @@ function build_table(data) {
--nbY: ${cellule.nbY || 1}; --nbY: ${cellule.nbY || 1};
">${cellule.data}</div>`; // ne pas mettre d'espace car c'est utilisé par :not(:empty) après ">${cellule.data}</div>`; // ne pas mettre d'espace car c'est utilisé par :not(:empty) après
if (cellule.style.includes("champs")) { if (cellule.style.includes("champs")) {
if (cellule.editable == true && cellule.data) { if (cellule.editable == true && cellule.data) {
value = parseFloat(cellule.data) * 100; value = parseFloat(cellule.data) * 100;
} else { } else {
value = 0; value = 0;
} }
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;
installListeners(); installListeners();
} }
function showSums(sumsRessources, sumsUE) { function showSums(sumsRessources, sumsUE) {
lastX = Object.keys(sumsUE).length + 2; lastX = Object.keys(sumsUE).length + 2;
lastY = Object.keys(sumsRessources).length + 2; lastY = Object.keys(sumsRessources).length + 2;
let output = ""; let output = "";
Object.entries(sumsUE).forEach(([num, value]) => { Object.entries(sumsUE).forEach(([num, value]) => {
output += ` output += `
<div <div
class="sums" class="sums"
data-editable="false" data-editable="false"
data-x="${num}" data-x="${num}"
@ -71,11 +71,11 @@ function showSums(sumsRessources, sumsUE) {
"> ">
${value / 100} ${value / 100}
</div>`; </div>`;
}) });
Object.entries(sumsRessources).forEach(([num, value]) => { Object.entries(sumsRessources).forEach(([num, value]) => {
output += ` output += `
<div <div
class="sums" class="sums"
data-editable="false" data-editable="false"
data-x="${lastX}" data-x="${lastX}"
@ -88,9 +88,9 @@ function showSums(sumsRessources, sumsUE) {
"> ">
${value / 100} ${value / 100}
</div>`; </div>`;
}) });
return output; return output;
} }
/*****************************/ /*****************************/
@ -98,125 +98,158 @@ function showSums(sumsRessources, sumsUE) {
/*****************************/ /*****************************/
function installListeners() { function installListeners() {
if (read_only) { if (read_only) {
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("blur", function () {
let currentModif = document.querySelector(".modifying");
if (currentModif) {
if (!save(currentModif)) {
return;
}
}
});
cellule.addEventListener("input", processSums);
}); });
cellule.addEventListener("dblclick", function () {
modifCell(this);
});
cellule.addEventListener("blur", function () {
let currentModif = document.querySelector(".modifying");
if (currentModif) {
if (!save(currentModif)) {
return;
}
}
});
cellule.addEventListener("input", processSums);
});
} }
/*********************************/ /*********************************/
/* Interaction avec les cellules */ /* Interaction avec les cellules */
/*********************************/ /*********************************/
function selectCell(obj) { function selectCell(obj) {
if (obj.classList.contains("modifying")) { if (obj.classList.contains("modifying")) {
return; // Cellule en cours de modification, ne pas sélectionner. return; // Cellule en cours de modification, ne pas sélectionner.
} }
let currentModif = document.querySelector(".modifying"); let currentModif = document.querySelector(".modifying");
if (currentModif) { if (currentModif) {
if (!save(currentModif)) { if (!save(currentModif)) {
return; return;
}
} }
}
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");
} }
function modifCell(obj) { function modifCell(obj) {
if (obj) { if (obj) {
obj.classList.add("modifying"); obj.classList.add("modifying");
obj.contentEditable = true; obj.contentEditable = true;
obj.addEventListener("keydown", keyCell); obj.addEventListener("keydown", keyCell);
obj.focus(); obj.focus();
} }
} }
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 (
return; // S'il n'y a aucune cellule selectionnée ou si une cellule est encours de modification, on ne change pas 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 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);
} }
} }
function keyCell(event) { function keyCell(event) {
if (event.key == "Enter") { if (event.key == "Enter") {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
if (!save(this)) { if (!save(this)) {
return return;
}
this.classList.remove("modifying");
let selected = document.querySelector(".selected");
ArrowMove(0, 1);
if (selected != document.querySelector(".selected")) {
modifCell(document.querySelector(".selected"));
}
} }
this.classList.remove("modifying");
let selected = document.querySelector(".selected");
ArrowMove(0, 1);
if (selected != document.querySelector(".selected")) {
modifCell(document.querySelector(".selected"));
}
}
} }
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
let val = parseFloat(e.innerText); .querySelectorAll(
if (!isNaN(val)) { `[data-editable="true"][data-x="${this.dataset.x}"]:not(:empty)`
sum += val * 100; )
} .forEach((e) => {
}) let val = parseFloat(e.innerText);
document.querySelector(`.sums[data-x="${this.dataset.x}"][data-y="${lastY}"]`).innerText = sum / 100; if (!isNaN(val)) {
sum += val * 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
let val = parseFloat(e.innerText); .querySelectorAll(
if (!isNaN(val)) { `[data-editable="true"][data-y="${this.dataset.y}"]:not(:empty)`
sum += val * 100; )
} .forEach((e) => {
}) let val = parseFloat(e.innerText);
document.querySelector(`.sums[data-x="${lastX}"][data-y="${this.dataset.y}"]`).innerText = sum / 100; if (!isNaN(val)) {
sum += val * 100;
}
});
document.querySelector(
`.sums[data-x="${lastX}"][data-y="${this.dataset.y}"]`
).innerText = sum / 100;
} }
/******************************/ /******************************/
/* Affichage d'un message */ /* Affichage d'un message */
/******************************/ /******************************/
function message(msg) { function message(msg) {
var div = document.createElement("div"); var div = document.createElement("div");
div.className = "message"; div.className = "message";
div.innerHTML = msg; div.innerHTML = msg;
document.querySelector("body").appendChild(div); document.querySelector("body").appendChild(div);
setTimeout(() => { setTimeout(() => {
div.remove(); div.remove();
}, 3000); }, 3000);
} }

View File

@ -1,11 +1,10 @@
// Affichage progressif du trombinoscope html // Affichage progressif du trombinoscope html
$().ready(function () { $().ready(function () {
var spans = $(".unloaded_img"); var spans = $(".unloaded_img");
for (var i = 0; i < spans.size(); i++) { for (var i = 0; i < spans.size(); i++) {
var sp = spans[i]; var sp = spans[i];
var etudid = sp.id; var etudid = sp.id;
$(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']")
if ($("input[name='reset_password:list']").is(":checked")) { .closest("tr")
$("#tf_password").closest('tr').css("display", "none"); .css("display", "table-row");
$("#tf_password2").closest('tr').css("display", "none"); if ($("input[name='reset_password:list']").is(":checked")) {
} else { $("#tf_password").closest("tr").css("display", "none");
// Le mot de passe doit être saisi $("#tf_password2").closest("tr").css("display", "none");
$("#tf_password").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") $("#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 {
// 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");
}
} }
$(function () { $(function () {
$("input[name='welcome:list']").click(function () { $("input[name='welcome:list']").click(function () {
refresh();
})
$("input[name='reset_password:list']").click(function () {
refresh();
})
refresh(); refresh();
}) });
$("input[name='reset_password:list']").click(function () {
refresh();
});
refresh();
});

View File

@ -43,7 +43,7 @@
d = new Date(dateString).getDay(); d = new Date(dateString).getDay();
if (verifyNonWorkDays(d, nonWorkDays)) return; if (isNonWorkDay(d, nonWorkDays)) return;
matin = `${dateString}T${timeMorning}`; matin = `${dateString}T${timeMorning}`;
midi = `${dateString}T${timeNoon}`; midi = `${dateString}T${timeNoon}`;
@ -70,4 +70,4 @@
{% include "assiduites/widgets/alert.j2" %} {% include "assiduites/widgets/alert.j2" %}
{% include "assiduites/widgets/prompt.j2" %} {% include "assiduites/widgets/prompt.j2" %}
{% include "assiduites/widgets/conflict.j2" %} {% include "assiduites/widgets/conflict.j2" %}
{% include "assiduites/widgets/toast.j2" %} {% include "assiduites/widgets/toast.j2" %}

View File

@ -89,8 +89,8 @@
const readOnly = {{ readonly }}; const readOnly = {{ readonly }};
updateDate();
setupDate(); setupDate();
updateDate();
setupTimeLine(); setupTimeLine();
window.forceModule = "{{ forcer_module }}" window.forceModule = "{{ forcer_module }}"

View File

@ -3,6 +3,7 @@
{% block scripts %} {% block scripts %}
{{ super() }} {{ super() }}
<script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script> <script src="{{scu.STATIC_DIR}}/js/etud_info.js"></script>
<script src="{{scu.STATIC_DIR}}/js/date_utils.js"></script>
{% endblock %} {% endblock %}
{% block app_content %} {% block app_content %}
@ -31,8 +32,8 @@
const group_ids = "{{group_ids}}"; const group_ids = "{{group_ids}}";
function stats() { function stats() {
const deb = document.querySelector('#stats_date_debut').value; const deb = Date.fromFRA(document.querySelector('#stats_date_debut').value);
const fin = document.querySelector('#stats_date_fin').value; const fin = Date.fromFRA(document.querySelector('#stats_date_fin').value);
location.href = `VisualisationAssiduitesGroupe?group_ids=${group_ids}&date_debut=${deb}&date_fin=${fin}`; location.href = `VisualisationAssiduitesGroupe?group_ids=${group_ids}&date_debut=${deb}&date_fin=${fin}`;
} }

View File

@ -954,24 +954,27 @@
editList.push(edit); editList.push(edit);
}) })
const values = { "create": {}, "edit": {} };
$.when( Promise.all(
asyncCreateAssiduiteGroup(createList, (data) => { [asyncCreateAssiduiteGroup(createList, (data) => {
values.create = data;
}), }),
asyncEditAssiduiteGroup(editList, (data) => { asyncEditAssiduiteGroup(editList, (data) => {
values.edit = data;
}) })]
).done((c, e) => { ).then(() => {
const c = values.create;
const e = values.edit;
let error; let error;
Object.keys(c[0].success).forEach((k) => { Object.keys(c.success).forEach((k) => {
const assiduite = createList[Number.parseInt(k)]; const assiduite = createList[Number.parseInt(k)];
assiduite["assiduite_id"] = c[0].success[k].message.assiduite_id; assiduite["assiduite_id"] = c.success[k].message.assiduite_id;
assiduites[assiduite.etudid].push(assiduite); assiduites[assiduite.etudid].push(assiduite);
}) })
if (c[0].errors.length > 0) { if (c.errors.length > 0) {
error = c[0].errors[Object.keys(c[0].errors)[0]]; error = c.errors[Object.keys(c.errors)[0]];
if (error.message.indexOf("Module") != -1) { if (error.message.indexOf("Module") != -1) {
const html = ` const html = `
<h3>Aucun module n'a été spécifié (préférence du semestre concerné)</h3> <h3>Aucun module n'a été spécifié (préférence du semestre concerné)</h3>
@ -982,7 +985,7 @@
toCreate.length = 0 toCreate.length = 0
} }
} }
Object.keys(e[0].success).forEach((k) => { Object.keys(e.success).forEach((k) => {
const { etudid, assiduite_id, moduleimpl_id, etat } = editList[Number.parseInt(k)] const { etudid, assiduite_id, moduleimpl_id, etat } = editList[Number.parseInt(k)]
assiduites[etudid].map((a) => { assiduites[etudid].map((a) => {
if (a.assiduite_id == assiduite_id) { if (a.assiduite_id == assiduite_id) {

View File

@ -0,0 +1,53 @@
{# -*- mode: jinja-html -*- #}
{% extends "sco_page.j2" %}
{% block styles %}
{{super()}}
{% endblock %}
{% block app_content %}
<releve-but>{{ formsemestre.id }}</releve-but>
{% endblock %}
{% block scripts %}
{{super()}}
{# <script src="{{scu.STATIC_DIR}}/js/releve-but.js"></script>#}
<script>
//let dataSrc = "{{bul_url|safe}}";
//fetch(dataSrc)
// .then(r => { return r.json() })
// .then(json => {
// let releve = document.querySelector("releve-but");
// releve.showData = json;
// // Syle custom à ajouter
// let style = document.createElement("style");
// style.textContent = `
// .module>div,
// .dateInscription,
// .numerosEtudiant,
// .dateNaissance{
// display: none;
// }`;
// releve.shadowRoot.appendChild(style);
// });
// .catch(error => {
// let div = document.createElement("div");
// div.innerText = "Une erreur s'est produite lors du transfert des données.";
// div.style.fontSize = "24px";
// div.style.color = "#d93030";
// let releve = document.querySelector("releve-but");
// releve.after(div);
// releve.remove();
// throw 'Fin du script - données invalides';
// });
document.querySelector("html").style.scrollBehavior = "smooth";
</script>
{% endblock %}

View File

@ -176,13 +176,13 @@ def bilan_dept():
), ),
"""<h2>Traitement de l'assiduité</h2> """<h2>Traitement de l'assiduité</h2>
<p class="help"> <p class="help">
Pour saisir l'assiduité ou consulter les états, il est recommandé de passer par Pour saisir l'assiduité ou consulter les états, il est recommandé de passer par
le semestre concerné (saisie par jour ou saisie différée). le semestre concerné (saisie par jour ou saisie différée).
</p> </p>
""", """,
] ]
H.append( H.append(
"""<p class="help">Pour signaler, annuler ou justifier l'assiduité d'un seul étudiant, """<p class="help">Pour signaler, annuler ou justifier l'assiduité d'un seul étudiant,
choisissez d'abord la personne concernée&nbsp;:</p>""" choisissez d'abord la personne concernée&nbsp;:</p>"""
) )
# Ajout de la barre de recherche d'étudiant (redirection vers bilan etud) # Ajout de la barre de recherche d'étudiant (redirection vers bilan etud)
@ -923,8 +923,8 @@ def etat_abs_date():
# On génère l'objet simplifié # On génère l'objet simplifié
etudiant = { etudiant = {
"nom": f"""<a href="{url_for( "nom": f"""<a href="{url_for(
"assiduites.calendrier_etud", "assiduites.calendrier_etud",
scodoc_dept=g.scodoc_dept, scodoc_dept=g.scodoc_dept,
etudid=etud["etudid"]) etudid=etud["etudid"])
}"><font color="#A00000">{etud["nomprenom"]}</font></a>""", }"><font color="#A00000">{etud["nomprenom"]}</font></a>""",
"etat": etat, "etat": etat,
@ -1019,7 +1019,7 @@ def visu_assi_group():
short=False, short=False,
), ),
date_debut=_dateiso_to_datefr(dates["debut"]), date_debut=_dateiso_to_datefr(dates["debut"]),
date_fin=_dateiso_to_datefr(dates["debut"]), date_fin=_dateiso_to_datefr(dates["fin"]),
gr_tit=gr_tit, gr_tit=gr_tit,
group_ids=request.args.get("group_ids", None), group_ids=request.args.get("group_ids", None),
sco=ScoData(formsemestre=groups_infos.get_formsemestre()), sco=ScoData(formsemestre=groups_infos.get_formsemestre()),

View File

@ -51,6 +51,7 @@ from app.but import (
jury_but_pv, jury_but_pv,
jury_but_validation_auto, jury_but_validation_auto,
jury_but_view, jury_but_view,
jury_export,
) )
from app.but.forms import jury_but_forms from app.but.forms import jury_but_forms
@ -2969,6 +2970,11 @@ sco_publish(
sco_prepajury.feuille_preparation_jury, sco_prepajury.feuille_preparation_jury,
Permission.ScoView, Permission.ScoView,
) )
sco_publish(
"/feuille_preparation_jury_but",
jury_export.feuille_preparation_jury_but,
Permission.ScoView,
)
sco_publish( sco_publish(
"/formsemestre_archive", "/formsemestre_archive",
sco_archives.formsemestre_archive, sco_archives.formsemestre_archive,

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"