fix missing bold for your account item
[brisk.git] / web / room.js
index f6d6d24..6308903 100644 (file)
@@ -274,7 +274,7 @@ function j_stand_cont(ddata)
 
     var data;
 
-    if (g_listen & l_list_isol) {
+    if (g_prefs.listen & l_list_isol) {
         data = new Array();
 
         for (i = 0, ii = 0 ; ii < ddata.length ; ii++) {
@@ -294,6 +294,9 @@ function j_stand_cont(ddata)
     if (standup_data_old == null || data.length < 4) {
         content = '<table cols="'+(data.length < 4 ? data.length : 4)+'" class="table_standup">';
         for (i = 0 ; i < data.length ; i++) {
+            if (ddata[i][1] == window.myname) {
+                ddata[i][0] |= 1;
+            }
             if ((i % 4) == 0)
                 content += '<tr>';
             content += '<td id="'+i+'" class="room_standup">';
@@ -329,6 +332,9 @@ function j_stand_cont(ddata)
         for (i = 0 ; i < standup_data_old.length ; i++) {
             for (e = 0 ; e < data.length ; e++) {
                 if (standup_data_old[i][1] == data[e][1]) {
+                    if (data[e][1] == window.myname) {
+                        data[e][0] |= 1;
+                    }
                     break;
                 }
             }
@@ -341,6 +347,9 @@ function j_stand_cont(ddata)
                 if (standup_data_old[i][0] != data[e][0] ||
                     standup_data_old[i].length != data[e].length ||
                     (data[e].length == 3 && standup_data_old[i][2] != data[e][2])) {
+                    if (data[e][1] == window.myname) {
+                        data[e][0] |= 1;
+                    }
                     arr_mod[idx_mod_n] = data[e];
                     idx_mod[idx_mod_n++] = i;
                 }
@@ -356,6 +365,9 @@ function j_stand_cont(ddata)
                 }
             }
             if (i == standup_data_old.length) {
+                if (data[e][1] == window.myname) {
+                    data[e][0] |= 1;
+                }
                 // console.log("ADD: "+data[e][1]);
                 arr_add[idx_add_n]   = data[e];
                 map_add[idx_add_n++] = e;
@@ -426,7 +438,7 @@ function j_stand_cont(ddata)
 
     var usr = $("standup").getElementsByClassName("id_usr");
     for (i = 0 ; i < usr.length ; i++) {
-        addEvent(usr[i], "click", click_update_cb);
+        addEvent(usr[i], "click", info_show_cb);
     }
 }
 
@@ -437,50 +449,15 @@ function esco_cb() {
     act_logout(0);
  };
 
-var g_user_info_target = "";
-
-function info_show(username)
-{
-    // ret = server_request('mesg', 'prefs|save','__POST__', 'prefs', JSON.stringify(g_prefs));
-    var info_in = JSON.parse(server_request('mesg', 'chatt|/info ' + username));
-    var info = null;
-
-    if (info_in.ret == 0) {
-        var fields = { login: { type: 'value' },
-                       state: { type: 'value' },
-                       guar: { type: 'value' },
-                       match: { type: 'value' },
-                       game: { type: 'value' },
-                       friend: { type: 'radio' } };
-
-        info = new Fieldify($('info'), fields);
-        info.populate(info_in);
-        info.visible(true);
-        }
-    else {
-        console.log("some error: open a dialog");
-    }
-    // FIXME: just to be finished
-    console.log(info);
-}
-
-function click_update_cb(e)
-{
-    if (g_user_info_target == e.target.innerHTML) {
-        g_user_info_target = "";
-        info_show(e.target.innerHTML);
-        }
-    else {
-        g_user_info_target = e.target.innerHTML;
-        }
-}
-
 function j_tab_cont(table_idx, data)
 {
     var i;
     var content = '';
 
     for (i = 0 ; i < data.length ; i++) {
+        if (data[i][1] == window.myname) {
+            data[i][0] |= 1;
+        }
         content += j_stand_tdcont(data[i]);
 
         content += '<br>';
@@ -488,7 +465,7 @@ function j_tab_cont(table_idx, data)
     $("table"+table_idx).innerHTML = content;
     var usr = $("table"+table_idx).getElementsByClassName("id_usr");
     for (i = 0 ; i < usr.length ; i++) {
-        addEvent(usr[i], "click", click_update_cb);
+        addEvent(usr[i], "click", info_show_cb);
     }
 }
 
@@ -498,6 +475,10 @@ function j_tab_act_cont(idx, act)
         // MLANG 1
         $("table_act"+idx).innerHTML = '<input type="button" class="button" name="xhenter'+idx+'"  value="'+(g_lang == 'en' ? "Sit down." : "Mi siedo.")+'" onclick="act_sitdown('+idx+');">';
     }
+    else if (act == 'sitappr') {
+        // MLANG 1
+        $("table_act"+idx).innerHTML = '<input type="button" style="background-repeat: no-repeat; background-position: center; background-image: url(\'img/okappr.png\');" class="button" name="xhenter'+idx+'"  value="'+(g_lang == 'en' ? "Sit down." : "Mi siedo.")+'" onclick="act_sitdown('+idx+');" title="'+(g_lang == 'en' ? "reserved table for authenticated and apprentice users only" : "tavolo riservato agli utenti registrati e agli apprendisti")+'" alt="'+(g_lang == 'en' ? "reserved table for authenticated and apprentice users only" : "tavolo riservato agli utenti registrati e agli apprendisti")+'">';
+    }
     else if (act == 'sitreser') {
         // MLANG 1
         $("table_act"+idx).innerHTML = '<input type="button" style="background-repeat: no-repeat; background-position: center; background-image: url(\'img/okauth.png\');" class="button" name="xhenter'+idx+'"  value="'+(g_lang == 'en' ? "Sit down." : "Mi siedo.")+'" onclick="act_sitdown('+idx+');" title="'+(g_lang == 'en' ? "reserved table for authenticated users only" : "tavolo riservato agli utenti registrati")+'" alt="'+(g_lang == 'en' ? "reserved table for authenticated users only" : "tavolo riservato agli utenti registrati")+'">';
@@ -538,13 +519,13 @@ function j_check_login(login, ret)
             (login[i] >= 'A' && login[i] <= 'Z')) {
             if (old_c != login[i]) {
                 old_c = login[i];
-                old_ct = 0;
+                old_ct = 1;
             }
             else {
-                if (old_ct > 3) {
+                if (old_ct > 2) {
                     // FIXME LANG
-                    ret.ret = (g_lang == 'en' ? "More than three contiguous '" + old_c + "' not allowed." :
-                               "Il nickname contiene più di tre caratteri '" + old_c + "' consecutivi.");
+                    ret.ret = (g_lang == 'en' ? "More than two contiguous '" + old_c + "' not allowed." :
+                               "Il nickname contiene più di 2 caratteri '" + old_c + "' consecutivi.");
                     return (false);
                 }
             }
@@ -673,7 +654,7 @@ function mesgtoadm_formtext_hilite(form)
 
 function j_check_email(email, ret)
 {
-    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,10})+$/.test(email))
+    if (/^\w+([\.-]*\w+)*@\w+([\.-]*\w+)*(\.\w{2,10})+$/.test(email))
         return (true);
     ret.ret += (g_lang == 'en' ? "Invalid email address. " :
                 "Indirizzo e-mail non valido.");