4 * Copyright (C) 2015 Matteo Nastasi
5 * mailto: nastasi@alternativeoutput.it
6 * matteo.nastasi@milug.org
7 * web: http://www.alternativeoutput.it
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details. You should have received a
18 * copy of the GNU General Public License along with this program; if
19 * not, write to the Free Software Foundation, Inc, 59 Temple Place -
20 * Suite 330, Boston, MA 02111-1307, USA.
24 var mlang_info = { 'btn_close' : { 'it' : 'Chiudi.',
28 function info_onlyifknown_isvisible_cb(item)
32 if (item.value == 'black' || item.value == 'unknown') {
36 $('info').getElementsByClassName('onlyifknown_gid')[0].style.visibility = vis;
40 function info_fld(dobj)
42 var fields = { login: { type: 'value', perms: 'key' },
43 state: { type: 'value', perms: 'ro' },
44 guar: { type: 'value', perms: 'ro' },
46 widefriend: { type: 'fields', fields: { skill: { type: 'value', perms: 'ro' },
47 black: { type: 'value', perms: 'ro' },
48 test: { type: 'value', perms: 'ro'},
49 friend: { type: 'value', perms: 'ro'},
50 bff: { type: 'value', perms: 'ro'}
52 narrowfriend: { type: 'fields', fields: { skill: { type: 'value', perms: 'ro' },
53 black: { type: 'value', perms: 'ro'},
54 test: { type: 'value', perms: 'ro'},
55 friend: { type: 'value', perms: 'ro'},
56 bff: { type: 'value', perms: 'ro'}
58 match: { type: 'value', perms: 'ro' },
59 game: { type: 'value', perms: 'ro' },
60 party: { type: 'value', perms: 'ro' },
61 friend: { type: 'radio', cb: info_onlyifknown_isvisible_cb },
62 skill: { type: 'radio' },
63 trust: { type: 'radio' }
66 var ret = new Fieldify([dobj], fields);
70 function info_show(username)
72 var info_in_in = server_request('index_wr.php', sess, 'mesg', 'chatt|/info ' +
73 encodeURIComponent(username));
74 var info_in = JSON.parse(info_in_in);
77 if (info_in.ret == 0) {
78 info = info_fld($('info'));
79 info.json2dom(info_in);
83 var noti = new notify(gst, info_in.mesg, 0, mlang_info['btn_close'][g_lang], 400, 150);
87 var g__info_show_target = "";
88 function info_show_cb(e)
90 if (g__info_show_target == e.target.innerHTML) {
91 g__info_show_target = "";
92 info_show(e.target.innerHTML);
95 g__info_show_target = e.target.innerHTML;
103 Fieldify.reset($('info'));
108 var info, jinfo, ret;
110 jinfo = Fieldify.dom2json($('info'));
112 ret = server_request('index_wr.php', sess, 'mesg', 'info|save','__POST__', 'info', JSON.stringify(jinfo));
115 Fieldify.actualize($('info'));