From: Matteo Nastasi (mop) Date: Tue, 9 Jul 2013 05:41:13 +0000 (+0200) Subject: moderation filtering added X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=a383231bf7777e9c296fd052c4ecc7e5ff6fdb39;p=brisk.git moderation filtering added --- diff --git a/web/commons.js b/web/commons.js index 4c0dbcf..794c9e3 100644 --- a/web/commons.js +++ b/web/commons.js @@ -503,6 +503,7 @@ ModerateItem.prototype = { cont: "", tr: null, + hide: false, sel: false, tr_get: function () { @@ -532,6 +533,9 @@ Moderate.prototype = { enabled: false, item: null, + room_show: true, + table_show: -1, + cur: -1, disable: function () { @@ -624,18 +628,82 @@ Moderate.prototype = { }, row_select: function(mi) { - for (idx in this.item) { - if (this.item[idx] == mi) { - this.item[idx].sel_set(!this.item[idx].sel_get()); + for (i = 0 ; i < this.item.length ; i++) { + if (this.item[i] == mi) { + this.item[i].sel_set(!this.item[i].sel_get()); } else { - this.item[idx].sel_set(false); + this.item[i].sel_set(false); } } // mi.tr.className = "selected"; + }, + + room_show_update: function(obj) { + this.tab_update(obj.checked, this.table_show); + }, + + // + table_show_update: function(obj) { + this.tab_update(this.room_show, obj.options[obj.selectedIndex].value ); + }, + + tab_update: function(room_new, table_new) + { + // remove all and add all valid + for (i = 0 ; i < this.item.length ; i++) { + if (this.item[i].hide) + continue; + this.table.removeChild(this.item[i].tr_get()); + this.item[i].hide = true; + } + + for (i = 0 ; i < this.item.length ; i++) { + var app = false; + + if (room_new && table_new == -1) { + app = true; + } + else if (room_new && table_new != -1) { + if (this.item[i].table == table_new || this.item[i].table == -1) { + app = true; + } + } + else if (!room_new && table_new == -1) { + if (this.item[i].table != -1) { + app = true; + } + } + else if (!room_new && table_new != -1) { + if (this.item[i].table == table_new) { + app = true; + } + } + if (app) { + this.table.appendChild(this.item[i].tr_get()); + this.item[i].hide = false; + } + } + this.room_show = room_new; + this.table_show = table_new; } } +// function AddBefore(rowId){ +// var target = document.getElementById(rowId); +// var newElement = document.createElement('tr'); +// target.parentNode.insertBefore(newElement, target); +// return newElement; +// } + +// function AddAfter(rowId){ +// var target = document.getElementById(rowId); +// var newElement = document.createElement('tr'); + +// target.parentNode.insertBefore(newElement, target.nextSibling ); +// return newElement; +// } + function moderate(enable) { return (g_moder.activate(enable)); diff --git a/web/moderation.css b/web/moderation.css index 6a2e905..ad8799b 100644 --- a/web/moderation.css +++ b/web/moderation.css @@ -1,3 +1,29 @@ +div.moder_tabanc { + height: 400px; + background-color: #ffaaaa; + overflow: auto; + vertical-align: text-bottom; +} + +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; + vertical-align: text-bottom; +} + +div.moder_cmdanc td { + border: 1px solid green; + vertical-align: text-bottom; +} + + tr.normal { background-color: white; cursor: pointer; diff --git a/web/moderation.php b/web/moderation.php index bfd12be..e2d2ade 100644 --- a/web/moderation.php +++ b/web/moderation.php @@ -10,15 +10,18 @@ require_once($G_base."Obj/brisk.phh");