fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [6467] Login: remember users language


From: Sigurd Nes
Subject: [Fmsystem-commits] [6467] Login: remember users language
Date: Mon, 11 Oct 2010 09:12:28 +0000

Revision: 6467
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6467
Author:   sigurdne
Date:     2010-10-11 09:12:28 +0000 (Mon, 11 Oct 2010)
Log Message:
-----------
Login: remember users language

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.translation.inc.php
    trunk/phpgwapi/inc/functions.inc.php
    trunk/phpgwapi/inc/sso/include_login.inc.php

Modified: trunk/phpgwapi/inc/class.translation.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.translation.inc.php        2010-10-10 21:40:37 UTC 
(rev 6466)
+++ trunk/phpgwapi/inc/class.translation.inc.php        2010-10-11 09:12:28 UTC 
(rev 6467)
@@ -58,13 +58,13 @@
                */
                public function __construct($reset = false)
                {
-                       $lang = 
isset($GLOBALS['phpgw_info']['server']['default_lang']) && 
$GLOBALS['phpgw_info']['server']['default_lang']? 
$GLOBALS['phpgw_info']['server']['default_lang'] : 'en';
+                       $userlang = 
isset($GLOBALS['phpgw_info']['server']['default_lang']) && 
$GLOBALS['phpgw_info']['server']['default_lang']? 
$GLOBALS['phpgw_info']['server']['default_lang'] : 'en';
                        if ( 
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) )
                        {
-                               $lang = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+                               $userlang = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
                        }
 
-                       $this->set_userlang($lang);
+                       $this->set_userlang($userlang);
 
                        if ( 
isset($GLOBALS['phpgw_info']['server']['collect_missing_translations']) 
                                && 
$GLOBALS['phpgw_info']['server']['collect_missing_translations'])
@@ -272,7 +272,11 @@
                                $this->lang = array();
                        }
 
-                       $userlang = 'en';
+                       if ( !$userlang = $this->userlang )
+                       {
+                               $userlang = 'en';
+                       }
+
                        if ( 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] )
                        {
                                $userlang = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];

Modified: trunk/phpgwapi/inc/functions.inc.php
===================================================================
--- trunk/phpgwapi/inc/functions.inc.php        2010-10-10 21:40:37 UTC (rev 
6466)
+++ trunk/phpgwapi/inc/functions.inc.php        2010-10-11 09:12:28 UTC (rev 
6467)
@@ -403,15 +403,18 @@
                }
                list(,$GLOBALS['phpgw_info']['user']['domain']) = 
explode('@',$GLOBALS['login']);
        }
-       else    // on "normal" pageview
+       else if (phpgw::get_var('domain', 'string', 'REQUEST', false))
        {
-//             $GLOBALS['phpgw_info']['user']['domain'] = 
phpgw::get_var('domain', 'string', 'REQUEST', false);
-
+               // on "normal" pageview
                if(!$GLOBALS['phpgw_info']['user']['domain'] = 
phpgw::get_var('domain', 'string', 'REQUEST', false))
                {
                        $GLOBALS['phpgw_info']['user']['domain'] = 
phpgw::get_var('domain', 'string', 'COOKIE', false);
                }
        }
+       else
+       {
+               $GLOBALS['phpgw_info']['user']['domain'] = 
phpgw::get_var('last_domain', 'string', 'COOKIE', false);
+       }
 
        if 
(isset($GLOBALS['phpgw_domain'][$GLOBALS['phpgw_info']['user']['domain']]))
        {

Modified: trunk/phpgwapi/inc/sso/include_login.inc.php
===================================================================
--- trunk/phpgwapi/inc/sso/include_login.inc.php        2010-10-10 21:40:37 UTC 
(rev 6466)
+++ trunk/phpgwapi/inc/sso/include_login.inc.php        2010-10-11 09:12:28 UTC 
(rev 6467)
@@ -198,7 +198,23 @@
 
                function phpgw_display_login($variables)
                {
-                       
+                       // If the lastloginid cookies isn't set, we will 
default to default_lang - then to english.
+                       // Change this if you need.
+
+                       
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = 
isset($GLOBALS['phpgw_info']['server']['default_lang']) && 
$GLOBALS['phpgw_info']['server']['default_lang']? 
$GLOBALS['phpgw_info']['server']['default_lang'] : 'en';
+                       if (isset($_COOKIE['last_loginid']))
+                       {
+                               $accounts = CreateObject('phpgwapi.accounts');
+                               $prefs = CreateObject('phpgwapi.preferences', 
$accounts->name2id($_COOKIE['last_loginid']));
+
+                               if ($prefs->account_id)
+                               {
+                                       
$GLOBALS['phpgw_info']['user']['preferences'] = $prefs->read();
+                               }
+                               #print 'LANG:' . 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] . '<br>';
+                               
$GLOBALS['phpgw']->translation->set_userlang($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'],
 $reset = true);
+                       }
+
                        $lang = array
                        (
                                'domain'        => lang('domain'),
@@ -221,7 +237,6 @@
                        }
                
                        $this->tmpl->set_file(array('login_form'  => 
'login.tpl'));
-                       $this->tmpl->set_var('charset', lang('charset'));
 
                        $this->tmpl->set_block('login_form', 'message_block', 
'message_blocks');
                        $this->tmpl->set_block('login_form', 'domain_option', 
'domain_options');
@@ -280,27 +295,6 @@
                                
                        }
 
-                       if (isset($_COOKIE['last_loginid']))
-                       {
-                               $accounts = CreateObject('phpgwapi.accounts');
-                               $prefs = CreateObject('phpgwapi.preferences', 
$accounts->name2id($_COOKIE['last_loginid']));
-
-                               if (! $prefs->account_id)
-                               {
-                                       
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = 'en';
-                               }
-                               else
-                               {
-                                       
$GLOBALS['phpgw_info']['user']['preferences'] = $prefs->read();
-                               }
-                               #print 'LANG:' . 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] . '<br>';
-                       }
-                       else
-                       {
-                               // If the lastloginid cookies isn't set, we 
will default to english.
-                               // Change this if you need.
-                               
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = 'en';
-                       }
                        $GLOBALS['phpgw']->translation->add_app('login');
                        $GLOBALS['phpgw']->translation->add_app('loginscreen');
                        if ( ($login_msg = lang('loginscreen_message') ) != 
'!loginscreen_message')
@@ -423,7 +417,7 @@
                                $this->tmpl->set_var('lang_login', 
$variables['lang_login']);
                        }
 
-                       $this->tmpl->set_var('lang_testjs', lang('Your browser 
does not support javascript and/or css, please use a modern standards compliant 
browser.  If you have disabled either of these features please enable them for 
this site.') );
+       //              $this->tmpl->set_var('lang_testjs', lang('Your browser 
does not support javascript and/or css, please use a modern standards compliant 
browser.  If you have disabled either of these features please enable them for 
this site.') );
 
                        if(isset($variables['lang_additional_url']) && 
isset($variables['additional_url']))
                        {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]