phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: preferences preferences.php,1.29,1.30


From: Ralf Becker <address@hidden>
Subject: [Phpgroupware-cvs] CVS: preferences preferences.php,1.29,1.30
Date: Sun, 06 Apr 2003 06:35:53 -0400

Update of /cvsroot/phpgroupware/preferences
In directory subversions:/tmp/cvs-serv29717

Modified Files:
        preferences.php 
Log Message:
fixed handling for prefixes, prefix was not uses for saveing the prefs


Index: preferences.php
===================================================================
RCS file: /cvsroot/phpgroupware/preferences/preferences.php,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** preferences.php     2 Apr 2003 18:00:03 -0000       1.29
--- preferences.php     6 Apr 2003 10:35:51 -0000       1.30
***************
*** 226,233 ****
        }
  
!       function process_array(&$_p, $array)
        {
                $_appname = check_app();
  
                while (is_array($array) && list($var,$value) = each($array))
                {
--- 226,243 ----
        }
  
!       function process_array(&$_p,$array,$prefix='')
        {
                $_appname = check_app();
  
+               $prefs = &$_p->data[$_appname];
+ 
+               if ($prefix != '')
+               {
+                       $prefix_arr = explode('/',$prefix);
+                       foreach ($prefix_arr as $pre)
+                       {
+                               $prefs = &$prefs[$pre];
+                       }
+               }
                while (is_array($array) && list($var,$value) = each($array))
                {
***************
*** 242,252 ****
                                        }
                                }
!                               $_p->add($_appname,$var,$value);
                        }
                        else
                        {
!                               unset($_p->data[$_appname][$var]);
                        }
                }
                $_p->save_repository(True);
        }
--- 252,264 ----
                                        }
                                }
!                               $prefs[$var] = $value;
                        }
                        else
                        {
!                               unset($prefs[$var]);
                        }
                }
+               //echo "prefix='$prefix', prefs=<pre>"; 
print_r($_p->data[$_appname]);
+ 
                $_p->save_repository(True);
        }
***************
*** 268,272 ****
        function is_admin()
        {
!               if (HAS_ADMIN_RIGHTS == 1 && !isset($_GET['prefix']))   // tabs 
only without prefix
                {
                        return True;
--- 280,286 ----
        function is_admin()
        {
!               global $prefix;
! 
!               if (HAS_ADMIN_RIGHTS == 1 && empty($prefix))    // tabs only 
without prefix
                {
                        return True;
***************
*** 291,294 ****
--- 305,310 ----
        $session_data = 
$GLOBALS['phpgw']->session->appsession('session_data','preferences');
  
+       $prefix = get_var('prefix',array('GET'),$session_data['appname'] == 
$_GET['appname'] ? $session_data['prefix'] : '');
+       
        if (is_admin())
        {
***************
*** 307,314 ****
                $GLOBALS['type'] = 'user';
        }
!       $prefix = get_var('prefix',array('GET'),$session_data['prefix']);
!       
!       $show_help = "$session_data[show_help]" != '' ? 
$session_data['show_help'] : 
!               
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['show_help']);
  
        if ($toggle_help = get_var('toggle_help','POST'))
--- 323,328 ----
                $GLOBALS['type'] = 'user';
        }
!       $show_help = "$session_data[show_help]" != '' && 
$session_data['appname'] == $_GET['appname'] ? 
!               $session_data['show_help'] : 
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['show_help']);
  
        if ($toggle_help = get_var('toggle_help','POST'))
***************
*** 330,334 ****
                if ($GLOBALS['type'] == 'user' || !($GLOBALS['type']))
                {
!                       process_array($GLOBALS['phpgw']->preferences, $user);
                }
  
--- 344,348 ----
                if ($GLOBALS['type'] == 'user' || !($GLOBALS['type']))
                {
!                       
process_array($GLOBALS['phpgw']->preferences,$user,$prefix);
                }
  
***************
*** 347,361 ****
                        
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
                }
! 
!               if ($GLOBALS['type'] == 'user' && $_GET['appname'] == 
'preferences')    // changes for the admin itself
                {
!                       if ($user['show_help'] != '')
!                       {
!                               $show_help = $user['show_help'];        // use 
it, if admin changes his help-prefs
!                       }
!                       if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] != 
$user['lang'])
!                       {
!                               
$GLOBALS['phpgw']->redirect_link('/preferences/preferences.php','appname='.$_GET['appname']);
!                       }
                }
        }
--- 361,368 ----
                        
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
                }
!               
!               if ($GLOBALS['type'] == 'user' && $_GET['appname'] == 
'preferences' && $user['show_help'] != '')
                {
!                       $show_help = $user['show_help'];        // use it, if 
admin changes his help-prefs
                }
        }
***************
*** 363,368 ****
                'type'      => $GLOBALS['type'],        // save our state in 
the app-session
                'show_help' => $show_help,
!               'prefix'    => $prefix
        ));
  
        if ($_GET['appname'] == 'preferences')
--- 370,380 ----
                'type'      => $GLOBALS['type'],        // save our state in 
the app-session
                'show_help' => $show_help,
!               'prefix'    => $prefix,
!               'appname'   => $_GET['appname']         // we use this to reset 
prefix on appname-change
        ));
+       // changes for the admin itself, should have immediate feedback ==> 
redirect
+       if ($_POST['submit'] && $GLOBALS['type'] == 'user' && $_GET['appname'] 
== 'preferences') {
+               
$GLOBALS['phpgw']->redirect_link('/preferences/preferences.php','appname='.$_GET['appname']);
+       }
  
        if ($_GET['appname'] == 'preferences')
***************
*** 388,395 ****
                        $prefs = 
&$GLOBALS['phpgw']->preferences->data[check_app()];
                        // use prefix if given in the url, used for email 
extra-accounts
!                       if ($_GET['prefix'] != '')
                        {
!                               $prefix = explode('/',$_GET['prefix']);
!                               foreach ($prefix as $pre)
                                {
                                        $prefs = &$prefs[$pre];
--- 400,407 ----
                        $prefs = 
&$GLOBALS['phpgw']->preferences->data[check_app()];
                        // use prefix if given in the url, used for email 
extra-accounts
!                       if ($prefix != '')
                        {
!                               $prefix_arr = explode('/',$prefix);
!                               foreach ($prefix_arr as $pre)
                                {
                                        $prefs = &$prefs[$pre];





reply via email to

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