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 return (new Fieldify([dobj], fields));
69 function info_show(username)
71 var info_in_in = server_request('index_wr.php', sess, 'mesg', 'chatt|/info ' +
72 encodeURIComponent(username));
73 var info_in = JSON.parse(info_in_in);
76 if (info_in.ret == 0) {
77 info = info_fld($('info'));
78 info.json2dom(info_in);
82 var noti = new notify(gst, info_in.mesg, 0, mlang_info['btn_close'][g_lang], 400, 150);
86 var g__info_show_target = "";
87 function info_show_cb(e)
89 if (g__info_show_target == e.target.innerHTML) {
90 g__info_show_target = "";
91 info_show(e.target.innerHTML);
94 g__info_show_target = e.target.innerHTML;
102 Fieldify.reset($('info'));
107 var info, jinfo, ret;
109 jinfo = Fieldify.dom2json($('info'));
111 ret = server_request('index_wr.php', sess, 'mesg', 'info|save','__POST__', 'info', JSON.stringify(jinfo));
114 Fieldify.actualize($('info'));