+/*
+ * brisk - room.js
+ *
+ * Copyright (C) 2006-2011 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 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;
default:
break;
}
+ }
+
+ if ((flags & 0xf0000) != 0) {
+ superst = flags & 0xf0000;
if (name != "") {
- content += ' <img title="'+tit+'" class="unbo" src="img/'+name+'">';
+ supersfx = "_side";
+ }
+
+ switch (superst) {
+ case 0x20000:
+ supername = "superuser"+supersfx+".png";
+ supertit = (g_lang == 'en' ? "Brisk Supporter" : "Brisk Supporter");
+ break;
}
}
+ if (supername != "") {
+ content += ' <img title="'+supertit+'" class="inline" src="img/'+supername+'">';
+ }
+
+ if (name != "") {
+ content += ' <img title="'+tit+'" class="inline" src="img/'+name+'">';
+ }
+
return content;
}
return (content);
}
-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) {
if ((i % 4) == 3)
content += '</tr>';
}
+ if ((i % 4) < 3)
+ content += '</tr>';
content += '</table>';
$("standup").innerHTML = content;
function j_tab_act_cont(idx, act)
{
if (act == 'sit') {
- $("table_act"+idx).innerHTML = '<input type="button" class="button" name="xhenter'+idx+'" value="Mi siedo." onclick="act_sitdown('+idx+');">';
+ // 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 == 'sitreser') {
// <img class="nobo" title="tavolo riservato agli utenti registrati" style="display: inline; margin-right: 80px;" src="img/okauth.png">
- $("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="Mi siedo." onclick="act_sitdown('+idx+');">';
+ // 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+');">';
}
else if (act == 'wake') {
- $("table_act"+idx).innerHTML = '<input type="button" class="button" name="xwakeup" value="Mi alzo." onclick="act_wakeup();">';
+ // MLANG 1
+ $("table_act"+idx).innerHTML = '<input type="button" class="button" name="xwakeup" value="'+(g_lang == 'en' ? "Wake up." : "Mi alzo.")+'" onclick="act_wakeup();">';
}
else if (act == 'reserved') {
- $("table_act"+idx).innerHTML = '<img class="nobo" title="tavolo riservato agli utenti registrati" style="margin-right: 20px;" src="img/onlyauth.png">';
+ // MLANG 1
+ $("table_act"+idx).innerHTML = '<img class="nobo" title="'+(g_lang == 'en' ? "reserved table for authenticated users only" : "tavolo riservato agli utenti registrati")+'" style="margin-right: 20px;" src="img/onlyauth.png">';
}
else {
$("table_act"+idx).innerHTML = '';
}
if (form.elements['name'].value == '' || j_check_email(form.elements['email'].value) == false) {
- no = new notify(gst, "<br>I campi user e/o e-mail non sono validi;</br> correggeteli per favore.", 1, "chiudi", 280, 100);
+ // MLANG 2-4
+ no = new notify(gst,
+ (g_lang == 'en' ? "<br><b>nickname</b> and/or <b>e-mail</b> fields are invalid;<br>please, fix them." :
+ "<br>I campi <b>nickname</b> e/o <b>e-mail</b> non sono validi;<br> correggeteli per favore."),
+ 1, (g_lang == 'en' ? "close" : "chiudi"), 280, 100);
break;
}
}
if (form.elements['mesg'].value == '' || form.elements['subj'].value == '') {
- no = new notify(gst, "<br>Il soggetto e il messaggo non possono essere vuoti;</br> correggeteli per favore.", 1, "chiudi", 280, 100);
+ // MLANG 1-3
+ no = new notify(gst, (g_lang == 'en' ? "<br><b>subject</b> and the <b>message</b> cannot be void;<br>please, fix them." :
+ "<br>Il <b>soggetto</b> e il <b>messaggo</b> non possono essere vuoti;<br>correggeteli per favore."), 1,
+ (g_lang == 'en' ? "close" : "chiudi"), 280, 100);
break;
}
$('mesgtoadm_form').elements['subj'].focus();
}
-function list_set(what, setco, info)
+function j_pollbox(form)
{
+ var no, i, choose;
+
+ do {
+ // submit the request
+
+ for (i = 0 ; i < form.elements.length ; i++) {
+ if (form.elements[i].checked == true)
+ break;
+ }
+ if (i == form.elements.length) {
+ // MLANG 1-3
+ no = new notify(gst, (g_lang == 'en' ? "<br>You must choose ah item;<br> please, fix it." :
+ "<br>Non hai espresso nessuna preferenza;<br> correggi per favore."), 1,
+ (g_lang == 'en' ? "close" : "chiudi"), 280, 100);
+ return false;
+ }
+ else
+ choose = form.elements[i].value;
+
+ token = server_request('mesg', 'poll',
+ 'cli_choose', encodeURIComponent(choose) );
+
+ if (token == "1") {
+ // TODO: mesg to user
+ // $('mesgtoadmbox').style.visibility = "hidden";
+ break;
+ }
+ } while (0);
+
+ return (false);
+}
+
+
+
+
+function list_set(what, is_update, info)
+{
+ // console.log(what);
+ 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)
+{
+ this.st = 'wait';
+ this.twait = 5000;
+
+ this.domobj = domobj;
+ this.height = height;
+ this.step = step;
+
+ this.start();
+}
+
+sideslide.prototype = {
+ id: null,
+ st: 'wait',
+ twait: 0,
+ scroll: 0,
+ countdown: 0,
+
+ domobj: null,
+ height: 0,
+ step: 0,
+
+ start: function() {
+ var instant = this;
+
+ this.st = 'wait';
+ this.id = setTimeout(function () { instant.sideslide_cb(); }, this.twait);
+ },
+
+ sideslide_cb: function() {
+ var instant = this;
+
+ if (this.st == 'wait') {
+ this.st = 'scroll';
+ this.countdown = 10;
+ this.id = setInterval(function () { instant.sideslide_cb(); }, 100);
+ }
+ else if (this.st == 'scroll') {
+ this.scroll += (this.step / 10);
+ if (this.scroll >= this.height - this.step) {
+ this.scroll = 0;
+ }
+ this.domobj.scrollTop = this.scroll;
+ this.countdown--;
+ if (this.countdown == 0) {
+ this.stop();
+ this.st = 'wait';
+ this.id = setTimeout(function () { instant.sideslide_cb(); }, this.twait);
+ }
+ }
+ },
+
+
+ stop: function() {
+ if (this.id != null) {
+ clearInterval(this.id);
+ this.id = null;
+ }
+ }
+
}