2000-08-18 05:24:22 +02:00
|
|
|
<?php
|
2001-03-08 10:56:18 +01:00
|
|
|
/**************************************************************************\
|
2004-08-09 16:30:59 +02:00
|
|
|
* eGroupWare - preferences *
|
|
|
|
* http://www.egroupware.org *
|
2003-08-28 16:31:11 +02:00
|
|
|
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
|
|
|
* -------------------------------------------- *
|
2001-03-08 10:56:18 +01:00
|
|
|
* 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. *
|
|
|
|
\**************************************************************************/
|
2003-08-28 16:31:11 +02:00
|
|
|
|
2001-03-08 10:56:18 +01:00
|
|
|
/* $Id$ */
|
2000-08-18 05:24:22 +02:00
|
|
|
|
2002-01-11 15:04:40 +01:00
|
|
|
$phpgw_info = array();
|
2004-01-10 23:54:35 +01:00
|
|
|
$GLOBALS['phpgw_info']['flags'] = array(
|
|
|
|
'currentapp' => 'preferences',
|
|
|
|
'disable_Template_class' => True
|
|
|
|
);
|
2001-03-08 10:56:18 +01:00
|
|
|
include('../header.inc.php');
|
2001-05-11 20:43:47 +02:00
|
|
|
|
2003-08-28 16:31:11 +02:00
|
|
|
$pref_tpl = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
|
|
|
|
$templates = Array(
|
|
|
|
'pref' => 'index.tpl'
|
|
|
|
);
|
|
|
|
|
|
|
|
$pref_tpl->set_file($templates);
|
2002-01-11 15:04:40 +01:00
|
|
|
|
2003-08-28 16:31:11 +02:00
|
|
|
$pref_tpl->set_block('pref','list');
|
|
|
|
$pref_tpl->set_block('pref','app_row');
|
|
|
|
$pref_tpl->set_block('pref','app_row_noicon');
|
|
|
|
$pref_tpl->set_block('pref','link_row');
|
|
|
|
$pref_tpl->set_block('pref','spacer_row');
|
2001-05-11 23:18:59 +02:00
|
|
|
|
2001-09-18 03:26:21 +02:00
|
|
|
if ($GLOBALS['phpgw']->acl->check('run',1,'admin'))
|
2001-09-04 01:01:42 +02:00
|
|
|
{
|
2002-01-11 15:04:40 +01:00
|
|
|
// This is where we will keep track of our position.
|
2001-09-04 01:01:42 +02:00
|
|
|
// Developers won't have to pass around a variable then
|
2001-09-18 03:26:21 +02:00
|
|
|
$session_data = $GLOBALS['phpgw']->session->appsession('session_data','preferences');
|
2001-09-04 01:01:42 +02:00
|
|
|
|
|
|
|
if (! is_array($session_data))
|
|
|
|
{
|
2002-01-11 15:04:40 +01:00
|
|
|
$session_data = array('type' => 'user');
|
2001-09-18 03:26:21 +02:00
|
|
|
$GLOBALS['phpgw']->session->appsession('session_data','preferences',$session_data);
|
2001-09-04 01:01:42 +02:00
|
|
|
}
|
|
|
|
|
2003-08-28 16:31:11 +02:00
|
|
|
if (! $GLOBALS['HTTP_GET_VARS']['type'])
|
2001-09-04 01:01:42 +02:00
|
|
|
{
|
|
|
|
$type = $session_data['type'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-08-28 16:31:11 +02:00
|
|
|
$type = $GLOBALS['HTTP_GET_VARS']['type'];
|
2002-01-11 15:04:40 +01:00
|
|
|
$session_data = array('type' => $type);
|
2001-09-18 03:26:21 +02:00
|
|
|
$GLOBALS['phpgw']->session->appsession('session_data','preferences',$session_data);
|
2001-09-04 01:01:42 +02:00
|
|
|
}
|
|
|
|
|
2003-08-28 16:31:11 +02:00
|
|
|
$tabs[] = array(
|
2002-01-11 15:04:40 +01:00
|
|
|
'label' => lang('Your preferences'),
|
2001-09-18 03:26:21 +02:00
|
|
|
'link' => $GLOBALS['phpgw']->link('/preferences/index.php','type=user')
|
2001-09-04 01:01:42 +02:00
|
|
|
);
|
2003-08-28 16:31:11 +02:00
|
|
|
$tabs[] = array(
|
2002-01-11 15:04:40 +01:00
|
|
|
'label' => lang('Default preferences'),
|
2001-09-18 03:26:21 +02:00
|
|
|
'link' => $GLOBALS['phpgw']->link('/preferences/index.php','type=default')
|
2001-09-04 01:01:42 +02:00
|
|
|
);
|
2003-08-28 16:31:11 +02:00
|
|
|
$tabs[] = array(
|
2002-01-11 15:04:40 +01:00
|
|
|
'label' => lang('Forced preferences'),
|
2001-09-18 03:26:21 +02:00
|
|
|
'link' => $GLOBALS['phpgw']->link('/preferences/index.php','type=forced')
|
2001-09-04 01:01:42 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
switch($type)
|
|
|
|
{
|
2002-01-11 15:04:40 +01:00
|
|
|
case 'user': $selected = 0; break;
|
|
|
|
case 'default': $selected = 1; break;
|
|
|
|
case 'forced': $selected = 2; break;
|
2001-09-04 01:01:42 +02:00
|
|
|
}
|
2003-08-28 16:31:11 +02:00
|
|
|
$pref_tpl->set_var('tabs',$GLOBALS['phpgw']->common->create_tabs($tabs,$selected));
|
2001-09-04 01:01:42 +02:00
|
|
|
}
|
|
|
|
|
2001-03-08 10:56:18 +01:00
|
|
|
// This func called by the includes to dump a row header
|
2002-11-04 01:50:18 +01:00
|
|
|
function section_start($appname='',$icon='')
|
2001-03-08 10:56:18 +01:00
|
|
|
{
|
2003-08-28 16:31:11 +02:00
|
|
|
global $pref_tpl;
|
2002-11-04 01:50:18 +01:00
|
|
|
|
2003-08-28 16:31:11 +02:00
|
|
|
$pref_tpl->set_var('a_name',$appname);
|
|
|
|
$pref_tpl->set_var('app_name',$GLOBALS['phpgw_info']['apps'][$appname]['title']);
|
|
|
|
$pref_tpl->set_var('app_icon',$icon);
|
2001-03-08 10:56:18 +01:00
|
|
|
if ($icon)
|
|
|
|
{
|
2003-08-28 16:31:11 +02:00
|
|
|
$pref_tpl->parse('rows','app_row',True);
|
2001-03-08 10:56:18 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-08-28 16:31:11 +02:00
|
|
|
$pref_tpl->parse('rows','app_row_noicon',True);
|
2004-01-10 23:54:35 +01:00
|
|
|
}
|
2001-03-08 10:56:18 +01:00
|
|
|
}
|
2000-09-23 03:25:17 +02:00
|
|
|
|
2001-05-11 19:19:20 +02:00
|
|
|
function section_item($pref_link='',$pref_text='')
|
|
|
|
{
|
2003-08-28 16:31:11 +02:00
|
|
|
global $pref_tpl;
|
|
|
|
|
|
|
|
$pref_tpl->set_var('pref_link',$pref_link);
|
2001-09-09 20:48:20 +02:00
|
|
|
|
|
|
|
if (strtolower($pref_text) == 'grant access' && $GLOBALS['phpgw_info']['server']['deny_user_grants_access'])
|
|
|
|
{
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-08-28 16:31:11 +02:00
|
|
|
$pref_tpl->set_var('pref_text',$pref_text);
|
2001-09-09 20:48:20 +02:00
|
|
|
}
|
|
|
|
|
2003-08-28 16:31:11 +02:00
|
|
|
$pref_tpl->parse('rows','link_row',True);
|
2004-01-10 23:54:35 +01:00
|
|
|
}
|
2001-05-11 19:19:20 +02:00
|
|
|
|
2001-03-08 10:56:18 +01:00
|
|
|
function section_end()
|
|
|
|
{
|
2003-08-28 16:31:11 +02:00
|
|
|
global $pref_tpl;
|
|
|
|
|
|
|
|
$pref_tpl->parse('rows','spacer_row',True);
|
2001-05-24 03:13:09 +02:00
|
|
|
}
|
|
|
|
|
2003-03-27 11:54:55 +01:00
|
|
|
function display_section($appname,$file,$file2=False)
|
2001-05-24 03:13:09 +02:00
|
|
|
{
|
2003-03-27 11:54:55 +01:00
|
|
|
if ($file2)
|
|
|
|
{
|
|
|
|
$file = $file2;
|
|
|
|
}
|
2003-08-28 16:31:11 +02:00
|
|
|
section_start($appname,$GLOBALS['phpgw']->common->image($appname,Array('navbar',$appname)));
|
2001-05-24 03:13:09 +02:00
|
|
|
|
2003-08-28 16:31:11 +02:00
|
|
|
while(list($text,$url) = each($file))
|
2001-05-24 03:13:09 +02:00
|
|
|
{
|
|
|
|
section_item($url,lang($text));
|
|
|
|
}
|
2004-01-10 23:54:35 +01:00
|
|
|
section_end();
|
2001-03-08 10:56:18 +01:00
|
|
|
}
|
2000-12-15 22:56:09 +01:00
|
|
|
|
2002-01-11 15:04:40 +01:00
|
|
|
$GLOBALS['phpgw']->hooks->process('preferences',array('preferences'));
|
2003-08-28 16:31:11 +02:00
|
|
|
$pref_tpl->pfp('out','list');
|
|
|
|
$GLOBALS['phpgw']->common->phpgw_footer();
|
2001-05-24 03:13:09 +02:00
|
|
|
?>
|