X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Froom.js;h=476429af5f639b6583dd3cb989b6c65679598532;hb=db58d4f8b388d9632d5f115a98d213a666be3c5b;hp=27093bbba3b31e9734db1a57c23af4bf90576430;hpb=c5e1d769c92e8beedab2f0f7dd6808bb61403705;p=brisk.git diff --git a/web/room.js b/web/room.js index 27093bb..476429a 100644 --- a/web/room.js +++ b/web/room.js @@ -1,53 +1,144 @@ +/* + * brisk - room.js + * + * Copyright (C) 2006-2012 Matteo Nastasi + * mailto: nastasi@alternativeoutput.it + * matteo.nastasi@milug.org + * web: http://www.alternativeoutput.it + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. You should have received a + * copy of the GNU General Public License along with this program; if + * not, write to the Free Software Foundation, Inc, 59 Temple Place - + * Suite 330, Boston, MA 02111-1307, USA. + * + */ + + /* + data = [ [ flags, name ], ... ] */ + +var l_list_all = 0x00; +var l_list_auth = 0x01; +var l_list_isol = 0x02; + +function client_prefs() +{ +} + +client_prefs.prototype = { + listen: -1 +} + function state_add(flags) { - var content = ""; - var st, name = ""; - var tit = ""; + var content = "", supercont = ""; + var st, superst, name = "", supername = "", supersfx = ""; + var tit = "", supertit = ""; + if ((flags & 0xf00) != 0) { st = flags & 0xf00; + // MLANG 4,12,16,20,24,28 switch (st) { case 0x100: name = "st_pau.png"; - tit = "sono in pausa"; + tit = (g_lang == 'en' ? "I'm doing a break" : "sono in pausa"); break; case 0x200: name = "st_out.png"; - tit = "sono fuori"; + tit = (g_lang == 'en' ? "I'm away" : "sono fuori"); break; case 0x300: name = "st_dog.png"; - tit = "sono a spasso col cane"; + tit = (g_lang == 'en' ? "Dog time" : "sono a spasso col cane"); break; case 0x400: name = "st_eat.png"; - tit = "sto mangiando"; + tit = (g_lang == 'en' ? "I'm eating" : "sto mangiando"); break; case 0x500: name = "st_wrk.png"; - tit = "sono a lavoro"; + tit = (g_lang == 'en' ? "I'm working" : "sono a lavoro"); break; case 0x600: name = "st_smk.png"; - tit = "sto fumando una sigaretta (e facendomi venire il cancro)"; + tit = (g_lang == 'en' ? "I'm smoking a sigarett (and keeping a cancer)" : "sto fumando una sigaretta (e facendomi venire il cancro)"); break; case 0x700: name = "st_eye.png"; - tit = "sono presente!"; + tit = (g_lang == 'en' ? "I'm here!" : "sono presente!"); + break; + case 0x800: + name = "st_rabbit.png"; + tit = (g_lang == 'en' ? "Rabbit time" : "sono a spasso col coniglio"); + break; + case 0x900: + name = "st_soccer.png"; + tit = (g_lang == 'en' ? "Soccer time" : "c'è la partita!!"); + break; + case 0xa00: + name = "st_baby.png"; + tit = (g_lang == 'en' ? "Children time" : "ho il pupo da accudire"); + break; + case 0xb00: + name = "st_mop.png"; + tit = (g_lang == 'en' ? "Mop time" : "sto rassettando"); + break; + case 0xc00: + name = "st_babbo.png"; + tit = (g_lang == 'en' ? "Sto dando i regali" : "sto dando i regali"); + break; + case 0xd00: + name = "st_renna.png"; + tit = (g_lang == 'en' ? "in giro per regali" : "in giro per regali"); + break; + case 0xe00: + name = "st_pupaz.png"; + tit = (g_lang == 'en' ? "Neve a gogò" : "neve a gogò"); + break; + case 0xf00: + name = "st_visch.png"; + tit = (g_lang == 'en' ? "aspettando sotto al vischio" : "aspettando sotto al vischio"); break; default: break; } + } + + if ((flags & 0xf0000) != 0) { + superst = flags & 0xf0000; if (name != "") { - content += ' '; + supersfx = "_side"; + } + + switch (superst) { + case 0x20000: + supername = "superuser"+supersfx+".png"; + supertit = (g_lang == 'en' ? "Brisk Supporter" : "Brisk Supporter"); + break; } } + if (supername != "") { + content += ' '; + } + + if (name != "") { + content += ' '; + } + return content; } @@ -58,7 +149,7 @@ var standup_data_old = null; function table_add(curtag, td) { - var tbody = null, tr; + var tbody = null, tr, ct; do { // console.log("wt: "+curtag.tagName); @@ -176,34 +267,31 @@ function table_walk(curtag) function j_stand_tdcont(el) { - var content = ""; - - if (el[0] & 0x01) - content += ''; - - if (el[0] & 0x02) - content += ''; - - content += el[1]; - - if (el[0] & 0x02) - content += ''; - - if (el[0] & 0x01) - content += ''; - - content += state_add(el[0]); - - return (content); + return (user_dec_and_state(el)); } -function j_stand_cont(data) +function j_stand_cont(ddata) { - var i; + var i, ii; var content; var st = 0, name = ""; var curtag, nextag; + var data; + + if (g_listen & l_list_isol) { + data = new Array(); + + for (i = 0, ii = 0 ; ii < ddata.length ; ii++) { + if ((ddata[ii][0] & 0x02) == 0) { + continue; + } + data[i++] = ddata[ii]; + } + } + else + data = ddata; + if (standup_data_old == null || data.length < 4) { // if (standup_data_old == null) { @@ -218,6 +306,8 @@ function j_stand_cont(data) if ((i % 4) == 3) content += ''; } + if ((i % 4) < 3) + content += ''; content += ''; $("standup").innerHTML = content; @@ -355,7 +445,7 @@ function esco_cb() { window.onbeforeunload = null; window.onunload = null; // nonunload = true; - act_logout(); + act_logout(0); }; @@ -366,20 +456,9 @@ function j_tab_cont(table_idx, data) var content = ''; for (i = 0 ; i < data.length ; i++) { - if (data[i][0] & 0x01) - content += ''; - - if (data[i][0] & 0x02) - content += ''; - - content += data[i][1]; - - if (data[i][0] & 0x02) - content += ''; - - if (data[i][0] & 0x01) - content += ''; - content += state_add(data[i][0]); + // content += user_decorator(data[i]); + // content += state_add(data[i][0]); + content += j_stand_tdcont(data[i]); content += '
'; } @@ -389,17 +468,21 @@ function j_tab_cont(table_idx, data) function j_tab_act_cont(idx, act) { if (act == 'sit') { - $("table_act"+idx).innerHTML = ''; + // MLANG 1 + $("table_act"+idx).innerHTML = ''; } else if (act == 'sitreser') { // - $("table_act"+idx).innerHTML = ''; + // MLANG 1 + $("table_act"+idx).innerHTML = ''; } else if (act == 'wake') { - $("table_act"+idx).innerHTML = ''; + // MLANG 1 + $("table_act"+idx).innerHTML = ''; } else if (act == 'reserved') { - $("table_act"+idx).innerHTML = ''; + // MLANG 1 + $("table_act"+idx).innerHTML = ''; } else { $("table_act"+idx).innerHTML = ''; @@ -495,7 +578,11 @@ function j_authbox(form) } if (form.elements['name'].value == '' || j_check_email(form.elements['email'].value) == false) { - no = new notify(gst, "
I campi user e/o e-mail non sono validi;
correggeteli per favore.", 1, "chiudi", 280, 100); + // MLANG 2-4 + no = new notify(gst, + (g_lang == 'en' ? "
nickname and/or e-mail fields are invalid;
please, fix them." : + "
I campi nickname e/o e-mail non sono validi;
correggeteli per favore."), + 1, (g_lang == 'en' ? "close" : "chiudi"), 280, 100); break; } @@ -543,7 +630,10 @@ function j_mesgtoadmbox(form) } if (form.elements['mesg'].value == '' || form.elements['subj'].value == '') { - no = new notify(gst, "
Il soggetto e il messaggo non possono essere vuoti;
correggeteli per favore.", 1, "chiudi", 280, 100); + // MLANG 1-3 + no = new notify(gst, (g_lang == 'en' ? "
subject and the message cannot be void;
please, fix them." : + "
Il soggetto e il messaggo non possono essere vuoti;
correggeteli per favore."), 1, + (g_lang == 'en' ? "close" : "chiudi"), 280, 100); break; } @@ -592,7 +682,10 @@ function j_pollbox(form) break; } if (i == form.elements.length) { - no = new notify(gst, "
Non hai espresso nessuna preferenza;
correggi per favore.", 1, "chiudi", 280, 100); + // MLANG 1-3 + no = new notify(gst, (g_lang == 'en' ? "
You must choose ah item;
please, fix it." : + "
Non hai espresso nessuna preferenza;
correggi per favore."), 1, + (g_lang == 'en' ? "close" : "chiudi"), 280, 100); return false; } else @@ -611,23 +704,119 @@ function j_pollbox(form) return (false); } +function prefs_assign(content) +{ + var prefs_new; + var s; + s = "prefs_new = " + content; + eval(s); + return (prefs_new); +} + +var prefs_list_idx = new Array( 0x00, 0x01, 0x02 ); +var prefs_list_id = new Array( "all", "auth", "isol" ); + +function prefs_apply(prefs_new) +{ + if (typeof(g_prefs) == 'undefined') + return false; + + /* listen management */ + if (g_prefs.listen != prefs_new.listen) { + for (i = 0 ; i < prefs_list_idx.length ; i++) { + set_checked_value($('ra_listen_'+prefs_list_id[i]), prefs_new.listen); + if (prefs_new.listen == prefs_list_idx[i]) { + $('list_'+prefs_list_id[i]).style.color = 'red'; + $('list_info').innerHTML = mlang_commons['tit_list'][i][g_lang]; + } + else { + $('list_'+prefs_list_id[i]).style.color = 'black'; + } + } + + g_prefs.listen = prefs_new.listen; + relo = true; + } +} + +function prefs_load(content) +{ + var prefs_new; + + if ((prefs_new = prefs_assign(content)) == null) + return false; + + return prefs_apply(prefs_new); +} -function list_set(what, setco, info) +function list_set(what, is_update, info) { + var i; + var relo = false; + var old_st = readCookie("CO_list"); + if (what == 'auth') { $('list_auth').style.color = 'red'; + $('list_isol').style.color = 'black'; + $('list_all').style.color = 'black'; + if (old_st == 'isolation') + relo = true; + g_listen = l_list_auth; + } + else if (what == 'isolation') { + $('list_auth').style.color = 'black'; + $('list_isol').style.color = 'red'; $('list_all').style.color = 'black'; + if (old_st != 'isolation') + relo = true; + g_listen = l_list_isol; } else { $('list_auth').style.color = 'black'; + $('list_isol').style.color = 'black'; $('list_all').style.color = 'red'; + if (old_st == 'isolation') + relo = true; + g_listen = l_list_all; } + + set_checked_value($('ra_listen_auth'), what); + set_checked_value($('ra_listen_isol'), what); + set_checked_value($('ra_listen_all'), what); + $('list_info').innerHTML = info; - if (setco) { + if (is_update) { createCookie("CO_list", what, 24*365, cookiepath); } + + + if (relo || !is_update) { + for (i = g_tables_auth_n ; i < g_tables_n ; i++) { + + if (i % 4 == 0) { + $('tr_noauth'+i).style.display = (what == 'isolation' ? 'none' : ''); + } + + $('td_noauth'+i).style.display = (what == 'isolation' ? 'none' : ''); + } + if (what == 'isolation') { + tra.hide_noauth(); + } + else { + tra.show_noauth(); + } + + if (false) { + // ricalculation of standup area + if (standup_data_old != null) { + standup_data = standup_data_old; + standup_data_old = null; + j_stand_cont(standup_data); + } + } + } } function sideslide(domobj, height, step)