From: Matteo Nastasi (mop) Date: Thu, 31 Jan 2013 07:17:45 +0000 (+0100) Subject: first step of the preferences management X-Git-Tag: v4.7.1~25 X-Git-Url: https://mop.ddnsfree.com/gitweb/?p=brisk.git;a=commitdiff_plain;h=22b71dd0fd76bf5af565d56c3e82ea77b4b44bc5 first step of the preferences management --- diff --git a/TODO.txt b/TODO.txt index 6a01e31..ef083d3 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,6 +1,22 @@ TODO | ------+ + FEATURES | + ----------+ + - prefs API: + . prefs_save (save to the server the new prefs) + . prefs_load (load prefs structure with a json) + . prefs_apply (from server, and after prefs_save if success) + + - preferences (listen into preferences) + . update values + . database change + + - preferences (with "modifiable S") + . Mod. S: new flag into database + . graph infrastructure + . new box to edit color + MAJOR | -------+ - BUG: some connection to the named socket fails diff --git a/doc/ARCHITECTURE.txt b/doc/ARCHITECTURE.txt index f8ce26c..45d7c24 100644 --- a/doc/ARCHITECTURE.txt +++ b/doc/ARCHITECTURE.txt @@ -2,6 +2,16 @@ Sparse documentation about Brisk. Many things aren't documented at all, but I start with authentication workflow. +==== MODIFY USERS TABLE ==== + +=== PHP CODE === + +web/Obj/dbase_base.phh + function LoginDBItem -> args & body + function LoginDBItemFromRecord -> args & body + +=== SQL CODE === +sql/sql.d/nnn-name-patch.sql AUTHENTICATION WORKFLOW diff --git a/sql/sql.d/100-anagr.sql.noinsert b/sql/sql.d/100-anagr.sql.noinsert index 805211d..f4e1400 100644 --- a/sql/sql.d/100-anagr.sql.noinsert +++ b/sql/sql.d/100-anagr.sql.noinsert @@ -9,9 +9,9 @@ -- define(USER_FLAG_TY_SUSPEND, 0x00400000); // done -- define(USER_FLAG_TY_DISABLE, 0x00800000); // done -INSERT INTO #PFX#users VALUES (1, 'uno', md5('one'), 'uno@pluto.com', CAST (X'00020000' as integer)); -INSERT INTO #PFX#users VALUES (2, 'due', md5('two'), 'due@pluto.com', CAST (X'00010000' as integer)); -INSERT INTO #PFX#users VALUES (3, 'tre', md5('thr'), 'tre@pluto.com', CAST (X'00010000' as integer)); -INSERT INTO #PFX#users VALUES (4, 'qua', md5('for'), 'qua@pluto.com', CAST (X'00010000' as integer)); -INSERT INTO #PFX#users VALUES (5, 'cin', md5('fiv'), 'cin@pluto.com', CAST (X'00010000' as integer)); +INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (1, 'uno', md5('one'), 'uno@pluto.com', CAST (X'00020000' as integer), 0); +INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (2, 'due', md5('two'), 'due@pluto.com', CAST (X'00010000' as integer), 0); +INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (3, 'tre', md5('thr'), 'tre@pluto.com', CAST (X'00010000' as integer), 0); +INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (4, 'qua', md5('for'), 'qua@pluto.com', CAST (X'00010000' as integer), 0); +INSERT INTO #PFX#users (code, login, pass, email, type, flags) VALUES (5, 'cin', md5('fiv'), 'cin@pluto.com', CAST (X'00010000' as integer), 0); diff --git a/web/Obj/brisk.phh b/web/Obj/brisk.phh index 804c6ee..db99007 100644 --- a/web/Obj/brisk.phh +++ b/web/Obj/brisk.phh @@ -695,6 +695,16 @@ class Delay_Manager } } +class Client_prefs { + var $listen; + + function Client_prefs($listen) + { + $this->listen = $listen; + } +} + + class Room { static $delta_t; @@ -916,6 +926,9 @@ class Room $ret = sprintf('gst.st = %d; ', $user_step); + $prefs = new Client_prefs(($user->flags & USER_FLAG_MAP_AUTH) >> 2); + $ret .= sprintf('var prefs_new = prefs_load(\'%s\'); console.log(prefs_new);', json_encode($prefs)); + if ($user->flags & USER_FLAG_ISOLAUTH) { $ret .= 'list_set(\'isolation\', false, \''.$mlang_brisk['tit_onisol'][$G_lang].'\' ); '; } diff --git a/web/Obj/dbase_base.phh b/web/Obj/dbase_base.phh index d567418..d82de62 100644 --- a/web/Obj/dbase_base.phh +++ b/web/Obj/dbase_base.phh @@ -74,11 +74,4 @@ class LoginDBItem { } -class LoginDBItemOld extends LoginDBItem { - function LoginDBItemOld($login, $pass, $email, $type) - { - parent::LoginDBItem(-1, $login, $pass, $email, $type); - } -} - ?> \ No newline at end of file diff --git a/web/Obj/user.phh b/web/Obj/user.phh index b7409de..f388603 100644 --- a/web/Obj/user.phh +++ b/web/Obj/user.phh @@ -57,6 +57,7 @@ define('USER_FLAG_S_ALL', 0xf00); // done define('USER_FLAG_TY_ALL', 0xff0000); // done define('USER_FLAG_TY_NORM', 0x010000); // done define('USER_FLAG_TY_SUPER', 0x020000); // done +define('USER_FLAG_TY_CERT', 0x040000); // done // ... other usefull status ... define('USER_FLAG_TY_SUSPEND', 0x400000); // done define('USER_FLAG_TY_DISABLE', 0x800000); // done diff --git a/web/index.php b/web/index.php index d89a091..da98a0a 100644 --- a/web/index.php +++ b/web/index.php @@ -52,6 +52,10 @@ $mlang_room = array( 'userpasserr' => array('it' => 'Utente e/o password errati 'en' => 'back to tables'), 'btn_exit' => array('it' => 'Esco.', 'en' => 'Exit.'), + 'btn_prefs_update' => array('it' => 'Salva.', + 'en' => 'Save.'), + 'btn_prefs_close' => array('it' => 'Chiudi.', + 'en' => 'Close.'), 'tit_tabl' => array('it' => 'Tavolo ', 'en' => 'Table '), 'tit_stat' => array('it' => 'imposta lo stato del tuo utente', @@ -119,6 +123,10 @@ $mlang_room = array( 'userpasserr' => array('it' => 'Utente e/o password errati 'en' => 'splash'), 'splash_desc' => array('it' => 'attiva la finestra di splash', 'en' => 'show the splash window'), + 'tit_prefs' => array('it' => 'preferenze', + 'en' => 'preferences'), + 'prefs_desc' => array('it' => 'preferenze dell\' utente', + 'en' => 'user\'s preferences'), 'tit_help' => array('it' => 'informazioni utili su Brisk', 'en' => 'usefull information about Brisk'), 'itm_help' => array('it' => 'aiuto', @@ -757,14 +765,6 @@ google_color_url = "000000"; .$mlang_room['st_visch_desc'][$G_lang]. ' 
-
-
' - // MLANG ascolta - .$mlang_room['itm_list'][$G_lang]. -'
-
+'.($user->flags & USER_FLAG_AUTH ? ' +
' + // MLANG garantisci + .$mlang_room['tit_prefs'][$G_lang].'
' : '').' '.($G_with_poll ? '' : '
').' @@ -1208,7 +1158,7 @@ type="submit" class="button" onclick="this.form.elements['realsub'].value = 'chi

- +

@@ -1237,6 +1187,47 @@ type="submit" class="button" onclick="this.form.elements['realsub'].value = 'chi
+