- ;;; dumpObj(dataToSend)
- jQuery.ajax(
- {
- type: "POST",
- url: "request",
- dataType: "json",
- data: this.util.jsonVersAction(dataToSend),
- success:
- function(data)
- {
- ;;; dumpObj(data)
-
- if (data["reply"] == "ok")
- {
- $("#page form#nouveauTroll input.troll").val("")
- }
- else if (data["reply"] == "error")
- {
- thisPageAdmin.util.messageDialogue(data["error_message"])
+/**
+ * Met à jour la liste des IP bannies.
+ */
+euphorik.PageAdmin.prototype.majIPs = function() {
+ if (this.timeoutIDmajIPs) {
+ clearTimeout(this.timeoutIDmajIPs);
+ }
+
+ var thisPageAdmin = this;
+
+ this.communication.requete(
+ "list_banned_ips",
+ {"cookie" : this.client.cookie},
+ function(data) {
+ var XHTML = "";
+ data.list.each(function(i, ip) {
+ XHTML += '<div class="ban"><span class="ip">' + ip.ip + '</span>|' +
+ '<span class="temps">' +
+ ip.remaining_time +
+ '</span>|';
+ ip.users.each(function(j, user) {
+ XHTML += (j > 0 ? ", " : "") +
+ '<span class="nick">' + thisPageAdmin.formater.completeProcessing(user.nick) + '</span>' +
+ (user.login === "" ? "" : '<span class="login">(' + thisPageAdmin.formater.completeProcessing(user.login) + ')</span>');
+ });
+ XHTML += '<span class="deban">débannir</span></div>';
+ });
+
+ if (data.list.length === 0) {
+ XHTML += '<p>Aucune IP bannie</p>';
+ }
+
+ $("#ips").html(XHTML);
+
+ $(".ban").each(function() {
+ var ip = $(".ip", this).html();
+ $(".deban", this).click(
+ function() {
+ thisPageAdmin.util.messageDialog("Êtes-vous sur de vouloir débannir l'IP ''" + ip + "'' ?", euphorik.Util.messageType.question,
+ {"Oui" : function() {
+ thisPageAdmin.deban(ip);
+ },
+ "Non" : function(){}
+ }
+ );