FIX problème de l'encapsulation de JSON dans de l'xml. jQuery.js a été modifié.....
[euphorik.git] / js / euphorik.js
index 88ef6e7..45b3cbd 100755 (executable)
@@ -106,8 +106,7 @@ var messageType = {informatif: 0, question: 1, erreur: 2}
   */
 Util.prototype.jsonVersAction = function(json)
 {
-   // FIXME : ne plus encapsuler json dans de l'xml (problème avec yaws)
-   return {action: "<json>" + JSON.stringify(json) + "</json>" }
+   return {action : JSON.stringify(json) }
 }
 \r
 Util.prototype.md5 = function(chaine)\r
@@ -459,10 +458,10 @@ Client.prototype.ajouterConversation = function(racine)
 {
    // vérification s'il elle n'existe pas déjà
    for (var i = 0; i < this.conversations.length; i++)
-      if (this.conversations[i].racine == racine)
+      if (this.conversations[i].root == racine)
          return false
          
-   this.conversations.push({racine : racine, page : 1})
+   this.conversations.push({root : racine, page : 1})
    return true
 }
 
@@ -514,7 +513,7 @@ Client.prototype.getJSONConversations = function()
 {
    var conversations = new Array()
    for (var i = 0; i < this.conversations.length; i++)
-      conversations.push({ "racine" : this.conversations[i].racine, "page" : this.conversations[i].page})
+      conversations.push({ "root" : this.conversations[i].root, "page" : this.conversations[i].page})
    return conversations
 }
 
@@ -525,6 +524,7 @@ Client.prototype.getJSONProfile = function()
       "cookie" : this.cookie,
       "login" : this.login,
       "password" : this.password,
+      "nick" : this.pseudo,
       "email" : this.email,
       "css" : this.css,
       "main_page" : this.pagePrincipale < 1 ? 1 : this.pagePrincipale,
@@ -568,7 +568,7 @@ Client.prototype.setStatut = function(statut)
    if (typeof(statut) == "string")\r
    {
       statut =
-         statut == "registered" ?
+         statut == "auth_registered" ?
             statutType.auth_registered :
          (statut == "auth_not_registered" ? statutType.auth_not_registered : statutType.deconnected)\r
    }   \r
@@ -688,7 +688,7 @@ Client.prototype.flush = function(async)
       return false
 
    thisClient = this
-   //this.util.jsonVersAction(this.getJSONProfile()).action.dump("Flush client")      
+   ;;; dumpObj(this.getJSONProfile())
    jQuery.ajax(
       {
          async: async,
@@ -765,11 +765,12 @@ jQuery(document).ready(
          })
       }
 
-      jQuery(document).unload(
+      // TODO : pourquoi jQuery(document).unload ne fonctionne pas ?
+      jQuery(window).unload(
          function()
          {
-            alert("ok")
-            client.flush()
+            //alert("ok")
+            client.flush(false)
          }
       )