X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=web%2Froom.js;h=6d73e92d50f669eb9f3d6f15a45bf3e1c42b07b1;hb=18c2f8c04345fdb34fc68f308225475c92afbbef;hp=a8230db90a830fd0547a1b843f9e7fa7a9bc2f2f;hpb=7f9618888f9963c4a7daebeb9e3d14ef0a56b968;p=brisk.git diff --git a/web/room.js b/web/room.js index a8230db..6d73e92 100644 --- a/web/room.js +++ b/web/room.js @@ -426,7 +426,7 @@ function j_stand_cont(ddata) var usr = $("standup").getElementsByClassName("id_usr"); for (i = 0 ; i < usr.length ; i++) { - addEvent(usr[i], "click", click_update_cb); + addEvent(usr[i], "click", info_show_cb); } } @@ -437,47 +437,6 @@ function esco_cb() { act_logout(0); }; -var g_user_info_target = ""; - -function info_show(username) -{ - // ret = server_request('mesg', 'prefs|save','__POST__', 'prefs', JSON.stringify(g_prefs)); - var info_in = JSON.parse(server_request('mesg', 'chatt|/info ' + username)); - var info = null; - - if (info_in.ret == 0) { - var fields = { login: { type: 'value' }, - state: { type: 'value' }, - guar: { type: 'value' }, - match: { type: 'value' }, - game: { type: 'value' }, - friend: { type: 'radio' }, - skill: { type: 'radio' }, - trust: { type: 'radio' } - }; - - info = new Fieldify($('info'), fields); - info.populate(info_in); - info.visible(true); - } - else { - console.log("some error: open a dialog"); - } - // FIXME: just to be finished - console.log(info); -} - -function click_update_cb(e) -{ - if (g_user_info_target == e.target.innerHTML) { - g_user_info_target = ""; - info_show(e.target.innerHTML); - } - else { - g_user_info_target = e.target.innerHTML; - } -} - function j_tab_cont(table_idx, data) { var i; @@ -491,7 +450,7 @@ function j_tab_cont(table_idx, data) $("table"+table_idx).innerHTML = content; var usr = $("table"+table_idx).getElementsByClassName("id_usr"); for (i = 0 ; i < usr.length ; i++) { - addEvent(usr[i], "click", click_update_cb); + addEvent(usr[i], "click", info_show_cb); } } @@ -501,6 +460,10 @@ function j_tab_act_cont(idx, act) // MLANG 1 $("table_act"+idx).innerHTML = ''; } + else if (act == 'sitappr') { + // MLANG 1 + $("table_act"+idx).innerHTML = ''; + } else if (act == 'sitreser') { // MLANG 1 $("table_act"+idx).innerHTML = ''; @@ -528,6 +491,8 @@ function j_tab_act_cont(idx, act) function j_check_login(login, ret) { + var cmp; + if (login.length > 12) { // FIXME LANG ret.ret += (g_lang == 'en' ? "Nickname too long." : "Nickname troppo lungo."); @@ -539,15 +504,24 @@ function j_check_login(login, ret) if ((login[i] >= '0' && login[i] <= '9') || (login[i] >= 'a' && login[i] <= 'z') || (login[i] >= 'A' && login[i] <= 'Z')) { - if (old_c != login[i]) { - old_c = login[i]; - old_ct = 0; + if (login[i] >= '0' && login[i] <= '9') + cmp = '0'; + else + cmp = login[i]; + + if (old_c != cmp) { + old_c = cmp; + old_ct = 1; } else { - if (old_ct > 3) { + if (old_ct > 2) { // FIXME LANG - ret.ret = (g_lang == 'en' ? "More than three contiguous '" + old_c + "' not allowed." : - "Il nickname contiene più di tre caratteri '" + old_c + "' consecutivi."); + if (old_c == '0') + ret.ret = (g_lang == 'en' ? "More than two contiguous digits not allowed." : + "Il nickname contiene più di 2 cifre consecutive."); + else + ret.ret = (g_lang == 'en' ? "More than two contiguous '" + old_c + "' not allowed." : + "Il nickname contiene più di 2 caratteri '" + old_c + "' consecutivi."); return (false); } } @@ -585,7 +559,7 @@ function j_new_apprentice(form) } // submit the request - token = server_request('mesg', 'apprentice', + token = server_request('index_wr.php', sess, 'mesg', 'apprentice', 'cli_name', encodeURIComponent(form.elements['nameid'].value), 'cli_email', encodeURIComponent(form.elements['emailid'].value), 'cli_lang', g_lang); @@ -613,7 +587,7 @@ function j_login_manager(form) else { // console.log("richiesta token"); /* richiede token */ - token = server_request('mesg', 'getchallenge', 'cli_name', encodeURIComponent(form.elements['nameid'].value)); + token = server_request('index_wr.php', sess, 'mesg', 'getchallenge', 'cli_name', encodeURIComponent(form.elements['nameid'].value)); tokens = token.split('|'); // console.log('XX token: '+token); @@ -676,7 +650,7 @@ function mesgtoadm_formtext_hilite(form) function j_check_email(email, ret) { - if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,10})+$/.test(email)) + if (/^\w+([\.-]*\w+)*@\w+([\.-]*\w+)*(\.\w{2,10})+$/.test(email)) return (true); ret.ret += (g_lang == 'en' ? "Invalid email address. " : "Indirizzo e-mail non valido."); @@ -704,7 +678,7 @@ function j_authbox(form) } // submit the request - token = server_request('mesg', 'warranty', + token = server_request('index_wr.php', sess, 'mesg', 'warranty', 'cli_name', encodeURIComponent(form.elements['name'].value), 'cli_email', encodeURIComponent(form.elements['email'].value) ); if (token == "1") { @@ -755,7 +729,7 @@ function j_mesgtoadmbox(form) } // submit the request - token = server_request('mesg', 'mesgtoadm', + token = server_request('index_wr.php', sess, 'mesg', 'mesgtoadm', 'cli_subj', encodeURIComponent(form.elements['subj'].value), 'cli_mesg', encodeURIComponent(form.elements['mesg'].value) ); if (token == "1") { @@ -808,7 +782,7 @@ function j_pollbox(form) else choose = form.elements[i].value; - token = server_request('mesg', 'poll', + token = server_request('index_wr.php', sess, 'mesg', 'poll', 'cli_choose', encodeURIComponent(choose) ); if (token == "1") {