phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: /sitemgr/sitemgr-site/inc class.bo.inc.php,1.6.2


From: Patrick Walsh <address@hidden>
Subject: [Phpgroupware-cvs] CVS: /sitemgr/sitemgr-site/inc class.bo.inc.php,1.6.2.1,1.6.2.2 class.so.inc.php,1.1.1.1,1.1.1.1.2.1 class.ui.inc.php,1.7.2.2,1.7.2.3
Date: Fri, 01 Nov 2002 01:25:17 -0500

Update of /cvsroot/phpgroupware//sitemgr/sitemgr-site/inc
In directory subversions:/tmp/cvs-serv18611/inc

Modified Files:
      Tag: Version-0_9_14-branch
        class.bo.inc.php class.so.inc.php class.ui.inc.php 
Log Message:
mostly translation updates


Index: class.bo.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//sitemgr/sitemgr-site/inc/class.bo.inc.php,v
retrieving revision 1.6.2.1
retrieving revision 1.6.2.2
diff -C2 -r1.6.2.1 -r1.6.2.2
*** class.bo.inc.php    18 Oct 2002 23:22:22 -0000      1.6.2.1
--- class.bo.inc.php    1 Nov 2002 06:25:14 -0000       1.6.2.2
***************
*** 40,44 ****
                        $this->page->subtitle = '';
                        $indexarray = $this->getIndex();
!                       $content = "\n".'<table border="0" width="100%" 
align="left" cellspacing="1" cellpadding="0"><tr>';
                        $catname = '';
                        foreach($indexarray as $page)
--- 40,46 ----
                        $this->page->subtitle = '';
                        $indexarray = $this->getIndex();
!                       $content = "\n".
!                               '<table border="0" width="100%" align="left" 
cellspacing="1" cellpadding="0">
!                               <tr>';
                        $catname = '';
                        foreach($indexarray as $page)
***************
*** 317,320 ****
--- 319,385 ----
                {
                        return $this->acl->is_admin();
+               }
+ 
+               //like $GLOBALS['phpgw']->common->getPreferredLanguage,
+               //but compares languages accepted by the user 
+               //to the languages the website is configured for
+               //instead of the languages installed in phpgroupware
+               function setsitemgrPreferredLanguage()
+               {
+                       $supportedLanguages = 
$GLOBALS['sitemgr_info']['sitelanguages'] ? 
$GLOBALS['sitemgr_info']['sitelanguages'] : array('en');
+                       $postlang = $_POST['language'];
+                       if ($postlang && 
in_array($postlang,$supportedLanguages))
+                       {
+                               
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $postlang;
+                               
$GLOBALS['phpgw']->session->appsession('language','sitemgr-site',$postlang);
+                               return;
+                       }
+                   
+                       $sessionlang = 
$GLOBALS['phpgw']->session->appsession('language','sitemgr-site');
+                       if ($sessionlang)
+                       {
+                               
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $sessionlang;
+                               return;
+                       }
+                       
+                   if ($this->is_user())
+                       {
+                               $userlang = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'];
+                               if (in_array($userlang,$supportedLanguages))
+                               {
+                               //we do not touch 
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] if
+                               //the user is registered and his lang 
preference is supported by the website,
+                               //but save it to the appsession for quicker 
retrieval
+                               
$GLOBALS['phpgw']->session->appsession('language','sitemgr-site',$userlang);
+                           return;
+                               }
+                       }
+                                    
+                       // create a array of languages the user is accepting
+                       $userLanguages = 
explode(',',$GLOBALS['HTTP_ACCEPT_LANGUAGE']);
+                   
+                       // find usersupported language
+                       while (list($key,$value) = each($userLanguages))
+                       {
+                               // remove everything behind '-' example: de-de
+                               $value = trim($value);
+                               $pieces = explode('-', $value);
+                               $value = $pieces[0];
+                               //print "current lang $value<br>";
+                               if (in_array($value,$supportedLanguages))
+                               {
+                                       $userlang = $value;
+                                       break;
+                               }
+                       }
+ 
+                       // no usersupported language found -> return the first 
entry of sitelanguages
+                       if (empty($userlang))
+                       {
+                               $userlang = $supportedLanguages[0];
+                       }
+                   
+                       
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] = $userlang;
+                       
$GLOBALS['phpgw']->session->appsession('language','sitemgr-site',$userlang);
                }
  

Index: class.so.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//sitemgr/sitemgr-site/inc/class.so.inc.php,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -C2 -r1.1.1.1 -r1.1.1.1.2.1
*** class.so.inc.php    29 Aug 2002 03:03:31 -0000      1.1.1.1
--- class.so.inc.php    1 Nov 2002 06:25:14 -0000       1.1.1.1.2.1
***************
*** 1,12 ****
  <?php
!       
/***************************************************************************\
!       * phpGroupWare - Web Content Manager                                    
    *
!       * http://www.phpgroupware.org                                           
    *
!       * -------------------------------------------------                     
    *
!       * This program is free software; you can redistribute it and/or modify 
it   *
!       * under the terms of the GNU General Public License as published by the 
    *
!       * Free Software Foundation; either version 2 of the License, or (at 
your    *
!       * option) any later version.                                            
    *
!       
\***************************************************************************/
        /* $Id$ */
  
--- 1,12 ----
  <?php
!       
/**************************************************************************\
!       * phpGroupWare - Web Content Manager                                    
   *
!       * http://www.phpgroupware.org                                           
   *
!       * -------------------------------------------------                     
   *
!       * This program is free software; you can redistribute it and/or modify 
it  *
!       * under the terms of the GNU General Public License as published by the 
   *
!       * Free Software Foundation; either version 2 of the License, or (at 
your   *
!       * option) any later version.                                            
   *
!       
\**************************************************************************/
        /* $Id$ */
  

Index: class.ui.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware//sitemgr/sitemgr-site/inc/class.ui.inc.php,v
retrieving revision 1.7.2.2
retrieving revision 1.7.2.3
diff -C2 -r1.7.2.2 -r1.7.2.3
*** class.ui.inc.php    18 Oct 2002 23:22:22 -0000      1.7.2.2
--- class.ui.inc.php    1 Nov 2002 06:25:14 -0000       1.7.2.3
***************
*** 1,12 ****
  <?php
!       
/***************************************************************************\
!       * phpGroupWare - Web Content Manager                                    
    *
!       * http://www.phpgroupware.org                                           
    *
!       * -------------------------------------------------                     
    *
!       * This program is free software; you can redistribute it and/or modify 
it   *
!       * under the terms of the GNU General Public License as published by the 
    *
!       * Free Software Foundation; either version 2 of the License, or (at 
your    *
!       * option) any later version.                                            
    *
!       
\***************************************************************************/
        /* $Id$ */
  
--- 1,12 ----
  <?php
!       
/**************************************************************************\
!       * phpGroupWare - Web Content Manager                                    
   *
!       * http://www.phpgroupware.org                                           
   *
!       * -------------------------------------------------                     
   *
!       * This program is free software; you can redistribute it and/or modify 
it  *
!       * under the terms of the GNU General Public License as published by the 
   *
!       * Free Software Foundation; either version 2 of the License, or (at 
your   *
!       * option) any later version.                                            
   *
!     
\**************************************************************************/
        /* $Id$ */
  
***************
*** 20,23 ****
--- 20,25 ----
                        $this->bo = new bo;
                        $this->t = new Template2;
+                       
+                       $this->bo->setsitemgrPreferredLanguage();
                }
  





reply via email to

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