urls in javascripts

This commit is contained in:
Emmanuel Viennet 2021-06-21 18:46:35 +02:00
parent 70eab84330
commit f177e777a9
9 changed files with 373 additions and 369 deletions

View File

@ -28,7 +28,7 @@ function ajaxFunction(mod, etudid, dat) {
document.getElementById("AjaxDiv").innerHTML = ajaxRequest.responseText;
}
}
ajaxRequest.open("POST", "doSignaleAbsenceGrSemestre", true);
ajaxRequest.open("POST", SCO_URL + "Absences/doSignaleAbsenceGrSemestre", true);
ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
var oSelectOne = $("#abs_form")[0].elements["moduleimpl_id"];
var index = oSelectOne.selectedIndex;

View File

@ -1,12 +1,13 @@
function _partition_set_attr(partition_id, attr_name, attr_value) {
$.post('partition_set_attr',
{ 'partition_id' : partition_id,
'attr' : attr_name,
'value' : attr_value
$.post(SCO_URL + '/partition_set_attr',
{
'partition_id': partition_id,
'attr': attr_name,
'value': attr_value
},
function(result) {
function (result) {
sco_message(result);
});
return;
@ -17,9 +18,9 @@ function update_rk(e) {
var partition_id = $(e).attr('data-partition_id');
var v;
if (e.checked)
v='1';
v = '1';
else
v='0';
v = '0';
_partition_set_attr(partition_id, 'bul_show_rank', v);
}
@ -28,9 +29,9 @@ function update_show_in_list(e) {
var partition_id = $(e).attr('data-partition_id');
var v;
if (e.checked)
v='1';
v = '1';
else
v='0';
v = '0';
_partition_set_attr(partition_id, 'show_in_lists', v);
}

View File

@ -1,6 +1,6 @@
// Affiche et met a jour la liste des UE partageant le meme code
$().ready(function(){
$().ready(function () {
update_ue_list();
$("#tf_ue_code").bind("keyup", update_ue_list);
});
@ -9,8 +9,8 @@ $().ready(function(){
function update_ue_list() {
var ue_id = $("#tf_ue_id")[0].value;
var ue_code = $("#tf_ue_code")[0].value;
var query = "ue_sharing_code?ue_code=" + ue_code +"&hide_ue_id=" + ue_id + "&ue_id=" + ue_id;
$.get( query, '', function(data){
var query = SCO_URL + "/Notes/ue_sharing_code?ue_code=" + ue_code + "&hide_ue_id=" + ue_id + "&ue_id=" + ue_id;
$.get(query, '', function (data) {
$("#ue_list_code").html(data);
});
}

View File

@ -3,7 +3,7 @@
// console.log('etud_debouche.js loaded');
$(function() {
$(function () {
display_itemsuivis(false);
});
@ -13,37 +13,37 @@ function display_itemsuivis(active) {
var readonly = $('div#fichedebouche').data('readonly'); // present ro interface
if (!readonly) {
$('#adddebouchelink').off("click").click(function(e){
$('#adddebouchelink').off("click").click(function (e) {
e.preventDefault();
$.post( "itemsuivi_create", { etudid: etudid, format:'json' } ).done( item_insert_new );
$.post(SCO_URL + "itemsuivi_create", { etudid: etudid, format: 'json' }).done(item_insert_new);
return false;
});
}
// add existing items
$.get( 'itemsuivi_list_etud', { etudid: etudid, format: 'json' }, function(L) {
$.get(SCO_URL + "/itemsuivi_list_etud", { etudid: etudid, format: 'json' }, function (L) {
for (var i in L) {
item_insert( L[i]['itemsuivi_id'], L[i]['item_date'], L[i]['situation'], L[i]['tags'], readonly );
item_insert(L[i]['itemsuivi_id'], L[i]['item_date'], L[i]['situation'], L[i]['tags'], readonly);
}
});
$( "div#fichedebouche" ).accordion( {
$("div#fichedebouche").accordion({
heightStyle: "content",
collapsible: true,
active: active,
});
}
function item_insert_new( it ) {
item_insert( it.itemsuivi_id, it.item_date, it.situation, '', false );
function item_insert_new(it) {
item_insert(it.itemsuivi_id, it.item_date, it.situation, '', false);
}
function item_insert( itemsuivi_id, item_date, situation, tags, readonly ) {
if ( item_date === undefined )
function item_insert(itemsuivi_id, item_date, situation, tags, readonly) {
if (item_date === undefined)
item_date = Date2DMY(new Date());
if ( situation === undefined )
if (situation === undefined)
situation = '';
if ( tags === undefined )
if (tags === undefined)
tags = '';
var nodes = item_nodes(itemsuivi_id, item_date, situation, tags, readonly);
@ -58,7 +58,7 @@ function item_insert( itemsuivi_id, item_date, situation, tags, readonly ) {
function item_nodes(itemsuivi_id, item_date, situation, tags, readonly) {
// console.log('item_nodes: itemsuivi_id=' + itemsuivi_id);
var sel_mois = 'Situation à la date du <input type="text" class="itemsuividatepicker" size="10" value="' + item_date + '"/><span class="itemsuivi_suppress" onclick="itemsuivi_suppress(\''+itemsuivi_id+'\')"><img width="10" height="9" border="0" title="" alt="supprimer cet item" src="/ScoDoc/static/icons/delete_small_img.png"/></span>';
var sel_mois = 'Situation à la date du <input type="text" class="itemsuividatepicker" size="10" value="' + item_date + '"/><span class="itemsuivi_suppress" onclick="itemsuivi_suppress(\'' + itemsuivi_id + '\')"><img width="10" height="9" border="0" title="" alt="supprimer cet item" src="/ScoDoc/static/icons/delete_small_img.png"/></span>';
var h = sel_mois;
// situation
@ -66,26 +66,26 @@ function item_nodes(itemsuivi_id, item_date, situation, tags, readonly) {
// tags:
h += '<div class="itemsuivi_tag_edit"><textarea class="itemsuivi_tag_editor">' + tags + '</textarea></div>';
var nodes = $($.parseHTML( '<li class="itemsuivi">' + h + '</li>' ));
var nodes = $($.parseHTML('<li class="itemsuivi">' + h + '</li>'));
var dp = nodes.find('.itemsuividatepicker');
dp.blur( function(e) {
dp.blur(function (e) {
var date = this.value;
// console.log('selected text: ' + date);
$.post( "itemsuivi_set_date", { item_date: date, itemsuivi_id: itemsuivi_id } );
$.post(SCO_URL + "/itemsuivi_set_date", { item_date: date, itemsuivi_id: itemsuivi_id });
});
dp.datepicker({
onSelect: function(date, instance) {
onSelect: function (date, instance) {
// console.log('selected: ' + date + 'for itemsuivi_id ' + itemsuivi_id);
$.post( "itemsuivi_set_date", { item_date: date, itemsuivi_id: itemsuivi_id } );
$.post(SCO_URL + "/itemsuivi_set_date", { item_date: date, itemsuivi_id: itemsuivi_id });
},
showOn: 'button',
buttonImage: '/ScoDoc/static/icons/calendar_img.png',
buttonImageOnly: true,
dateFormat: 'dd/mm/yy',
duration : 'fast',
duration: 'fast',
disabled: readonly
});
dp.datepicker('option', $.extend({showMonthAfterYear: false},
dp.datepicker('option', $.extend({ showMonthAfterYear: false },
$.datepicker.regional['fr']));
if (readonly) {
@ -97,7 +97,7 @@ function item_nodes(itemsuivi_id, item_date, situation, tags, readonly) {
nodes.find('.itemsuivi_tag_editor').tagEditor({
initialTags: '',
placeholder: 'Tags...',
onChange: function(field, editor, tags) {
onChange: function (field, editor, tags) {
$.post('itemsuivi_tag_set',
{
itemsuivi_id: itemsuivi_id,
@ -131,7 +131,7 @@ function Date2DMY(date) {
}
function itemsuivi_suppress(itemsuivi_id) {
$.post( "itemsuivi_suppress", { itemsuivi_id: itemsuivi_id } );
$.post(SCO_URL + "/itemsuivi_suppress", { itemsuivi_id: itemsuivi_id });
// Clear items and rebuild:
$("ul.listdebouches li.itemsuivi").remove();
display_itemsuivis(0);

View File

@ -6,7 +6,7 @@
/* --- Globals ---- */
var EtudColors = [ "#E8EEF7", "#ffffff" ]; // [ "#E8EEF7", "#E0ECFF", "#E5E6BE", "#F3EAE2", "#E3EAE1" ];
var EtudColors = ["#E8EEF7", "#ffffff"]; // [ "#E8EEF7", "#E0ECFF", "#E5E6BE", "#F3EAE2", "#E3EAE1" ];
var EtudColorsIdx = 0;
var NbEtuds = 0;
var ETUDS = new Object(); // { etudid : etud }
@ -19,19 +19,19 @@ function loadGroupes() {
$("#gmsg")[0].innerHTML = 'Chargement des groupes en cours...';
var partition_id = document.formGroup.partition_id.value;
$.get('XMLgetGroupsInPartition', { partition_id : partition_id } )
$.get(SCO_URL + 'XMLgetGroupsInPartition', { partition_id: partition_id })
.done(
function( data ) {
function (data) {
var nodes = data.getElementsByTagName('group');
if (nodes) {
var nbgroups = nodes.length;
// put last group at first (etudiants sans groupes)
if (nodes.length > 1 && nodes[nbgroups-1].attributes.getNamedItem("group_id").value == '_none_') {
populateGroup(nodes[nodes.length-1]);
if (nodes.length > 1 && nodes[nbgroups - 1].attributes.getNamedItem("group_id").value == '_none_') {
populateGroup(nodes[nodes.length - 1]);
nbgroups -= 1;
}
// then standard groups
for (var i=0; i < nbgroups; i++) {
for (var i = 0; i < nbgroups; i++) {
populateGroup(nodes[i]);
}
}
@ -41,24 +41,24 @@ function loadGroupes() {
)
}
function populateGroup( node ) {
function populateGroup(node) {
var group_id = node.attributes.getNamedItem("group_id").value;
var group_name = node.attributes.getNamedItem("group_name").value;
// CREE LA BOITE POUR CE GROUPE
if (group_id) {
var gbox = new CGroupBox( group_id, group_name );
var gbox = new CGroupBox(group_id, group_name);
var etuds = node.getElementsByTagName('etud');
var x='';
var x = '';
gbox.sorting = false; // disable to speedup
EtudColorsIdx = 0; // repart de la premiere couleur
for (var j=0; j < etuds.length; j++) {
for (var j = 0; j < etuds.length; j++) {
var nom = etuds[j].attributes.getNamedItem("nom").value;
var prenom = etuds[j].attributes.getNamedItem("prenom").value;
var sexe = etuds[j].attributes.getNamedItem("sexe").value;
var etudid = etuds[j].attributes.getNamedItem("etudid").value;
var origin = etuds[j].attributes.getNamedItem("origin").value;
var etud = new CDraggableEtud( nom, prenom, sexe, origin, etudid );
var etud = new CDraggableEtud(nom, prenom, sexe, origin, etudid);
gbox.createEtudInGroup(etud, group_id);
}
gbox.sorting = true;
@ -72,14 +72,14 @@ function populateGroup( node ) {
var groupBoxes = new Object(); // assoc group_id : groupBox
var groupsToDelete = new Object(); // list of group_id to be supressed
var CGroupBox = function(group_id, group_name) {
var CGroupBox = function (group_id, group_name) {
group_id = $.trim(group_id);
var regex = /^\w+$/;
if (! regex.test(group_id) ) {
if (!regex.test(group_id)) {
alert("Id de groupe invalide");
return;
}
if ( group_id in groups ) {
if (group_id in groups) {
alert("Le groupe " + group_id + " existe déjà !");
return;
}
@ -103,9 +103,9 @@ var CGroupBox = function(group_id, group_name) {
this.updateTitle();
$(this.groupBox).droppable(
{
accept : ".box",
accept: ".box",
activeClass: "activatedPanel",
drop: function( event, ui ) {
drop: function (event, ui) {
// alert("drop on " + this.group_name);
var etudid = ui.draggable[0].id;
var etud = ETUDS[etudid];
@ -119,7 +119,7 @@ var CGroupBox = function(group_id, group_name) {
}
});
/* On peut s'amuser a deplacer tout un groupe (visuellement: pas droppable) */
$(this.groupBox).draggable( {
$(this.groupBox).draggable({
cursor: 'move',
containment: '#groups'
});
@ -130,7 +130,7 @@ var CGroupBox = function(group_id, group_name) {
$.extend(CGroupBox.prototype, {
// menu for group title
groupTitle : function() {
groupTitle: function () {
var menuSpan = document.createElement("span");
menuSpan.className = "barrenav";
var h = "<table><tr><td><ul class=\"nav\"><li onmouseover=\"MenuDisplay(this)\" onmouseout=\"MenuHide(this)\"><a href=\"#\" class=\"menu custommenu\"><span id=\"titleSpan" + this.group_id + "\" class=\"groupTitle\">menu</span></a><ul>";
@ -143,12 +143,12 @@ $.extend(CGroupBox.prototype, {
return menuSpan;
},
// add etud to group, attach to DOM
createEtudInGroup: function(etud) {
createEtudInGroup: function (etud) {
this.addEtudToGroup(etud);
this.groupBox.appendChild(etud.htmlElement);
},
// add existing etud to group (does not affect DOM)
addEtudToGroup: function(etud) {
addEtudToGroup: function (etud) {
etud.group_id = this.group_id;
this.etuds[etud.etudid] = etud;
this.nbetuds++;
@ -156,33 +156,33 @@ $.extend(CGroupBox.prototype, {
this.updateTitle();
},
// remove etud
removeEtud: function(etud) {
removeEtud: function (etud) {
delete this.etuds[etud.etudid];
this.nbetuds--;
this.updateTitle();
},
// Update counter display
updateTitle: function() {
updateTitle: function () {
var tclass = '';
if (this.isNew) {
tclass = ' class="newgroup"'
}
var titleSpan = document.getElementById('titleSpan'+this.group_id);
var titleSpan = document.getElementById('titleSpan' + this.group_id);
if (this.group_id != '_none_')
titleSpan.innerHTML = '<span'+tclass+'>Groupe ' + this.group_name + ' (' + this.nbetuds + ')</span>';
titleSpan.innerHTML = '<span' + tclass + '>Groupe ' + this.group_name + ' (' + this.nbetuds + ')</span>';
else
titleSpan.innerHTML = '<span'+tclass+'>Etudiants sans groupe' + ' (' + this.nbetuds + ')</span>';
titleSpan.innerHTML = '<span' + tclass + '>Etudiants sans groupe' + ' (' + this.nbetuds + ')</span>';
this.sortList(); // maintient toujours la liste triee
},
// Tri de la boite par nom
sortList: function() {
sortList: function () {
if (!this.sorting)
return;
var newRows = new Array();
for (var i=1; i < this.groupBox.childNodes.length; i++) { // 1 car div titre
newRows[i-1] = this.groupBox.childNodes[i];
for (var i = 1; i < this.groupBox.childNodes.length; i++) { // 1 car div titre
newRows[i - 1] = this.groupBox.childNodes[i];
}
var sortfn = function(a,b) {
var sortfn = function (a, b) {
// recupere les noms qui sont dans un span
var nom_a = a.childNodes[1].childNodes[0].nodeValue;
var nom_b = b.childNodes[1].childNodes[0].nodeValue;
@ -194,7 +194,7 @@ $.extend(CGroupBox.prototype, {
return 1;
};
newRows.sort(sortfn);
for (var i=0;i<newRows.length;i++) {
for (var i = 0; i < newRows.length; i++) {
this.groupBox.appendChild(newRows[i]);
newRows[i].style.backgroundColor = EtudColors[EtudColorsIdx];
EtudColorsIdx = (EtudColorsIdx + 1) % EtudColors.length;
@ -203,11 +203,11 @@ $.extend(CGroupBox.prototype, {
});
function suppressGroup( group_id ) {
function suppressGroup(group_id) {
// 1- associate all members to group _none_
if (!groupBoxes['_none_']) {
// create group _none_
var gbox = new CGroupBox( '_none_', 'Etudiants sans groupe' );
var gbox = new CGroupBox('_none_', 'Etudiants sans groupe');
}
var dst_group_id = groupBoxes['_none_'].group_id;
var src_box_etuds = groupBoxes[group_id].etuds;
@ -229,13 +229,13 @@ function suppressGroup( group_id ) {
}
function renameGroup( group_id ) {
function renameGroup(group_id) {
// 1-- save modifications
if (groups_unsaved) {
alert("Enregistrez ou annulez vos changement avant !");
} else {
// 2- form rename
document.location='group_rename?group_id=' + group_id;
document.location = 'group_rename?group_id=' + group_id;
}
}
@ -267,14 +267,14 @@ function createGroup() {
}
var group_id = newGroupId();
groups_unsaved = true;
var gbox = new CGroupBox( group_id, group_name );
var gbox = new CGroupBox(group_id, group_name);
gbox.isNew = true;
gbox.updateTitle();
return true;
}
/* --- Etudiant draggable --- */
var CDraggableEtud = function(nom, prenom, sexe, origin, etudid) {
var CDraggableEtud = function (nom, prenom, sexe, origin, etudid) {
this.type = 'Custom';
this.name = etudid;
this.etudid = etudid;
@ -284,14 +284,14 @@ var CDraggableEtud = function(nom, prenom, sexe, origin, etudid) {
this.origin = origin;
this.createNode();
ETUDS[etudid] = this;
NbEtuds ++;
NbEtuds++;
}
$.extend(CDraggableEtud.prototype, {
repr: function() {
return this.sexe + ' ' + this.prenom + ' <span class="nom">' + this.nom + '</span> ' + '<b>'+this.origin+'</b>';
repr: function () {
return this.sexe + ' ' + this.prenom + ' <span class="nom">' + this.nom + '</span> ' + '<b>' + this.origin + '</b>';
},
createNode: function() {
createNode: function () {
// Create DOM element for student
var e = document.createElement("div");
this.htmlElement = e;
@ -303,23 +303,23 @@ $.extend(CDraggableEtud.prototype, {
//e.appendChild(txtNode);
e.innerHTML = this.repr();
// declare as draggable
$(e).draggable( {
$(e).draggable({
cursor: 'move',
stack: '#groups div',
containment: '#groups',
revert: 'invalid'
});
},
endDrag: function() {
endDrag: function () {
var el = this.htmlElement;
var p = el.parentNode;
// alert("endDrag: [" + this.name +"] " + p.id );
this.changeGroup( this.group_id, p.id );
this.changeGroup(this.group_id, p.id);
this.htmlElement.style.fontStyle = 'italic'; // italic pour les etudiants deplaces
},
// Move a student from a group to another
changeGroup: function( oldGroupName, newGroupName ) {
if (oldGroupName==newGroupName) {
changeGroup: function (oldGroupName, newGroupName) {
if (oldGroupName == newGroupName) {
// drop on original group, just sort
groupBoxes[oldGroupName].updateTitle();
return;
@ -343,16 +343,16 @@ function processResponse(value) {
location.reload(); // necessaire pour reinitialiser les id des groupes créés
}
function handleError( msg ) {
alert( 'Error: ' + msg );
console.log( 'Error: ' + msg );
function handleError(msg) {
alert('Error: ' + msg);
console.log('Error: ' + msg);
}
function submitGroups() {
var url = 'setGroups';
var url = SCO_URL + '/setGroups';
// build post request body: groupname \n etudid; ...
var groupsLists = '';
var groupsToCreate='';
var groupsToCreate = '';
for (var group_id in groupBoxes) {
if (group_id != 'extend') { // je ne sais pas ce dont il s'agit ???
if (group_id != '_none_') { // ne renvoie pas le groupe des sans-groupes
@ -383,16 +383,16 @@ function submitGroups() {
groupsToDelete = new Object(); // empty
var partition_id = document.formGroup.partition_id.value;
// Send to server
$.get( url, {
groupsLists : groupsLists, // encodeURIComponent
partition_id : partition_id,
groupsToDelete : todel,
groupsToCreate : groupsToCreate
$.get(url, {
groupsLists: groupsLists, // encodeURIComponent
partition_id: partition_id,
groupsToDelete: todel,
groupsToCreate: groupsToCreate
})
.done( function (data) {
.done(function (data) {
processResponse(data);
})
.fail(function() {
.fail(function () {
handleError("Erreur lors de l'enregistrement de groupes");
});
}
@ -402,7 +402,7 @@ function GotoAnother() {
if (groups_unsaved) {
alert("Enregistrez ou annulez vos changement avant !");
} else
document.location='affectGroups?partition_id='+document.formGroup.other_partition_id.value;
document.location = SCO_URL + '/affectGroups?partition_id=' + document.formGroup.other_partition_id.value;
}
@ -411,7 +411,7 @@ function updateginfo() {
var g = document.getElementById('ginfo');
var group_names = new Array();
for (var group_id in groupBoxes) {
if ((group_id != 'extend') && (groupBoxes[group_id].group_name)){
if ((group_id != 'extend') && (groupBoxes[group_id].group_name)) {
group_names.push(groupBoxes[group_id].group_name);
}
}
@ -426,16 +426,16 @@ function updatesavedinfo() {
var g = document.getElementById('savedinfo');
if (groups_unsaved) {
g.innerHTML = 'modifications non enregistrées';
g.style.visibility='visible';
g.style.visibility = 'visible';
} else {
g.innerHTML = '';
g.style.visibility='hidden';
g.style.visibility = 'hidden';
}
return true;
}
$(function() {
$(function () {
loadGroupes();
});

View File

@ -5,7 +5,7 @@
//
// Ce code utilise d3.js
$().ready(function(){
$().ready(function () {
var etudid = $("#etudid")[0].value;
var formsemestre_id = $("#formsemestre_id")[0].value;
get_notes_and_draw(formsemestre_id, etudid);
@ -14,12 +14,12 @@ $().ready(function(){
var WIDTH = 460; // taille du canvas SVG
var HEIGHT = WIDTH;
var CX = WIDTH/2; // coordonnees centre du cercle
var CY = HEIGHT/2;
var RR = 0.4*WIDTH; // Rayon du cercle exterieur
var CX = WIDTH / 2; // coordonnees centre du cercle
var CY = HEIGHT / 2;
var RR = 0.4 * WIDTH; // Rayon du cercle exterieur
/* Emplacements des marques (polygones et axe gradué) */
var R_TICS = [ 8, 10, 20 ]; /* [6, 8, 10, 12, 14, 16, 18, 20]; */
var R_TICS = [8, 10, 20]; /* [6, 8, 10, 12, 14, 16, 18, 20]; */
var R_AXIS_TICS = [4, 6, 8, 10, 12, 14, 16, 18, 20];
var NB_TICS = R_TICS.length;
@ -33,18 +33,21 @@ function get_notes_and_draw(formsemestre_id, etudid) {
'moy' : 16 },
];
*/
var query = "formsemestre_bulletinetud?formsemestre_id=" + formsemestre_id + "&etudid=" + etudid + "&format=json&version=selectedevals&force_publishing=1"
var query = SCO_URL + "/Notes/formsemestre_bulletinetud?formsemestre_id=" + formsemestre_id + "&etudid=" + etudid + "&format=json&version=selectedevals&force_publishing=1"
$.get( query, '', function(bul){
$.get(query, '', function (bul) {
var notes = [];
bul.ue.forEach(
function(ue, i, ues) {
ue['module'].forEach( function(m, i) {
notes.push( { 'code': m['code'],
'titre' : m['titre'],
'note':m['note']['value'],
'moy':m['note']['moy'] } );
}); } );
function (ue, i, ues) {
ue['module'].forEach(function (m, i) {
notes.push({
'code': m['code'],
'titre': m['titre'],
'note': m['note']['value'],
'moy': m['note']['moy']
});
});
});
draw_radar(notes);
});
}
@ -52,51 +55,51 @@ function get_notes_and_draw(formsemestre_id, etudid) {
function draw_radar(notes) {
/* Calcul coordonnées des éléments */
var nmod = notes.length;
var angle = 2*Math.PI/nmod;
var angle = 2 * Math.PI / nmod;
for (var i=0; i<notes.length; i++) {
for (var i = 0; i < notes.length; i++) {
var d = notes[i];
var cx = Math.sin(i*angle);
var cy = - Math.cos(i*angle);
d["x_v"] = CX + RR * d.note/20 * cx;
d["y_v"] = CY + RR * d.note/20 * cy;
d["x_moy"] = CX + RR * d.moy/20 * cx;
d["y_moy"] = CY + RR * d.moy/20 * cy;
var cx = Math.sin(i * angle);
var cy = - Math.cos(i * angle);
d["x_v"] = CX + RR * d.note / 20 * cx;
d["y_v"] = CY + RR * d.note / 20 * cy;
d["x_moy"] = CX + RR * d.moy / 20 * cx;
d["y_moy"] = CY + RR * d.moy / 20 * cy;
d["x_20"] = CX + RR * cx;
d["y_20"] = CY + RR * cy;
d["x_label"] = CX + (RR + 25) * cx - 10
d["y_label"] = CY + (RR + 25) * cy + 10;
d["tics"] = [];
// Coords des tics sur chaque axe
for (var j=0; j < NB_TICS; j++) {
var r = R_TICS[j]/20 * RR;
d["tics"][j] = { "x" : CX + r * cx, "y" : CY + r * cy };
for (var j = 0; j < NB_TICS; j++) {
var r = R_TICS[j] / 20 * RR;
d["tics"][j] = { "x": CX + r * cx, "y": CY + r * cy };
}
}
var notes_circ = notes.slice(0);
notes_circ.push(notes[0])
var notes_circ_valid = notes_circ.filter( function(e,i,a) { return e.note != 'NA' && e.note != '-'; } );
var notes_valid = notes.filter( function(e,i,a) { return e.note != 'NA' && e.note != '-'; } )
var notes_circ_valid = notes_circ.filter(function (e, i, a) { return e.note != 'NA' && e.note != '-'; });
var notes_valid = notes.filter(function (e, i, a) { return e.note != 'NA' && e.note != '-'; })
/* Crée l'élément SVG */
g = d3.select("#radar_bulletin").append("svg")
.attr("class", "radar")
.attr("width", WIDTH+100)
.attr("width", WIDTH + 100)
.attr("height", HEIGHT);
/* Centre */
g.append( "circle" ).attr("cy", CY)
g.append("circle").attr("cy", CY)
.attr("cx", CX)
.attr("r", 2)
.attr("class", "radar_center_mark");
/* Lignes "tics" */
for (var j=0; j < NB_TICS; j++) {
for (var j = 0; j < NB_TICS; j++) {
var ligne_tics = d3.svg.line()
.x(function(d) { return d["tics"][j]["x"]; })
.y(function(d) { return d["tics"][j]["y"]; });
g.append( "svg:path" )
.x(function (d) { return d["tics"][j]["x"]; })
.y(function (d) { return d["tics"][j]["y"]; });
g.append("svg:path")
.attr("class", "radar_disk_tic")
.attr("id", "radar_disk_tic_" + R_TICS[j])
.attr("d", ligne_tics(notes_circ));
@ -108,25 +111,25 @@ function draw_radar(notes) {
.enter().append("line")
.attr("x1", CX)
.attr("y1", CY)
.attr("x2", function(d) { return d["x_20"]; })
.attr("y2", function(d) { return d["y_20"]; })
.attr("x2", function (d) { return d["x_20"]; })
.attr("y2", function (d) { return d["y_20"]; })
.attr("class", "radarrad");
/* Lignes entre notes */
var ligne = d3.svg.line()
.x(function(d) { return d["x_v"]; })
.y(function(d) { return d["y_v"]; });
.x(function (d) { return d["x_v"]; })
.y(function (d) { return d["y_v"]; });
g.append( "svg:path" )
g.append("svg:path")
.attr("class", "radarnoteslines")
.attr("d", ligne(notes_circ_valid));
var ligne_moy = d3.svg.line()
.x(function(d) { return d["x_moy"]; })
.y(function(d) { return d["y_moy"]; })
.x(function (d) { return d["x_moy"]; })
.y(function (d) { return d["y_moy"]; })
g.append( "svg:path" )
g.append("svg:path")
.attr("class", "radarmoylines")
.attr("d", ligne_moy(notes_circ_valid));
@ -134,13 +137,13 @@ function draw_radar(notes) {
g.selectAll("circle1")
.data(notes_valid)
.enter().append("circle")
.attr("cx", function(d) { return d["x_v"]; })
.attr("cy", function(d) { return d["y_v"]; })
.attr("r", function(x, i) { return 3; } )
.attr("cx", function (d) { return d["x_v"]; })
.attr("cy", function (d) { return d["y_v"]; })
.attr("r", function (x, i) { return 3; })
.style("stroke-width", 1)
.style("stroke", "black")
.style("fill", "blue")
.on("mouseover", function(d) {
.on("mouseover", function (d) {
var rwidth = 310;
var x = d["x_v"];
if ((x - CX) < 0) {
@ -157,7 +160,7 @@ function draw_radar(notes) {
}
}
else {
x = CX - rwidth/2;
x = CX - rwidth / 2;
}
}
var yrect = d["y_v"];
@ -171,17 +174,17 @@ function draw_radar(notes) {
ytext = ytext + 5 + 16;
}
var r = g.append("rect")
.attr('class','radartip')
.attr('class', 'radartip')
.attr("x", x)
.attr("y", yrect );
.attr("y", yrect);
var txt = g.append("text").text("Note: " + d.note + "/20, moyenne promo: " + d.moy + "/20")
.attr('class','radartip')
.attr('class', 'radartip')
.attr("x", x + 5)
.attr("y", ytext);
r.attr("width", rwidth).attr("height", 20);
})
.on("mouseout", function(d){
.on("mouseout", function (d) {
d3.selectAll(".radartip").remove()
});
@ -189,11 +192,11 @@ function draw_radar(notes) {
g.selectAll("notes_labels")
.data(notes_valid)
.enter().append("text")
.text(function(d) { return d["note"]; })
.attr("x", function(d) {
.text(function (d) { return d["note"]; })
.attr("x", function (d) {
return d["x_v"];
})
.attr("y", function(d) {
.attr("y", function (d) {
if (d["y_v"] > CY)
return d["y_v"] + 16;
else
@ -205,36 +208,36 @@ function draw_radar(notes) {
g.selectAll("circle2")
.data(notes_valid)
.enter().append("circle")
.attr("cx", function(d) { return d["x_moy"]; })
.attr("cy", function(d) { return d["y_moy"]; })
.attr("r", function(x, i) { return 2; } )
.attr("cx", function (d) { return d["x_moy"]; })
.attr("cy", function (d) { return d["y_moy"]; })
.attr("r", function (x, i) { return 2; })
.style("stroke-width", 0)
.style("stroke", "black")
.style("fill", "rgb(20,90,50)");
/* Valeurs sur axe */
g.selectAll("textaxis")
.data( R_AXIS_TICS )
.data(R_AXIS_TICS)
.enter().append("text")
.text(String)
.attr("x", CX - 10)
.attr("y", function(x, i) { return CY - x*RR/20 + 6; })
.attr("y", function (x, i) { return CY - x * RR / 20 + 6; })
.attr("class", "textaxis");
/* Noms des modules */
g.selectAll("text_modules")
.data(notes)
.enter().append("text")
.text( function(d) { return d['code']; } )
.attr("x", function(d) { return d['x_label']; } )
.attr("y", function(d) { return d['y_label']; })
.text(function (d) { return d['code']; })
.attr("x", function (d) { return d['x_label']; })
.attr("y", function (d) { return d['y_label']; })
.attr("dx", 0)
.attr("dy", 0)
.on("mouseover", function(d) {
.on("mouseover", function (d) {
var x = d["x_label"];
var yrect = d["y_label"];
var ytext = d["y_label"];
var titre = d['titre'].replace("&apos;", "'").substring(0,64);
var titre = d['titre'].replace("&apos;", "'").substring(0, 64);
var rwidth = titre.length * 9; // rough estimate of string width in pixels
if ((x - CX) < 0) {
x = x + 5;
@ -250,7 +253,7 @@ function draw_radar(notes) {
}
}
else {
x = CX - rwidth/2;
x = CX - rwidth / 2;
}
}
if ((yrect - CY) > 0) {
@ -262,17 +265,17 @@ function draw_radar(notes) {
ytext = ytext + 5 + 16;
}
var r = g.append("rect")
.attr('class','radartip')
.attr('class', 'radartip')
.attr("x", x)
.attr("y", yrect)
.attr("height", 20)
.attr("width", rwidth);
var txt = g.append("text").text( titre )
.attr('class','radartip')
var txt = g.append("text").text(titre)
.attr('class', 'radartip')
.attr("x", x + 5)
.attr("y", ytext);
})
.on("mouseout", function(d){
.on("mouseout", function (d) {
d3.selectAll(".radartip").remove()
});
}

View File

@ -1,6 +1,6 @@
// Formulaire saisie des notes
$().ready(function(){
$().ready(function () {
$("#formnotes .note").bind("blur", valid_note);
@ -15,8 +15,8 @@ function is_valid_note(v) {
var note_min = parseFloat($("#eval_note_min").text());
var note_max = parseFloat($("#eval_note_max").text());
if (! v.match("^-?[0-9.]*$")) {
return (v=="ABS")||(v=="EXC")||(v=="SUPR")||(v=="ATT")||(v=="DEM");
if (!v.match("^-?[0-9.]*$")) {
return (v == "ABS") || (v == "EXC") || (v == "SUPR") || (v == "ATT") || (v == "DEM");
} else {
var x = parseFloat(v);
return (x >= note_min) && (x <= note_max);
@ -41,28 +41,28 @@ function save_note(elem, v, etudid) {
var evaluation_id = $("#formnotes_evaluation_id").attr("value");
var formsemestre_id = $("#formnotes_formsemestre_id").attr("value");
$('#sco_msg').html("en cours...").show();
$.post( 'save_note',
$.post(SCO_URL + 'Notes/save_note',
{
'etudid' : etudid,
'evaluation_id' : evaluation_id,
'value' : v,
'comment' : $("#formnotes_comment").attr("value")
'etudid': etudid,
'evaluation_id': evaluation_id,
'value': v,
'comment': $("#formnotes_comment").attr("value")
},
function(result) {
function (result) {
sco_message("enregistré");
elem.className = "note_saved";
if (result['nbchanged'] > 0) {
// il y avait une decision de jury ?
if (result.existing_decisions[0] == etudid) {
if (v != $(elem).attr('data-orig-value')) {
$("#jurylink_"+etudid).html('<a href="formsemestre_validation_etud_form?formsemestre_id=' + formsemestre_id + '&etudid=' + etudid + '">mettre à jour décision de jury</a>');
$("#jurylink_" + etudid).html('<a href="formsemestre_validation_etud_form?formsemestre_id=' + formsemestre_id + '&etudid=' + etudid + '">mettre à jour décision de jury</a>');
} else {
$("#jurylink_"+etudid).html('');
$("#jurylink_" + etudid).html('');
}
}
// mise a jour menu historique
if (result['history_menu']) {
$("#hist_"+etudid).html(result['history_menu']);
$("#hist_" + etudid).html(result['history_menu']);
}
}
$(elem).attr('data-last-saved-value', v)
@ -92,7 +92,7 @@ function paste_text(e) {
var list = data.split(/\r\n|\r|\n|\t| /g);
var currentInput = event.currentTarget;
for(var i=0 ; i<list.length ; i++){
for (var i = 0; i < list.length; i++) {
currentInput.value = list[i];
var evt = document.createEvent("HTMLEvents");
evt.initEvent("blur", false, true);
@ -103,7 +103,7 @@ function paste_text(e) {
}
if (sibbling) {
currentInput = sibbling.querySelector("input");
if(!currentInput){
if (!currentInput) {
return;
}
} else {

View File

@ -1,11 +1,11 @@
// Affichage progressif du trombinoscope html
$().ready(function(){
$().ready(function () {
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 etudid = sp.id;
$(sp).load('etud_photo_html?etudid='+etudid);
$(sp).load(SCO_URL + "/etud_photo_html?etudid=" + etudid);
}
});

View File

@ -1,6 +1,6 @@
// Affiche et met a jour la liste des UE partageant le meme code
$().ready(function(){
$().ready(function () {
update_ue_validations();
update_ue_list();
$("#tf_ue_id").bind("change", update_ue_list);
@ -12,7 +12,7 @@ function update_ue_list() {
var ue_id = $("#tf_ue_id")[0].value;
if (ue_id) {
var query = "ue_sharing_code?ue_id=" + ue_id;
$.get( query, '', function(data){
$.get(query, '', function (data) {
$("#ue_list_code").html(data);
});
}
@ -23,8 +23,8 @@ function update_ue_validations() {
var ue_id = $("#tf_ue_id")[0].value;
var formsemestre_id = $("#tf_formsemestre_id")[0].value;
if (ue_id) {
var query = "get_etud_ue_cap_html?ue_id="+ue_id+"&etudid="+etudid+"&formsemestre_id="+formsemestre_id;
$.get( query, '', function(data){
var query = SCO_URL + "/Notes/get_etud_ue_cap_html?ue_id=" + ue_id + "&etudid=" + etudid + "&formsemestre_id=" + formsemestre_id;
$.get(query, '', function (data) {
$("#ue_list_etud_validations").html(data);
});
}