From: Matteo Nastasi (mop) Date: Wed, 6 Mar 2013 17:39:01 +0000 (+0100) Subject: reset button added to preferences window X-Git-Tag: v4.7.1~5 X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=commitdiff_plain;h=628c0ad0666348d62d0e46fcace789c38edb5350;p=brisk.git reset button added to preferences window --- diff --git a/web/index.php b/web/index.php index fc9442b..7166b5b 100644 --- a/web/index.php +++ b/web/index.php @@ -54,6 +54,8 @@ $mlang_room = array( 'userpasserr' => array('it' => 'Utente e/o password errati '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 ', @@ -1311,7 +1313,11 @@ else { -
+
+ + + +
diff --git a/web/index_wr.php b/web/index_wr.php index 347bf35..8571c76 100644 --- a/web/index_wr.php +++ b/web/index_wr.php @@ -203,32 +203,34 @@ function index_wr_main(&$room, $remote_addr_full, $get, $post, $cookie) 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; } diff --git a/web/prefs.js b/web/prefs.js index f0969f1..51b7eba 100644 --- a/web/prefs.js +++ b/web/prefs.js @@ -112,12 +112,19 @@ function prefs_save() 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;