X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;ds=sidebyside;f=js%2FpageAdmin.js;h=2373cab9f5f6f95564544a6105d6bf39373bc844;hb=17c57646c92608dbb2421e224f8cf55f4a0f55cb;hp=d7d735a5de5fc3a719b292ec6103e3b24b02d252;hpb=cd30bb86848bd5b52c46b8a0ff40cea6398de60e;p=euphorik.git
diff --git a/js/pageAdmin.js b/js/pageAdmin.js
index d7d735a..2373cab 100644
--- a/js/pageAdmin.js
+++ b/js/pageAdmin.js
@@ -1,4 +1,20 @@
-// coding: utf-8
+// coding: utf-8
+// Copyright 2008 Grégory Burri
+//
+// This file is part of Euphorik.
+//
+// Euphorik is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Euphorik is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Euphorik. If not, see
Un troll est un sujet à débat, en général une question.
\ +Un troll est un sujet à débat, en général une question, affiché sur la page principale.
\Chaque semaine un troll est choisit au hasard parmis les trolls proposés et devient le troll de la semaine.
\ ' + ) + $("form input.content").focus() + + var virerLeFormulaire = function() + { + $('form', troll).remove() + $('span', troll).css("display", "inline") + } + $("span.modifier", troll).click( + function() + { + var content = $("form input.content", troll).val() + virerLeFormulaire() + thisTrolls.modifier(id, content) + } + ) + $("span.annuler", troll).click( virerLeFormulaire ) + $("form", troll).submit(function(){ return false}) + } + ) + } + ) + + if (data["trolls"].length > 0) + thisTrolls.dernierTroll = data["trolls"][data["trolls"].length - 1]["troll_id"] +} + +Trolls.prototype.modifierTrollEvent = function(data) +{ + var thisTrolls = this + $("#trolls #troll" + data["troll_id"] + " .content").html(thisTrolls.formateur.traitementComplet(data["content"], thisTrolls.trolls[data["troll_id"]].author)) + $("#trolls #troll" + data["troll_id"] + " a[@rel*=lightbox]").lightBox() + thisTrolls.trolls[data["troll_id"]].content = data["content"] +} + +Trolls.prototype.supprimerTrollEvent = function(data) +{ + $("#trolls #troll"+data["troll_id"]).remove() +} Trolls.prototype.modifier = function(id, content) { @@ -242,110 +455,3 @@ Trolls.prototype.supprimer = function(id) } ) } - -Trolls.prototype.rafraichirTrolls = function() -{ - var thisTrolls = this - - this.pageEvent.waitEvent( - function() { return { "last_troll" : thisTrolls.dernierTroll }}, - function(data) - { - switch (data["reply"]) - { - case "troll_added" : - var XHTML = "" - for (var i = 0; i < data["trolls"].length; i++) - { - var troll = new Troll(data["trolls"][i]["content"], data["trolls"][i]["author"]) - var trollId = data["trolls"][i]["troll_id"] - thisTrolls.trolls[trollId] = troll - - XHTML += - '