Possible fixes for some small problems in the preferences.

This commit is contained in:
skeeter 2001-09-18 01:26:21 +00:00
parent 2e57b81863
commit 63ca721bd5
2 changed files with 23 additions and 22 deletions

View File

@ -28,43 +28,44 @@
$pref_tpl->set_block('pref','link_row');
$pref_tpl->set_block('pref','spacer_row');
if ($phpgw->acl->check('run',1,'admin'))
if ($GLOBALS['phpgw']->acl->check('run',1,'admin'))
{
// This is where we will keep track of our postion.
// Developers won't have to pass around a variable then
$session_data = $phpgw->session->appsession('session_data','preferences');
$session_data = $GLOBALS['phpgw']->session->appsession('session_data','preferences');
if (! is_array($session_data))
{
$session_data = array(
'type' => 'user'
);
$phpgw->session->appsession('session_data','preferences',$session_data);
$GLOBALS['phpgw']->session->appsession('session_data','preferences',$session_data);
}
if (! $GLOBALS['type'])
if (! $GLOBALS['HTTP_GET_VARS']['type'])
{
$type = $session_data['type'];
}
else
{
$type = $GLOBALS['HTTP_GET_VARS']['type'];
$session_data = array(
'type' => $GLOBALS['type']
'type' => $type
);
$phpgw->session->appsession('session_data','preferences',$session_data);
$GLOBALS['phpgw']->session->appsession('session_data','preferences',$session_data);
}
$tabs[] = array(
'label' => 'Your preferences',
'link' => $phpgw->link('/preferences/index.php','type=user')
'link' => $GLOBALS['phpgw']->link('/preferences/index.php','type=user')
);
$tabs[] = array(
'label' => 'Default preferences',
'link' => $phpgw->link('/preferences/index.php','type=default')
'link' => $GLOBALS['phpgw']->link('/preferences/index.php','type=default')
);
$tabs[] = array(
'label' => 'Forced preferences',
'link' => $phpgw->link('/preferences/index.php','type=forced')
'link' => $GLOBALS['phpgw']->link('/preferences/index.php','type=forced')
);
switch($type)
@ -73,7 +74,7 @@
case 'default': $selected = 1; break;
case 'forced': $selected = 2; break;
}
$pref_tpl->set_var('tabs',$phpgw->common->create_tabs($tabs,$selected));
$pref_tpl->set_var('tabs',$GLOBALS['phpgw']->common->create_tabs($tabs,$selected));
}
// This func called by the includes to dump a row header
@ -123,8 +124,7 @@
function display_section($appname,$title,$file)
{
global $phpgw;
section_start($title,$phpgw->common->image($appname,Array('navbar.gif',$appname.'.gif')),$appname);
section_start($title,$GLOBALS['phpgw']->common->image($appname,Array('navbar.gif',$appname.'.gif')),$appname);
while(list($text,$url) = each($file))
{

View File

@ -208,29 +208,30 @@
$phpgw->session->appsession('session_data','preferences',$session_data);
}
if (! $GLOBALS['type'])
if (!isset($GLOBALS['HTTP_GET_VARS']['type']))
{
$type = $session_data['type'];
}
else
{
$type = $GLOBALS['HTTP_GET_VARS']['type'];
$session_data = array(
'type' => $GLOBALS['type']
'type' => $type
);
$phpgw->session->appsession('session_data','preferences',$session_data);
}
$tabs[] = array(
'label' => 'Your preferences',
'link' => $phpgw->link('/preferences/preferences.php','appname=' . $appname . '&type=user')
'link' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname=' . $appname . '&type=user')
);
$tabs[] = array(
'label' => 'Default preferences',
'link' => $phpgw->link('/preferences/preferences.php','appname=' . $appname . '&type=default')
'link' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname=' . $appname . '&type=default')
);
$tabs[] = array(
'label' => 'Forced preferences',
'link' => $phpgw->link('/preferences/preferences.php','appname=' . $appname . '&type=forced')
'link' => $GLOBALS['phpgw']->link('/preferences/preferences.php','appname=' . $appname . '&type=forced')
);
switch($type)
@ -239,11 +240,11 @@
case 'default': $selected = 1; break;
case 'forced': $selected = 2; break;
}
$t->set_var('tabs',$phpgw->common->create_tabs($tabs,$selected));
$t->set_var('tabs',$GLOBALS['phpgw']->common->create_tabs($tabs,$selected));
}
else
{
$GLOBALS['type'] = 'user';
$type = 'user';
}
/* Only load if there working on the default preferences */
@ -258,17 +259,17 @@
/* Don't use a switch here, we need to check some permissions durring the ifs */
if ($type == 'user')
{
process_array(&$p, $user);
process_array($p, $user);
}
if ($type == 'default' && is_admin())
{
process_array(&$dp, $default);
process_array($dp, $default);
}
if ($type == 'forced' && is_admin())
{
process_array(&$gp, $forced);
process_array($gp, $forced);
}
Header('Location: ' . $GLOBALS['phpgw']->link('/preferences/index.php'));