X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=blobdiff_plain;f=js%2Feuphorik.js;h=f78e10300e460b46e6f77a955671e8d79c5db103;hp=5ce9357c9785eeb6ada2bbbe98537fc8242ebe97;hb=ccb7fdfe9914f47cc38f96e5973851f2c6f0c4b6;hpb=ffea71492c07cbf81430883c894b34e1c9408699 diff --git a/js/euphorik.js b/js/euphorik.js index 5ce9357..f78e103 100755 --- a/js/euphorik.js +++ b/js/euphorik.js @@ -154,6 +154,15 @@ Util.prototype.xmlVersAction = function(xml) //return {action: this.to_utf8(this.serializeXML(xml /*, "UTF-8"*/))} return {action: this.serializeXML(xml)} } + +/** + * Utilisé pour l'envoie de donnée avec la méthode ajax de jQuery. + */ +Util.prototype.jsonVersAction = function(json) +{ + // FIXME : ne plus encapsuler json dans de l'xml (problème avec yaws) + return {action: "" + JSON.stringify(json) + "" } +} Util.prototype.md5 = function(chaine) { @@ -538,6 +547,15 @@ Client.prototype.getXMLlogin = function(login, password) return XMLDocument } +Client.prototype.getJSONLogin = function(login, password) +{ + return { + "action" : "authentification", + "login" : login, + "password" : password + } +} + Client.prototype.getXMLloginCookie = function() { var XMLDocument = this.util.creerDocumentXMLAction() @@ -681,7 +699,8 @@ Client.prototype.connexionCookie = function() Client.prototype.connexionLogin = function(login, password) { - return this.connexion(this.util.xmlVersAction(this.getXMLlogin(login, password))) + // return this.connexion(this.util.xmlVersAction(this.getXMLlogin(login, password))) + return this.connexion(this.util.jsonVersAction(this.getJSONLogin(login, password))) } Client.prototype.enregistrement = function(login, password) @@ -704,20 +723,21 @@ Client.prototype.enregistrement = function(login, password) Client.prototype.connexion = function(action) { - //action.action.dump() + action.action.dump("Connexion client") thisClient = this jQuery.ajax( { async: false, type: "POST", url: "request", - dataType: "xml", + dataType: "json", data: action, success: function(data) { + //alert(data["error_message"]) //thisClient.util.serializer.serializeToString(data).dump("Charger client") - thisClient.chargerDonnees(data) + //thisClient.chargerDonnees(data) } } ) @@ -779,7 +799,7 @@ Client.prototype.flush = function(async) async = true thisClient = this - //this.util.xmlVersAction(this.getXMLProfile()).action.dump("Flush client") + this.util.xmlVersAction(this.getXMLProfile()).action.dump("Flush client") jQuery.ajax( { async: async,