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)";
41 tit = "sono presente!";
47 content += '<img title="'+tit+'" class="unbo" src="img/'+name+'">';
54 function j_stand_cont(data)
60 content = '<table cols="'+(data.length < 4 ? data.length : 4)+'" class="table_standup">';
61 for (i = 0 ; i < data.length ; i++) {
64 content += '<td class="room_standup">';
65 if (data[i][0] & 0x01)
68 if (data[i][0] & 0x02)
71 content += data[i][1];
73 if (data[i][0] & 0x02)
76 if (data[i][0] & 0x01)
79 content += state_add(data[i][0]);
87 $("standup").innerHTML = content;
89 // $("esco").innerHTML = '<input class="button" name="logout" value="Esco." onclick="esco_cb();" type="button">';
93 window.onbeforeunload = null;
94 window.onunload = null;
101 function j_tab_cont(table_idx, data)
106 for (i = 0 ; i < data.length ; i++) {
107 if (data[i][0] & 0x01)
110 if (data[i][0] & 0x02)
113 content += data[i][1];
115 if (data[i][0] & 0x02)
118 if (data[i][0] & 0x01)
120 content += state_add(data[i][0]);
124 $("table"+table_idx).innerHTML = content;
127 function j_tab_act_cont(idx, act)
130 $("table_act"+idx).innerHTML = '<input type="button" class="button" name="xhenter'+idx+'" value="Mi siedo." onclick="act_sitdown('+idx+');">';
132 else if (act == 'sitreser') {
133 // <img class="nobo" title="tavolo riservato agli utenti registrati" style="display: inline; margin-right: 80px;" src="img/okauth.png">
134 $("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+');">';
136 else if (act == 'wake') {
137 $("table_act"+idx).innerHTML = '<input type="button" class="button" name="xwakeup" value="Mi alzo." onclick="act_wakeup();">';
139 else if (act == 'reserved') {
140 $("table_act"+idx).innerHTML = '<img class="nobo" title="tavolo riservato agli utenti registrati" style="margin-right: 20px;" src="img/onlyauth.png">';
143 $("table_act"+idx).innerHTML = '';
147 function j_login_manager(form)
151 if (form.elements['passid'].value == '')
155 // console.log("richiesta token");
157 token = server_request('mesg', 'getchallenge', 'cli_name', encodeURIComponent(form.elements['nameid'].value));
158 tokens = token.split('|');
160 // console.log('XX token: '+token);
161 // console.log(tokens);
165 token = calcMD5(tokens[1]+calcMD5(form.elements['passid'].value));
167 form.elements['passid_private'].value = token;
168 form.elements['passid'].value = ""; // FIXME da sost con la stessa len di A
176 function formtext_hilite(obj)
178 obj.className = 'input_text';
179 addEvent(obj, "focus", function () { this.className = 'input_text_hi'; });
180 addEvent(obj, "blur", function () { this.className = 'input_text'; });
183 function formsub_hilite(obj)
185 obj.className = 'input_sub';
186 addEvent(obj, "focus", function () { this.className = 'input_sub_hi'; });
187 addEvent(obj, "blur", function () { this.className = 'input_sub'; });
190 function login_formtext_hilite()
192 formtext_hilite($("nameid"));
193 formtext_hilite($("passid"));
194 formsub_hilite($("sub"));
197 function login_init()
200 login_formtext_hilite();
203 function warrant_formtext_hilite()
205 formtext_hilite($("nameid"));
206 formtext_hilite($("emailid"));
207 formsub_hilite($("subid"));
208 formsub_hilite($("cloid"));
212 function j_check_email(email)
214 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
219 function j_authbox(form)
223 if (form.elements['realsub'].value == "chiudi") {
224 $('authbox').style.visibility = "hidden";
228 if (form.elements['name'].value == '' || j_check_email(form.elements['email'].value) == false)
229 no = new notify(gst, "<br>I campi user e/o e-mail non sono validi;</br> correggeteli per favore.", 1, "chiudi", 280, 100);
231 // submit the request
232 token = server_request('mesg', 'warranty',
233 'cli_name', encodeURIComponent(form.elements['name'].value),
234 'cli_email', encodeURIComponent(form.elements['email'].value) );
236 $('authbox').style.visibility = "hidden";
237 form.elements['name'].value = "";
238 form.elements['email'].value = "";
246 function authbox(w, h)
252 box.style.zIndex = 200;
253 box.style.width = w+"px";
254 box.style.marginLeft = -parseInt(w/2)+"px";
255 box.style.height = h+"px";
256 box.style.top = parseInt((document.body.clientHeight - h) / 2) + document.body.scrollTop;
258 warrant_formtext_hilite();
260 box.style.visibility = "visible";