X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=js%2Feuphorik.js;h=929a35ce4855514f8d436392a9326e370041f4e6;hb=1200ee837aedee95d9aad6730acde8e19d60bebe;hp=7bab324f9b7734c969760aef2c8589d41a22f21c;hpb=eae50232e73fca26d6f631c8177cbea649e5036e;p=euphorik.git diff --git a/js/euphorik.js b/js/euphorik.js index 7bab324..929a35c 100755 --- a/js/euphorik.js +++ b/js/euphorik.js @@ -437,7 +437,7 @@ Client.prototype.resetDonneesPersonnelles = function() Client.prototype.setCss = function(css) { - if (this.css == css) + if (this.css == css || css == "") return this.css = css @@ -681,8 +681,10 @@ Client.prototype.deconnexion = function() Client.prototype.chargerDonnees = function(data) { - var thisClient = this - + // la modification du statut qui suit met à jour le menu, le menu dépend (page admin) + // de l'état ekMaster + this.ekMaster = data["ek_master"] != undefined ? data["ek_master"] : false + this.setStatut(data["status"]) if (this.authentifie()) @@ -693,22 +695,14 @@ Client.prototype.chargerDonnees = function(data) this.login = data["login"] this.pseudo = data["nick"] this.email = data["email"] - this.css = data["css"] + this.setCss(data["css"]) this.nickFormat = data["nick_format"] // la page de la conversation principale this.pagePrincipale = data["main_page"] == undefined ? 1 : data["main_page"] - // met à jour la css - if (this.css != "") - { - $("link#cssPrincipale").attr("href", this.css) - this.majMenu() - } // les conversations - thisClient.conversations = data["conversations"] - - thisClient.ekMaster = data["ek_master"] + this.conversations = data["conversations"] } this.dernierMessageErreur = data["error_message"] } @@ -748,8 +742,12 @@ Client.prototype.flush = function(async) Client.prototype.majMenu = function() { + // TODO : à virer : ne plus changer de style de display ... spa beau .. ou trouver une autre méthode var displayType = this.css == "css/3/euphorik.css" ? "block" : "inline" //this.client + alert(this.ekMaster) + $("#menu .admin").css("display", this.ekMaster ? "inline" : "none") + // met à jour le menu if (this.statut == statutType.auth_registered) { @@ -772,7 +770,7 @@ Client.prototype.majMenu = function() } -Client.prototype.slap = function(userId) +Client.prototype.slap = function(userId, raison) { var thisClient = this @@ -784,7 +782,8 @@ Client.prototype.slap = function(userId) { "action" : "slap", "cookie" : thisClient.cookie, - "user_id" : userId + "user_id" : userId, + "reason" : raison }), success: function(data) @@ -796,7 +795,7 @@ Client.prototype.slap = function(userId) } -Client.prototype.ban = function(userId, minutes) +Client.prototype.ban = function(userId, raison, minutes) { var thisClient = this @@ -813,7 +812,8 @@ Client.prototype.ban = function(userId, minutes) "action" : "ban", "cookie" : thisClient.cookie, "duration" : minutes, - "user_id" : userId + "user_id" : userId, + "reason" : raison }), success: function(data) @@ -824,9 +824,9 @@ Client.prototype.ban = function(userId, minutes) }) } -Client.prototype.kick = function(userId) +Client.prototype.kick = function(userId, raison) { - this.ban(userId, 15) + this.ban(userId, raison, 15) } /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -862,6 +862,7 @@ $(document).ready( $(window).unload(function(){client.flush(false)}) $("#menu .minichat").click(function(){ pages.afficherPage("minichat") }) + $("#menu .admin").click(function(){ pages.afficherPage("admin") }) $("#menu .profile").click(function(){ pages.afficherPage("profile") }) $("#menu .logout").click(function(){ util.messageDialogue("Êtes-vous sur de vouloir vous délogger ?", messageType.question, @@ -878,6 +879,7 @@ $(document).ready( $("#menu .about").click(function(){ pages.afficherPage("about") }) pages.ajouterPage(new PageMinichat(client, formateur, util)) + pages.ajouterPage(new PageAdmin(client, formateur, util)) pages.ajouterPage(new PageProfile(client, formateur, util)) pages.ajouterPage(new PageRegister(client, formateur, util)) pages.ajouterPage(new PageAbout(client, formateur, util))