'en' => 'Exit.'),
'btn_prefs_save' => array('it' => 'Salva.',
'en' => 'Save.'),
+ 'btn_prefs_reset' => array('it' => 'Annulla.',
+ 'en' => 'Reset.'),
'btn_prefs_close' => array('it' => 'Chiudi.',
'en' => 'Close.'),
'tit_tabl' => array('it' => 'Tavolo ',
</div>
-<div class="notify_clo"><input type="submit" class="input_sub" style="bottom: 4px;" onclick="$('preferences').style.visibility = 'hidden';" value="<?php echo $mlang_room['btn_prefs_close'][$G_lang]; ?>"/> <input type="submit" class="input_sub" style="bottom: 4px;" onclick="prefs_save();" value="<?php echo $mlang_room['btn_prefs_save'][$G_lang]; ?>"/></div>
+<div class="notify_clo">
+<input type="submit" class="input_sub" style="bottom: 4px;" onclick="$('preferences').style.visibility = 'hidden';" value="<?php echo $mlang_room['btn_prefs_close'][$G_lang]; ?>"/>
+<input type="submit" class="input_sub" style="bottom: 4px;" onclick="prefs_reset();" value="<?php echo $mlang_room['btn_prefs_reset'][$G_lang]; ?>"/>
+<input type="submit" class="input_sub" style="bottom: 4px;" onclick="prefs_save();" value="<?php echo $mlang_room['btn_prefs_save'][$G_lang]; ?>"/>
+</div>
</div>
</body>
</html>
log_wr("PING RECEIVED");
}
else if ($argz[0] == 'prefs') {
- fprintf(STDERR, "\n\n PREFS pre\n\n");
- if (!isset($post['prefs'])) {
- return FALSE;
- }
+ if ($argz[1] == 'save') {
+ if (!isset($post['prefs'])) {
+ return FALSE;
+ }
- if (($prefs = Client_prefs::from_json($post['prefs'])) == FALSE) {
+ if (($prefs = Client_prefs::from_json($post['prefs'])) == FALSE) {
+ $prefs = Client_prefs::from_user($user);
+ }
+ $prefs->store($user, TRUE);
+ }
+ else { // reset case as default
$prefs = Client_prefs::from_user($user);
}
- fprintf(STDERR, "\n\n PREFS [%s]\n\n", print_r($prefs, TRUE));
-
- $prefs->store($user, TRUE);
-
$user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ";
$user->comm[$user->step % COMM_N] .= sprintf('prefs_load(\'%s\', true, %s);', json_encode($prefs),
'false');
$user->step_inc();
- if ($user->stat == 'room' && $user->subst == 'standup') {
- $room->standup_update($user);
- }
- else if ($user->stat == 'room' && $user->subst == 'sitdown') {
- log_main("chatt_send pre table update");
- $room->table_update($user);
- log_main("chatt_send post table update");
+ if ($argz[1] == 'save') {
+ if ($user->stat == 'room' && $user->subst == 'standup') {
+ $room->standup_update($user);
+ }
+ else if ($user->stat == 'room' && $user->subst == 'sitdown') {
+ log_main("chatt_send pre table update");
+ $room->table_update($user);
+ log_main("chatt_send post table update");
+ }
}
-
echo "1";
return TRUE;
}
if (typeof(g_prefs) == 'undefined')
return false;
- ret = server_request('mesg', 'prefs','__POST__', 'prefs', JSON.stringify(g_prefs));
+ ret = server_request('mesg', 'prefs|save','__POST__', 'prefs', JSON.stringify(g_prefs));
if (ret == 1)
$('preferences').style.visibility = 'hidden';
}
+function prefs_reset()
+{
+ var ret;
+
+ ret = server_request('mesg', 'prefs|reset');
+}
+
function prefs_update(field)
{
var i;