Version 0.3: replace Prototype by JQuery and use bootstrap
This commit is contained in:
parent
32b69fbd20
commit
ad51d9da73
39 changed files with 19615 additions and 8436 deletions
196
htdocs/js/app.js
196
htdocs/js/app.js
|
|
@ -20,12 +20,12 @@ function Application(XMLproperties)
|
|||
this.developpeur = XMLproperties.getElementsByTagName("developpeur")[0].firstChild.data;
|
||||
else
|
||||
this.developpeur = null;
|
||||
|
||||
|
||||
if (XMLproperties.getElementsByTagName("corps")[0])
|
||||
this.corps = XMLproperties.getElementsByTagName("corps")[0].firstChild.data;
|
||||
else
|
||||
this.corps = "corps";
|
||||
|
||||
|
||||
this.menu = null;
|
||||
}
|
||||
|
||||
|
|
@ -33,174 +33,154 @@ Application.prototype.getHomeElt = function()
|
|||
{
|
||||
var app = document.createElement("dl");
|
||||
app.className = "application " + this.etatAvancement;
|
||||
|
||||
|
||||
var appTitle = document.createElement("dt");
|
||||
appTitle.innerHTML = this.name;
|
||||
var appDescription = document.createElement("dd");
|
||||
appDescription.innerHTML = this.description;
|
||||
|
||||
app.observe('click', this.load.bind(this));
|
||||
|
||||
|
||||
$(app).bind('click', this.load.bind(this));
|
||||
|
||||
app.appendChild(appTitle);
|
||||
app.appendChild(appDescription);
|
||||
|
||||
|
||||
return app;
|
||||
}
|
||||
|
||||
Application.prototype.load = function()
|
||||
{
|
||||
printEtat(6);
|
||||
var test = new Ajax.Request(
|
||||
'ajax.php',
|
||||
{
|
||||
method: 'get',
|
||||
parameters: {d: "display", a: this.dir},
|
||||
onSuccess: this.loaded.bind(this),
|
||||
onFailure: function() { printEtat(3); }
|
||||
}
|
||||
);
|
||||
printState(6);
|
||||
|
||||
$.ajax({
|
||||
url: "ajax.php",
|
||||
data: {d: "display", a: this.dir},
|
||||
}).done(this.loaded.bind(this)).fail(function(jqXHR, textStatus) {
|
||||
printState(7, textStatus);
|
||||
});
|
||||
}
|
||||
|
||||
Application.prototype.loaded = function(transport, json)
|
||||
Application.prototype.loaded = function(data)
|
||||
{
|
||||
clearScreen();
|
||||
|
||||
var display = transport.responseXML.documentElement.getElementsByTagName("display")[0];
|
||||
var property = transport.responseXML.documentElement.getElementsByTagName("property")[0];
|
||||
|
||||
var display = data.documentElement.getElementsByTagName("display")[0];
|
||||
var property = data.documentElement.getElementsByTagName("property")[0];
|
||||
|
||||
if (display.getElementsByTagName("titre")[0])
|
||||
$('titre').src = imgTitres_dir + display.getElementsByTagName("titre")[0].firstChild.data;
|
||||
|
||||
$('#titre').prop("src", imgTitres_dir + display.getElementsByTagName("titre")[0].firstChild.data);
|
||||
|
||||
if (display.getElementsByTagName("css"))
|
||||
{
|
||||
//On supprime le style par défaut
|
||||
if ($("main_thm"))
|
||||
document.getElementsByTagName('head')[0].removeChild($("main_thm"));
|
||||
|
||||
var styles = display.getElementsByTagName("css");
|
||||
for (i = styles.length - 1; i >= 0; i--)
|
||||
{
|
||||
var css_file = document.createElement("link");
|
||||
css_file.type = 'text/css';
|
||||
css_file.rel = 'stylesheet';
|
||||
css_file.className = 'app';
|
||||
if (styles[i].getAttribute("media"))
|
||||
css_file.media = styles[i].getAttribute("media");
|
||||
css_file.href = "applications/" + this.dir + "/" + styles[i].firstChild.data;
|
||||
|
||||
document.getElementsByTagName('head')[0].appendChild(css_file);
|
||||
}
|
||||
//On supprime le style par défaut
|
||||
$("#main_thm").remove();
|
||||
|
||||
var styles = display.getElementsByTagName("css");
|
||||
for (i = styles.length - 1; i >= 0; i--)
|
||||
{
|
||||
var css_file = document.createElement("link");
|
||||
css_file.type = 'text/css';
|
||||
css_file.rel = 'stylesheet';
|
||||
css_file.className = 'app';
|
||||
if (styles[i].getAttribute("media"))
|
||||
css_file.media = styles[i].getAttribute("media");
|
||||
css_file.href = "applications/" + this.dir + "/" + styles[i].firstChild.data;
|
||||
|
||||
document.getElementsByTagName('head')[0].appendChild(css_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (display.getElementsByTagName("script"))
|
||||
{
|
||||
var scripts = display.getElementsByTagName("script");
|
||||
for (i = scripts.length - 1; i >= 0; i--)
|
||||
{
|
||||
js_file = document.createElement("script");
|
||||
js_file.type = 'text/javascript';
|
||||
js_file.className = 'app';
|
||||
js_file.src = "applications/" + this.dir + "/" + scripts[i].firstChild.data;
|
||||
js_file.defer = true;
|
||||
|
||||
document.getElementsByTagName('head')[0].appendChild(js_file);
|
||||
}
|
||||
var scripts = display.getElementsByTagName("script");
|
||||
for (i = scripts.length - 1; i >= 0; i--)
|
||||
{
|
||||
js_file = document.createElement("script");
|
||||
js_file.type = 'text/javascript';
|
||||
js_file.className = 'app';
|
||||
js_file.src = "applications/" + this.dir + "/" + scripts[i].firstChild.data;
|
||||
js_file.defer = true;
|
||||
|
||||
document.getElementsByTagName('head')[0].appendChild(js_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (display.getElementsByTagName("background").length > 0)
|
||||
$('body').style.backgroundImage = "url(" + display.getElementsByTagName("background")[0].firstChild.data + ")";
|
||||
|
||||
$('#body').css("backgroundImage", "url(" + display.getElementsByTagName("background")[0].firstChild.data + ")");
|
||||
|
||||
var etat;
|
||||
if (property.getElementsByTagName("etatAvancement").length > 0)
|
||||
etat = property.getElementsByTagName("etatAvancement")[0].firstChild.data;
|
||||
etat = property.getElementsByTagName("etatAvancement")[0].firstChild.data;
|
||||
else
|
||||
etat = "";
|
||||
|
||||
etat = "";
|
||||
|
||||
if (etat == "En construction" || etat == "en construction" || etat == "enconstruction" || etat == "construction" || etat == "c")
|
||||
$('etatAvance').src = "images/etats/construction.png";
|
||||
$('#etatAvance').prop("src", "images/etats/construction.png");
|
||||
else if (etat == "Alpha" || etat == "alpha" || etat == "a")
|
||||
$('etatAvance').src = "images/etats/alpha.png";
|
||||
$('#etatAvance').prop("src", "images/etats/alpha.png");
|
||||
else if (etat == "Beta" || etat == "beta" || etat == "Béta" || etat == "béta" || etat == "b")
|
||||
$('etatAvance').src = "images/etats/beta.png";
|
||||
$('#etatAvance').prop("src", "images/etats/beta.png");
|
||||
else
|
||||
$('etatAvance').src = "images/etats/final.png";
|
||||
$('#etatAvance').prop("src", "images/etats/final.png");
|
||||
|
||||
//On affiche la page
|
||||
if (display.getElementsByTagName('body')[0])
|
||||
$('corps').innerHTML = display.getElementsByTagName('body')[0].firstChild.data;
|
||||
|
||||
$('#corps').html(display.getElementsByTagName('body')[0].firstChild.data);
|
||||
|
||||
//On prépare le menu
|
||||
if (property.getElementsByTagName("menu").length > 0)
|
||||
this.menu = eval(property.getElementsByTagName("menu")[0].firstChild.data);
|
||||
this.menu = eval(property.getElementsByTagName("menu")[0].firstChild.data);
|
||||
this.genMenu(username != "");
|
||||
|
||||
|
||||
//On lance l'application
|
||||
if (display.getElementsByTagName("js")[0])
|
||||
{
|
||||
var scripts = display.getElementsByTagName("js");
|
||||
for (i = scripts.length - 1; i >= 0; i--)
|
||||
eval(scripts[i].firstChild.data);
|
||||
|
||||
runApplication(property, display, json);
|
||||
var scripts = display.getElementsByTagName("js");
|
||||
for (i = scripts.length - 1; i >= 0; i--)
|
||||
eval(scripts[i].firstChild.data);
|
||||
|
||||
runApplication(property, display);
|
||||
}
|
||||
else
|
||||
setTimeout("runApplication" + this.dir + "(" + property + ", " + display + ", " + json + ");", 1);
|
||||
// setTimeout("alert('test')", 0);
|
||||
|
||||
printEtat(0);
|
||||
setTimeout("runApplication" + this.dir + "(" + property + ", " + display + ");", 1);
|
||||
|
||||
printState(0);
|
||||
}
|
||||
|
||||
Application.prototype.genMenu = function(online)
|
||||
{
|
||||
//On supprime tous les éléments du menu actuel
|
||||
clearNode($('menu'));
|
||||
$('#menu').empty();
|
||||
|
||||
//On ajoute le titre
|
||||
var item = document.createElement("li");
|
||||
item.innerHTML = this.name;
|
||||
item.id = "nameApp";
|
||||
$('menu').appendChild(item);
|
||||
$('#menu').append('<li class="nameApp">' + this.name + "</li>");
|
||||
|
||||
//Lien vers la page d'accueil
|
||||
var item = document.createElement("li");
|
||||
item.onclick = function() { hideShownMenu(); firstLoad(); };
|
||||
item.innerHTML = "Accueil";
|
||||
if (online)
|
||||
item.className = "item";
|
||||
else
|
||||
item.className = "item hr";
|
||||
$('menu').appendChild(item);
|
||||
$('#menu').append(newMenuItem("Accueil", firstLoad));
|
||||
|
||||
//Lien de déconnexion
|
||||
if (online)
|
||||
{
|
||||
var item = document.createElement("li");
|
||||
item.onclick = function() { hideShownMenu(); deconnexion(); };
|
||||
item.innerHTML = "Déconnexion";
|
||||
item.className = "item hr";
|
||||
$('menu').appendChild(item);
|
||||
}
|
||||
$('#menu').append(newMenuItem("Déconnexion", deconnexion));
|
||||
|
||||
$('#menu').append('<li class="divider"></li>');
|
||||
|
||||
//On insère les éléments de l'app
|
||||
if (this.menu)
|
||||
{
|
||||
for (var i = this.menu.length - 1; i >= 0; i--)
|
||||
addMenuItem(this.menu[i]["text"], this.menu[i]["eventClick"]);
|
||||
for (var i = this.menu.length - 1; i >= 0; i--)
|
||||
addMenuItem(this.menu[i]["text"], this.menu[i]["eventClick"]);
|
||||
}
|
||||
|
||||
//On insère le about app
|
||||
var item = document.createElement("li");
|
||||
item.observe('click', this.about.bind(this));
|
||||
item.innerHTML = "À propos de ...";
|
||||
item.className = "item hr";
|
||||
$('menu').appendChild(item);
|
||||
$('#menu').append(newMenuItem("À propos de ...",
|
||||
function() { this.about.bind(this); },
|
||||
"about-app"));
|
||||
|
||||
$('#menu').append('<li class="divider"></li>');
|
||||
|
||||
//Lien vers la page à propos du site
|
||||
var item = document.createElement("li");
|
||||
item.onclick = function() { hideShownMenu(); loadPage('aproposdusite'); };
|
||||
item.innerHTML = "À propos du site";
|
||||
item.className = "item";
|
||||
$('menu').appendChild(item);
|
||||
$('#menu').append(newMenuItem("À propos du site",
|
||||
function() { loadPage('aproposdusite'); },
|
||||
"about-PA4home"));
|
||||
}
|
||||
|
||||
Application.prototype.about = function()
|
||||
|
|
@ -244,4 +224,4 @@ Application.prototype.about = function()
|
|||
titre.innerHTML = "<ins>Développeur :</ins> " + this.developpeur;
|
||||
$(this.corps).appendChild(titre);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1951
htdocs/js/bootstrap.js
vendored
Normal file
1951
htdocs/js/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
6
htdocs/js/bootstrap.min.js
vendored
Normal file
6
htdocs/js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
8829
htdocs/js/jquery.js
vendored
Normal file
8829
htdocs/js/jquery.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
6
htdocs/js/jquery.min.js
vendored
Normal file
6
htdocs/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1,195 +1,180 @@
|
|||
var imgTitres_dir = "images/titres/";
|
||||
var imgTitres_dir = "/images/titres/";
|
||||
var username = "";
|
||||
var apps = Array();
|
||||
|
||||
function clearNode(node)
|
||||
String.prototype.isInt = function()
|
||||
{
|
||||
if (node.hasChildNodes())
|
||||
{
|
||||
while (node.childNodes.length >= 1)
|
||||
node.removeChild(node.firstChild);
|
||||
}
|
||||
var re = new RegExp("^-?[\\d]+$");
|
||||
return this.match(re);
|
||||
}
|
||||
|
||||
Array.prototype.in_array = function(v)
|
||||
{
|
||||
for(var i = 0, l = this.length; i < l; i++)
|
||||
{
|
||||
if(this[i] == v)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
window.onload = function()
|
||||
{
|
||||
printEtat(1);
|
||||
clearScreen();
|
||||
firstLoad();
|
||||
|
||||
document.getElementById('btMenu').onclick = function(){
|
||||
showMenu();
|
||||
}
|
||||
document.getElementById('btMenu').onmouseout = function(){
|
||||
setHideMenuTimeout();
|
||||
}
|
||||
document.getElementById('menu').onmouseover = function(){
|
||||
showMenu();
|
||||
}
|
||||
document.getElementById('menu').onmouseout = function(){
|
||||
setHideMenuTimeout();
|
||||
}
|
||||
printState(1);
|
||||
clearScreen();
|
||||
firstLoad();
|
||||
}
|
||||
|
||||
function firstLoad()
|
||||
{
|
||||
new Ajax.Request(
|
||||
'ajax.php',
|
||||
{
|
||||
onSuccess: function(transport, json)
|
||||
{
|
||||
printEtat(2);
|
||||
if (json.statut == 1)
|
||||
{
|
||||
username = json.username;
|
||||
|
||||
if (window.sessionStorage && window.sessionStorage.username == username)
|
||||
{
|
||||
//On restaure l'application en cours
|
||||
|
||||
}
|
||||
else
|
||||
page_accueil();
|
||||
}
|
||||
else
|
||||
loadPage("connexion");
|
||||
printEtat(0);
|
||||
},
|
||||
onFailure: function() { printEtat(3); }
|
||||
}
|
||||
);
|
||||
$.ajax({
|
||||
url: "ajax.php",
|
||||
}).done(function(data) {
|
||||
printState(2);
|
||||
if (data.documentElement.getAttribute("statut") == 1)
|
||||
{
|
||||
username = data.documentElement.getAttribute("username");
|
||||
|
||||
if (window.sessionStorage && window.sessionStorage.username == username)
|
||||
{
|
||||
//On restaure l'application en cours
|
||||
|
||||
}
|
||||
else
|
||||
page_accueil();
|
||||
}
|
||||
else
|
||||
loadPage("connexion");
|
||||
printState(0);
|
||||
}).fail(function(jqXHR, textStatus) {
|
||||
printState(7, textStatus);
|
||||
});
|
||||
}
|
||||
|
||||
function deconnexion()
|
||||
{
|
||||
printEtat(1);
|
||||
clearScreen();
|
||||
new Ajax.Request(
|
||||
'ajax.php',
|
||||
{
|
||||
method: 'get',
|
||||
parameters: {d: "logout"},
|
||||
onSuccess: function(transport, json) { firstLoad(); },
|
||||
onFailure: function() { printEtat(3); }
|
||||
}
|
||||
);
|
||||
printState(1);
|
||||
clearScreen();
|
||||
|
||||
$.ajax({
|
||||
url: "ajax.php",
|
||||
data: {d: "logout"},
|
||||
}).done(function(data) {
|
||||
firstLoad();
|
||||
}).fail(function(jqXHR, textStatus) {
|
||||
printState(7, textStatus);
|
||||
});
|
||||
}
|
||||
|
||||
function printEtat(id)
|
||||
function printState(id, appendText)
|
||||
{
|
||||
if (id == 0)
|
||||
$('etat').innerHTML = "";
|
||||
else if (id == 1)
|
||||
$('etat').innerHTML = "Connexion au serveur en cours ...";
|
||||
else if (id == 2)
|
||||
$('etat').innerHTML = "Connexion établie, affichage de la page ...";
|
||||
else if (id == 3)
|
||||
$('etat').innerHTML = "Impossible de contacter le serveur, délais d'attente expiré !";
|
||||
else if (id == 4)
|
||||
$('etat').innerHTML = "Vérification des informations en cours ...";
|
||||
else if (id == 5)
|
||||
$('etat').innerHTML = "Récupération de la liste des applications ...";
|
||||
else if (id == 6)
|
||||
$('etat').innerHTML = "Chargement de l'application ...";
|
||||
else
|
||||
$('etat').innerHTML = "État inconnu : #" + id;
|
||||
var state;
|
||||
var color = null;
|
||||
switch(id)
|
||||
{
|
||||
case 0:
|
||||
state = "";
|
||||
break;
|
||||
case 1:
|
||||
state = "Connexion au serveur en cours ...";
|
||||
break;
|
||||
case 2:
|
||||
state = "Connexion établie, affichage de la page ...";
|
||||
color = "green";
|
||||
break;
|
||||
case 3:
|
||||
state = "Impossible de contacter le serveur, délais d'attente expiré !";
|
||||
color = "red";
|
||||
break;
|
||||
case 4:
|
||||
state = "Vérification des informations en cours ...";
|
||||
color = "orange";
|
||||
break;
|
||||
case 5:
|
||||
state = "Récupération de la liste des applications ...";
|
||||
color = "green";
|
||||
break;
|
||||
case 6:
|
||||
state = "Chargement de l'application ...";
|
||||
break;
|
||||
case 7:
|
||||
state = "Une erreur est survenue";
|
||||
color = "red";
|
||||
break;
|
||||
default:
|
||||
state = "État inconnu : #" + id;
|
||||
};
|
||||
|
||||
if (appendText != null)
|
||||
state += ": " + appendText;
|
||||
|
||||
$('#state').html(state);
|
||||
|
||||
if (color)
|
||||
$('#state').css("background-color", color);
|
||||
else
|
||||
$('#state').css("background-color", "#CDF");
|
||||
}
|
||||
|
||||
function clearScreen()
|
||||
{
|
||||
if ($('logo').style.display != "block")
|
||||
$('logo').style.display = "block";
|
||||
$('#logo').css("display", "block");
|
||||
|
||||
genMenu(username != "");
|
||||
$('corps').innerHTML = "";
|
||||
genMenu(username != "");
|
||||
$('#corps').html("");
|
||||
|
||||
$('etatAvance').src = "images/etats/alpha.png";
|
||||
|
||||
var head = document.getElementsByTagName("head")[0];
|
||||
//On décharge les fichiers JavaScript non standards
|
||||
if (head.getElementsByTagName("script")[4])
|
||||
{
|
||||
var scripts = head.getElementsByTagName("script");
|
||||
for (i = scripts.length - 1; i >= 0; i--)
|
||||
{
|
||||
if (scripts[i].className == "app")
|
||||
head.removeChild(scripts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//Idem avec les fichiers CSS
|
||||
if (head.getElementsByTagName("link")[3])
|
||||
{
|
||||
var links = head.getElementsByTagName("link");
|
||||
for (i = links.length - 1; i >= 0; i--)
|
||||
{
|
||||
if (links[i].className == "app")
|
||||
head.removeChild(links[i]);
|
||||
}
|
||||
}
|
||||
|
||||
//On ajoute le thème par défaut
|
||||
if (!$("main_thm"))
|
||||
{
|
||||
var css_file = document.createElement("link");
|
||||
css_file.type = 'text/css';
|
||||
css_file.rel = 'stylesheet';
|
||||
css_file.media = 'all';
|
||||
css_file.id = 'main_thm';
|
||||
css_file.href = "style.css";
|
||||
document.getElementsByTagName('head')[0].appendChild(css_file);
|
||||
}
|
||||
$('#etatAvance').prop("src", "images/etats/alpha.png");
|
||||
|
||||
//On décharge les fichiers JavaScript et CSS non standards
|
||||
$("script").remove(".app");
|
||||
$("link").remove(".app");
|
||||
|
||||
//On ajoute le thème par défaut
|
||||
if (!$("#main_thm").length)
|
||||
$("head").append('<link type="text/css" rel="stylesheet" media="all" id="main_thm" href="css/style.css">');
|
||||
}
|
||||
|
||||
function newMenuItem(text, onclick, link)
|
||||
{
|
||||
item = document.createElement("li");
|
||||
itemLink = document.createElement("a");
|
||||
if (link)
|
||||
itemLink.href = "#" + link;
|
||||
else
|
||||
itemLink.href = "#";
|
||||
itemLink.onclick = onclick;
|
||||
itemLink.innerHTML = text;
|
||||
item.appendChild(itemLink);
|
||||
return item;
|
||||
}
|
||||
|
||||
function genMenu(online)
|
||||
{
|
||||
//On supprime tous les éléments du menu
|
||||
clearNode($('menu'));
|
||||
|
||||
$('#menu').empty();
|
||||
|
||||
//On ajoute le titre
|
||||
var item = document.createElement("li");
|
||||
item.innerHTML = "PA4home";
|
||||
item.id = "nameApp";
|
||||
$('menu').appendChild(item);
|
||||
|
||||
$('#menu').append('<li class="nameApp">PA4home</li>');
|
||||
|
||||
//Lien vers la page d'accueil
|
||||
item = document.createElement("li");
|
||||
item.onclick = function() { hideShownMenu(); firstLoad(); };
|
||||
item.innerHTML = "Accueil";
|
||||
$('#menu').append(newMenuItem("Accueil", firstLoad));
|
||||
|
||||
if (online)
|
||||
item.className = "item";
|
||||
else
|
||||
item.className = "item hr";
|
||||
$('menu').appendChild(item);
|
||||
|
||||
//Lien de déconnexion
|
||||
if (online)
|
||||
{
|
||||
item = document.createElement("li");
|
||||
item.onclick = function() { hideShownMenu(); deconnexion(); };
|
||||
item.innerHTML = "Déconnexion";
|
||||
item.className = "item hr";
|
||||
$('menu').appendChild(item);
|
||||
}
|
||||
|
||||
$('#menu').append(newMenuItem("Déconnexion", deconnexion));
|
||||
|
||||
$('#menu').append('<li class="divider"></li>');
|
||||
|
||||
//Lien vers la page à propos du site
|
||||
item = document.createElement("li");
|
||||
item.onclick = function() { hideShownMenu(); loadPage('aproposdusite'); };
|
||||
item.innerHTML = "À propos du site";
|
||||
item.className = "item";
|
||||
$('menu').appendChild(item);
|
||||
$('#menu').append(newMenuItem("À propos du site",
|
||||
function() { loadPage('aproposdusite'); },
|
||||
"about-PA4home"));
|
||||
}
|
||||
|
||||
function addMenuItem(text, iven)
|
||||
{
|
||||
var item = document.createElement("li");
|
||||
item.onclick = function(e) {
|
||||
hideShownMenu();
|
||||
eval(iven);
|
||||
};
|
||||
item.innerHTML = text;
|
||||
item.className = "item";
|
||||
$('menu').appendChild(item);
|
||||
$('#menu').append(newMenuItem(text,
|
||||
function() { eval(iven) })
|
||||
);
|
||||
}
|
||||
|
||||
/**************************************
|
||||
|
|
@ -198,101 +183,111 @@ function addMenuItem(text, iven)
|
|||
|
||||
function loadPage(nom)
|
||||
{
|
||||
clearScreen();
|
||||
printEtat(1);
|
||||
new Ajax.Request(
|
||||
'ajax.php',
|
||||
{
|
||||
method: 'get',
|
||||
parameters: {d: "page", p: nom},
|
||||
onSuccess: function(transport, json)
|
||||
{
|
||||
printEtat(2);
|
||||
$('titre').src = imgTitres_dir + transport.responseXML.documentElement.getElementsByTagName("titre")[0].firstChild.data;
|
||||
$('corps').innerHTML = transport.responseXML.documentElement.getElementsByTagName("body")[0].firstChild.data;
|
||||
|
||||
if (transport.responseXML.documentElement.getElementsByTagName("js"))
|
||||
{
|
||||
var scripts = transport.responseXML.documentElement.getElementsByTagName("js");
|
||||
var nbScripts = scripts.length;
|
||||
for (i = 0; i < nbScripts; i++)
|
||||
eval(scripts[i].firstChild.data);
|
||||
}
|
||||
|
||||
printEtat(0);
|
||||
},
|
||||
onFailure: function() { printEtat(3); }
|
||||
}
|
||||
);
|
||||
clearScreen();
|
||||
printState(1);
|
||||
|
||||
$.ajax({
|
||||
url: "ajax.php",
|
||||
data: { d: "page", p: nom }
|
||||
}).done(function(data) {
|
||||
printState(2);
|
||||
|
||||
$('#titre').prop("src", imgTitres_dir + data.documentElement.getElementsByTagName("titre")[0].firstChild.data);
|
||||
$('#corps').html(data.documentElement.getElementsByTagName("body")[0].firstChild.data);
|
||||
|
||||
if (data.documentElement.getElementsByTagName("js"))
|
||||
{
|
||||
var scripts = data.documentElement.getElementsByTagName("js");
|
||||
var nbScripts = scripts.length;
|
||||
for (i = 0; i < nbScripts; i++)
|
||||
eval(scripts[i].firstChild.data);
|
||||
}
|
||||
|
||||
printState(0);
|
||||
}).fail(function(jqXHR, textStatus) {
|
||||
printState(7, textStatus);
|
||||
});
|
||||
}
|
||||
|
||||
function page_accueil()
|
||||
{
|
||||
clearScreen();
|
||||
printEtat(5);
|
||||
clearScreen();
|
||||
printState(5);
|
||||
|
||||
if (username == "root" || username == "pierre-o")
|
||||
$('titre').src = imgTitres_dir + "bienvenuePierreO.png";
|
||||
else if (username == "sergcaen" || username == "serge")
|
||||
$('titre').src = imgTitres_dir + "bienvenueSerge.png";
|
||||
else if (username == "christine" || username == "chriscaen")
|
||||
$('titre').src = imgTitres_dir + "bienvenueChristine.png";
|
||||
else if (username == "raphael" || username == "minou")
|
||||
$('titre').src = imgTitres_dir + "bienvenueRaphael.png";
|
||||
else if (username == "florence" || username == "floflo")
|
||||
$('titre').src = imgTitres_dir + "bienvenueFlorence.png";
|
||||
else if (username == "florent")
|
||||
$('titre').src = imgTitres_dir + "bienvenueFlorent.png";
|
||||
else if (username == "alisson13081991" || username == "alisson13081991@hotmail.fr")
|
||||
$('titre').src = imgTitres_dir + "bienvenueAlisson.png";
|
||||
else
|
||||
$('titre').src = imgTitres_dir + "bienvenue.png";
|
||||
if (username == "root" || username == "pierre-o")
|
||||
$('#titre').prop("src", imgTitres_dir + "bienvenuePierreO.png");
|
||||
else if (username == "sergcaen" || username == "serge")
|
||||
$('#titre').prop("src", imgTitres_dir + "bienvenueSerge.png");
|
||||
else if (username == "christine" || username == "chriscaen")
|
||||
$('#titre').prop("src", imgTitres_dir + "bienvenueChristine.png");
|
||||
else if (username == "raphael" || username == "minou")
|
||||
$('#titre').prop("src", imgTitres_dir + "bienvenueRaphael.png");
|
||||
else if (username == "florence" || username == "floflo")
|
||||
$('#titre').prop("src", imgTitres_dir + "bienvenueFlorence.png");
|
||||
else if (username == "florent")
|
||||
$('#titre').prop("src", imgTitres_dir + "bienvenueFlorent.png");
|
||||
else if (username == "alisson13081991" || username == "alisson13081991@hotmail.fr")
|
||||
$('#titre').prop("src", imgTitres_dir + "bienvenueAlisson.png");
|
||||
else
|
||||
$('#titre').prop("src", imgTitres_dir + "bienvenue.png");
|
||||
|
||||
new Ajax.Request(
|
||||
'ajax.php',
|
||||
{
|
||||
method: 'get',
|
||||
parameters: {d: "accueil"},
|
||||
onSuccess: function(transport, json)
|
||||
{
|
||||
var applications = transport.responseXML.documentElement.getElementsByTagName("application");
|
||||
for (i = applications.length - 1; i >= 0; i--)
|
||||
{
|
||||
var app = new Application(applications[i]);
|
||||
apps.pop(app);
|
||||
$.ajax({
|
||||
url: "ajax.php",
|
||||
data: {d: "accueil"},
|
||||
}).done(function(data) {
|
||||
printState(2);
|
||||
var applications = data.documentElement.getElementsByTagName("application");
|
||||
for (i = applications.length - 1; i >= 0; i--)
|
||||
{
|
||||
var app = new Application(applications[i]);
|
||||
apps.pop(app);
|
||||
|
||||
var elt = app.getHomeElt();
|
||||
|
||||
$('corps').appendChild(elt);
|
||||
}
|
||||
printEtat(0);
|
||||
},
|
||||
onFailure: function() { printEtat(3); }
|
||||
}
|
||||
);
|
||||
var elt = app.getHomeElt();
|
||||
|
||||
$('#corps').append(elt);
|
||||
}
|
||||
printState(0);
|
||||
}).fail(function(jqXHR, textStatus) {
|
||||
printState(7, textStatus);
|
||||
});
|
||||
}
|
||||
|
||||
function runApplication(property, display, json){
|
||||
alert("Aucun lancement à faire !");
|
||||
}
|
||||
|
||||
var entityMap = {
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
'"': '"',
|
||||
"'": ''',
|
||||
"/": '/'
|
||||
};
|
||||
|
||||
function escapeHtml(string) {
|
||||
return String(string).replace(/[&<>"'\/]/g, function (s) {
|
||||
return entityMap[s];
|
||||
});
|
||||
}
|
||||
|
||||
//Menu
|
||||
var menu_timeout;
|
||||
|
||||
function showMenu()
|
||||
{
|
||||
if (menu_timeout)
|
||||
clearTimeout(menu_timeout);
|
||||
if (menu_timeout)
|
||||
clearTimeout(menu_timeout);
|
||||
|
||||
$('menu').style.display = "block";
|
||||
$('menu').style.display = "block";
|
||||
}
|
||||
|
||||
function setHideMenuTimeout()
|
||||
{
|
||||
menu_timeout = setTimeout('hideShownMenu()', 500);
|
||||
menu_timeout = setTimeout('hideShownMenu()', 500);
|
||||
}
|
||||
|
||||
function hideShownMenu()
|
||||
{
|
||||
$('menu').style.display = "none";
|
||||
}
|
||||
$('menu').style.display = "none";
|
||||
}
|
||||
|
|
|
|||
6082
htdocs/js/prototype.js
vendored
6082
htdocs/js/prototype.js
vendored
File diff suppressed because it is too large
Load diff
Reference in a new issue