-Client.prototype.getCookie = function()
-{
- var cookie = this.regexCookie.exec(document.cookie)
- if (cookie == null) this.cookie = null
- else this.cookie = cookie[1]
-}\r
-\r
-Client.prototype.delCookie = function()\r
-{\r
- document.cookie = "cookie=; max-age=0"\r
-}
-
-Client.prototype.setCookie = function(cookie)
-{
- if (this.cookie == null)
- return
-
- document.cookie =
- "cookie="+this.cookie+
- "; max-age=" + (60 * 60 * 24 * 365)
-}
-
-Client.prototype.identifie = function()
-{
- return this.statut == statutType.enregistre || this.statut == statutType.identifie
-}
-
-Client.prototype.setStatut = function(statut)
-{ \r
- if(typeof(statut) == "string")\r
- {
- statut =
- statut == "enregistre" ?
- statutType.enregistre : (statut == "identifie" ? statutType.identifie : statutType.non_identifie) \r
- } \r
- \r
- if (statut == this.statut) return \r
- \r
- this.statut = statut \r
- this.majMenu()
-}\r
-
-/**
- * Demande la génération d'un captcha au serveur et l'affiche.
- */\r
- /* Obsolète
-Client.prototype.afficherCaptcha = function(query)
-{
- var thisClient = this
-
- $.post("request", this.util.xmlVersAction(this.getXMLgenerationCaptcha()),
- function(data, textStatus)
- {
- var chemin = jQuery("chemin", data.documentElement).text()
- thisClient.captchaCrypt = jQuery("captchaCrypt", data.documentElement).text()
- jQuery(query).prepend(
- "<p id=\"captcha\" >Es-tu un bot ? <img class=\"captchaImg\" src=\"" + chemin + "\" />" +
- "<input name=\"captchaInput\" type=\"text\" size=\"5\" max_length=\"5\" ></p>"
- )
- }
- )
-}
-
-Client.prototype.cacherCaptcha = function()
-{
- jQuery("#captcha").remove()
-}*/
-\r
-/**\r
- * Effectue la connexion vers le serveur.\r
- * Cette fonction est bloquante tant que la connexion n'a pas été établie.\r
- * S'il existe un cookie en local on s'authentifie directement avec lui.\r
- * Si il n'est pas possible de s'authentifier alors on affiche un captcha anti-bot.\r
- */\r
-Client.prototype.connexionCookie = function()\r
-{\r
- this.getCookie()\r
- if (this.cookie == null) return false;
- return this.connexion(this.util.xmlVersAction(this.getXMLloginCookie()))\r
-}
-
-Client.prototype.connexionLogin = function(login, password)
-{
- return this.connexion(this.util.xmlVersAction(this.getXMLlogin(login, password)))
-}
-\r
-/* Obsolète\r
-Client.prototype.connexionCaptcha = function()
-{
- return this.connexion(this.util.xmlVersAction(this.getXMLloginCaptcha(this.captchaCrypt, jQuery("#captcha input").val())))
-}*/
-
-Client.prototype.enregistrement = function(login, password)
-{
- if (this.identifie())
- {
- this.login = login
- this.password = password
- if(this.flush())
- this.setStatut(statutType.enregistre)
- return true
- }
- else\r
- {\r
- if (login == undefined) login = ""\r
- if (password == undefined) password = ""
- return this.connexion(this.util.xmlVersAction(this.getXMLEnregistrement(login, password)))\r
- }
-}
-
-Client.prototype.connexion = function(action)
-{
- thisClient = this
- jQuery.ajax(
- {
- async: false,
- type: "POST",
- url: "request",
- dataType: "xml",
- data: action,
- success:
- function(data)
- {
- thisClient.chargerDonnees(data)
- }
- }
- )
- return this.identifie()
-}\r
-\r
-Client.prototype.deconnexion = function()\r
-{\r
- this.setStatut(statutType.non_identifie) // deconnexion\r
- this.resetDonneesPersonnelles()\r
- this.delCookie ()\r
-}
-
-Client.prototype.chargerDonnees = function(data)
-{
- this.setStatut(jQuery("statut", data.documentElement).text())
-
- if (this.identifie())
- {
- this.cookie = jQuery("cookie", data.documentElement).text()
- this.setCookie()
- \r
- this.login = jQuery("login", data.documentElement).text()
- this.pseudo = jQuery("pseudo", data.documentElement).text()\r
- this.email = jQuery("email", data.documentElement).text()\r
- this.css = jQuery("css", data.documentElement).text()
- // met à jour la css
- if (this.css != "")
- {
- jQuery("link#cssPrincipale").attr("href", this.css)
- this.majMenu()
- }