2 var l_list_auth = 0x01;
3 var l_list_isol = 0x02;
4 var l_prefs_list_idx = new Array( 0x00, 0x01, 0x02 );
5 var l_prefs_list_id = new Array( "all", "auth", "isol" );
6 var l_comps_name = new Array('s_fg_r', 's_fg_g', 's_fg_b', 's_bg_r', 's_bg_g', 's_bg_b');
8 var standup_data_notisol = null;
10 function client_prefs(old)
13 this.listen = old.listen;
14 this.supp_comp = old.supp_comp;
18 client_prefs.prototype = {
20 supp_comp: 'ff00ffff00'
23 function prefs_assign(content)
28 s = "prefs_new = " + content;
34 function prefs_apply(prefs_new, is_update, is_volat)
39 console.log('prefs_apply: begin');
41 if (typeof(g_prefs) == 'undefined')
43 /* listen management */
44 if (g_prefs.listen != prefs_new.listen || is_update) {
45 for (i = 0 ; i < l_prefs_list_idx.length ; i++) {
46 set_checked_value($('ra_listen_'+l_prefs_list_id[i]), prefs_new.listen);
47 if (prefs_new.listen == l_prefs_list_idx[i]) {
49 $('list_'+l_prefs_list_id[i]).style.color = 'red';
50 $('list_info').innerHTML = mlang_commons['tit_list'][i][g_lang];
54 $('list_'+l_prefs_list_id[i]).style.color = 'black';
61 // supporter component management
62 if (g_prefs.supp_comp != prefs_new.supp_comp || is_update) {
64 for (i = 0 ; i < 6 ; i++) {
65 $(l_comps_name[i]).value = parseInt(prefs_new.supp_comp.substr(i*2,2), 16);
67 $('s_img').src = 'suprend.php?comp='+prefs_new.supp_comp;
70 if (relo || !is_update) {
71 for (i = g_tables_appr_n ; i < g_tables_n ; i++) {
73 $('tr_noauth'+i).style.display = (prefs_new.listen == l_list_isol ? 'none' : '');
76 $('td_noauth'+i).style.display = (prefs_new.listen == l_list_isol ? 'none' : '');
78 if (prefs_new.listen == l_list_isol) {
85 if (prefs.listen != l_list_isol && prefs_new.listen == l_list_isol) {
86 if (standup_data_old != null) {
87 standup_data_notisol = standup_data_old.slice();
90 else if (prefs.listen == l_list_isol && prefs_new.listen != l_list_isol) {
91 if (standup_data_notisol != null) {
92 standup_data_old = standup_data_notisol;
93 standup_data_notisol = null;
98 // ricalculation of standup area
99 g_prefs.listen = prefs_new.listen;
101 console.log('here we are');
102 if (standup_data_old != null) {
103 console.log('here we are2');
104 standup_data = standup_data_old;
105 standup_data_old = null;
106 j_stand_cont(standup_data);
111 g_prefs.listen = prefs_new.listen;
112 g_prefs.supp_comp = prefs_new.supp_comp;
115 function prefs_load(content, is_update, is_volat)
119 // console.log('prefs_load('+content+')');
121 if ((prefs_new = prefs_assign(content)) == null)
124 return prefs_apply(prefs_new, is_update, is_volat);
127 function prefs_save()
131 if (typeof(g_prefs) == 'undefined')
134 ret = server_request('mesg', 'prefs|save','__POST__', 'prefs', JSON.stringify(g_prefs));
137 $('preferences').style.visibility = 'hidden';
144 function prefs_reset()
148 ret = server_request('mesg', 'prefs|reset');
151 function prefs_update(field)
156 // console.log("prefs_update("+field+")");
158 if (typeof(g_prefs) == 'undefined')
161 prefs_new = new client_prefs(g_prefs);
163 if (field == 'listen') {
164 /* listen management */
165 for (i = 0 ; i < l_prefs_list_idx.length ; i++) {
166 prefs_new.listen = get_checked_value($('ra_listen_'+l_prefs_list_id[i]));
167 if (prefs_new.listen != '')
171 else if (field == 'supp') {
172 for (i = 0 ; i < 6 ; i++) {
173 if (parseInt($(l_comps_name[i]).value) < 0 || parseInt($(l_comps_name[i]).value) > 255 ||
174 isNaN(parseInt($(l_comps_name[i]).value))) {
180 prefs_new.supp_comp = "";
181 for (i = 0 ; i < 6 ; i++) {
182 prefs_new.supp_comp += dec2hex(parseInt($(l_comps_name[i]).value), 2);
186 // console.log("prefs_update:: i break "+i+" ["+prefs_new.supp_comp+"]");
188 for (i = 0 ; i < 6 ; i++) {
189 $(l_comps_name[i]).value = parseInt(prefs_new.supp_comp.substr(i*2, 2), 16);
193 /* from form to struct */
194 prefs_apply(prefs_new, true, true);
197 function list_set(what, is_update, info)
201 var old_st = readCookie("CO_list");
203 if (what == 'auth') {
204 $('list_auth').style.color = 'red';
205 $('list_isol').style.color = 'black';
206 $('list_all').style.color = 'black';
207 if (old_st == 'isolation')
209 g_listen = l_list_auth;
211 else if (what == 'isolation') {
212 $('list_auth').style.color = 'black';
213 $('list_isol').style.color = 'red';
214 $('list_all').style.color = 'black';
215 if (old_st != 'isolation')
217 g_listen = l_list_isol;
220 $('list_auth').style.color = 'black';
221 $('list_isol').style.color = 'black';
222 $('list_all').style.color = 'red';
223 if (old_st == 'isolation')
225 g_listen = l_list_all;
228 set_checked_value($('ra_listen_auth'), what);
229 set_checked_value($('ra_listen_isol'), what);
230 set_checked_value($('ra_listen_all'), what);
232 $('list_info').innerHTML = info;
234 createCookie("CO_list", what, 24*365, cookiepath);
238 if (relo || !is_update) {
239 for (i = g_tables_appr_n ; i < g_tables_n ; i++) {
242 $('tr_noauth'+i).style.display = (what == 'isolation' ? 'none' : '');
245 $('td_noauth'+i).style.display = (what == 'isolation' ? 'none' : '');
247 if (what == 'isolation') {
255 // ricalculation of standup area
256 if (standup_data_old != null) {
257 standup_data = standup_data_old;
258 standup_data_old = null;
259 j_stand_cont(standup_data);