103 lines
2.5 KiB
JavaScript
103 lines
2.5 KiB
JavaScript
var xmlhttp;
|
|
|
|
function RGBToHex(ColorString) {
|
|
|
|
HexDigits = "0123456789abcdef";
|
|
|
|
ColorString = ColorString.substr(4);
|
|
pos = ColorString.indexOf(',');
|
|
Result = HexDigits.substr(Math.floor(ColorString.substr(0, pos) / 16), 1) + HexDigits.substr(ColorString.substr(0, pos) % 16, 1);
|
|
ColorString = ColorString.substr(pos + 1);
|
|
pos = ColorString.indexOf(',');
|
|
Result = Result + HexDigits.substr(Math.floor(ColorString.substr(0, pos) / 16), 1) + HexDigits.substr(ColorString.substr(0, pos) % 16, 1);
|
|
ColorString = ColorString.substr(pos + 1);
|
|
pos = ColorString.length - 1;
|
|
Result = Result + HexDigits.substr(Math.floor(ColorString.substr(0, pos) / 16), 1) + HexDigits.substr(ColorString.substr(0, pos) % 16, 1);
|
|
|
|
return Result;
|
|
}
|
|
|
|
function ajouter(mode, siret, date, duree, chiffre, libelle, evol, color, style) {
|
|
|
|
xmlhttp=GetXmlHttpObject();
|
|
if (xmlhttp==null) {
|
|
|
|
alert ("Le navigateur ne supporte pas HTTP Request.");
|
|
return;
|
|
}
|
|
|
|
var color = RGBToHex(color);
|
|
|
|
var url="../pages/synthese_perso_img.php";
|
|
url=url+"?mode="+mode;
|
|
url=url+"&siret="+siret;
|
|
url=url+"&datecloture="+date;
|
|
url=url+"&dateduree="+duree;
|
|
url=url+"&chiffre="+chiffre;
|
|
url=url+"&libelle="+libelle;
|
|
url=url+"&evol="+evol;
|
|
url=url+"&color="+color;
|
|
url=url+"&style="+style;
|
|
|
|
xmlhttp.onreadystatechange=stateChanged;
|
|
xmlhttp.open("GET",url,true);
|
|
xmlhttp.send(null);
|
|
}
|
|
|
|
function enlever(mode, evol) {
|
|
|
|
xmlhttp=GetXmlHttpObject();
|
|
if (xmlhttp==null) {
|
|
|
|
alert ("Le navigateur ne supporte pas HTTP Request.");
|
|
return;
|
|
}
|
|
|
|
var url="../pages/synthese_perso_img.php";
|
|
url=url+"?mode="+mode;
|
|
url=url+"&evol="+evol;
|
|
|
|
xmlhttp.onreadystatechange=stateChanged;
|
|
xmlhttp.open("GET",url,true);
|
|
xmlhttp.send(null);
|
|
}
|
|
|
|
function vider(mode) {
|
|
|
|
xmlhttp=GetXmlHttpObject();
|
|
if (xmlhttp==null) {
|
|
|
|
alert ("Le navigateur ne supporte pas HTTP Request.");
|
|
return;
|
|
}
|
|
|
|
var url="../pages/synthese_perso_img.php";
|
|
url=url+"?mode="+mode;
|
|
|
|
xmlhttp.onreadystatechange=stateChanged;
|
|
xmlhttp.open("GET",url,true);
|
|
xmlhttp.send(null);
|
|
}
|
|
|
|
function stateChanged() {
|
|
|
|
if (xmlhttp.readyState==4) {
|
|
|
|
document.getElementById("img").innerHTML=xmlhttp.responseText;
|
|
}
|
|
}
|
|
|
|
function GetXmlHttpObject() {
|
|
|
|
if (window.XMLHttpRequest) {
|
|
|
|
// code pour IE7+, Firefox, Chrome, Opera, Safari
|
|
return new XMLHttpRequest();
|
|
}
|
|
if (window.ActiveXObject) {
|
|
|
|
// code pour IE6, IE5
|
|
return new ActiveXObject("Microsoft.XMLHTTP");
|
|
}
|
|
return null;
|
|
} |