select/unselect of a chat row added
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Wed, 3 Jul 2013 17:19:04 +0000 (19:19 +0200)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Wed, 3 Jul 2013 17:19:04 +0000 (19:19 +0200)
TODO.txt
web/commons.js
web/moderation.css
web/moderation.php

index a239aff..ab66395 100644 (file)
--- 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
index 5e98d05..793ff4e 100644 (file)
@@ -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)
index f201ed3..6a2e905 100644 (file)
@@ -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
index 50f320a..bfd12be 100644 (file)
@@ -6,6 +6,7 @@ require_once($G_base."Obj/brisk.phh");
 <html>
 <head>
 <title>Moderation</title>
+<link rel="stylesheet" type="text/css" href="moderation.css">
 <script type="text/javascript"><!--
 window.is_loaded = false;
 
@@ -40,19 +41,17 @@ window.onbeforeunload = function() {
     </div>
     <div>
     <table>
-    <tr><th>Room</th><th>Tavolo</th></tr>
-    <tr>
-    <td><input type="checkbox" name="showroom" onclick="showroom_update(this);">Show room<td>
-    <td><select name="onlytable" onchange="onlytable_update(this);">
-    <option selected>Tutti</option>
+    <tr><td>mostra room <input type="checkbox" name="showroom" onclick="showroom_update(this);"></td>
+    <td>tavolo: <select name="onlytable" onchange="onlytable_update(this);">
+    <option selected>tutti</option>
     <?php
 
     for ($i = 0 ; $i < TABLES_N ; $i++) {
         printf("<option>%d</option>", $i);
     }
     ?>
-    </select></td>
-    </tr>
+    </select>
+    </td></tr>
     </table>
     </div>
     </div>