moderation: first log experiment
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Wed, 29 May 2013 06:12:03 +0000 (08:12 +0200)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Wed, 29 May 2013 06:12:03 +0000 (08:12 +0200)
TODO.txt
web/Obj/brisk.phh
web/commons.js
web/index.php
web/moderation.css

index b21d918..a239aff 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -9,6 +9,7 @@ Moderation features:
 
    - moderation
      . turn off moderation when moder win is closed or if window creation fails
+     . turn off moder when logout
      . enable moderation for certified users only
      . create a mockup of the moder win
      . create js to manage moderation
index f7430b5..3a0905e 100644 (file)
@@ -1708,8 +1708,8 @@ class Room
             $user_cur->comm[$user_cur->step % COMM_N] .= $to_room; 
             
             if ($user_cur->flags_vlt_get(USER_FLAG_MODER)) {
-                $user_cur->comm[$user_cur->step % COMM_N] .= sprintf('$$(moder_win, "mainbody").innerHTML += "%s<br>";' ,
-                                                                     xcape($to_room) );
+                $user_cur->comm[$user_cur->step % COMM_N] .= sprintf('g_moder.add([111, 222, "table N", "%s", "%s"]);' ,
+                                                                     xcape($user->name), xcape($to_room) );
             }
             $user_cur->step_inc();
         }
index c2087c7..4c0ea73 100644 (file)
@@ -458,11 +458,22 @@ function act_logout(exitlock)
 
 function ModerateItem(item_ar)
 {
+    var tr, td;
     this.time  = item_ar[0];
     this.usrid = item_ar[1];
     this.where = item_ar[2];
     this.name  = item_ar[3];
     this.cont  = item_ar[4];
+
+    tr = document.createElement("tr");
+    td = document.createElement("td");
+    td.innerHTML = this.name;
+    tr.appendChild(td);
+    td = document.createElement("td");
+    td.innerHTML = this.cont;
+    tr.appendChild(td);
+
+    this.tr = tr;
 }
 
 ModerateItem.prototype = {
@@ -470,11 +481,18 @@ ModerateItem.prototype = {
     usrid: 0,
     where: -1,
     name: "",
-    cont: ""
+    cont: "",
+
+    tr: null,
+
+    tr_get: function () {
+        return this.tr;
+    }
 }
 
 function Moderate()
 {
+    this.item = new Array();
 }
 
 Moderate.prototype = {
@@ -536,18 +554,19 @@ Moderate.prototype = {
         this.win.anc = this;
         this.table = $(this.win, 'moder_tab');
 
-        for (i = 0 ; i < 3 ; i++) {
-            tr = document.createElement("tr");
-            for (e = 0 ; e < 2 ; e++) {
-                td = document.createElement("td");
-                td.innerHTML = "Content "+((i * 2)+e);
-                tr.appendChild(td);
-            }
-            this.table.appendChild(tr);
-            if (i == 0) 
-                remtr = tr;
-        }
-        this.table.removeChild(remtr);
+        // for (i = 0 ; i < 3 ; i++) {
+        //     tr = document.createElement("tr");
+        //     for (e = 0 ; e < 2 ; e++) {
+        //         td = document.createElement("td");
+        //         td.innerHTML = "Content "+((i * 2)+e);
+        //         tr.appendChild(td);
+        //     }
+        //     this.table.appendChild(tr);
+        //     if (i == 0) 
+        //         remtr = tr;
+        // }
+        // this.table.removeChild(remtr);
+
         this.enabled = true;
     },
 
@@ -557,11 +576,17 @@ Moderate.prototype = {
 
     is_enabled: function() {
         return (this.enabled);
-    }// ,
+    },
+    add: function(item) {
+        var mi;
 
-    //add: function(item) {
-    //    this.item.append(new ModerateItem(item));
-    //}
+        console.log(typeof(this.item));
+        mi = new ModerateItem(item);
+        this.item.push(mi);
+
+        this.table.appendChild(mi.tr_get());
+
+    }
     // send_mesg("moderate|"+(enable ? "false" | "true"));
 
 }
index d606335..1f6f636 100644 (file)
@@ -899,7 +899,6 @@ supported by:<br>
    var g_listen;
    var g_withflash = false;
    var g_is_spawn = 0;
-   var g_moder = -1;
    var gst  = new globst();
    var topbanner_sfx, topbanner_dx;
    var g_brow = null;
index 6cac30e..f201ed3 100644 (file)
@@ -1,3 +1,9 @@
+div.moder_tabanc {
+    height: 100px;
+    background-color: #ffaaaa;
+    overflow: auto;
+}
+
 div.moder_tabanc table {
     width: 100%;
     border: 1px solid red;