2 var l_list_auth = 0x01;
3 var l_list_isol = 0x02;
5 function client_prefs(old)
8 this.listen = old.listen;
9 this.supp_comp = old.supp_comp;
13 client_prefs.prototype = {
15 supp_comp: 'ff00ffff00'
18 function prefs_assign(content)
23 s = "prefs_new = " + content;
29 var prefs_list_idx = new Array( 0x00, 0x01, 0x02 );
30 var prefs_list_id = new Array( "all", "auth", "isol" );
32 function prefs_apply(prefs_new, is_update, is_volat)
37 if (typeof(g_prefs) == 'undefined')
39 /* listen management */
40 if (g_prefs.listen != prefs_new.listen || is_update) {
41 for (i = 0 ; i < prefs_list_idx.length ; i++) {
42 set_checked_value($('ra_listen_'+prefs_list_id[i]), prefs_new.listen);
43 if (prefs_new.listen == prefs_list_idx[i]) {
45 $('list_'+prefs_list_id[i]).style.color = 'red';
46 $('list_info').innerHTML = mlang_commons['tit_list'][i][g_lang];
50 $('list_'+prefs_list_id[i]).style.color = 'black';
57 // supporter component management
58 if (g_prefs.supp_comp != prefs_new.supp_comp || is_update) {
59 $('s_img').src = 'suprend.php?comp='+prefs_new.supp_comp;
62 if (relo || !is_update) {
63 for (i = g_tables_auth_n ; i < g_tables_n ; i++) {
65 $('tr_noauth'+i).style.display = (prefs_new.listen == l_list_isol ? 'none' : '');
68 $('td_noauth'+i).style.display = (prefs_new.listen == l_list_isol ? 'none' : '');
70 if (prefs_new.listen == l_list_isol) {
78 // ricalculation of standup area
79 if (standup_data_old != null) {
80 standup_data = standup_data_old;
81 standup_data_old = null;
82 j_stand_cont(standup_data);
87 g_prefs.listen = prefs_new.listen;
88 g_prefs.supp_comp = prefs_new.supp_comp;
91 function prefs_load(content, is_update, is_volat)
95 // console.log('prefs_load('+content+')');
97 if ((prefs_new = prefs_assign(content)) == null)
100 return prefs_apply(prefs_new, is_update, is_volat);
103 function prefs_save()
107 if (typeof(g_prefs) == 'undefined')
110 ret = server_request('mesg', 'prefs','__POST__', 'prefs', JSON.stringify(g_prefs));
113 $('preferences').style.visibility = 'hidden';
116 function prefs_update(field)
122 // console.log("prefs_update("+field+")");
124 if (typeof(g_prefs) == 'undefined')
127 prefs_new = new client_prefs(g_prefs);
129 if (field == 'listen') {
130 /* listen management */
131 for (i = 0 ; i < prefs_list_idx.length ; i++) {
132 prefs_new.listen = get_checked_value($('ra_listen_'+prefs_list_id[i]));
133 if (prefs_new.listen != '')
137 else if (field == 'supp') {
138 prefs_new.supp_comp = "" + dec2hex($('s_fg_r').value, 2) + dec2hex($('s_fg_g').value, 2) + dec2hex($('s_fg_b').value, 2) + dec2hex($('s_bg_r').value, 2) + dec2hex($('s_bg_g').value, 2) + dec2hex($('s_bg_b').value, 2);
141 /* from form to struct */
142 prefs_apply(prefs_new, true, true);
145 function list_set(what, is_update, info)
149 var old_st = readCookie("CO_list");
151 if (what == 'auth') {
152 $('list_auth').style.color = 'red';
153 $('list_isol').style.color = 'black';
154 $('list_all').style.color = 'black';
155 if (old_st == 'isolation')
157 g_listen = l_list_auth;
159 else if (what == 'isolation') {
160 $('list_auth').style.color = 'black';
161 $('list_isol').style.color = 'red';
162 $('list_all').style.color = 'black';
163 if (old_st != 'isolation')
165 g_listen = l_list_isol;
168 $('list_auth').style.color = 'black';
169 $('list_isol').style.color = 'black';
170 $('list_all').style.color = 'red';
171 if (old_st == 'isolation')
173 g_listen = l_list_all;
176 set_checked_value($('ra_listen_auth'), what);
177 set_checked_value($('ra_listen_isol'), what);
178 set_checked_value($('ra_listen_all'), what);
180 $('list_info').innerHTML = info;
182 createCookie("CO_list", what, 24*365, cookiepath);
186 if (relo || !is_update) {
187 for (i = g_tables_auth_n ; i < g_tables_n ; i++) {
190 $('tr_noauth'+i).style.display = (what == 'isolation' ? 'none' : '');
193 $('td_noauth'+i).style.display = (what == 'isolation' ? 'none' : '');
195 if (what == 'isolation') {
203 // ricalculation of standup area
204 if (standup_data_old != null) {
205 standup_data = standup_data_old;
206 standup_data_old = null;
207 j_stand_cont(standup_data);