2 // Copyright 2008 Grégory Burri
4 // This file is part of Euphorik.
6 // Euphorik is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
11 // Euphorik is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with Euphorik. If not, see <http://www.gnu.org/licenses/>.
19 function PageProfile(client
, formateur
, util
)
24 this.formateur
= formateur
28 PageProfile
.prototype.contenu = function()
34 PageProfile
.prototype.charger = function()
36 $("#page").html(this.getHTML())
38 // en fonction du statut
39 if (this.client
.authentifie())
44 $("#page form#profile").submit(function(){return false})
47 PageProfile
.prototype.chargerProfile = function()
51 $("form#profile input.login").val(this.client
.login
)
52 $("form#profile input.pseudo").val(this.client
.pseudo
)
53 $("form#profile input.email").val(this.client
.email
)
54 $("form#profile input#viewTooltips").attr("checked", this.client
.viewTooltips
)
55 $("form#profile input#viewTimes").attr("checked", this.client
.viewTimes
)
57 $("form#profile select#chatOrder option").removeAttr("selected")
58 $("form#profile select#chatOrder option[value=" + this.client
.chatOrder
+ "]").attr("selected", "selected")
60 $("form#profile select#affichagePseudo option").removeAttr("selected")
61 $("form#profile select#affichagePseudo option[value=" + this.client
.nickFormat
+ "]").attr("selected", "selected")
63 if (this.client
.ostentatiousMaster
)
65 $("form#profile select#degreeOstentatoire option").removeAttr("selected")
66 $("form#profile select#degreeOstentatoire option[value=" + this.client
.ostentatiousMaster
+ "]").attr("selected", "selected")
69 $("form#profile button").click(
72 thisPage
.client
.pseudo
= thisPage
.formateur
.filtrerInputPseudo($("form#profile input.pseudo").val())
73 thisPage
.client
.email
= $("form#profile input.email").val()
74 thisPage
.client
.chatOrder
= $("form#profile select#chatOrder option:selected").attr("value")
75 thisPage
.client
.nickFormat
= $("form#profile select#affichagePseudo option:selected").attr("value")
76 if (thisPage
.client
.ekMaster
)
77 thisPage
.client
.ostentatiousMaster
= $("form#profile select#degreeOstentatoire option:selected").attr("value")
78 thisPage
.client
.viewTooltips
= $("form#profile input#viewTooltips").attr("checked")
79 thisPage
.client
.viewTimes
= $("form#profile input#viewTimes").attr("checked")
81 var password
= $("form#profile input.password").val()
82 var passwordRe
= $("form#profile input.passwordRe").val()
83 if (password
!= "" || passwordRe
!= "")
85 if (password
!= passwordRe
)
87 thisPage
.util
.messageDialogue("Les mots de passes ne correspondent pas")
90 thisPage
.client
.password
= thisPage
.util
.md5(password
)
93 if(!thisPage
.client
.flush())
94 thisPage
.util
.messageDialogue("Impossible de mettre à jour votre profile, causes inconnues", messageType
.erreur
)
97 thisPage
.util
.messageDialogue("Votre profile a été mis à jour")
98 thisPage
.pages
.afficherPage("minichat")
104 PageProfile
.prototype.chargerLogin = function()
108 $("#page form#profile button").click(
111 if(thisPage
.client
.connexionLogin($("form#profile input.login").val(), thisPage
.util
.md5($("form#profile input.password").val())))
113 // TODO afficher un message "ok"
114 thisPage
.pages
.afficherPage("minichat")
120 PageProfile
.prototype.getHTML = function()
123 <form action="" id="profile" >\
127 <td><input class="login" type="text" size="20" maxlength="20" ' + (this.client
.authentifie() ? 'readonly="readonly"' : '') + ' /></td>\
131 <td><input class="password" type="password" size="20" maxlength="20"/></td>\
133 (this.client
.authentifie() ? '\
135 <td>password re</td>\
136 <td><input class="passwordRe" type="password" size="20" maxlength="20"/></td>\
140 <td><input class="pseudo" type="text" size="40" maxlength="20"/></td>\
144 <td><input class="email" type="text" size="40" maxlength="100"/></td>\
147 <td>Ordre des messages</td>\
149 <select id="chatOrder">\
150 <option value="chrono">Chronologique</option>\
151 <option value="reverse">Anti-chronologique</option>\
156 (this.client
.ekMaster
? '<td>Degrée d\'ostentation</td>\
158 <select id="degreeOstentatoire">\
159 <option value="invisible">Nul</option>\
160 <option value="light">Faible</option>\
161 <option value="heavy">Élevé</option>\
166 <td>Affichage des identifiants</td>\
168 <select id="affichagePseudo">\
169 <option value="nick">Pseudo</option>\
170 <option value="login">Login</option>\
171 <option value="nick_login">Pseudo(Login)</option>\
176 <td>Afficher les infos bulles</td>\
177 <td><input type="checkbox" id="viewTooltips" /></td>\
180 <td>Afficher les dates</td>\
181 <td><input type="checkbox" id="viewTimes" /></td>\
185 <td><button>Valider</button>\