$ret = sprintf('gst.st = %d; ', $user_step);
if ($user->is_auth()) {
- $ret .= sprintf('/* g_prefsn.load(\'%s\'); */', json_encode($user->prefsn_get()));
- }
- if(false) {
- if ($user->flags & USER_FLAG_ISOLAUTH) {
- $ret .= 'list_set(\'isolation\', false, \''.$mlang_brisk['tit_onisol'][$G_lang].'\' ); ';
- }
- else if ($user->flags & USER_FLAG_LISTAUTH) {
- $ret .= 'list_set(\'auth\', false, \''.$mlang_brisk['tit_onauth'][$G_lang].'\' ); ';
- }
- else {
- $ret .= 'list_set(\'all\', false, \'\' ); ';
- }
+ $model = '{ "listen": { "__type": "radio" } }';
+ $content = '{ "listen": {"val": "' . ($user->flags & USER_FLAG_ISOLAUTH ? "2" :
+ ($user->flags & USER_FLAG_LISTAUTH ? "1" : "0")) .
+ '" } }';
+ $ret .= sprintf('g_prefsf.fields_descr_set(JSON.parse(\'%s\'));', $model);
+ $ret .= sprintf('g_prefsf.json2dom(JSON.parse(\'%s\'));', $content);
}
if ($user->subst == 'standup')
/*
* brisk - index.php
*
- * Copyright (C) 2006-2015 Matteo Nastasi
+ * Copyright (C) 2006-2016 Matteo Nastasi
* mailto: nastasi@alternativeoutput.it
* matteo.nastasi@milug.org
* web: http://www.alternativeoutput.it
<link rel="shortcut icon" href="img/brisk_ico.png">
<script type="text/javascript" src="commons.js"></script>
<script type="text/javascript" src="fieldify.js"></script>
-<script type="text/javascript" src="prefs.js"></script>
<script type="text/javascript" src="info.js"></script>
<!-- <script type="text/javascript" src="myconsole.js"></script> -->
<script type="text/javascript" src="menu.js"></script>
var g_tables_cert_n = <? echo TABLES_CERT_N; ?>;
var g_prefs, g_prefs_new = null;
var g_prefsn = null, g_prefsn_old = null;
-var g_prefsf = null;
var g_listen;
var g_withflash = false;
var g_is_spawn = 0;
var g_tables_cert_n = <? echo TABLES_CERT_N; ?>;
var g_prefs, g_prefs_new = null;
var g_prefsn = null, g_prefsn_old = null;
- var g_prefsf = null;
var g_listen;
var g_is_spawn = 0;
var g_withflash = false;
// var nonunload = false;
var spo_slide, sup_slide;
- function status_cb()
- {
- console.log("status_cb");
- }
-
+ /* room case */
window.onload = function() {
g_brow = get_browser_agent();
g_prefs = new client_prefs(null);
/* g_prefsn = new Prefsn($('prefsn')); */
- g_prefsf = new Fieldify(null, null, null, {}, "prefsf", [$("prefsf")], status_cb);
+ prefsf_initialize();
+ // console.log(g_prefsf);
spo_slide = new sideslide($('spon_caro'), 80, 20);
sup_slide = new sideslide($('supp_caro'), 80, 20);
+ g_prefsf.page_set('index_wr.php?mesg=prefsf');
<?php
if ($BRISK_SHOWHTML == "debugtable") {
?>
<!-- PREFSF -->
<div id="prefsf" class="notify" style="z-index: 200; width: 600px; margin-left: -300px; height: 240px; top: 150px; visibility: hidden;">
<div id="prefsf_child" style="background-color: text-align: left; border-bottom: 1px solid gray; overflow: auto; height: 370px;">
- <h4 style="text-align: left;"><?php echo $mlang_room['tit_prefs'][$G_lang]; ?></h4>
+ <h4 style="text-align: left;"><?php echo $mlang_room['tit_prefs'][$G_lang]; ?> <img style="border: 0px; position: relative;" id="prefsf-status-flag" src="img/light-none.png"></h4>
<table style="text-align: center; margin: auto; border-collapse: collapse;"><tr><td style="vertical-align: top;">
<tr><td style="vertical-align: top; border: 1px solid black; border-width: 1px 0px 1px 0px;">
<!--#
<span style="font-weight: bold;"><?php echo $mlang_room['itm_list'][$G_lang];?>:</span>
</td></tr>
<tr><td>
-<input class="listen_id" style="vertical-align: bottom;" type="radio" name="listen" value="0" onclick="prefs_update('listen');" title="<?php echo $mlang_room['listall_desc'][$G_lang];?>">
+<input class="listen_id" style="vertical-align: bottom;" type="radio" name="listen" value="0" title="<?php echo $mlang_room['listall_desc'][$G_lang];?>">
<span class="listen_t_id" data-ffy-value="0"><?php echo $mlang_room['tit_listall'][$G_lang];?></span>
</td></tr><tr><td>
-<input class="listen_id" style="vertical-align: bottom;" type="radio" name="listen" value="1" onclick="prefs_update('listen');" title="<?php echo $mlang_room['listaut_desc'][$G_lang];?>">
+<input class="listen_id" style="vertical-align: bottom;" type="radio" name="listen" value="1" title="<?php echo $mlang_room['listaut_desc'][$G_lang];?>">
<span class="listen_t_id" data-ffy-value="1"><?php echo $mlang_room['tit_listaut'][$G_lang];?></span>
</td></tr><tr><td>
-<input class="listen_id" style="vertical-align: bottom;" type="radio" name="listen" value="2" onclick="prefs_update('listen');" title="<?php echo $mlang_room['listisol_desc'][$G_lang];?>">
+<input class="listen_id" style="vertical-align: bottom;" type="radio" name="listen" value="2" title="<?php echo $mlang_room['listisol_desc'][$G_lang];?>">
<span class="listen_t_id" data-ffy-value="2"><?php echo $mlang_room['tit_listisol'][$G_lang];?></span>
</td></tr>
</table>
<div class="notify_clo">
<input type="submit" class="input_sub" style="bottom: 4px;" onclick="g_prefsf.visible(false);" value="<?php echo $mlang_room['btn_close'][$G_lang]; ?>"/>
<input type="submit" class="input_sub" style="bottom: 4px;" onclick="g_prefsf.reset();" value="<?php echo $mlang_room['btn_reset'][$G_lang]; ?>"/>
-<input type="submit" class="input_sub" style="bottom: 4px;" onclick="prefs_save();" value="<?php echo $mlang_room['btn_save'][$G_lang]; ?>"/>
+<input type="submit" class="input_sub" style="bottom: 4px;" onclick="g_prefsf.save();" value="<?php echo $mlang_room['btn_save'][$G_lang]; ?>"/>
</div>
</div> <!-- end prefsf -->
*
*/
+var mlang_prefsf = { 'btn_close' : { 'it' : 'Chiudi.',
+ 'en' : 'Close.' },
+ 'tit_list' : { '0' : { 'it' : '',
+ 'en' : '' },
+ '1' : { 'it' : '(solo aut.)',
+ 'en' : '(only aut.)' },
+ '2' : { 'it' : '(isolam.to)',
+ 'en' : '(isolation)' } }
+ };
+
var mlang_prefsn = { 'btn_close' : { 'it' : 'Chiudi.',
'en' : 'Close.' },
'tit_list' : { '0' : { 'it' : '',
}
}
}
+
+var g_prefsf = null;
+function g_prefsf_listen_cb(item)
+{
+ var whats = [ 'all', 'auth', 'isolation' ];
+ var what = whats[item.value];
+
+ console.log("change listen", item.value);
+
+ $('list_info').innerHTML = mlang_prefsf.tit_list[item.value][g_lang];
+
+ for (i = g_tables_cert_n + g_tables_auth_n ; i < g_tables_n ; i++) {
+ if (i % 4 == 0) {
+ $('tr_noauth'+i).style.display = (what == 'isolation' ? 'none' : '');
+ }
+ $('td_noauth'+i).style.display = (what == 'isolation' ? 'none' : '');
+ }
+ if (what == 'isolation') {
+ tra.hide_noauth();
+ }
+ else {
+ tra.show_noauth();
+ }
+}
+
+function prefsf_status_cb(st)
+{
+ // console.log('status_show HERE ' + st);
+ switch(st) {
+ case Fieldify.STATUS_OK:
+ $('prefsf-status-flag').src = 'img/light-green.png';
+ break;
+ case Fieldify.STATUS_PROC:
+ $('prefsf-status-flag').src = 'img/light-orange.png';
+ break;
+ default: // Fieldify.STATUS_ERR
+ $('prefsf-status-flag').src = 'img/light-red.png';
+ break;
+ }
+}
+
+
+
+function prefsf_initialize()
+{
+ clie_cb = { 'listen': { cb: g_prefsf_listen_cb, type: "fast" } };
+ g_prefsf = new Fieldify(null, null, null, clie_cb, "prefsf", [$("prefsf")], prefsf_status_cb);
+}