From 4f47e5eff24ed42d837878132b2bc15b240211eb Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Wed, 3 Jul 2013 19:19:04 +0200 Subject: [PATCH] select/unselect of a chat row added --- TODO.txt | 10 ++++++---- web/commons.js | 35 ++++++++++++++++++++++++++++++++--- web/moderation.css | 22 +++++++--------------- web/moderation.php | 13 ++++++------- 4 files changed, 51 insertions(+), 29 deletions(-) diff --git a/TODO.txt b/TODO.txt index a239aff..ab66395 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,10 +1,12 @@ TODO | ------+ Moderation features: -* Lista righe di chat -* Richiesta di verifica -* Ban per nick/sessione/IP -* Filtra per tavolo e/o room + * Select row + * Lista righe di chat + * Richiesta di verifica + * Ban per nick/sessione/IP + * Filtra per tavolo e/o room + * Silent cancer behaviour management - moderation diff --git a/web/commons.js b/web/commons.js index 5e98d05..793ff4e 100644 --- a/web/commons.js +++ b/web/commons.js @@ -459,6 +459,7 @@ function act_logout(exitlock) function ModerateItem(item_ar) { var tr, td, date; + this.time = item_ar[0]; this.usrid = item_ar[1]; this.where = item_ar[2]; @@ -502,9 +503,21 @@ ModerateItem.prototype = { cont: "", tr: null, + sel: false, tr_get: function () { return this.tr; + }, + + sel_get: function () { + return this.sel; + }, + + sel_set: function (v) { + if (this.sel != v) { + this.sel = v; + this.tr.className = (v ? 'selected' : 'normal'); + } } } @@ -593,16 +606,32 @@ Moderate.prototype = { is_enabled: function() { return (this.enabled); }, + add: function(item) { var mi; mi = new ModerateItem(item); - this.item.push(mi); + mi.tr.className = 'normal'; + + var self; + self = this; + mi.tr.onclick = function () { self.row_select(mi); }; + this.item.push(mi); this.table.appendChild(mi.tr_get()); - } - // send_mesg("moderate|"+(enable ? "false" | "true")); + }, + row_select: function(mi) { + for (idx in this.item) { + if (this.item[idx] == mi) { + this.item[idx].sel_set(!this.item[idx].sel_get()); + } + else { + this.item[idx].sel_set(false); + } + } + // mi.tr.className = "selected"; + } } function moderate(enable) diff --git a/web/moderation.css b/web/moderation.css index f201ed3..6a2e905 100644 --- a/web/moderation.css +++ b/web/moderation.css @@ -1,17 +1,9 @@ -div.moder_tabanc { - height: 100px; - background-color: #ffaaaa; - overflow: auto; +tr.normal { + background-color: white; + cursor: pointer; } -div.moder_tabanc table { - width: 100%; - border: 1px solid red; - border-collapse: collapse; - border-spacing: 0px; - padding: 0px; -} - -div.moder_tabanc td { - border: 1px solid green; -} +tr.selected { + background-color: orange; + cursor: pointer; +} \ No newline at end of file diff --git a/web/moderation.php b/web/moderation.php index 50f320a..bfd12be 100644 --- a/web/moderation.php +++ b/web/moderation.php @@ -6,6 +6,7 @@ require_once($G_base."Obj/brisk.phh"); Moderation +