+/* FIXME: move to html page with dynamic valorization */
+var is_supp_custom = true;
+
+function Prefsn(obj)
+{
+ var fields = { listen: { type: 'radio', cb: Prefsn.listen_change_cb } };
+ if (is_supp_custom) {
+ fields.fg = {
+ type: 'fields', fields: { r: { type: 'value' },
+ g: { type: 'value' },
+ b: { type: 'value' }
+ }
+ };
+ fields.bg = {
+ type: 'fields', fields: { r: { type: 'value' },
+ g: { type: 'value' },
+ b: { type: 'value' }
+ }
+ };
+ }
+
+ this.fieldify = new Fieldify([obj], fields);
+ this.obj = obj;
+ this.data = null;
+}
+
+Prefsn.listen_change_cb = function(field)
+{
+ var i;
+ var prefs_new;
+ var relo = false;
+
+ console.log("listen_change_cb:" + field.value);
+ console.log("xx" + g_prefsn.data);
+
+ /* listen management */
+ if (g_prefsn.data == null || g_prefsn.data.listen != field.value) {
+ $('list_info').innerHTML = mlang_prefsn['tit_list'][field.value][g_lang];
+ console.log('update listen');
+ for (i = g_tables_auth_n ; i < g_tables_n ; i++) {
+ if (i % 4 == 0) {
+ $('tr_noauth'+i).style.display = (field.value == l_list_isol ? 'none' : '');
+ }
+
+ $('td_noauth'+i).style.display = (field.value == l_list_isol ? 'none' : '');
+ }
+ if (field.value == l_list_isol) {
+ tra.hide_noauth();
+ }
+ else {
+ tra.show_noauth();
+ }
+ }
+}
+
+Prefsn.supp_change_cb = function(field)
+{
+ var i;
+ var prefs_new;
+ var relo = false;
+ // console.log("prefs_update("+field+")");
+
+ if (typeof(g_prefsn) == 'undefined')
+ return false;
+
+ for (i = 0 ; i < 6 ; i++) {
+ if (parseInt($(l_comps_name[i]).value) < 0 || parseInt($(l_comps_name[i]).value) > 255 ||
+ isNaN(parseInt($(l_comps_name[i]).value))) {
+ break;
+ }
+ }
+
+ if (i == 6) {
+ prefs_new.supp_comp = "";
+ for (i = 0 ; i < 6 ; i++) {
+ prefs_new.supp_comp += dec2hex(parseInt($(l_comps_name[i]).value), 2);
+ }
+ }
+
+ // console.log("prefs_update:: i break "+i+" ["+prefs_new.supp_comp+"]");
+
+ for (i = 0 ; i < 6 ; i++) {
+ $(l_comps_name[i]).value = parseInt(prefs_new.supp_comp.substr(i*2, 2), 16);
+ }
+
+ /* from form to struct */
+ // prefs_apply(prefs_new, true, true);
+};
+
+
+
+Prefsn.prototype = {
+ obj: null,
+ fieldify: null,
+ data: null,
+
+ load: function(data) {
+ var in_data = JSON.parse(data);
+ this.fieldify.json2dom(in_data);
+ this.data = in_data;
+ },
+
+ reset: function() {
+ console.log('here');
+ Fieldify.reset(this.obj);
+ },
+
+ show: function() {
+ this.fieldify.visible(true);
+ }
+}
+
+function prefsn_show(username)
+{
+ var prefsn_in_in = server_request('index_wr.php', sess, 'mesg', 'chatt|/prefsn');
+ var prefsn_in = JSON.parse(prefsn_in_in);
+ var prefsn = null;
+
+ if (prefsn_in.ret == 0) {
+ prefsn = prefsn_fld($('prefsn'));
+ prefsn.json2dom(prefsn_in);
+ prefsn.visible(true);
+ }
+ else {
+ var noti = new notify(gst, prefsn_in.mesg, 0, mlang_prefsn['btn_close'][g_lang], 400, 150);
+ }
+}
+
+function prefsn_reset()
+{
+ Fieldify.reset($('prefsn'));
+}
+
+
+
+
+
+