-var statutType = {enregistre: 0, identifie: 1, non_identifie: 2}
-\r
-function Client(util)\r
-{
- this.util = util
- \r
- this.cookie = null
- this.regexCookie = new RegExp("^cookie=([^;]*)")
- \r
- // Obsolète
- //this.captchaCrypt = null
-
- // données personnels\r
- this.resetDonneesPersonnelles()
-
- this.setStatut(statutType.non_identifie)
-
- // le dernier message d'erreur recut du serveur (par exemple une connexion foireuse : "login impossible")
- this.dernierMessageErreur = ""\r
-}
-\r
-Client.prototype.resetDonneesPersonnelles = function()\r
-{\r
- this.pseudo = conf.pseudoDefaut\r
- this.login = ""\r
- this.password = ""\r
- this.email = ""\r
- this.css = jQuery("link#cssPrincipale").attr("href")\r
-}
-
-Client.prototype.setCss = function(css)
-{
- if (this.css == css)
- return
-
- this.css = css
- jQuery("link#cssPrincipale").attr("href", this.css)
- this.majMenu()
-
- /* enregistement automatique..
- if (!this.identifie())
- if (!this.enregistrement())
- return
- */
- if (this.identifie())
- this.flush()
-}\r
-
-Client.prototype.getXMLlogin = function(login, password)
-{
- var XMLDocument = this.util.creerDocumentXMLAction()
- XMLDocument.documentElement.setAttribute("name", "login")
-
- var nodeLogin = XMLDocument.createElement("login")
- nodeLogin.appendChild(XMLDocument.createTextNode(login))
- XMLDocument.documentElement.appendChild(nodeLogin)
-
- var nodePassword = XMLDocument.createElement("password")
- nodePassword.appendChild(XMLDocument.createTextNode(password))
- XMLDocument.documentElement.appendChild(nodePassword)
-
- return XMLDocument
-}
-
-Client.prototype.getXMLloginCookie = function()
-{
- var XMLDocument = this.util.creerDocumentXMLAction()
- XMLDocument.documentElement.setAttribute("name", "login")
-
- var nodeCookie = XMLDocument.createElement("cookie")
- nodeCookie.appendChild(XMLDocument.createTextNode(this.cookie))
- XMLDocument.documentElement.appendChild(nodeCookie)
-
- return XMLDocument
-}
-\r
-/* Obsolète
-Client.prototype.getXMLloginCaptcha = function(captchaCrypt, captchaInput)
-{
- var XMLDocument = this.util.creerDocumentXMLAction()
- XMLDocument.documentElement.setAttribute("name", "loginCaptcha")
-
- var nodecaptchaCrypt = XMLDocument.createElement("captchaCrypt")
- nodecaptchaCrypt.appendChild(XMLDocument.createTextNode(captchaCrypt))
- XMLDocument.documentElement.appendChild(nodecaptchaCrypt)
-
- var nodecaptchaInput = XMLDocument.createElement("captchaInput")
- nodecaptchaInput.appendChild(XMLDocument.createTextNode(captchaInput))
- XMLDocument.documentElement.appendChild(nodecaptchaInput)
-
- return XMLDocument
-}*/
-\r
-/* Obsolète
-Client.prototype.getXMLgenerationCaptcha = function()
-{
- var XMLDocument = this.util.creerDocumentXMLAction()
- XMLDocument.documentElement.setAttribute("name", "generationCaptcha")
-
- return XMLDocument
-}*/
-
-Client.prototype.getXMLEnregistrement = function(login, password)
-{
- var XMLDocument = this.util.creerDocumentXMLAction()
- XMLDocument.documentElement.setAttribute("name", "register")
-
- var nodeLogin = XMLDocument.createElement("login")
- nodeLogin.appendChild(XMLDocument.createTextNode(login))
- XMLDocument.documentElement.appendChild(nodeLogin)
-
- var nodePassword = XMLDocument.createElement("password")
- nodePassword.appendChild(XMLDocument.createTextNode(password))
- XMLDocument.documentElement.appendChild(nodePassword)
-
- return XMLDocument
-}
-
-Client.prototype.getXMLProfile = function()
-{
- var XMLDocument = this.util.creerDocumentXMLAction()
- XMLDocument.documentElement.setAttribute("name", "profile")
-
- var nodeCookie = XMLDocument.createElement("cookie")
- nodeCookie.appendChild(XMLDocument.createTextNode(this.cookie))
- XMLDocument.documentElement.appendChild(nodeCookie)
-
- var nodeLogin = XMLDocument.createElement("login")
- nodeLogin.appendChild(XMLDocument.createTextNode(this.login))
- XMLDocument.documentElement.appendChild(nodeLogin)
-
- var nodePassword = XMLDocument.createElement("password")
- nodePassword.appendChild(XMLDocument.createTextNode(this.password))
- XMLDocument.documentElement.appendChild(nodePassword)
-
- var nodePseudo = XMLDocument.createElement("pseudo")
- nodePseudo.appendChild(XMLDocument.createTextNode(this.pseudo))
- XMLDocument.documentElement.appendChild(nodePseudo)
-
- var nodeEmail = XMLDocument.createElement("email")
- nodeEmail.appendChild(XMLDocument.createTextNode(this.email))
- XMLDocument.documentElement.appendChild(nodeEmail)
-
- var nodeCSS = XMLDocument.createElement("css")
- nodeCSS.appendChild(XMLDocument.createTextNode(this.css))
- XMLDocument.documentElement.appendChild(nodeCSS)
-
- return XMLDocument
-}
-
-/**
- * Renvoie null si pas définit.
- */
-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