X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Froom.js;h=92d282b10bd4773c542e9cc4be3a62cb6f16e508;hb=0407f36c21c0c0bf77fba61c35df33cce50a1393;hp=9cc2616a7ed75fe1ca124b40919731e9c7de6126;hpb=2846628b700a116b8de45ea5489445d0ed195846;p=brisk.git diff --git a/web/room.js b/web/room.js index 9cc2616..92d282b 100644 --- a/web/room.js +++ b/web/room.js @@ -1,8 +1,36 @@ +/* + * brisk - room.js + * + * Copyright (C) 2006-2009 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 = ""; @@ -11,40 +39,41 @@ function state_add(flags) 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; default: break; } if (name != "") { - content += ''; + content += ' '; } } @@ -208,15 +237,20 @@ function j_stand_cont(data) // if (standup_data_old == null) { content = ''; - for (i = 0 ; i < data.length ; i++) { + for (i = 0, ii = 0 ; ii < data.length ; ii++) { + if (g_listen & l_list_isol && ((data[ii][0] & 0x02) == 0)) { + continue; + } if ((i % 4) == 0) content += ''; content += ''; if ((i % 4) == 3) content += ''; + + i++; } content += '
'; - content += j_stand_tdcont(data[i]); + content += j_stand_tdcont(data[ii]); content += '
'; @@ -257,7 +291,8 @@ function j_stand_cont(data) break; } } - if (e == data.length) { + if (e == data.length || + (g_listen & l_list_isol && ((data[e][0] & 0x02) == 0))) { idx_del[idx_del_n++] = i; map_cur[i] = -1; } @@ -278,7 +313,8 @@ function j_stand_cont(data) break; } } - if (i == standup_data_old.length) { + if (i == standup_data_old.length && + !(g_listen & l_list_isol && ((data[e][0] & 0x02) == 0))) { // console.log("ADD: "+data[e][1]); arr_add[idx_add_n] = data[e]; map_add[idx_add_n++] = e; @@ -389,17 +425,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 = ''; @@ -435,20 +475,6 @@ function j_login_manager(form) return (false); } -function formtext_hilite(obj) -{ - obj.className = 'input_text'; - addEvent(obj, "focus", function () { this.className = 'input_text_hi'; }); - addEvent(obj, "blur", function () { this.className = 'input_text'; }); -} - -function formsub_hilite(obj) -{ - obj.className = 'input_sub'; - addEvent(obj, "focus", function () { this.className = 'input_sub_hi'; }); - addEvent(obj, "blur", function () { this.className = 'input_sub'; }); -} - function login_formtext_hilite() { formtext_hilite($("nameid")); @@ -462,12 +488,32 @@ function login_init() login_formtext_hilite(); } -function warrant_formtext_hilite() +function warrant_formtext_hilite(form) { + /* formtext_hilite($("nameid")); formtext_hilite($("emailid")); formsub_hilite($("subid")); formsub_hilite($("cloid")); + */ + formtext_hilite(form.elements['name']); + formtext_hilite(form.elements['email']); + formsub_hilite(form.elements['sub']); + formsub_hilite(form.elements['clo']); +} + +function mesgtoadm_formtext_hilite(form) +{ + /* + formtext_hilite($("subjid")); + formtext_hilite($("mesgid")); + formsub_hilite($("subid")); + formsub_hilite($("cloid")); + */ + formtext_hilite(form.elements['subj']); + formtext_hilite(form.elements['mesg']); + formsub_hilite(form.elements['sub']); + formsub_hilite(form.elements['clo']); } @@ -482,14 +528,21 @@ function j_authbox(form) { var no; - if (form.elements['realsub'].value == "chiudi") { - $('authbox').style.visibility = "hidden"; - return (false); - } + do { + if (form.elements['realsub'].value == "chiudi") { + $('authbox').style.visibility = "hidden"; + break; + } + + if (form.elements['name'].value == '' || j_check_email(form.elements['email'].value) == false) { + // 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; + } - 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); - else { // submit the request token = server_request('mesg', 'warranty', 'cli_name', encodeURIComponent(form.elements['name'].value), @@ -498,9 +551,9 @@ function j_authbox(form) $('authbox').style.visibility = "hidden"; form.elements['name'].value = ""; form.elements['email'].value = ""; - return (false); + break; } - } + } while (0); return (false); } @@ -517,8 +570,214 @@ function authbox(w, h) box.style.height = h+"px"; box.style.top = parseInt((document.body.clientHeight - h) / 2) + document.body.scrollTop; - warrant_formtext_hilite(); + warrant_formtext_hilite($('auth_form')); box.style.visibility = "visible"; $("nameid").focus(); } + +function j_mesgtoadmbox(form) +{ + var no; + + do { + if (form.elements['realsub'].value == "chiudi") { + $('mesgtoadmbox').style.visibility = "hidden"; + break; + } + + if (form.elements['mesg'].value == '' || form.elements['subj'].value == '') { + // 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; + } + + // submit the request + token = server_request('mesg', 'mesgtoadm', + 'cli_subj', encodeURIComponent(form.elements['subj'].value), + 'cli_mesg', encodeURIComponent(form.elements['mesg'].value) ); + if (token == "1") { + $('mesgtoadmbox').style.visibility = "hidden"; + form.elements['subj'].value = ""; + form.elements['mesg'].value = ""; + break; + } + } while (0); + + return (false); +} + +function mesgtoadmbox(w, h) +{ + var box; + + box = $('mesgtoadmbox'); + + box.style.zIndex = 200; + box.style.width = w+"px"; + box.style.marginLeft = -parseInt(w/2)+"px"; + box.style.height = h+"px"; + box.style.top = parseInt((document.body.clientHeight - h) / 2) + document.body.scrollTop; + + mesgtoadm_formtext_hilite($('mesgtoadm_form')); + + box.style.visibility = "visible"; + $('mesgtoadm_form').elements['subj'].focus(); +} + +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' ? "
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 + 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; + } + $('list_info').innerHTML = info; + 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' : ''); + } + // 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; + } + } + +}