2 data = [ [ flags, name ], ... ]
6 function state_add(flags)
12 if ((flags & 0xf00) != 0) {
17 tit = "sono in pausa";
25 tit = "sono a spasso col cane";
29 tit = "sto mangiando";
33 tit = "sono a lavoro";
37 tit = "sto fumando una sigaretta (e facendomi venire il cancro)";
43 content += '<img title="'+tit+'" class="unbo" src="img/'+name+'">';
50 function j_stand_cont(data)
56 content = '<table cols="'+(data.length < 4 ? data.length : 4)+'" class="table_standup">';
57 for (i = 0 ; i < data.length ; i++) {
60 content += '<td class="room_standup">';
61 if (data[i][0] & 0x01)
64 if (data[i][0] & 0x02)
67 content += data[i][1];
69 if (data[i][0] & 0x02)
72 if (data[i][0] & 0x01)
75 content += state_add(data[i][0]);
83 $("standup").innerHTML = content;
85 $("esco").innerHTML = '<input class="button" name="logout" value="Esco." onclick="esco_cb();" type="button">';
89 window.onbeforeunload = null;
90 window.onunload = null;
97 function j_tab_cont(table_idx, data)
102 for (i = 0 ; i < data.length ; i++) {
103 if (data[i][0] & 0x01)
106 if (data[i][0] & 0x02)
109 content += data[i][1];
111 if (data[i][0] & 0x02)
114 if (data[i][0] & 0x01)
116 content += state_add(data[i][0]);
120 $("table"+table_idx).innerHTML = content;
123 function j_tab_act_cont(idx, act)
126 $("table_act"+idx).innerHTML = '<input type="button" class="button" name="xhenter'+idx+'" value="Mi siedo." onclick="act_sitdown('+idx+');">';
128 else if (act == 'sitreser') {
129 // <img class="nobo" title="tavolo riservato agli utenti registrati" style="display: inline; margin-right: 80px;" src="img/okauth.png">
130 $("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+');">';
132 else if (act == 'wake') {
133 $("table_act"+idx).innerHTML = '<input type="button" class="button" name="xwakeup" value="Mi alzo." onclick="act_wakeup();">';
135 else if (act == 'reserved') {
136 $("table_act"+idx).innerHTML = '<img class="nobo" title="tavolo riservato agli utenti registrati" style="margin-right: 20px;" src="img/onlyauth.png">';
139 $("table_act"+idx).innerHTML = '';
143 function j_login_manager(form)
147 if (form.elements['passid'].value == '')
151 // console.log("richiesta token");
153 token = server_request('mesg', 'getchallenge', 'cli_name', encodeURIComponent(form.elements['nameid'].value));
154 tokens = token.split('|');
156 // console.log('XX token: '+token);
157 // console.log(tokens);
161 token = calcMD5(tokens[1]+calcMD5(form.elements['passid'].value));
163 form.elements['passid_private'].value = token;
164 form.elements['passid'].value = ""; // FIXME da sost con la stessa len di A
172 function formtext_hilite(obj)
174 obj.className = 'input_text';
175 addEvent(obj, "focus", function () { this.className = 'input_text_hi'; });
176 addEvent(obj, "blur", function () { this.className = 'input_text'; });
179 function formsub_hilite(obj)
181 obj.className = 'input_sub';
182 addEvent(obj, "focus", function () { this.className = 'input_sub_hi'; });
183 addEvent(obj, "blur", function () { this.className = 'input_sub'; });
186 function login_formtext_hilite()
188 formtext_hilite($("nameid"));
189 formtext_hilite($("passid"));
190 formsub_hilite($("sub"));
193 function login_init()
196 login_formtext_hilite();
199 function warrant_formtext_hilite()
201 formtext_hilite($("nameid"));
202 formtext_hilite($("emailid"));
203 formsub_hilite($("subid"));
204 formsub_hilite($("cloid"));
208 function j_check_email(email)
210 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
215 function j_authbox(form)
219 if (form.elements['realsub'].value == "chiudi") {
220 $('authbox').style.visibility = "hidden";
224 if (form.elements['name'].value == '' || j_check_email(form.elements['email'].value) == false)
225 no = new notify(gst, "<br>I campi user e/o e-mail non sono validi;</br> correggeteli per favore.", 1, "chiudi", 280, 100);
227 // submit the request
228 token = server_request('mesg', 'warranty',
229 'cli_name', encodeURIComponent(form.elements['name'].value),
230 'cli_email', encodeURIComponent(form.elements['email'].value) );
232 $('authbox').style.visibility = "hidden";
233 form.elements['name'].value = "";
234 form.elements['email'].value = "";
242 function authbox(w, h)
248 box.style.zIndex = 200;
249 box.style.width = w+"px";
250 box.style.marginLeft = -parseInt(w/2)+"px";
251 box.style.height = h+"px";
252 box.style.top = parseInt((document.body.clientHeight - h) / 2) + document.body.scrollTop;
254 warrant_formtext_hilite();
256 box.style.visibility = "visible";