sid/page/_JS/modules.js

49 lines
1.5 KiB
JavaScript
Raw Normal View History

2015-11-15 18:10:33 +00:00
<!--
/********************************/
/* GESTION DE L'AFFINAGE PAR UE */
/********************************/
var partList = document.querySelectorAll("#CONTAINER > section[name] > table.partlist[name=UE], #CONTAINER > section[name] > table.partlist[name=semestre], #CONTAINER > section[name] > table.partlist[name=formation]");
2015-11-15 18:10:33 +00:00
for( var i = 0 ; i < partList.length ; i++ ){
partList[i].addEventListener('click', function(e){
var tableauParent = e.target.parentNode.parentNode.parentNode;
if( tableauParent.tagName == 'TABLE' && e.target.dataset.hasOwnProperty('value') ){
2015-11-15 18:10:33 +00:00
/* SI c'est une affinage par FORMATION */
if( tableauParent.getAttribute('name') == 'formation' ){
pageM.vars[1] = 'f:'+e.target.dataset.value;
if( pageM.vars.length > 2 ) // si un deuxième affinage existe, on le supprime lors du choix de la formation
pageM.vars.pop();
}
/* SI c'est une affinage par SEMESTRE */
if( tableauParent.getAttribute('name') == 'semestre' )
pageM.vars[2] = 's:'+e.target.dataset.value;
/* SI c'est un affinage par UE */
if( tableauParent.getAttribute('name') == 'UE' )
pageM.vars[2] = 'u:'+e.target.dataset.value;
// si la formation n'est pas définie, on l'active
if( !/^f:/.test(pageM.vars[1]) )
pageM.vars[1] = 'f:'+document.querySelector('#CONTAINER > section[name] > table.partlist[name=formation] option[data-value].active').dataset.formation;
2015-11-15 18:10:33 +00:00
// si on a '*' comme valeur, on l'enlève
if( /\*$/.test(pageM.vars[2]) )
2015-11-15 18:10:33 +00:00
pageM.vars.pop();
reload();
}
}, false);
}
-->