diff --git a/htdocs/applications/GPC/album.js b/htdocs/applications/GPC/album.js
new file mode 100644
index 0000000..74f267e
--- /dev/null
+++ b/htdocs/applications/GPC/album.js
@@ -0,0 +1,8 @@
+function Album(elt)
+{
+ this.id = elt.getAttribute("id");
+ this.type = parseInt(elt.getAttribute("type"));
+ this.titre = elt.getAttribute("titre");
+ if (elt.hasAttribute("couleur"))
+ this.color = elt.getAttribute("couleur");
+}
diff --git a/htdocs/applications/GPC/app.js b/htdocs/applications/GPC/app.js
new file mode 100644
index 0000000..21f70fd
--- /dev/null
+++ b/htdocs/applications/GPC/app.js
@@ -0,0 +1,1213 @@
+var GPC_origin_liste = false;
+var GPC_liste = false;
+var GPC_liste_CDs = false; //Albums, tout type
+var GPC_lastSort = -1;
+var GPC_delay = null;
+var nbParPage = 50;
+
+//On charge la liste des porte-clés
+function GPC_loadList()
+{
+ GPC_origin_liste = false;
+ GPC_liste = false;
+ GPC_liste_CDs = false;
+ GPC_lastSort = -1;
+ $('nbpc').innerHTML = '';
+ new Ajax.Request(
+ 'ajax.php',
+ {
+ method: 'get',
+ parameters: {d: "action", a: "GPC", p: "liste"},
+ onSuccess: GPC_parseList,
+ onFailure: function() { printEtat(3); }
+ }
+ );
+}
+function GPC_loadSelectedList()
+{
+ //TODO: ne charger que les listes dont l'état est false
+ GPC_loadList();
+}
+GPC_loadList();
+
+//Une fois la liste reçue, on la parse
+function GPC_parseList(transport, json)
+{
+ $('nbpc').innerHTML = json.nombre;
+
+ GPC_origin_liste = new Array();
+ var liste = transport.responseXML.documentElement.getElementsByTagName("chanson");
+ for (var elt in liste)
+ {
+ if (elt.isInt())
+ {
+ var chan = new Chanson(liste[elt]);
+ GPC_origin_liste[chan.id] = chan;
+ }
+ }
+
+ GPC_liste_CDs = new Array();
+ liste = transport.responseXML.documentElement.getElementsByTagName("album");
+ for (var elt in liste)
+ {
+ if (elt.isInt())
+ {
+ var alb = new Album(liste[elt]);
+ GPC_liste_CDs[alb.id] = alb;
+ }
+ }
+}
+
+function GPC_add()
+{
+ window.scrollTo(0,0);
+ $('contenu').innerHTML = "";
+ titre = document.createElement("h2");
+ titre.innerHTML = "Ajout d'un album à la base de données";
+ $('contenu').appendChild(titre);
+
+ GPC_addAlbum();
+}
+
+function GPC_edit()
+{
+ window.scrollTo(0,0);
+ $('contenu').innerHTML = "";
+ titre = document.createElement("h2");
+ titre.innerHTML = "Liste des albums";
+ $('contenu').appendChild(titre);
+
+ GPC_viewliste(0, 0, 0);
+}
+
+function GPC_listAlbums()
+{
+ window.scrollTo(0,0);
+ $('contenu').innerHTML = "";
+ titre = document.createElement("h2");
+ titre.innerHTML = "Liste des albums";
+ $('contenu').appendChild(titre);
+
+ GPC_viewalbums(false);
+}
+
+function GPC_listTitres(types)
+{
+ window.scrollTo(0,0);
+ $('contenu').innerHTML = "";
+ titre = document.createElement("h2");
+ titre.innerHTML = "Liste des titres";
+ $('contenu').appendChild(titre);
+
+ var confirmation = document.createElement("h2");
+ confirmation.style.color = "teal";
+ confirmation.id = "confirm";
+ $('contenu').appendChild(confirmation);
+
+ GPC_liste = false;
+
+ GPC_viewliste(types, 0, 0);
+}
+
+function GPC_rechTitres()
+{
+ window.scrollTo(0,0);
+ $('contenu').innerHTML = "";
+ titre = document.createElement("h2");
+ titre.innerHTML = "Recherche d'un élément";
+ $('contenu').appendChild(titre);
+
+ GPC_formRech("", "", "", [1,2,3,4,5,6,7,8]);
+}
+
+function GPC_formRech(titleC, artiste, album, types)
+{
+ var formulaire = document.createElement("form");
+ formulaire.id = "rechTitles";
+ formulaire.onsubmit = function() {
+ tps = [];
+ if ($("type1").checked) tps.push(1);
+ if ($("type2").checked) tps.push(2);
+ if ($("type3").checked) tps.push(3);
+ rechTitles($("titreC").value,
+ $("artiste").value,
+ $("album").value,
+ tps);
+ return false;
+ }
+ var cntr = document.createElement("div");
+ var lbl = document.createElement("label");
+ lbl.htmlFor = "titreC"; lbl.innerHTML = "Titre :";
+ cntr.appendChild(lbl);
+ var inpt = document.createElement("input");
+ inpt.type = "text"; inpt.name = "titre";
+ inpt.value = titleC;
+ inpt.id = "titreC"; cntr.appendChild(inpt);
+ cntr.appendChild(document.createElement("br"));
+
+ var lbl = document.createElement("label");
+ lbl.htmlFor = "artiste"; lbl.innerHTML = "Artiste :";
+ cntr.appendChild(lbl);
+ var inpt = document.createElement("input");
+ inpt.type = "text"; inpt.name = "artiste";
+ inpt.value = artiste;
+ inpt.id = "artiste"; cntr.appendChild(inpt);
+ cntr.appendChild(document.createElement("br"));
+
+ var lbl = document.createElement("label");
+ lbl.htmlFor = "album"; lbl.innerHTML = "Album :";
+ cntr.appendChild(lbl);
+ var inpt = document.createElement("input");
+ inpt.type = "text"; inpt.name = "album";
+ inpt.value = album;
+ inpt.id = "album"; cntr.appendChild(inpt);
+ cntr.appendChild(document.createElement("br"));
+ formulaire.appendChild(cntr);
+
+ var inpt = document.createElement("input");
+ inpt.type = "checkbox"; inpt.name = "type1";
+ inpt.id = "type1"; inpt.value = "1";
+ inpt.checked = types.in_array(1);
+ formulaire.appendChild(inpt);
+ var lbl = document.createElement("label");
+ lbl.htmlFor = "type1"; lbl.innerHTML = "Albums d'année";
+ formulaire.appendChild(lbl);
+ formulaire.appendChild(document.createElement("br"));
+
+ var inpt = document.createElement("input");
+ inpt.type = "checkbox"; inpt.name = "type2";
+ inpt.id = "type2"; inpt.value = "1";
+ inpt.checked = types.in_array(2);
+ formulaire.appendChild(inpt);
+ var lbl = document.createElement("label");
+ lbl.htmlFor = "type2"; lbl.innerHTML = "Compilations";
+ formulaire.appendChild(lbl);
+ formulaire.appendChild(document.createElement("br"));
+
+ var inpt = document.createElement("input");
+ inpt.type = "checkbox"; inpt.name = "type3";
+ inpt.id = "type3"; inpt.value = "1";
+ inpt.checked = types.in_array(3);
+ formulaire.appendChild(inpt);
+ var lbl = document.createElement("label");
+ lbl.htmlFor = "type3"; lbl.innerHTML = "Musique classique";
+ formulaire.appendChild(lbl);
+
+ var cntr = document.createElement("div");
+ formulaire.appendChild(document.createElement("br"));
+ formulaire.appendChild(document.createElement("br"));
+ var inpt = document.createElement("input");
+ inpt.type = "submit";
+ inpt.value = "Rechercher";
+ cntr.appendChild(inpt);
+ formulaire.appendChild(cntr);
+
+ $('contenu').appendChild(formulaire);
+}
+
+function GPC_addAlbum()
+{
+ var formulaire = document.createElement("form");
+ formulaire.id = "addAlbms";
+ formulaire.onsubmit = function() { newAlbum(); return false; }
+ var inpt = document.createElement("input");
+ inpt.type = "radio";
+ inpt.name = "cd";
+ inpt.id = "cda";
+ inpt.value = "1";
+ inpt.onclick = function() { GPC_addAlbum_chColor(1); };
+ formulaire.appendChild(inpt);
+ var lbl = document.createElement("label");
+ lbl.htmlFor = "cda";
+ lbl.innerHTML = "Ajouter un album d'année";
+ formulaire.appendChild(lbl);
+ formulaire.appendChild(document.createElement("br"));
+ var inpt = document.createElement("input");
+ inpt.type = "radio";
+ inpt.name = "cd";
+ inpt.id = "cdd";
+ inpt.value = "1";
+ inpt.onclick = function() { GPC_addAlbum_chColor(2); };
+ formulaire.appendChild(inpt);
+ var lbl = document.createElement("label");
+ lbl.htmlFor = "cdd";
+ lbl.innerHTML = "Ajouter d'une compilation";
+ formulaire.appendChild(lbl);
+ formulaire.appendChild(document.createElement("br"));
+ var inpt = document.createElement("input");
+ inpt.type = "radio";
+ inpt.name = "cd";
+ inpt.id = "cdc";
+ inpt.value = "1";
+ inpt.onclick = function() { GPC_addAlbum_chColor(3); };
+ formulaire.appendChild(inpt);
+ var lbl = document.createElement("label");
+ lbl.htmlFor = "cdc";
+ lbl.innerHTML = "Ajouter un album de musiques classiques";
+ formulaire.appendChild(lbl);
+ formulaire.appendChild(document.createElement("br"));
+ formulaire.appendChild(document.createElement("br"));
+ var cntr = document.createElement("div");
+ var lbl = document.createElement("label");
+ lbl.htmlFor = "nom";
+ lbl.innerHTML = "Nom :";
+ cntr.appendChild(lbl);
+ var inpt = document.createElement("input");
+ inpt.type = "text";
+ inpt.name = "nom";
+ inpt.id = "nom";
+ inpt.style.width = "300px";
+ cntr.appendChild(inpt);
+ cntr.appendChild(document.createElement("br"));
+ var lbl = document.createElement("label");
+ lbl.htmlFor = "color";
+ lbl.innerHTML = "Couleur :";
+ cntr.appendChild(lbl);
+ var inpt = document.createElement("input");
+ inpt.type = "color";
+ inpt.name = "color";
+ inpt.id = "color";
+ inpt.onchange = function() { $("testColor").style.backgroundColor = $('color').value; };
+ cntr.appendChild(inpt);
+ var test = document.createElement("div");
+ test.id = "testColor";
+ cntr.appendChild(test);
+ cntr.appendChild(document.createElement("br"));
+ var lbl = document.createElement("label");
+ lbl.htmlFor = "ccf";
+ lbl.innerHTML = "Copier la couleur depuis :";
+ cntr.appendChild(lbl);
+ var inpt = document.createElement("select");
+ inpt.name = "ccf";
+ inpt.id = "ccf";
+ cntr.appendChild(inpt);
+ cntr.appendChild(document.createElement("br"));
+ cntr.appendChild(document.createElement("br"));
+ var inpt = document.createElement("input");
+ inpt.type = "submit";
+ inpt.value = "Valider";
+ cntr.appendChild(inpt);
+ formulaire.appendChild(cntr);
+ $('contenu').appendChild(formulaire);
+}
+
+function GPC_addAlbum_chColor(type)
+{
+ $("ccf").innerHTML = '';
+
+ for (var i in GPC_liste_CDs)
+ {
+ if (i.isInt() && GPC_liste_CDs[i].type == type)
+ {
+ var opt = document.createElement("option");
+ opt.value = i;
+ opt.innerHTML = GPC_liste_CDs[i].titre;
+ $("ccf").appendChild(opt);
+ }
+ }
+
+ if ($("ccf").innerHTML != "")
+ $("ccf").onchange = function(event)
+ {
+ if (this.value > 0)
+ GPC_addAlbum_loadColor(this, type);
+ };
+}
+
+function GPC_addAlbum_loadColor(elt, type)
+{
+ new Ajax.Request(
+ 'ajax.php',
+ {
+ method: 'get',
+ parameters: {d: "action", a: "GSM", p: "color", type: type, id: elt.value},
+ onSuccess: function(transport, json)
+ {
+ $('color').value = transport.responseXML.documentElement.getElementsByTagName("color")[0].firstChild.textContent;
+ $("testColor").style.backgroundColor = $('color').value;
+ }
+ });
+}
+
+function newAlbum()
+{
+ var type;
+ if ($('cda').checked == 1)
+ type = 1;
+ else if ($('cdc').checked == 1)
+ type = 3;
+ else if ($('cdd').checked == 1)
+ type = 2;
+ else
+ {
+ alert("Vous n'avez pas sélectionné de type !");
+ return;
+ }
+
+ var nom = $('nom').value;
+ if (nom)
+ {
+ //On ajoute l'album
+ new Ajax.Request(
+ 'ajax.php?d=action&a=GSM&p=add',
+ {
+ method: 'post',
+ parameters: {
+ type: type,
+ title: nom,
+ color: $('color').value
+ },
+ onSuccess: function(transport, json)
+ {
+ if (json.statut != 1)
+ {
+ firstLoad();
+ alert("Vous avez été déconnecté. L'album' n'a pas été ajouté.");
+ }
+ else
+ {
+ if (transport.responseXML.documentElement.getElementsByTagName("id")[0])
+ {
+ GPC_liste_CDs = false;
+
+ $('contenu').innerHTML = "";
+ titre = document.createElement("h2");
+ titre.style.color = "#FF8800";
+ titre.innerHTML = 'Chargement en cours ... ';
+ $('contenu').appendChild(titre);
+
+ //On recharge la liste d'album
+ GPC_loadSelectedList();
+
+ //On passe à l'écran de modification du nouvel album
+ GPC_viewalbum(type,
+ transport.responseXML.documentElement.getElementsByTagName("id")[0].textContent,
+ 0,
+ nom);
+ }
+ else
+ alert("L'ajout de l'album ne s'est pas passé correctement, vérifiez que cet album n'existe pas déjà.");
+ }
+ },
+ onFailure: function() { printEtat(3); }
+ }
+ );
+ }
+ else
+ alert("Vous n'avez pas précisé de nom pour ce nouvel album.");
+}
+
+function GPC_addForm(type, idAlbum, modif, page)
+{
+ //Si le formulaire existe déjà, on ne fait que remplacer son contenu
+ var formulaire;
+ if ($('ajout'))
+ {
+ formulaire = $('ajout');
+ formulaire.innerHTML = "";
+ }
+ else
+ {
+ formulaire = document.createElement("form");
+ formulaire.id = "ajout";
+ $('contenu').appendChild(formulaire);
+ }
+
+ formulaire.onsubmit = function() { checkAndAdd(type, idAlbum, modif, page); return false; }
+ var th = document.createElement("h3");
+ if (modif)
+ th.innerHTML = "Modification d'un titre";
+ else
+ th.innerHTML = "Ajout d'un titre à l'album";
+
+ var lab_nom = document.createElement("label");
+ lab_nom.innerHTML = "Titre :";
+ lab_nom.forHTML = "titrechan";
+ var inp_nom = document.createElement("input");
+ if(modif)
+ inp_nom.value = GPC_liste[modif-1].titre;
+ inp_nom.type = "text";
+ inp_nom.maxLength = "250";
+ inp_nom.id = "titrechan";
+
+ var lab_carac = document.createElement("label");
+ lab_carac.innerHTML = "Interpréte :";
+ lab_carac.setAttribute("for", "auteur");
+ var inp_carac = document.createElement("input");
+ if(modif)
+ inp_carac.value = GPC_liste[modif-1].artiste;
+ inp_carac.type = "text";
+ inp_carac.maxLength = "250";
+ inp_carac.id = "auteur";
+
+ var auteur_propos = document.createElement("div");
+ auteur_propos.id = "auteur_propositions";
+ auteur_propos.className = "autocomplete";
+
+ var inp_submit = document.createElement("input");
+ inp_submit.type = "submit";
+ if (modif)
+ inp_submit.value = "Modifier";
+ else
+ inp_submit.value = "Ajouter";
+ inp_submit.style.marginLeft = "165px";
+
+ formulaire.appendChild(th);
+ formulaire.appendChild(lab_nom);
+ formulaire.appendChild(inp_nom);
+ formulaire.appendChild(document.createElement("br"));
+ formulaire.appendChild(lab_carac);
+ formulaire.appendChild(inp_carac);
+ formulaire.appendChild(auteur_propos);
+ formulaire.appendChild(document.createElement("br"));
+ formulaire.appendChild(document.createElement("br"));
+ formulaire.appendChild(inp_submit);
+ if (modif)
+ {
+ var inp_del = document.createElement("input");
+ inp_del.type = "button";
+ inp_del.value = "Supprimer";
+ inp_del.onclick = function() { GPC_del(type, idAlbum, modif, page); };
+ inp_del.style.marginLeft = "15px";
+ formulaire.appendChild(inp_del);
+ }
+ if (modif)
+ $('titrechan').focus();
+
+ new Ajax.Autocompleter(
+ "auteur",
+ "auteur_propositions",
+ "applications/GSM/auteurs.php",
+ {
+ paramName: 'auteur',
+ minChars: 1
+ });
+}
+
+function GPC_checkChange(e)
+{
+ if (this.value == "add")
+ {
+ if (this.id == "discAuteur")
+ id_name = "new_auteur";
+ else if (this.id == "discDece")
+ id_name = "new_decenie";
+ else if (this.id == "discAnnee")
+ id_name = "new_annee";
+
+ document.getElementById(id_name).style.display = "inline";
+ if (document.getElementById(id_name).value == "")
+ document.getElementById(id_name).value = "Nom du nouvel l'album";
+ document.getElementById(id_name).focus();
+ document.getElementById(id_name).select();
+ }
+ else if (this.id == "discAuteur")
+ document.getElementById("new_auteur").style.display = "none";
+ else if (this.id == "discDece")
+ document.getElementById("new_decenie").style.display = "none";
+ else if (this.id == "discAnnee")
+ document.getElementById("new_annee").style.display = "none";
+}
+
+function GPC_del(type, idAlbum, modif, page)
+{
+ $('titrechan').disabled = true;
+ $('auteur').disabled = true;
+
+ var identifiant = GPC_liste[modif-1].id;
+
+ new Ajax.Request(
+ 'ajax.php?d=action&a=GSM&p=del',
+ {
+ method: 'post',
+ parameters: {
+ id: identifiant,
+ alb: idAlbum
+ },
+ onSuccess: function(transport, json)
+ {
+ if (json.statut != 1)
+ {
+ firstLoad();
+ alert("Vous avez été déconnecté. La chanson n'a pas été enregistrée");
+ }
+ else
+ {
+ delete GPC_origin_liste[identifiant];
+
+ setTimeout('$("confirm").innerHTML = "Chanson supprimée avec succès !";', 234);
+ setTimeout("$('confirm').innerHTML = '';", 3500);
+
+ $('nbpc').innerHTML = json.nombre;
+
+ if (type)
+ GPC_viewalbum(type, idAlbum, page);
+ else
+ GPC_viewliste(type, 0, page);
+
+ if (modif)
+ window.scrollTo(0,0);
+ }
+ },
+ onFailure: function() { printEtat(3); }
+ }
+ );
+
+ //On réinitialise les variables de liste pour aller rechercher les listes
+ GPC_liste = false;
+ GPC_pagination = false;
+ $('contenu').innerHTML = "
Veuillez patienter suppression de la chanson en cours ...
";
+}
+
+function checkAndAdd(type, idAlbum, modif, page)
+{
+ var modifURI;
+ if(modif)
+ modifURI = "&id=" + GPC_liste[modif-1].id;
+ else
+ modifURI = "";
+
+ if ($('titrechan').value == "")
+ {
+ $('titrechan').className = "erreur";
+ alert('Vous n\'avez pas indiqué le titre de la chanson !');
+ }
+ else if ($('auteur').value == "")
+ {
+ $('auteur').className = "erreur";
+ alert('Vous n\'avez pas indiqué l\'auteur de la chanson !');
+ }
+ else
+ {
+ $('titrechan').disabled = true;
+ $('auteur').disabled = true;
+
+ new Ajax.Request(
+ 'ajax.php?d=action&a=GSM' + modifURI,
+ {
+ method: 'post',
+ parameters: {
+ titre: $('titrechan').value,
+ auteur: $('auteur').value,
+ type: type,
+ alb: idAlbum
+ },
+ onSuccess: function(transport, json)
+ {
+ if (json.statut != 1)
+ {
+ firstLoad();
+ alert("Vous avez été déconnecté. La chanson n'a pas été enregistrée");
+ }
+ else
+ {
+ if(modif)
+ {
+ setTimeout('$("confirm").innerHTML = "Chanson modifiée avec succès !";', 234);
+ setTimeout("$('confirm').innerHTML = '';", 3500);
+
+ GPC_liste[modif-1].titre = $('titrechan').value;
+ GPC_liste[modif-1].artiste = $('auteur').value;
+ }
+ else
+ {
+ nc = new Chanson();
+ nc.id = transport.responseXML.documentElement.getElementsByTagName("id")[0].textContent;
+ nc.titre = $('titrechan').value;
+ nc.artiste = $('auteur').value;
+ nc.albums.push(idAlbum);
+ GPC_origin_liste[nc.id] = nc;
+ GPC_liste.push(nc);
+
+ $('titrechan').value = "";
+ $('auteur').value = "";
+
+ $('titrechan').disabled = false;
+ $('auteur').disabled = false;
+
+ $('nbpc').innerHTML = json.nombre;
+
+ setTimeout('$("confirm").innerHTML = "Chanson ajoutée avec succès !";', 234);
+ setTimeout("$('confirm').innerHTML = '';", 3500);
+ }
+
+ if (idAlbum)
+ GPC_viewalbum(type, idAlbum, page);
+ else
+ //TODO à tester ça marche pas
+ GPC_viewliste(type, 0, page);
+
+ if (modif)
+ window.scrollTo(0,0);
+ else
+ $('titrechan').focus();
+ }
+ },
+ onFailure: function() { printEtat(3); }
+ }
+ );
+ }
+}
+
+function GPC_viewalbums()
+{
+ if (GPC_origin_liste == false)
+ setTimeout(GPC_viewalbums, 200);
+ else
+ {
+ var tableau = document.createElement("div");
+ tableau.className = "table cols2 stats";
+ tableau.id = "statsA";
+ var tableau_head = document.createElement("div");
+ tableau_head.className = "head";
+ var head_th = document.createElement("span");
+ head_th.innerHTML = "CD années";
+ tableau_head.appendChild(head_th);
+ var head_th = document.createElement("span");
+ head_th.innerHTML = "Nombre";
+ tableau_head.appendChild(head_th);
+ tableau.appendChild(tableau_head);
+ var tableau_bodyA = document.createElement("div");
+ tableau_bodyA.className = "body";
+ tableau_bodyA.innerHTML = '';
+ tableau.appendChild(tableau_bodyA);
+ $('contenu').appendChild(tableau);
+
+ var tableau = document.createElement("div");
+ tableau.className = "table cols2 stats";
+ tableau.id = "statsD";
+ var tableau_head = document.createElement("div");
+ tableau_head.className = "head";
+ var head_th = document.createElement("span");
+ head_th.innerHTML = "CD décénies";
+ tableau_head.appendChild(head_th);
+ var head_th = document.createElement("span");
+ head_th.innerHTML = "Nombre";
+ tableau_head.appendChild(head_th);
+ tableau.appendChild(tableau_head);
+ var tableau_bodyD = document.createElement("div");
+ tableau_bodyD.className = "body";
+ tableau_bodyD.innerHTML = '';
+ tableau.appendChild(tableau_bodyD);
+ $('contenu').appendChild(tableau);
+
+ var tableau = document.createElement("div");
+ tableau.className = "table cols2 stats";
+ tableau.id = "statsC";
+ var tableau_head = document.createElement("div");
+ tableau_head.className = "head";
+ var head_th = document.createElement("span");
+ head_th.innerHTML = "CD classiques";
+ tableau_head.appendChild(head_th);
+ var head_th = document.createElement("span");
+ head_th.innerHTML = "Nombre";
+ tableau_head.appendChild(head_th);
+ tableau.appendChild(tableau_head);
+ var tableau_bodyC = document.createElement("div");
+ tableau_bodyC.className = "body";
+ tableau_bodyC.innerHTML = '';
+ tableau.appendChild(tableau_bodyC);
+ $('contenu').appendChild(tableau);
+
+
+ new Ajax.Request(
+ 'ajax.php',
+ {
+ method: 'get',
+ parameters: {d: "action", a: "GSM", p: "stats"},
+ onSuccess: function(transport, json)
+ {
+ var annees = transport.responseXML.documentElement.getElementsByTagName("annee");
+ var chanteurs = transport.responseXML.documentElement.getElementsByTagName("interprete");
+ var decenies = transport.responseXML.documentElement.getElementsByTagName("decenie");
+
+ tableau_bodyA.innerHTML = "";
+ for (var i = 0; i < annees.length; i++)
+ {
+ if (annees[i].getAttribute("id") != "")
+ {
+ var lign = document.createElement("div");
+ lign.className = "elt" + (i%2);
+ GPC_addStatLign(lign, [1], annees[i].getAttribute("id"));
+ var col = document.createElement("span");
+ col.innerHTML = GPC_liste_CDs[annees[i].getAttribute("id")].titre;
+ lign.appendChild(col);
+ var col = document.createElement("span");
+ col.innerHTML = annees[i].getAttribute("nbTitles");
+ lign.appendChild(col);
+ tableau_bodyA.appendChild(lign);
+ }
+ }
+ if (annees.length == 0)
+ tableau_bodyA.innerHTML = '';
+ else
+ lign.className += " foot";
+
+ tableau_bodyC.innerHTML = "";
+ for (var i = 0; i < chanteurs.length; i++)
+ {
+ if (chanteurs[i].getAttribute("id") != "")
+ {
+ var lign = document.createElement("div");
+ lign.className = "elt" + (i%2);
+ GPC_addStatLign(lign, [2], chanteurs[i].getAttribute("id"));
+ var col = document.createElement("span");
+ col.innerHTML = GPC_liste_CDs[chanteurs[i].getAttribute("id")].titre;
+ lign.appendChild(col);
+ var col = document.createElement("span");
+ col.innerHTML = chanteurs[i].getAttribute("nbTitles");
+ lign.appendChild(col);
+ tableau_bodyC.appendChild(lign);
+ }
+ }
+ if (chanteurs.length == 0)
+ tableau_bodyC.innerHTML = '';
+ else
+ lign.className += " foot";
+
+ tableau_bodyD.innerHTML = "";
+ for (var i = 0; i < decenies.length; i++)
+ {
+ if (decenies[i].getAttribute("id") != "")
+ {
+ var lign = document.createElement("div");
+ lign.className = "elt" + (i%2);
+ GPC_addStatLign(lign, [3], decenies[i].getAttribute("id"));
+ var col = document.createElement("span");
+ col.innerHTML = GPC_liste_CDs[decenies[i].getAttribute("id")].titre;
+ lign.appendChild(col);
+ var col = document.createElement("span");
+ col.innerHTML = decenies[i].getAttribute("nbTitles");
+ lign.appendChild(col);
+ tableau_bodyD.appendChild(lign);
+ }
+ }
+ if (decenies.length == 0)
+ tableau_bodyD.innerHTML = '';
+ else
+ lign.className += " foot";
+ },
+ onFailure: function() { printEtat(3); }
+ }
+ );
+ }
+}
+
+function GPC_addStatLign(lign, type, id)
+{
+ lign.onclick = function() { window.scrollTo(0,0); GPC_viewalbum(type, id, 0) };
+}
+
+function GPC_viewalbum(type, id, page, title)
+{
+ window.scrollTo(0,75);
+ $('contenu').innerHTML = "";
+ var confirmation = document.createElement("h2");
+ confirmation.style.color = "teal";
+ confirmation.id = "confirm";
+
+ var titre = document.createElement("h2");
+ if (typeof(title) == 'undefined')
+ titre.innerHTML = "Liste des titres de " + GPC_liste_CDs[id].titre;
+ else
+ titre.innerHTML = "Liste des titres de " + title;
+ $('contenu').appendChild(titre);
+ $('contenu').appendChild(confirmation);
+ GPC_delay_viewalbum(type, id, page);
+}
+
+function GPC_build_liste(id, types)
+{
+ GPC_liste = new Array();
+ for (var i in GPC_origin_liste)
+ {
+ if (i.isInt() && typeof(GPC_origin_liste[i]) != 'undefined')
+ {
+ if (GPC_origin_liste[i].inAlbum(id, types))
+ GPC_liste.push(GPC_origin_liste[i]);
+ }
+ }
+}
+
+function rechTitles(title, artiste, album, types)
+{
+ if (GPC_origin_liste == false)
+ GPC_delay = setTimeout(rechTitles, titre, artiste, album, types);
+ else
+ {
+ window.scrollTo(0,0);
+ $('contenu').innerHTML = "";
+ titre = document.createElement("h2");
+ titre.className = "vp";
+ titre.innerHTML = "Recherche en cours ...Veuillez patienter";
+ $('contenu').appendChild(titre);
+
+ GPC_liste = new Array();
+ for (var i in GPC_origin_liste)
+ {
+ if (i.isInt() && typeof(GPC_origin_liste[i]) != 'undefined')
+ {
+ if (GPC_origin_liste[i].search(title, artiste, album, types))
+ GPC_liste.push(GPC_origin_liste[i]);
+ }
+ }
+
+ $('contenu').innerHTML = "";
+ titre = document.createElement("h2");
+ titre.innerHTML = "Recherche d'un élément";
+ $('contenu').appendChild(titre);
+
+ if (GPC_liste == false)
+ {
+ titre2 = document.createElement("h3");
+ titre2.innerHTML = "Aucun élément n'a été trouvé avec ces critères";
+ $('contenu').appendChild(titre2);
+
+ GPC_formRech(title, artiste, album, types);
+ }
+ else
+ GPC_viewliste(0, 0, 0);
+ }
+}
+
+function GPC_delay_viewalbum(type, id, page)
+{
+ if (GPC_origin_liste == false)
+ GPC_delay = setTimeout(GPC_delay_viewalbum, 200, type, id, page);
+ else
+ {
+ GPC_build_liste(id);
+ if (GPC_liste == false)
+ GPC_liste[0] = 2;
+
+ GPC_lastSort = -1;
+
+ GPC_viewliste(type, id, page);
+
+ GPC_addForm(type, id, false, 0);
+ }
+}
+
+function GPC_viewliste(type, idAlbum, page)
+{
+ var pagination = document.createElement("div");
+ pagination.className = "pagination top";
+ pagination.id = "pagination1";
+ $('contenu').appendChild(pagination);
+
+ var tableau = document.createElement("div");
+ tableau.className = "table cols3";
+ tableau.id = "list";
+ var tableau_head = document.createElement("div");
+ tableau_head.className = "head";
+ var head_th = document.createElement("span");
+ head_th.innerHTML = "Titre";
+ head_th.onclick = function() { GPC_showliste("titre", 0, type, idAlbum); }
+ tableau_head.appendChild(head_th);
+ var head_th = document.createElement("span");
+ head_th.innerHTML = "Chanteur";
+ head_th.onclick = function() { GPC_showliste("artiste", 0, type, idAlbum); }
+ tableau_head.appendChild(head_th);
+ var head_th = document.createElement("span");
+ head_th.innerHTML = "CDs";
+ head_th.style.cursor = "auto";
+ tableau_head.appendChild(head_th);
+ tableau.appendChild(tableau_head);
+ var tableau_body = document.createElement("div");
+ tableau_body.className = "body";
+ tableau_body.id = "bodyList";
+ tableau_body.innerHTML = '';
+ tableau.appendChild(tableau_body);
+ $('contenu').appendChild(tableau);
+
+
+ var pagination = document.createElement("div");
+ pagination.className = "pagination bottom";
+ pagination.id = "pagination2";
+ $('contenu').appendChild(pagination);
+
+ GPC_showliste(-1, page, type, idAlbum);
+}
+
+function GPC_showliste(tri, page, type, idAlbum)
+{
+ if (GPC_origin_liste == false)
+ setTimeout(GPC_showliste, 200, tri, page, type, idAlbum);
+ else
+ {
+ if (GPC_liste == false)
+ GPC_build_liste(undefined, type);
+
+ //On tente un tri
+ if (GPC_lastSort != tri && tri != -1)
+ {
+ $('bodyList').innerHTML = '';
+ GPC_liste = GPC_liste.sort(function(a,b){return a[tri].localeCompare(b[tri]);});
+ GPC_lastSort = tri;
+ }
+
+ nbPages = Math.ceil(GPC_liste.length / nbParPage);
+ $('pagination1').innerHTML = "";
+ $('pagination2').innerHTML = "";
+
+ if (nbPages < 3)
+ {
+ var lnkP = document.createElement("a");
+ lnkP.href = "javascript:GPC_printliste('" + GPC_lastSort + "', " + type + ", " + idAlbum + ");";
+ lnkP.innerHTML = "Imprimer la pochette";
+ $('pagination1').appendChild(lnkP);
+ var lnkP = document.createElement("a");
+ lnkP.href = "javascript:GPC_printliste('" + GPC_lastSort + "', " + type + ", " + idAlbum + ");";
+ lnkP.innerHTML = "Imprimer la pochette";
+ $('pagination2').appendChild(lnkP);
+ }
+
+ for (var i = 0; i < 4 && i < nbPages; i++)
+ GPC_addLinkPagination(i, type, idAlbum);
+ if (page > 5 && i < nbPages)
+ {
+ $('pagination1').innerHTML += "...";
+ $('pagination2').innerHTML += "...";
+ }
+ for (var i = (page < 6?4:page - 2); (i < page + 3 && i < nbPages); i++)
+ GPC_addLinkPagination(i, type, idAlbum);
+ if (page <= 5 && i < nbPages)
+ {
+ $('pagination1').innerHTML += "...";
+ $('pagination2').innerHTML += "...";
+ for (var i = Math.ceil(nbPages/2) - 2; i < nbPages/2 + 2; i++)
+ GPC_addLinkPagination(i, type, idAlbum);
+ }
+ if (page + 3 < nbPages - 4)
+ {
+ $('pagination1').innerHTML += "...";
+ $('pagination2').innerHTML += "...";
+ }
+ for (var i = (page + 3 >= nbPages - 4?page + 3:nbPages - 4); (i < nbPages); i++)
+ GPC_addLinkPagination(i, type, idAlbum);
+
+ start = page * nbParPage;
+ $('bodyList').innerHTML = "";
+
+ if (GPC_liste[0] != 2)
+ {
+ for (var i = 0; i < nbParPage && i + start < GPC_liste.length; i++)
+ {
+ var lign = document.createElement("div");
+ lign.className = "elt" + (i%2);
+
+ GPC_addLinkCD(lign, i + start, idAlbum, type, page);
+ var col = document.createElement("span");
+ col.innerHTML = GPC_liste[i + start].titre;
+ lign.appendChild(col);
+ var col = document.createElement("span");
+ col.innerHTML = GPC_liste[i + start].artiste;
+ lign.appendChild(col);
+ var col = document.createElement("span");
+
+ for (var alb in GPC_liste[i + start].albums)
+ {
+ if (alb.isInt())
+ col.innerHTML += '" + GPC_liste_CDs[GPC_liste[i + start].albums[alb]].titre + "
";
+ }
+ lign.appendChild(col);
+ $('bodyList').appendChild(lign);
+ }
+ }
+ else
+ {
+ var lign = document.createElement("div");
+ lign.className = "elt0";
+ lign.innerHTML = "Il n'y a aucun titre enregistré dans cet album.";
+ $('bodyList').appendChild(lign);
+ }
+ lign.className += " foot";
+ }
+}
+function GPC_addLinkPagination(page, type, idAlbum)
+{
+ var lnkP = document.createElement("a");
+ lnkP.href = "javascript:GPC_showliste('" + GPC_lastSort + "', " + page + ", " + type + ", " + idAlbum + ");";
+ lnkP.innerHTML = page+1;
+ $('pagination1').appendChild(lnkP);
+ var lnkP = document.createElement("a");
+ lnkP.href = "javascript:GPC_showliste('" + GPC_lastSort + "', " + page + ", " + type + ", " + idAlbum + ");";
+ lnkP.innerHTML = page+1;
+ $('pagination2').appendChild(lnkP);
+}
+
+function GPC_printliste(tri, type, idAlbum)
+{
+ if (GPC_origin_liste == false)
+ setTimeout(GPC_printliste, 200, tri, type, idAlbum);
+ else
+ {
+ $('contenu').innerHTML = "";
+
+ var patt1 = "";
+ if (GPC_liste_CDs[idAlbum].titre.toLowerCase().indexOf("cd") >= 0)
+ patt1 = GPC_liste_CDs[idAlbum].titre.match(/cd ?([0-9]+)/i).toString();
+ var trueTitleL1 = GPC_liste_CDs[idAlbum].titre;
+ trueTitleL1 = trueTitleL1.substr(0, trueTitleL1.length - patt1.indexOf(','));
+ if (type == 1)
+ trueTitleL1 = "Année " + trueTitleL1;
+
+ var trueTitleL2;
+ if (patt1)
+ trueTitleL2 = "CD " + patt1.substr(patt1.indexOf(',')+1);
+ else
+ trueTitleL2 = "";
+
+ var trueTitle = trueTitleL1 + " – " + trueTitleL2;
+
+ var front = document.createElement("div");
+ front.className = "front";
+ var titleP = document.createElement("div");
+ titleP.className = "title";
+ titleP.innerHTML = trueTitleL1;
+ front.appendChild(titleP);
+ var cd = document.createElement("div");
+ cd.className = "cd";
+ cd.innerHTML = trueTitleL2;
+ if (trueTitleL2)
+ cd.style.marginTop = "70px";
+ front.appendChild(cd);
+ $('contenu').appendChild(front);
+
+ new Ajax.Request(
+ 'ajax.php',
+ {
+ method: 'get',
+ parameters: {d: "action", a: "GSM", p: "color", type: type, id: idAlbum},
+ onSuccess: function(transport, json)
+ {
+ var colors = transport.responseXML.documentElement.getElementsByTagName("color");
+ if (colors.length == 2)
+ {
+ titleP.style.color = colors[1].firstChild.textContent;
+ cd.style.color = colors[0].firstChild.textContent;
+ }
+ else if (colors.length == 1)
+ {
+ titleP.style.color = colors[0].firstChild.textContent;
+ cd.style.color = colors[0].firstChild.textContent;
+ }
+ }
+ });
+
+ var sp = document.createElement("div");
+ sp.className = "sp";
+ $('contenu').appendChild(sp);
+
+ var back = document.createElement("div");
+ back.className = "back";
+ var backL = document.createElement("div");
+ backL.className = "left";
+ var title = document.createElement("div");
+ title.className = "title";
+ title.innerHTML = trueTitleL1 + " " + trueTitleL2;
+ backL.appendChild(title);
+ back.appendChild(backL);
+ var backR = document.createElement("div");
+ backR.className = "right";
+ var title = document.createElement("div");
+ title.className = "title";
+ title.innerHTML = trueTitleL1 + " " + trueTitleL2;
+ backR.appendChild(title);
+ back.appendChild(backR);
+
+ var backC = document.createElement("div");
+ backC.className = "center";
+ var title = document.createElement("div");
+ title.className = "title";
+ title.innerHTML = trueTitleL1 + " – " + trueTitleL2;
+ backC.appendChild(title);
+
+ var listeC = document.createElement("ol");
+ backC.appendChild(listeC);
+
+ back.appendChild(backC);
+ $('contenu').appendChild(back);
+
+ if (GPC_liste == false)
+ {
+ GPC_liste = new Array();
+ for (var i in GPC_origin_liste)
+ {
+ if (i.isInt())
+ GPC_liste.push(GPC_origin_liste[i]);
+ }
+ }
+
+ //On tente un tri
+ if (GPC_lastSort != tri)
+ {
+ GPC_liste = GPC_liste.sort(function(a,b){return a[tri].localeCompare(b[tri]);});
+ GPC_lastSort = tri;
+ }
+
+ if (GPC_liste[0] != 2)
+ {
+ for (var i = 0; i < GPC_liste.length; i++)
+ {
+ var lign = document.createElement("li");
+ lign.className = "elt" + (i%2);
+ lign.innerHTML = GPC_liste[i + start].titre
+ var col = document.createElement("span");
+ col.className = "author";
+ col.innerHTML = GPC_liste[i + start].artiste;
+ lign.appendChild(col);
+ GPC_addLinkOrder(lign, i + start, tri, type, idAlbum);
+ listeC.appendChild(lign);
+ }
+
+ //On ajuste automatiquement la taille de la police
+ listeC.style.fontSize = Math.floor(4000/(GPC_liste.length*1.35))/10 + "px";
+ listeC.style.marginTop = ((400 - listeC.clientHeight) / 2) + "px";
+ }
+ else
+ {
+ var lign = document.createElement("div");
+ lign.className = "elt0";
+ lign.innerHTML = "Il n'y a aucun titre enregistré dans cet album.";
+ $('bodyList').appendChild(lign);
+ }
+ lign.className += " foot";
+ }
+}
+
+function GPC_addLinkCD(elt, idTitle, idAlbum, type, page)
+{
+ elt.onclick = function() {
+ GPC_addForm(type, idAlbum, idTitle+1, page);
+ }
+}
+
+function GPC_addLinkOrder(elt, id, tri, type, idAlbum)
+{
+ elt.onclick = function() {
+ GPC_chOrder(id, tri, type, idAlbum);
+ }
+}
+function GPC_chOrder(id, tri, type, idAlbum)
+{
+ var num = prompt("Quel est le numéro de cette chanson : ", id+1);
+ if (num > 0 && num <= GPC_liste.length)
+ {
+ if (num != id)
+ {
+ var tmp = GPC_liste[num-1];
+ GPC_liste[num-1] = GPC_liste[id];
+ GPC_liste[id] = tmp;
+
+ GPC_printliste(tri, type, idAlbum);
+ }
+ }
+ else
+ alert("Ce nombre n'est pas valide !\nLe numéro de la chanson doit être compris entre 1 et " + GPC_liste.length);
+}
+
+function GPC_apropos()
+{
+ aproposApp("GPC", "contenu");
+}
diff --git a/htdocs/applications/GPC/auteurs.php b/htdocs/applications/GPC/auteurs.php
new file mode 100644
index 0000000..17a00d5
--- /dev/null
+++ b/htdocs/applications/GPC/auteurs.php
@@ -0,0 +1,28 @@
+escape($nom);
+$chanteurs = $bdd->query("SELECT artiste FROM gsm_titres WHERE artiste LIKE '$nom%' GROUP BY artiste;");
+$bdd->deconnexion();
+
+if (!empty($chanteurs) && !empty($nom))
+{
+ print "\n";
+ foreach ($chanteurs as $chanteur)
+ {
+ print ' - '.$chanteur["artiste"]."
\n";
+ }
+ print "
";
+}
+?>
\ No newline at end of file
diff --git a/htdocs/applications/GPC/chanson.js b/htdocs/applications/GPC/chanson.js
new file mode 100644
index 0000000..f080c83
--- /dev/null
+++ b/htdocs/applications/GPC/chanson.js
@@ -0,0 +1,45 @@
+function Chanson(elt)
+{
+ this.albums = new Array();
+ if (elt)
+ {
+ this.id = elt.getAttribute("id");
+ this.titre = elt.getAttribute("titre");
+ this.artiste = elt.getAttribute("artiste");
+
+ for (var albm in elt.getElementsByTagName("inalbum"))
+ {
+ if (albm.isInt())
+ this.albums.push(elt.getElementsByTagName("inalbum")[albm].getAttribute("id"));
+ }
+ }
+}
+
+Chanson.prototype.inAlbum = function(idAlbum, types)
+{
+ for (var i = 0; i < this.albums.length; i++)
+ {
+ if (
+ (typeof(idAlbum) == 'undefined' || this.albums[i] == idAlbum) &&
+ (typeof(types) == 'undefined' || types.in_array(GSM_liste_CDs[this.albums[i]].type))
+ )
+ return true;
+ }
+ return false;
+}
+
+Chanson.prototype.search = function(titre, artiste, album, types)
+{
+ if (
+ (titre == '' || this.titre.toLowerCase().indexOf(titre.toLowerCase()) >= 0) &&
+ (artiste == '' || this.artiste.toLowerCase().indexOf(artiste.toLowerCase()) >= 0)
+ )
+ {
+ for (var i = 0; i < this.albums.length; i++)
+ {
+ if (album == '' || GSM_liste_CDs[this.albums[i]].titre.toLowerCase().indexOf(album.toLowerCase()) >= 0)
+ return (types.length == 0 || types.in_array(GSM_liste_CDs[this.albums[i]].type));
+ }
+ }
+ return false;
+}
diff --git a/htdocs/applications/GPC/loader.gif b/htdocs/applications/GPC/loader.gif
new file mode 100644
index 0000000..6e44c0e
Binary files /dev/null and b/htdocs/applications/GPC/loader.gif differ
diff --git a/htdocs/applications/GPC/main.css b/htdocs/applications/GPC/main.css
new file mode 100644
index 0000000..d9e5ee0
--- /dev/null
+++ b/htdocs/applications/GPC/main.css
@@ -0,0 +1,101 @@
+.front
+{
+ border: solid 1px black;
+ display: table-cell;
+ height: 12cm;
+ text-align: center;
+ vertical-align: middle;
+ width: 12cm;
+}
+
+.front .title, .front .cd
+{
+ font-size: 60px;
+ font-family: sans-serif;
+ font-weight: bolder;
+ text-transform: uppercase;
+}
+
+.sp
+{
+ margin: 1cm 0;
+}
+
+.back
+{
+ border: solid 1px black;
+ display: table;
+ height: 11.8cm;
+ width: 15.3cm;
+}
+
+.back .title
+{
+ font-variant: small-caps
+}
+
+.back .center .title
+{
+ font-size: 14px;
+ font-weight: bolder;
+}
+
+.back .left, .back .right
+{
+ display: block;
+ height: 11.8cm;
+ text-align: left;
+ vertical-align: top;
+ width: 0.8cm;
+}
+.back .left
+{
+ border-right: dashed 1px gray;
+ float: left;
+}
+.back .right
+{
+ border-left: dashed 1px gray;
+ float: right;
+}
+.back .left .title, .back .right .title
+{
+ font-size: 13pt;
+ font-weight: bolder;
+ margin-top: 5.5cm;
+ margin-left: -5.15cm;
+ position: absolute;
+}
+
+.back .left .title
+{
+ -webkit-transform: rotate(-90deg);
+ -moz-transform: rotate(-90deg);
+ transform: rotate(-90deg);
+ text-align: center;
+ width: 11.1cm;
+}
+.back .right .title
+{
+ -webkit-transform: rotate(90deg);
+ -moz-transform: rotate(90deg);
+ transform: rotate(90deg);
+ text-align: center;
+ width: 11cm;
+}
+
+.back .center
+{
+ text-align: center;
+}
+
+.back ol
+{
+ text-align: left;
+}
+
+.back .author
+{
+ float: right;
+ width: 45%;
+}
\ No newline at end of file
diff --git a/htdocs/applications/GPC/print.css b/htdocs/applications/GPC/print.css
new file mode 100644
index 0000000..9bb2ef9
--- /dev/null
+++ b/htdocs/applications/GPC/print.css
@@ -0,0 +1,24 @@
+body
+{
+ font-family: serif;
+ font-size: 10px;
+ margin: auto;
+ width: 18cm;
+}
+
+h1 {
+ display: none;
+}
+menu {
+ display: none;
+}
+
+.back .center
+{
+ overflow:hidden;
+ height: 11.1cm;
+}
+.back .center ol
+{
+ -webkit-margin-before: 0.5em;
+}
diff --git a/htdocs/applications/GPC/style.css b/htdocs/applications/GPC/style.css
new file mode 100644
index 0000000..18ce779
--- /dev/null
+++ b/htdocs/applications/GPC/style.css
@@ -0,0 +1,345 @@
+html {
+ height: 100%;
+}
+
+body {
+ background: -webkit-gradient(
+ linear,
+ left top,
+ left bottom,
+ color-stop(0.31, #ffa2a1),
+ color-stop(0.90, #ffd3d3)
+ );
+ background: -moz-linear-gradient(
+ center bottom,
+ #ffa2a1 31%,
+ #ffd3d3 90%
+ );
+
+ font-family: serif;
+ margin-bottom: 10px;
+ min-height: 80%;
+}
+
+a:link, a:visited {
+ text-decoration: none;
+ color:#000000;
+}
+
+h1 {
+ text-align: center;
+ margin-left: 250px;
+}
+
+.pagination a:link, .pagination a:visited {
+ text-decoration: none;
+ color:#FFFFFF;
+}
+
+.pagination a:hover, a:hover {
+ text-decoration: underline;
+}
+
+.news {
+ background: -webkit-gradient(
+ linear,
+ left top,
+ right bottom,
+ color-stop(0.31, #ffa2a1),
+ color-stop(0.66, #ffdcdb)
+ );
+ background: -moz-linear-gradient(
+ right bottom,
+ #ffa2a1 31%,
+ #ffdcdb 66%
+ );
+
+ border: 2px solid #ff6062;
+ border-radius: 17px;
+ box-shadow: 3px 4px 5px #444466;
+
+ height: 127px;
+ margin: auto;
+ padding: 20px;
+ text-align: left;
+ width: 75%;
+}
+
+.vp {
+ color: orange;
+}
+
+menu {
+ background: -webkit-gradient(
+ linear,
+ left top,
+ left bottom,
+ color-stop(0.31, #ffa2a1),
+ color-stop(0.90, #ffd3d3)
+ );
+ background: -moz-linear-gradient(
+ center bottom,
+ #ffa2a1 31%,
+ #ffd3d3 90%
+ );
+
+ border-right: 2px dotted white;
+ color:#FFFFFF;
+ font-weight: bold;
+ height: 100%;
+ left: 0px;
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ position: fixed;
+ text-align: center;
+ top: 0px;
+ width: 250px;
+}
+
+menu h2 {
+ margin-left: 69px;
+}
+
+menu > li {
+ margin-bottom: 40px;
+ text-align: center;
+ width: 250px;
+}
+menu > li ul {
+ margin-left: 20px;
+}
+menu > li li {
+ margin-top: 5px;
+}
+menu li[onclick] {
+ cursor: pointer;
+}
+menu li[onclick]:hover {
+ text-decoration: underline;
+}
+
+label {
+ font-weight: bold;
+}
+label:hover {
+ text-decoration: underline;
+}
+
+form {
+ background: -webkit-gradient(
+ linear,
+ left top,
+ left bottom,
+ color-stop(0.31, #cc6d1d),
+ color-stop(0.95, #ff8f26)
+ );
+ background: -moz-linear-gradient(
+ center bottom,
+ #cc6d1d 31%,
+ #ff8f26 95%
+ );
+ border: 1px solid #ff9b42;
+ border-radius: 25px;
+ box-shadow: 2px 2px 5px #553333;
+}
+
+form#addAlbms, form#rechTitles {
+ margin: auto;
+ padding: 13px;
+ text-align: left;
+ width: 400px;
+}
+form#addAlbms div, form#rechTitles div {
+ text-align: center;
+}
+form#rechTitles input[type=text] {
+ width: 234px;
+}
+form#rechTitles input[type=checkbox] {
+ margin-left: 120px;
+}
+form#addAlbms div label, form#rechTitles div label {
+ margin-right: 4px;
+}
+form#addAlbms div#testColor {
+ background-color: black;
+ border: solid 1px black;
+ display: inline-block;
+ height: 1em;
+ margin-left: 5px;
+ margin-bottom: -4px;
+ width: 2em;
+}
+
+form#ajout {
+ height: 182px;
+ margin: 10px auto;
+ padding: 13px;
+ text-align: left;
+ width: 642px;
+}
+form#ajout input[type=text] {
+ width: 444px;
+}
+form#ajout select {
+ margin-right: 10px;
+}
+
+form#ajout label {
+ float: left;
+ display: block;
+ font-weight: bold;
+ margin: 10px 7px 10px 0;
+ text-align: right;
+ width: 110px;
+}
+form#ajout label:hover {
+ text-decoration: underline;
+}
+
+input[type=text], select {
+ margin: 10px 0;
+ transition: background 0.75s;
+ -moz-transition: background 0.75s;
+ -webkit-transition: background 0.75s;
+ -o-transition: background 0.75s;
+}
+input, select {
+ background: #FF6600;
+ border: #CA2A20 solid 1px;
+ border-radius: 3px;
+ margin-top: 5px;
+}
+input:hover, input:focus, select:hover, select:focus {
+ background: #CC6600;
+}
+
+input.erreur, select.erreur {
+ background: #CC0000;
+}
+
+div#GSM_menu {
+ background: url(backmenu.png);
+ color:#FFFFFF;
+ top: 0px;
+ font-weight: bold;
+ height: 1200px;
+ padding-top: 30px;
+ position: fixed;
+ text-align: center;
+ left: 0px;
+ width: 250px;
+}
+
+div#GSM_menu h2 {
+ margin-bottom: 40px;
+}
+
+div#contenu {
+ margin-left: 250px;
+ text-align: center;
+}
+
+.table {
+ border: 1px solid black;
+ border-radius: 10px;
+ box-shadow: 3px 3px 5px #666666;
+ margin: auto;
+}
+.table .body div {
+ transition: background 500ms;
+ -moz-transition: background 500ms;
+ -webkit-transition: background 500ms;
+ -o-transition: background 500ms;
+}
+.table .body div.elt0 {
+ background: #ec7d60;
+}
+.table .body div.elt1 {
+ background: #f68063;
+}
+.table .body div:hover {
+ background: #fa8022;
+}
+.table.cols2 div span {
+ display: inline-block;
+ width: 40%;
+}
+.table.cols3 div span {
+ display: inline-block;
+ width: 40%;
+}
+.table.cols3 div span+span+span {
+ width: 20%;
+}
+.table div.lign {
+ display: inline-block;
+ width: 100%;
+}
+
+.table .head {
+ background: #f26340;
+ border-bottom: 1px solid black;
+ border-radius: 10px 10px 0 0;
+ font-weight: bolder;
+ display: block;
+ text-align: center;
+ width: 100%;
+}
+.table .foot { border-radius: 0 0 10px 10px; }
+
+.table.stats {
+ float: left;
+ margin: 0 1%;
+ width: 31%;
+}
+.table#list {
+ width: 83%;
+}
+.table#list .head {
+ cursor: pointer;
+}
+.table .body div {
+ cursor: pointer;
+}
+
+.pagination {
+ background: #f26340;
+ border: 1px solid black;
+ color: white;
+ margin: auto;
+ width: 442px;
+}
+.pagination.top {
+ border-radius: 10px 10px 0 0;
+ border-bottom: none;
+}
+.pagination.bottom {
+ border-top: none;
+ border-radius: 0 0 10px 10px;
+ box-shadow: 0px 2px 7px #666666;
+}
+.pagination a {
+ cursor: pointer;
+ padding: 0 5px;
+}
+
+.front, .back
+{
+ background: white;
+}
+.back .center
+{
+ overflow:auto;
+}
+.back ol li:hover
+{
+ background-color: teal;
+}
+
+div.autocomplete
+{
+ margin-top: 20px;
+ margin-left: 6px;
+}
diff --git a/onyx2/include/applications/GPC/main.php b/onyx2/include/applications/GPC/main.php
new file mode 100644
index 0000000..8895c23
--- /dev/null
+++ b/onyx2/include/applications/GPC/main.php
@@ -0,0 +1,276 @@
+createElement("cuillere");
+ $cuil->setAttribute("id", $c["id"]);
+ $cuil->setAttribute("name", $c["name"]);
+ $cuil->setAttribute("category", $c["category"]);
+
+ $xml_root->appendChild($cuil);
+ }
+ }
+}
+
+if ($p == "liste")
+{
+ $bdd = new BDD();
+ $req = $bdd->query("SELECT P.id, P.name, C.categ AS category FROM gpc_pc P LEFT JOIN gpc_categ C ON C.id = P.id_categ;");
+ $req["nombre"] = $bdd->num_rows;
+ $bdd->deconnexion();
+
+ format_list($req, $xml, $xml_root);
+}
+elseif ($p == "add" && ($type = intval(gpc("type", "post"))) && ($title = gpc("title", "post")))
+{
+ $color = hexdec(gpc("color", "post"));
+
+ $bdd = new BDD();
+ $bdd->escape($title);
+ $bdd->query("INSERT INTO `gsm_albums` (type, titre, color) VALUES ($type, '$title', $color);");
+ $id = $bdd->insert_id();
+ if ($id == 0)
+ {
+ $res = $bdd->unique_query("SELECT id FROM `gsm_albums` WHERE type = $type AND titre = '$title';");
+ $id = $res["id"];
+ }
+ $req = $bdd->unique_query("SELECT COUNT(*) AS nombre FROM gsm_in");
+ $bdd->deconnexion();
+
+ if ($id != 0)
+ $xml_root->appendChild($xml->createElement("id", $id));
+}
+elseif ($p == "del" && $id = intval(gpc("id", "post")))
+{
+ $alb = intval(gpc("alb", "post"));
+
+ $bdd = new BDD();
+ if (empty($alb))
+ $bdd->query("DELETE FROM `gsm_in` WHERE id_titre = $id;");
+ else
+ $bdd->query("DELETE FROM `gsm_in` WHERE id_titre = $id AND id_album = $alb;");
+
+ $res = $bdd->unique_query("SELECT COUNT(*) AS c FROM `gsm_in` WHERE id_titre = $id;");
+ if ($res["c"] <= 0)
+ $bdd->query("DELETE FROM `gsm_titres` WHERE id = $id;");
+
+ $req = $bdd->unique_query("SELECT COUNT(*) AS nombre FROM gsm_in");
+ $bdd->deconnexion();
+}
+elseif ($p == "color" && ($type = intval(gpc("type", "get"))) && ($idAlbum = intval(gpc("id", "get"))))
+{
+ $bdd = new BDD();
+ $res = $bdd->unique_query("SELECT color FROM `gsm_albums` WHERE id = $idAlbum;");
+ $req = $bdd->unique_query("SELECT COUNT(*) AS nombre FROM gsm_in;");
+ $bdd->deconnexion();
+
+ $xml_root->appendChild($xml->createElement("color", sprintf("#%06X", $res["color"])));
+
+ $color2R = ($res["color"] >> 16) & 255;
+ if ($color2R >= 25)
+ $color2R -= 25;
+ $color2G = ($res["color"] >> 8) & 255;
+ if ($color2G >= 25)
+ $color2G -= 25;
+ $color2B = ($res["color"]) & 255;
+ if ($color2B >= 25)
+ $color2B -= 25;
+ $xml_root->appendChild($xml->createElement("color", sprintf("#%02X%02X%02X", $color2R, $color2G, $color2B)));
+}
+elseif ($p == "rech")
+{
+ $where = "TRUE";
+ $type = array();
+
+ $bdd = new BDD();
+ foreach($_POST as $key => $val)
+ {
+ $v = gpc($key, "post");
+ $bdd->escape($v);
+
+ if ($key == "titre")
+ $where .= " AND T.titre LIKE = '%".$v."%'";
+ else if ($key == "artiste")
+ $where .= " AND T.artiste LIKE = '%".$v."%'";
+ else if ($key == "album")
+ $where .= " AND A.titre LIKE = '%".$v."%'";
+ else if (preg_match($key, "#^type([0-9]+)$#", $out) && gpc($key, "post") == "1")
+ $type[] = intval($out[1]);
+ }
+
+ if (count($type) > 0)
+ {
+ $where .= " AND (FALSE";
+ foreach($type as $t)
+ $where .= " OR A.type = ".$t;
+ $where .= ")";
+ }
+
+ $rech = $bdd->query("SELECT T.*, A.id AS id_album, A.type, A.titre AS nom FROM gsm_titres T RIGHT OUTER JOIN gsm_in I ON T.id = I.id_titre RIGHT OUTER JOIN gsm_albums A ON A.id = I.id_album WHERE ".$where);
+ $req = $bdd->unique_query("SELECT COUNT(*) AS nombre FROM gsm_in");
+ $bdd->deconnexion();
+
+ format_list(build_list($rech), $xml, $xml_root);
+
+ $xml_cds = $xml->createElement("album");
+ if (!empty($rech))
+ {
+ foreach($rech as $ligne)
+ {
+ $chan = $xml->createElement("chanson");
+ $chan->setAttribute("id", $ligne["id"]);
+ $chan->setAttribute("titre", $ligne["titre"]);
+ $chan->setAttribute("chanteur", $ligne["chanteur"]);
+ $chan->setAttribute("CD_decenie", $ligne["CDDeca"]);
+ $chan->setAttribute("CD_annee", $ligne["CDAnnee"]);
+ $chan->setAttribute("CD_interprete", $ligne["CDChanteur"]);
+ $xml_cds->appendChild($chan);
+ }
+ }
+ $xml_root->appendChild($xml_cds);
+}
+elseif ($p == "stats")
+{
+ $cds = array();
+
+ $bdd = new BDD();
+ $cds["annees"] = $bdd->query("SELECT A.id, A.titre AS nom, COUNT(A.id) AS nombre FROM gsm_albums A RIGHT OUTER JOIN gsm_in I ON A.id = I.id_album WHERE A.type = 1 GROUP BY A.id ORDER BY nom DESC;");
+ $cds["interpretes"] = $bdd->query("SELECT A.id, A.titre AS nom, COUNT(A.id) AS nombre FROM gsm_albums A RIGHT OUTER JOIN gsm_in I ON A.id = I.id_album WHERE A.type = 3 GROUP BY A.id ORDER BY nom ASC;");
+ $cds["decenies"] = $bdd->query("SELECT A.id, A.titre AS nom, COUNT(A.id) AS nombre FROM gsm_albums A RIGHT OUTER JOIN gsm_in I ON A.id = I.id_album WHERE A.type = 2 GROUP BY A.id ORDER BY nom ASC;");
+ $req = $bdd->unique_query("SELECT COUNT(id) AS nombre FROM gsm_in");
+ $bdd->deconnexion();
+
+ if (!empty($cds["annees"]))
+ {
+ foreach($cds["annees"] as $ligne)
+ {
+ $cd = $xml->createElement("annee");
+ $cd->setAttribute("id", $ligne["id"]);
+ $cd->setAttribute("nbTitles", $ligne["nombre"]);
+ $xml_root->appendChild($cd);
+ }
+ }
+
+ if (!empty($cds["interpretes"]))
+ {
+ foreach($cds["interpretes"] as $ligne)
+ {
+ $cd = $xml->createElement("interprete");
+ $cd->setAttribute("id", $ligne["id"]);
+ $cd->setAttribute("nbTitles", $ligne["nombre"]);
+ $xml_root->appendChild($cd);
+ }
+ }
+
+ if (!empty($cds["decenies"]))
+ {
+ foreach($cds["decenies"] as $ligne)
+ {
+ $cd = $xml->createElement("decenie");
+ $cd->setAttribute("id", $ligne["id"]);
+ $cd->setAttribute("nbTitles", $ligne["nombre"]);
+ $xml_root->appendChild($cd);
+ }
+ }
+}
+elseif ($p == "cds")
+{
+ $bdd = new BDD();
+ $cds["decenies"] = $bdd->query("SELECT A.*, COUNT(T.id) AS nombre FROM gsm_cddece A LEFT OUTER JOIN gsm T ON A.id = T.CDDeca GROUP BY A.nom;");
+ $cds["interpretes"] = $bdd->query("SELECT A.*, COUNT(T.id) AS nombre FROM gsm_cdchant A LEFT OUTER JOIN gsm T ON A.id = T.CDChanteur GROUP BY A.nom;");
+ $cds["annees"] = $bdd->query("SELECT A.*, COUNT(T.id) AS nombre FROM gsm_cdannee A LEFT OUTER JOIN gsm T ON A.id = T.CDAnnee GROUP BY A.nom;");
+ $req = $bdd->unique_query("SELECT COUNT(id) AS nombre FROM gsm_in");
+ $bdd->deconnexion();
+
+ $xml_cds = $xml->createElement("decenies");
+ if (!empty($cds["decenies"]))
+ {
+ foreach($cds["decenies"] as $ligne)
+ {
+ $cd = $xml->createElement("cd");
+ $cd->setAttribute("id", $ligne["id"]);
+ $cd->setAttribute("nom", $ligne["nom"]);
+ $cd->setAttribute("nombre_titres", $ligne["nombre"]);
+ $xml_cds->appendChild($cd);
+ }
+ }
+ $xml_root->appendChild($xml_cds);
+
+ $xml_cds = $xml->createElement("interpretes");
+ if (!empty($cds["interpretes"]))
+ {
+ foreach($cds["interpretes"] as $ligne)
+ {
+ $cd = $xml->createElement("cd");
+ $cd->setAttribute("id", $ligne["id"]);
+ $cd->setAttribute("nom", $ligne["nom"]);
+ $cd->setAttribute("nombre_titres", $ligne["nombre"]);
+ $xml_cds->appendChild($cd);
+ }
+ }
+ $xml_root->appendChild($xml_cds);
+
+ $xml_cds = $xml->createElement("annees");
+ if (!empty($cds["annees"]))
+ {
+ foreach($cds["annees"] as $ligne)
+ {
+ $cd = $xml->createElement("cd");
+ $cd->setAttribute("id", $ligne["id"]);
+ $cd->setAttribute("nom", $ligne["nom"]);
+ $cd->setAttribute("nombre_titres", $ligne["nombre"]);
+ $xml_cds->appendChild($cd);
+ }
+ }
+ $xml_root->appendChild($xml_cds);
+}
+elseif (!empty($titre) && !empty($auteur))
+{
+ $alb = intval(gpc("alb", "post"));
+ $type = intval(gpc("type", "post"));
+ $id = intval(gpc("id"));
+
+ $bdd = new BDD();
+ $bdd->escape($titre);
+ $bdd->escape($auteur);
+ if ($id)
+ $bdd->query("UPDATE gsm_titres SET titre = '$titre', artiste = '$auteur' WHERE id = $id;");
+ else
+ {
+ $bdd->query("INSERT INTO gsm_titres (titre, artiste) VALUES ('$titre', '$auteur');");
+ $res = $bdd->insert_id();
+ if (empty($res))
+ {
+ $res = $bdd->unique_query("SELECT id FROM gsm_titres WHERE titre = '$titre' AND artiste = '$auteur';");
+ $res = $res["id"];
+ }
+
+ if (!empty($alb))
+ $bdd->query("INSERT INTO gsm_in (id_titre, id_album) VALUES ($res, $alb);");
+ }
+ $req = $bdd->unique_query("SELECT COUNT(id) AS nombre FROM gsm_titres");
+ $bdd->deconnexion();
+
+ $xml_root->appendChild($xml->createElement("id", $res));
+}
+else
+{
+ $bdd = new BDD();
+ $req = $bdd->unique_query("SELECT COUNT(id) AS nombre FROM gsm_titres");
+ $bdd->deconnexion();
+}
+
+$json["nombre"] = $req["nombre"];
+?>
\ No newline at end of file
diff --git a/onyx2/include/applications/GPC/property.xml b/onyx2/include/applications/GPC/property.xml
new file mode 100644
index 0000000..7117907
--- /dev/null
+++ b/onyx2/include/applications/GPC/property.xml
@@ -0,0 +1,51 @@
+
+
+ Gérer ses petites cuillères
+ Cette application vous permet de gérer facilement vos petites-cuillères.
+ alpha
+ 0.1
+ fr_FR
+ Mercier Pierre-Olivier]]>
+ contenu
+
+
+ 1
+ 3
+
+
+ 0
+ main.css
+ style.css
+ print.css
+ album.js
+ chanson.js
+ app.js
+
+ Bienvenue dans la gestion des petites cuillères
+
+
+ ]]>
+
+
+ Bienvenue dans la version béta de GPC pour Pommultimédia For Home !Cette nouvelle version est plus rapide que la version précédente et a une meilleur intégration avec Pommultimédia For Home.
N'hésitez pas à nous faire part de vos commentaires ;)";
+ $('contenu').appendChild(news);
+}
+ ]]>
+
+
+ gpc
+