ADD avancement sur la page admin : listage des ips bannis (presque fini)
[euphorik.git] / js / euphorik.js
index 4b56fa3..a19d33e 100755 (executable)
@@ -13,7 +13,7 @@
   * Normalement 'const' à la place de 'var' mais non supporté par IE7.
   */\r
 var conf = {\r
-   nbMessageAffiche : 10, // (par page)
+   nbMessageAffiche : 40, // (par page)
    pseudoDefaut : "<nick>",\r
    tempsAffichageMessageDialogue : 4000, // en ms\r
    smiles : {   \r
@@ -277,7 +277,7 @@ Formateur.prototype.getSmilesHTML = function()
    var XHTML = ""\r
    for (var sNom in this.smiles)\r
    {\r
-      XHTML += "<img class=\"" + sNom + "\" src=\"img/smileys/" + sNom + ".gif\" />"\r
+      XHTML += "<img class=\"" + sNom + "\" src=\"img/smileys/" + sNom + ".gif\" alt =\"" + sNom + "\" />"\r
    }\r
    return XHTML\r
 }\r
@@ -311,7 +311,7 @@ Formateur.prototype.traiterLiensConv = function(M)
 \r
 /**\r
   * FIXME : Cette méthode est attrocement lourde ! A optimiser.
-  * moyenne su échantillon : 234ms\r
+  * moyenne sur échantillon : 234ms\r
   */
 Formateur.prototype.traiterSmiles = function(M)
 {  
@@ -319,7 +319,7 @@ Formateur.prototype.traiterSmiles = function(M)
    {
       ss = this.smiles[sNom]
       for (var i = 0; i < ss.length; i++)       
-         M = M.replace(ss[i], "<img src=\"img/smileys/" + sNom + ".gif\" />")
+         M = M.replace(ss[i], "<img src=\"img/smileys/" + sNom + ".gif\" alt =\"" + sNom + "\"  />")
    }
    return M
 }
@@ -384,7 +384,7 @@ Formateur.prototype.traiterPourFenetreLightBox = function(M, urlCourante)
    thisFormateur = this
    var traitementUrl = function(url)
    {
-      return "[" + thisFormateur.getShort(url)[0] + (urlCourante == url ? ": image courante" : "") + "]"
+      return "[" + thisFormateur.getShort(url)[0] + (urlCourante == url ? "*" : "") + "]"
    }
    \r
    return this.remplacerBalisesHTML(M).replace(this.regexUrl, traitementUrl)
@@ -413,10 +413,7 @@ function Client(util)
    // données personnels\r
    this.resetDonneesPersonnelles()
    
-   this.setStatut(statutType.deconnected)
-   
-   // le dernier message d'erreur recut du serveur (par exemple une connexion foireuse : "login impossible")
-   this.dernierMessageErreur = ""\r
+   this.setStatut(statutType.deconnected)\r
 }
 \r
 Client.prototype.resetDonneesPersonnelles = function()\r
@@ -428,6 +425,7 @@ Client.prototype.resetDonneesPersonnelles = function()
    this.email = ""\r
    this.css = $("link#cssPrincipale").attr("href")
    this.nickFormat = "nick"
+   this.cookie = undefined
    
    this.pagePrincipale = 1
    this.ekMaster = false
@@ -611,7 +609,7 @@ Client.prototype.setStatut = function(statut)
          (statut == "auth_not_registered" ? statutType.auth_not_registered : statutType.deconnected)\r
    }   \r
    \r
-   if (statut == this.statut) return   \r
+   if (statut == this.statut) return\r
    \r
    this.statut = statut   \r
    this.majMenu()
@@ -669,7 +667,10 @@ Client.prototype.connexion = function(messageJson)
             function(data)
             {
                ;;; dumpObj(data)
-               thisClient.chargerDonnees(data)
+               if (data["reply"] == "error")
+                  thisClient.util.messageDialogue(data["error_message"])
+               else
+                  thisClient.chargerDonnees(data)
             }
       }
    )
@@ -679,9 +680,9 @@ Client.prototype.connexion = function(messageJson)
 Client.prototype.deconnexion = function()\r
 {
    this.flush(true)
-   this.delCookie()\r
-   this.setStatut(statutType.deconnected) // deconnexion\r
+   this.delCookie()
    this.resetDonneesPersonnelles()\r
+   this.setStatut(statutType.deconnected) // deconnexion\r
 }
 
 Client.prototype.chargerDonnees = function(data)
@@ -710,7 +711,6 @@ Client.prototype.chargerDonnees = function(data)
       // les conversations
       this.conversations = data["conversations"]
    }
-   this.dernierMessageErreur = data["error_message"]
 }
 
 /**
@@ -726,7 +726,7 @@ Client.prototype.flush = function(async)
    if (!this.authentifie())
       return false
 
-   thisClient = this
+   var thisClient = this
    var ok = true
    
    ;;; dumpObj(this.getJSONProfile())
@@ -743,7 +743,7 @@ Client.prototype.flush = function(async)
                ;;; dumpObj(data)
                if (data["reply"] == "error")
                {
-                  thisClient.dernierMessageErreur = data["error_message"]
+                  thisClient.util.messageDialogue(data["error_message"])
                   ok = false
                }
             }
@@ -756,9 +756,10 @@ 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
+   // var displayType = this.css == "css/3/euphorik.css" ? "block" : "inline" //this.client
+   displayType = "block"
 
-   $("#menu .admin").css("display", this.ekMaster ? "inline" : "none")
+   $("#menu .admin").css("display", this.ekMaster ? displayType : "none")
 
    // met à jour le menu   
    if (this.statut == statutType.auth_registered)
@@ -904,7 +905,7 @@ PageEvent.prototype.waitEvent = function(funSend, funReceive)
       error:
          function(XMLHttpRequest, textStatus, errorThrown)
          {
-            setTimeout(function(){ thisPageEvent.rafraichirMessages(funSend, funReceive) }, 1000);
+            setTimeout(function(){ thisPageEvent.waitEvent(funSend, funReceive) }, 1000);
          }
    })
 
@@ -939,7 +940,8 @@ $(document).ready(
       
       initialiserListeStyles(client)
 
-      // TODO : pourquoi $(document).unload ne fonctionne pas ?
+      // FIXME : ne fonctionne pas sous opera
+      // voir : http://dev.jquery.com/ticket/2892#preview
       $(window).unload(function(){client.flush()})
       
       $("#menu .minichat").click(function(){ pages.afficherPage("minichat") })