From 756f0fa75c7d8e18188dffdfbdd4416651dca9fe Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc <ludovic@pouzenc.fr> Date: Sat, 30 Jun 2018 10:03:15 +0200 Subject: Première maquette 2007-02-03+09:05:40 - 2007-02-03+22:31:43 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maquette_old/script.js | 146 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 maquette_old/script.js (limited to 'maquette_old/script.js') diff --git a/maquette_old/script.js b/maquette_old/script.js new file mode 100644 index 0000000..93cdcaa --- /dev/null +++ b/maquette_old/script.js @@ -0,0 +1,146 @@ +function addPers(form) +{ + if(form.contactDispo.options.selectedIndex>=0) + { + var oValue = form.contactDispo.options[form.contactDispo.options.selectedIndex].value; + + var exist = false; + var i = 0; + while (i<form.participants.options.length && !exist) { if (form.participants.options[i].value == oValue) exist = true; i=i+1;} + + if (!exist) + { + var oText = form.contactDispo.options[form.contactDispo.options.selectedIndex].text; + var o = new Option(oText,oValue); + form.participants.options[form.participants.options.length]=o; + } + } +} + +function removePers(form) +{ + if (form.participants.options.selectedIndex>=0) + { + var i = form.participants.options.selectedIndex; + form.participants.options[form.participants.options.selectedIndex]=null; + if (parseInt(i) > 0) {form.participants.options.selectedIndex=parseInt(i)-1;} else {form.participants.options.selectedIndex=0;} + } + else + { + alert("Suppression impossible : aucune ligne s�lectionn�e"); + } +} + +function loadpop(url,id) { + document.getElementById(id).innerHTML = "<em>Chargement en cours ...<br/><a href=\"#\" onclick=\"popoff('"+id+"')\" >Fermer</a><em>"; + + var http_request = false; + + if (window.XMLHttpRequest) { // Mozilla, Safari,... + http_request = new XMLHttpRequest(); + if (http_request.overrideMimeType) { + http_request.overrideMimeType('text/xml'); + } + } else if (window.ActiveXObject) { // IE + try { + http_request = new ActiveXObject("Msxml2.XMLHTTP"); + } catch (e) { + try { + http_request = new ActiveXObject("Microsoft.XMLHTTP"); + } catch (e) {} + } + } + + if (!http_request) { + alert('Abandon : Impossible de cr�er une instance XMLHTTP'); + return false; + } + + http_request.onreadystatechange = function(){ + + if (http_request.readyState == 4) { + if (http_request.status == 200) { + document.getElementById(id).innerHTML = http_request.responseText; + } else { + document.getElementById(id).innerHTML = "<em>Un problème est survenu ...<br/><a href=\"#\" onclick=\"loadpop('"+url+"','"+id+"')\" >Réessayer</a> - <a href=\"#\" onclick=\"popoff('"+id+"')\" >Fermer</a><em>"; + } + } + }; + + http_request.open('GET', url, true); + http_request.send(null); +} + +function popon (id) +{ + var thisPopup = document.getElementById(id); + thisPopup.style.display='block'; + var thisMasque = document.getElementById('masque'); + thisMasque.style.display='block'; +} + +function popoff (id) +{ + var thisPopup = document.getElementById(id); + thisPopup.style.display='none'; + var thisMasque = document.getElementById('masque'); + thisMasque.style.display='none'; +} + +function addcreneau(form) +{ + if(form.day.options.selectedIndex>=0 && form.month.options.selectedIndex>=0 && form.year.options.selectedIndex>=0 && form.hourStart.options.selectedIndex>=0 && form.minuteStart.options.selectedIndex>=0 && form.hourEnd.options.selectedIndex>=0 && form.minuteEnd.options.selectedIndex>=0) + { + //Cr�ation de la valeur + var oValue = form.hourStart.options[form.hourStart.options.selectedIndex].value + form.minuteStart.options[form.minuteStart.options.selectedIndex].value + form.hourEnd.options[form.hourEnd.options.selectedIndex].value + form.minuteEnd.options[form.minuteEnd.options.selectedIndex].value; + oValue = oValue + form.day.options[form.day.options.selectedIndex].value + form.month.options[form.month.options.selectedIndex].value + form.year.options[form.year.options.selectedIndex].value; + + //Test si la valeur est d�ja dans la liste + var exist = false; + var i = 0; + while (i<form.creneaux.options.length && !exist) { if (form.creneaux.options[i].value == oValue) exist = true; i=i+1;} + + //Cr�ation du texte et de l'option et insertion de l'option si la valeur n'a pas �t� trouv�e + if (!exist) + { + var oText = form.hourStart.options[form.hourStart.options.selectedIndex].value + ":" + form.minuteStart.options[form.minuteStart.options.selectedIndex].value + " -> " + form.hourEnd.options[form.hourEnd.options.selectedIndex].value + ":" + form.minuteEnd.options[form.minuteEnd.options.selectedIndex].value; + oText = oText + " " + form.day.options[form.day.options.selectedIndex].value + "/" + form.month.options[form.month.options.selectedIndex].value + "/" + form.year.options[form.year.options.selectedIndex].value; + var o = new Option(oText,oValue); + form.creneaux.options[form.creneaux.options.length]=o; + } + } +} + +function removecreneau(form) +{ + if (form.creneaux.options.selectedIndex>=0) + { + var i = form.creneaux.options.selectedIndex; + form.creneaux.options[form.creneaux.options.selectedIndex]=null; + if (parseInt(i) > 0) {form.creneaux.options.selectedIndex=parseInt(i)-1;} else {form.creneaux.options.selectedIndex=0;} + } + else + { + alert("Suppression impossible : aucune ligne s�lectionn�e"); + } +} + +function dataListe(idSelect,idInput) +{ + var liste = document.getElementById(idSelect); + var champs = document.getElementById(idInput); + var data = ""; + if (liste && champs) + { + for (var i=0;i<liste.options.length;i++) + { + data = data + idInput + "[" + i + "]" + liste.options[i].value + "&"; + } + champs.value = data; + return (true); + } + else + { + return (false); + } +} \ No newline at end of file -- cgit v1.2.3