3 function PageAdmin(client
, formateur
, util
)
8 this.formateur
= formateur
12 PageAdmin
.prototype.contenu = function()
14 return '<h1>Trolls</h1>\
15 <form id="nouveauTroll"><p>Nouveau troll\
16 <input class="troll" name="troll" type="text" size="80" maxlength="500" value=""></input>\
17 <button class="return" value="return">poster</button>\
18 </p></form><div id="trolls"></div>'
21 PageAdmin
.prototype.charger = function()
23 $("#page form#nouveauTroll").submit(function(){return false})
27 this.trolls
= new Trolls(this.util
)
28 this.trolls
.rafraichirTrolls()
30 $("#page form#nouveauTroll button.return").click(
37 PageAdmin
.prototype.decharger = function()
39 this.trolls
.pageEvent
.stopAttenteCourante()
43 ///////////////////////////////////////////////////////////////////////////////////////////////////
49 this.pageEvent
= new PageEvent("admin", this.util
)
52 Trolls
.prototype.rafraichirTrolls = function()
56 this.pageEvent
.waitEvent(
57 function() { return { "last_troll" : thisTrolls
.dernierTroll
}},
60 switch (data
["reply"]) {
63 for (var i
= 0; i
< data
["trolls"].length
; i
++)
65 thisTrolls
.dernierTroll
= data
["trolls"][i
]["troll_id"]
66 XHTML
+= '<p id="troll' + data
["trolls"][i
]["troll_id"] + '">' + data
["trolls"][i
]["content"] + '</p>'
68 $("#trolls").append(XHTML
)
70 case "troll_modified" :
71 $("#trolls #troll"+data
["troll_id"]).html(data
["content"])