ADD trolls, fin coté serveur et début coté client
[euphorik.git] / js / euphorik.js
index 7bab324..b36fbbb 100755 (executable)
@@ -748,8 +748,11 @@ 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
 
+   $("#menu .admin").css("display", this.ekMaster ? "none" : "inline")
+
    // met à jour le menu   
    if (this.statut == statutType.auth_registered)
    {
@@ -772,7 +775,7 @@ Client.prototype.majMenu = function()
 }
 
 
-Client.prototype.slap = function(userId)
+Client.prototype.slap = function(userId, raison)
 {
    var thisClient = this
    
@@ -784,7 +787,8 @@ Client.prototype.slap = function(userId)
          {
             "action" : "slap",
             "cookie" : thisClient.cookie,
-            "user_id" : userId
+            "user_id" : userId,
+            "reason" : raison
          }),
       success: 
          function(data)
@@ -796,7 +800,7 @@ Client.prototype.slap = function(userId)
 }
 
 
-Client.prototype.ban = function(userId, minutes)
+Client.prototype.ban = function(userId, raison, minutes)
 {
    var thisClient = this
 
@@ -813,7 +817,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 +829,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 +867,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") })\r
       $("#menu .logout").click(function(){
          util.messageDialogue("Êtes-vous sur de vouloir vous délogger ?", messageType.question,
@@ -878,6 +884,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))