Update for egroupware variables and defines

This commit is contained in:
Miles Lott 2005-07-09 19:07:16 +00:00
parent d9843f38df
commit e97ccc5202
8 changed files with 258 additions and 262 deletions

View File

@ -12,43 +12,42 @@
/* $Id$ */
$GLOBALS['phpgw_info']['flags'] = array(
$GLOBALS['egw_info']['flags'] = array(
'noheader' => True,
'nonavbar' => True,
'currentapp' => 'preferences'
);
include('../header.inc.php');
$n_passwd = $_POST['n_passwd'];
$n_passwd_2 = $_POST['n_passwd_2'];
$o_passwd_2 = $_POST['o_passwd_2'];
if(!$GLOBALS['phpgw']->acl->check('changepassword', 1) || $_POST['cancel'])
if(!$GLOBALS['egw']->acl->check('changepassword', 1) || $_POST['cancel'])
{
$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
$GLOBALS['phpgw']->common->phpgw_exit();
$GLOBALS['egw']->redirect_link('/preferences/index.php');
$GLOBALS['egw']->common->phpgw_exit();
}
$GLOBALS['phpgw']->template->set_file(array(
$GLOBALS['egw']->template->set_file(array(
'form' => 'changepassword.tpl'
));
$GLOBALS['phpgw']->template->set_var('lang_enter_password',lang('Enter your new password'));
$GLOBALS['phpgw']->template->set_var('lang_reenter_password',lang('Re-enter your password'));
$GLOBALS['phpgw']->template->set_var('lang_enter_old_password',lang('Enter your old password'));
$GLOBALS['phpgw']->template->set_var('lang_change',lang('Change'));
$GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel'));
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/preferences/changepassword.php'));
$GLOBALS['egw']->template->set_var('lang_enter_password',lang('Enter your new password'));
$GLOBALS['egw']->template->set_var('lang_reenter_password',lang('Re-enter your password'));
$GLOBALS['egw']->template->set_var('lang_enter_old_password',lang('Enter your old password'));
$GLOBALS['egw']->template->set_var('lang_change',lang('Change'));
$GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel'));
$GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/preferences/changepassword.php'));
if ($GLOBALS['phpgw_info']['server']['auth_type'] != 'ldap')
if ($GLOBALS['egw_info']['server']['auth_type'] != 'ldap')
{
$GLOBALS['phpgw']->template->set_var('sql_message',lang('note: This feature does *not* change your email password. This will '
$GLOBALS['egw']->template->set_var('sql_message',lang('note: This feature does *not* change your email password. This will '
. 'need to be done manually.'));
}
if ($_POST['change'])
{
$o_passwd = $GLOBALS['phpgw_info']['user']['passwd'];
$o_passwd = $GLOBALS['egw_info']['user']['passwd'];
if ($o_passwd != $o_passwd_2)
{
@ -67,45 +66,45 @@
if(is_array($errors))
{
$GLOBALS['phpgw']->common->phpgw_header();
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
$GLOBALS['phpgw']->template->set_var('messages',$GLOBALS['phpgw']->common->error_list($errors));
$GLOBALS['phpgw']->template->pfp('out','form');
$GLOBALS['phpgw']->common->phpgw_exit(True);
$GLOBALS['egw']->template->set_var('messages',$GLOBALS['egw']->common->error_list($errors));
$GLOBALS['egw']->template->pfp('out','form');
$GLOBALS['egw']->common->phpgw_exit(True);
}
$passwd_changed = $GLOBALS['phpgw']->auth->change_password($o_passwd, $n_passwd);
$passwd_changed = $GLOBALS['egw']->auth->change_password($o_passwd, $n_passwd);
if(!$passwd_changed)
{
$errors[] = lang('Failed to change password. Please contact your administrator.');
$GLOBALS['phpgw']->common->phpgw_header();
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
$GLOBALS['phpgw']->template->set_var('messages',$GLOBALS['phpgw']->common->error_list($errors));
$GLOBALS['phpgw']->template->pfp('out','form');
$GLOBALS['phpgw']->common->phpgw_exit(True);
$GLOBALS['egw']->template->set_var('messages',$GLOBALS['egw']->common->error_list($errors));
$GLOBALS['egw']->template->pfp('out','form');
$GLOBALS['egw']->common->phpgw_exit(True);
}
else
{
$GLOBALS['phpgw']->session->appsession('password','phpgwapi',base64_encode($n_passwd));
$GLOBALS['phpgw_info']['user']['passwd'] = $n_passwd;
$GLOBALS['hook_values']['account_id'] = $GLOBALS['phpgw_info']['user']['account_id'];
$GLOBALS['egw']->session->appsession('password','phpgwapi',base64_encode($n_passwd));
$GLOBALS['egw_info']['user']['passwd'] = $n_passwd;
$GLOBALS['hook_values']['account_id'] = $GLOBALS['egw_info']['user']['account_id'];
$GLOBALS['hook_values']['old_passwd'] = $o_passwd;
$GLOBALS['hook_values']['new_passwd'] = $n_passwd;
// called for every app now, not only for the ones enabled for the user
$GLOBALS['phpgw']->hooks->process($GLOBALS['hook_values']+array(
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
'location' => 'changepassword',
),False,True);
$GLOBALS['phpgw']->redirect_link('/preferences/index.php','cd=18');
$GLOBALS['egw']->redirect_link('/preferences/index.php','cd=18');
}
}
else
{
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Change your password');
$GLOBALS['phpgw']->common->phpgw_header();
$GLOBALS['egw_info']['flags']['app_header'] = lang('Change your password');
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
$GLOBALS['phpgw']->template->pfp('out','form');
$GLOBALS['phpgw']->common->phpgw_footer();
$GLOBALS['egw']->template->pfp('out','form');
$GLOBALS['egw']->common->phpgw_footer();
}
?>

View File

@ -20,11 +20,11 @@
function uiaclprefs()
{
$GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs');
if (!is_object($GLOBALS['phpgw']->html))
$GLOBALS['egw']->nextmatchs = CreateObject('phpgwapi.nextmatchs');
if (!is_object($GLOBALS['egw']->html))
{
$GLOBALS['phpgw']->html = CreateObject('phpgwapi.html');
$GLOBALS['egw']->html = CreateObject('phpgwapi.html');
}
}
@ -33,7 +33,7 @@
$acl_app = get_var('acl_app',array('POST','GET'));
$start = get_var('start',array('POST','GET'),0);
$query = get_var('query',array('POST','GET'));
$owner = get_var('owner',array('POST','GET'),$GLOBALS['phpgw_info']['user']['account_id']);
$owner = get_var('owner',array('POST','GET'),$GLOBALS['egw_info']['user']['account_id']);
if (!$acl_app)
{
@ -42,42 +42,42 @@
}
else
{
$GLOBALS['phpgw']->translation->add_app($acl_app);
$GLOBALS['egw']->translation->add_app($acl_app);
}
$GLOBALS['phpgw_info']['flags']['currentapp'] = $acl_app;
$GLOBALS['egw_info']['flags']['currentapp'] = $acl_app;
if ($acl_app_not_passed)
{
if(is_object($GLOBALS['phpgw']->log))
if(is_object($GLOBALS['egw']->log))
{
$GLOBALS['phpgw']->log->message(array(
$GLOBALS['egw']->log->message(array(
'text' => 'F-BadmenuactionVariable, failed to pass acl_app.',
'line' => __LINE__,
'file' => __FILE__
));
$GLOBALS['phpgw']->log->commit();
$GLOBALS['egw']->log->commit();
}
}
if (($GLOBALS['phpgw_info']['server']['deny_user_grants_access'] || $owner != $GLOBALS['phpgw_info']['user']['account_id'])
&& !isset($GLOBALS['phpgw_info']['user']['apps']['admin']) || $acl_app_not_passed)
if (($GLOBALS['egw_info']['server']['deny_user_grants_access'] || $owner != $GLOBALS['egw_info']['user']['account_id'])
&& !isset($GLOBALS['egw_info']['user']['apps']['admin']) || $acl_app_not_passed)
{
$GLOBALS['phpgw']->common->phpgw_header();
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
echo '<center><b>' . lang('Access not permitted') . '</b></center>';
$GLOBALS['phpgw']->common->phpgw_footer();
$GLOBALS['egw']->common->phpgw_footer();
return;
}
$owner_name = $GLOBALS['phpgw']->accounts->id2name($owner); // get owner name for title
if($no_privat_grants = $GLOBALS['phpgw']->accounts->get_type($owner) == 'g')
$owner_name = $GLOBALS['egw']->accounts->id2name($owner); // get owner name for title
if($no_privat_grants = $GLOBALS['egw']->accounts->get_type($owner) == 'g')
{
$owner_name = lang('Group').' ('.$owner_name.')';
}
else // admin setting acl-rights is handled as group-rights => no private grants !!
{
$no_privat_grants = $owner != $GLOBALS['phpgw_info']['user']['account_id'];
$no_privat_grants = $owner != $GLOBALS['egw_info']['user']['account_id'];
}
$this->acl = CreateObject('phpgwapi.acl',(int)$owner);
$this->acl->read_repository();
@ -88,13 +88,13 @@
$to_remove = unserialize(urldecode($processed));
foreach($to_remove as $uid)
{
//echo "deleting acl-records for $uid=".$GLOBALS['phpgw']->accounts->id2name($uid)." and $acl_app<br>\n";
//echo "deleting acl-records for $uid=".$GLOBALS['egw']->accounts->id2name($uid)." and $acl_app<br>\n";
$this->acl->delete($acl_app,$uid);
}
/* Group records */
$totalacl = array();
$group_variable = $_POST['g_'.$GLOBALS['phpgw_info']['flags']['currentapp']];
$group_variable = $_POST['g_'.$GLOBALS['egw_info']['flags']['currentapp']];
if (is_array($group_variable))
{
@ -108,16 +108,16 @@
if($no_privat_grants)
{
/* Don't allow group-grants or admin to grant private */
$rights &= ~PHPGW_ACL_PRIVATE;
$rights &= ~EGW_ACL_PRIVATE;
}
//echo "adding acl-rights $rights for $group_id=".$GLOBALS['phpgw']->accounts->id2name($group_id)." and $acl_app<br>\n";
$this->acl->add($GLOBALS['phpgw_info']['flags']['currentapp'],$group_id,$rights);
//echo "adding acl-rights $rights for $group_id=".$GLOBALS['egw']->accounts->id2name($group_id)." and $acl_app<br>\n";
$this->acl->add($GLOBALS['egw_info']['flags']['currentapp'],$group_id,$rights);
}
}
/* User records */
$totalacl = array();
$user_variable = $_POST['u_'.$GLOBALS['phpgw_info']['flags']['currentapp']];
$user_variable = $_POST['u_'.$GLOBALS['egw_info']['flags']['currentapp']];
if (is_array($user_variable))
{
@ -131,19 +131,19 @@
if($no_privat_grants)
{
/* Don't allow group-grants or admin to grant private */
$rights &= ~ PHPGW_ACL_PRIVATE;
$rights &= ~ EGW_ACL_PRIVATE;
}
//echo "adding acl-rights $rights for $user_id=".$GLOBALS['phpgw']->accounts->id2name($user_id)." and $acl_app<br>\n";
$this->acl->add($GLOBALS['phpgw_info']['flags']['currentapp'],$user_id,$rights);
//echo "adding acl-rights $rights for $user_id=".$GLOBALS['egw']->accounts->id2name($user_id)." and $acl_app<br>\n";
$this->acl->add($GLOBALS['egw_info']['flags']['currentapp'],$user_id,$rights);
}
}
$this->acl->save_repository();
}
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('%1 - Preferences',$GLOBALS['phpgw_info']['apps'][$acl_app]['title']).' - '.lang('acl').': '.$owner_name;
$GLOBALS['phpgw']->common->phpgw_header();
$GLOBALS['egw_info']['flags']['app_header'] = lang('%1 - Preferences',$GLOBALS['egw_info']['apps'][$acl_app]['title']).' - '.lang('acl').': '.$owner_name;
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
$this->template = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir($acl_app));
$this->template = CreateObject('phpgwapi.Template',$GLOBALS['egw']->common->get_tpl_dir($acl_app));
$templates = Array (
'preferences' => 'preference_acl.tpl',
'row_colspan' => 'preference_colspan.tpl',
@ -166,10 +166,10 @@
$var = Array(
'errors' => '',
'title' => '<br>',
'action_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app=' . $acl_app),
'bg_color' => $GLOBALS['phpgw_info']['theme']['th_bg'],
'action_url' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app=' . $acl_app),
'bg_color' => $GLOBALS['egw_info']['theme']['th_bg'],
'submit_lang' => lang('Save'),
'common_hidden_vars_form' => $GLOBALS['phpgw']->html->input_hidden($common_hidden_vars)
'common_hidden_vars_form' => $GLOBALS['egw']->html->input_hidden($common_hidden_vars)
);
$this->template->set_var($var);
@ -185,16 +185,16 @@
}
}
$accounts = $GLOBALS['phpgw']->accounts->search(array(
$accounts = $GLOBALS['egw']->accounts->search(array(
'type' => 'both',
'start' => $start,
'query' => $query,
'order' => 'account_type,account_lid',
'sort' => 'ASC',
));
$totalentries = $GLOBALS['phpgw']->accounts->total;
$memberships = (array) $GLOBALS['phpgw']->acl->get_location_list_for_id('phpgw_group', 1, $owner);
$totalentries = $GLOBALS['egw']->accounts->total;
$memberships = (array) $GLOBALS['egw']->acl->get_location_list_for_id('phpgw_group', 1, $owner);
$header_type = '';
$processed = Array();
@ -209,7 +209,7 @@
$this->template->parse('row','row_colspan',True);
$header_type = $data['account_type'];
}
$tr_class = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color,true);
$tr_class = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color,true);
if ($data['account_type'] == 'g')
{
@ -217,7 +217,7 @@
}
else
{
$this->display_row($tr_class,'u_',$data['account_id'],$GLOBALS['phpgw']->common->display_fullname($data['account_lid'],$data['account_firstname'],$data['account_lastname']),$no_privat_grants,$memberships);
$this->display_row($tr_class,'u_',$data['account_id'],$GLOBALS['egw']->common->display_fullname($data['account_lid'],$data['account_firstname'],$data['account_lastname']),$no_privat_grants,$memberships);
}
$processed[] = $uid;
}
@ -229,9 +229,9 @@
);
$var = Array(
'nml' => $GLOBALS['phpgw']->nextmatchs->left('/index.php',$start,$totalentries,$extra_parms),
'nmr' => $GLOBALS['phpgw']->nextmatchs->right('/index.php',$start,$totalentries,$extra_parms),
'search_value' => isset($query) && $query ? $GLOBALS['phpgw']->html->htmlspecialchars($query) : '',
'nml' => $GLOBALS['egw']->nextmatchs->left('/index.php',$start,$totalentries,$extra_parms),
'nmr' => $GLOBALS['egw']->nextmatchs->right('/index.php',$start,$totalentries,$extra_parms),
'search_value' => isset($query) && $query ? $GLOBALS['egw']->html->htmlspecialchars($query) : '',
'search' => lang('search'),
'processed' => urlencode(serialize($processed))
);
@ -243,7 +243,7 @@
function check_acl($label,$id,$acl,$rights,$right,$disabled=False)
{
$this->template->set_var($acl,$label.$GLOBALS['phpgw_info']['flags']['currentapp'].'['.$id.'_'.$right.']');
$this->template->set_var($acl,$label.$GLOBALS['egw_info']['flags']['currentapp'].'['.$id.'_'.$right.']');
$rights_set = ($rights & $right) ? ' checked="1"' : '';
if ($disabled)
{
@ -256,31 +256,31 @@
function display_row($tr_class,$label,$id,$name,$no_privat_grants,$memberships)
{
$this->template->set_var('row_class',$tr_class);
$this->template->set_var('row_color',$GLOBALS['phpgw_info']['theme'][$tr_class]);
$this->template->set_var('row_color',$GLOBALS['egw_info']['theme'][$tr_class]);
$this->template->set_var('user',$name);
$rights = $this->acl->get_rights($id,$GLOBALS['phpgw_info']['flags']['currentapp']);
$is_group = $GLOBALS['phpgw']->accounts->get_type($id) == 'g';
$rights = $this->acl->get_rights($id,$GLOBALS['egw_info']['flags']['currentapp']);
$is_group = $GLOBALS['egw']->accounts->get_type($id) == 'g';
foreach(array(
PHPGW_ACL_READ => 'read',
PHPGW_ACL_ADD => 'add',
PHPGW_ACL_EDIT => 'edit',
PHPGW_ACL_DELETE => 'delete',
PHPGW_ACL_PRIVATE => 'private',
PHPGW_ACL_CUSTOM_1 => 'custom_1',
PHPGW_ACL_CUSTOM_2 => 'custom_2',
PHPGW_ACL_CUSTOM_3 => 'custom_3',
EGW_ACL_READ => 'read',
EGW_ACL_ADD => 'add',
EGW_ACL_EDIT => 'edit',
EGW_ACL_DELETE => 'delete',
EGW_ACL_PRIVATE => 'private',
EGW_ACL_CUSTOM_1 => 'custom_1',
EGW_ACL_CUSTOM_2 => 'custom_2',
EGW_ACL_CUSTOM_3 => 'custom_3',
) as $right => $name)
{
$is_group_set = False;
if ($is_group)
{
$grantors = $this->acl->get_ids_for_location($id,$right,$GLOBALS['phpgw_info']['flags']['currentapp']);
$grantors = $this->acl->get_ids_for_location($id,$right,$GLOBALS['egw_info']['flags']['currentapp']);
if (is_array($grantors))
{
foreach($grantors as $grantor)
{
//echo $GLOBALS['phpgw']->accounts->id2name($id)."=$id: $name-grant from ".$GLOBALS['phpgw']->accounts->id2name($grantor)."=$grantor<br>\n";
//echo $GLOBALS['egw']->accounts->id2name($id)."=$id: $name-grant from ".$GLOBALS['egw']->accounts->id2name($grantor)."=$grantor<br>\n";
// check if the grant comes from a group, the owner is a member off, in that case he is NOT allowed to remove it
if(in_array($grantor,$memberships))
{
@ -290,7 +290,7 @@
}
}
}
$this->check_acl($label,$id,$name,$rights,$right,$is_group_set || $no_privat_grants && $right == PHPGW_ACL_PRIVATE);
$this->check_acl($label,$id,$name,$rights,$right,$is_group_set || $no_privat_grants && $right == EGW_ACL_PRIVATE);
}
$this->template->parse('row','acl_row',True);
}

View File

@ -39,15 +39,15 @@
$this->bo = CreateObject('preferences.bocategories',$cats_app);
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
$this->account = $GLOBALS['phpgw_info']['user']['account_id'];
$this->user = $GLOBALS['phpgw_info']['user']['fullname'];
$this->account = $GLOBALS['egw_info']['user']['account_id'];
$this->user = $GLOBALS['egw_info']['user']['fullname'];
$this->start = $this->bo->start;
$this->query = $this->bo->query;
$this->sort = $this->bo->sort;
$this->order = $this->bo->order;
$dir = dir(PHPGW_SERVER_ROOT.'/phpgwapi/images');
$dir = dir(EGW_SERVER_ROOT.'/phpgwapi/images');
while($file = $dir->read())
{
if (preg_match('/\\.(png|gif|jpe?g)$/i',$file))
@ -57,7 +57,7 @@
}
$dir->close();
sort($this->icons);
$this->img_url = $GLOBALS['phpgw_info']['server']['webserver_url'].'/phpgwapi/images/';
$this->img_url = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/images/';
}
function save_sessiondata($cats_app)
@ -74,22 +74,22 @@
function set_langs()
{
$GLOBALS['phpgw']->template->set_var('lang_access',lang('Private'));
$GLOBALS['phpgw']->template->set_var('lang_save',lang('Save'));
$GLOBALS['phpgw']->template->set_var('user_name',$this->user);
$GLOBALS['phpgw']->template->set_var('lang_search',lang('Search'));
$GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel'));
$GLOBALS['phpgw']->template->set_var('lang_sub',lang('Add sub'));
$GLOBALS['phpgw']->template->set_var('lang_edit',lang('Edit'));
$GLOBALS['phpgw']->template->set_var('lang_delete',lang('Delete'));
$GLOBALS['phpgw']->template->set_var('lang_parent',lang('Parent category'));
$GLOBALS['phpgw']->template->set_var('lang_none',lang('None'));
$GLOBALS['phpgw']->template->set_var('lang_name',lang('Name'));
$GLOBALS['phpgw']->template->set_var('lang_descr',lang('Description'));
$GLOBALS['phpgw']->template->set_var('lang_add',lang('Add'));
$GLOBALS['phpgw']->template->set_var('lang_reset',lang('Clear Form'));
$GLOBALS['phpgw']->template->set_var('lang_color',lang('Color'));
$GLOBALS['phpgw']->template->set_var('lang_icon',lang('Icon'));
$GLOBALS['egw']->template->set_var('lang_access',lang('Private'));
$GLOBALS['egw']->template->set_var('lang_save',lang('Save'));
$GLOBALS['egw']->template->set_var('user_name',$this->user);
$GLOBALS['egw']->template->set_var('lang_search',lang('Search'));
$GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel'));
$GLOBALS['egw']->template->set_var('lang_sub',lang('Add sub'));
$GLOBALS['egw']->template->set_var('lang_edit',lang('Edit'));
$GLOBALS['egw']->template->set_var('lang_delete',lang('Delete'));
$GLOBALS['egw']->template->set_var('lang_parent',lang('Parent category'));
$GLOBALS['egw']->template->set_var('lang_none',lang('None'));
$GLOBALS['egw']->template->set_var('lang_name',lang('Name'));
$GLOBALS['egw']->template->set_var('lang_descr',lang('Description'));
$GLOBALS['egw']->template->set_var('lang_add',lang('Add'));
$GLOBALS['egw']->template->set_var('lang_reset',lang('Clear Form'));
$GLOBALS['egw']->template->set_var('lang_color',lang('Color'));
$GLOBALS['egw']->template->set_var('lang_icon',lang('Icon'));
}
function cat_data($edata,$data)
@ -125,22 +125,22 @@
{
$edata = array('icon');
}
$GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps'][$cats_app]['title'].
$GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps'][$cats_app]['title'].
'&nbsp;'.lang('categories for').':&nbsp;'.$this->user;
$GLOBALS['phpgw']->common->phpgw_header();
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
$GLOBALS['phpgw']->template->set_file(array(
$GLOBALS['egw']->template->set_file(array(
'cat_list_t' => 'listcats.tpl',
));
$GLOBALS['phpgw']->template->set_block('cat_list_t','cat_list','list');
$GLOBALS['egw']->template->set_block('cat_list_t','cat_list','list');
$this->set_langs();
$GLOBALS['phpgw']->template->set_var('title_categories',lang('categories for'));
$GLOBALS['phpgw']->template->set_var('lang_app',lang($cats_app));
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['phpgw']->template->set_var('doneurl',$GLOBALS['phpgw']->link('/preferences/index.php'));
$GLOBALS['egw']->template->set_var('title_categories',lang('categories for'));
$GLOBALS['egw']->template->set_var('lang_app',lang($cats_app));
$GLOBALS['egw']->template->set_var('actionurl',$GLOBALS['egw']->link('/index.php',$link_data));
$GLOBALS['egw']->template->set_var('doneurl',$GLOBALS['egw']->link('/preferences/index.php'));
if(!$this->start)
{
@ -159,28 +159,28 @@
$left = $this->nextmatchs->left('/index.php',$this->start,$this->bo->cats->total_records,$link_data);
$right = $this->nextmatchs->right('/index.php',$this->start,$this->bo->cats->total_records,$link_data);
$GLOBALS['phpgw']->template->set_var('left',$left);
$GLOBALS['phpgw']->template->set_var('right',$right);
$GLOBALS['egw']->template->set_var('left',$left);
$GLOBALS['egw']->template->set_var('right',$right);
$GLOBALS['phpgw']->template->set_var('lang_showing',$this->nextmatchs->show_hits($this->bo->cats->total_records,$this->start));
$GLOBALS['egw']->template->set_var('lang_showing',$this->nextmatchs->show_hits($this->bo->cats->total_records,$this->start));
// ------------------------------ end nextmatch ------------------------------------------
//------------------- list header variable template-declarations -------------------------
$GLOBALS['phpgw']->template->set_var('sort_name',$this->nextmatchs->show_sort_order($this->sort,'cat_name',$this->order,'/index.php',lang('Name'),$link_data));
$GLOBALS['phpgw']->template->set_var('sort_description',$this->nextmatchs->show_sort_order($this->sort,'cat_description',$this->order,'/index.php',lang('Description'),$link_data));
$GLOBALS['egw']->template->set_var('sort_name',$this->nextmatchs->show_sort_order($this->sort,'cat_name',$this->order,'/index.php',lang('Name'),$link_data));
$GLOBALS['egw']->template->set_var('sort_description',$this->nextmatchs->show_sort_order($this->sort,'cat_description',$this->order,'/index.php',lang('Description'),$link_data));
if (is_array($edata))
{
for($i=0;$i<count($edata);$i++)
{
$GLOBALS['phpgw']->template->set_var('sort_data','<td class="th">' . lang($edata[$i]) . '</td>');
$GLOBALS['egw']->template->set_var('sort_data','<td class="th">' . lang($edata[$i]) . '</td>');
}
}
else
{
$GLOBALS['phpgw']->template->set_var('th_data','');
$GLOBALS['egw']->template->set_var('th_data','');
}
// -------------------------- end header declaration --------------------------------------
@ -191,15 +191,15 @@
if ($data['color'])
{
$GLOBALS['phpgw']->template->set_var('tr_color',$data['color']);
$GLOBALS['egw']->template->set_var('tr_color',$data['color']);
$gray = (hexdec(substr($data['color'],1,2))+hexdec(substr($data['color'],3,2))+hexdec(substr($data['color'],5,2)))/3;
}
else
{
$this->nextmatchs->template_alternate_row_color($GLOBALS['phpgw']->template);
$this->nextmatchs->template_alternate_row_color($GLOBALS['egw']->template);
$gray = 255;
}
$GLOBALS['phpgw']->template->set_var('color',$gray < 128 ? 'style="color: white;"' : '');
$GLOBALS['egw']->template->set_var('color',$gray < 128 ? 'style="color: white;"' : '');
if ($cat['app_name'] == 'phpgw')
{
@ -207,7 +207,7 @@
}
elseif ($cat['owner'] == '-1')
{
$appendix = '&lt;' . lang('Global') . '&nbsp;' . $GLOBALS['phpgw_info']['apps'][$cats_app]['title'] . '&gt;';
$appendix = '&lt;' . lang('Global') . '&nbsp;' . $GLOBALS['egw_info']['apps'][$cats_app]['title'] . '&gt;';
}
else
{
@ -220,10 +220,10 @@
{
$space = '&nbsp;&nbsp;';
$spaceset = str_repeat($space,$level);
$name = $spaceset . $GLOBALS['phpgw']->strip_html($cat['name']) . $appendix;
$name = $spaceset . $GLOBALS['egw']->strip_html($cat['name']) . $appendix;
}
$descr = $GLOBALS['phpgw']->strip_html($cat['description']);
$descr = $GLOBALS['egw']->strip_html($cat['description']);
if (!$descr) { $descr = '&nbsp;'; }
if (is_array($edata))
@ -232,26 +232,26 @@
{
$holder = '<td>&nbsp;</td>' . "\n";
$placeholder = str_repeat($holder,count($edata));
$GLOBALS['phpgw']->template->set_var('td_data',$placeholder);
$GLOBALS['egw']->template->set_var('td_data',$placeholder);
}
else
{
$GLOBALS['phpgw']->template->set_var('td_data',$this->cat_data($edata,$data));
$GLOBALS['egw']->template->set_var('td_data',$this->cat_data($edata,$data));
}
}
if ($level == 0)
{
$name = '<font color="FF0000"><b>' . $GLOBALS['phpgw']->strip_html($cat['name']) . '</b></font>' . $appendix;
$name = '<font color="FF0000"><b>' . $GLOBALS['egw']->strip_html($cat['name']) . '</b></font>' . $appendix;
$descr = '<font color="FF0000"><b>' . $descr . '</b></font>';
}
$GLOBALS['phpgw']->template->set_var(array(
$GLOBALS['egw']->template->set_var(array(
'name' => $name,
'descr' => $descr
));
$GLOBALS['phpgw']->template->set_var('app_url',$GLOBALS['phpgw']->link('/' . $cats_app . '/index.php','cat_id=' . $cat['id']));
$GLOBALS['egw']->template->set_var('app_url',$GLOBALS['egw']->link('/' . $cats_app . '/index.php','cat_id=' . $cat['id']));
if ($cats_level || ($level == 0))
{
@ -260,44 +260,44 @@
$link_data['menuaction'] = 'preferences.uicategories.edit';
$link_data['cat_parent'] = $cat['id'];
unset($link_data['cat_id']);
$GLOBALS['phpgw']->template->set_var('add_sub',$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['phpgw']->template->set_var('lang_sub_entry',lang('Add sub'));
$GLOBALS['egw']->template->set_var('add_sub',$GLOBALS['egw']->link('/index.php',$link_data));
$GLOBALS['egw']->template->set_var('lang_sub_entry',lang('Add sub'));
}
}
else
{
$GLOBALS['phpgw']->template->set_var('add_sub','');
$GLOBALS['phpgw']->template->set_var('lang_sub_entry','&nbsp;');
$GLOBALS['egw']->template->set_var('add_sub','');
$GLOBALS['egw']->template->set_var('lang_sub_entry','&nbsp;');
}
$link_data['cat_id'] = $cat['id'];
if ($cat['owner'] == $this->account && $cat['app_name'] != 'phpgw')
{
$link_data['menuaction'] = 'preferences.uicategories.edit';
$GLOBALS['phpgw']->template->set_var('edit',$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['phpgw']->template->set_var('lang_edit_entry',lang('Edit'));
$GLOBALS['egw']->template->set_var('edit',$GLOBALS['egw']->link('/index.php',$link_data));
$GLOBALS['egw']->template->set_var('lang_edit_entry',lang('Edit'));
$link_data['menuaction'] = 'preferences.uicategories.delete';
$GLOBALS['phpgw']->template->set_var('delete',$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['phpgw']->template->set_var('lang_delete_entry',lang('Delete'));
$GLOBALS['egw']->template->set_var('delete',$GLOBALS['egw']->link('/index.php',$link_data));
$GLOBALS['egw']->template->set_var('lang_delete_entry',lang('Delete'));
}
else
{
$GLOBALS['phpgw']->template->set_var('edit','');
$GLOBALS['phpgw']->template->set_var('lang_edit_entry','&nbsp;');
$GLOBALS['egw']->template->set_var('edit','');
$GLOBALS['egw']->template->set_var('lang_edit_entry','&nbsp;');
$GLOBALS['phpgw']->template->set_var('delete','');
$GLOBALS['phpgw']->template->set_var('lang_delete_entry','&nbsp;');
$GLOBALS['egw']->template->set_var('delete','');
$GLOBALS['egw']->template->set_var('lang_delete_entry','&nbsp;');
}
$GLOBALS['phpgw']->template->fp('list','cat_list',True);
$GLOBALS['egw']->template->fp('list','cat_list',True);
}
$link_data['menuaction'] = 'preferences.uicategories.edit';
unset($link_data['cat_id']);
unset($link_data['cat_parent']);
$GLOBALS['phpgw']->template->set_var('add_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['egw']->template->set_var('add_action',$GLOBALS['egw']->link('/index.php',$link_data));
$this->save_sessiondata($cats_app);
$GLOBALS['phpgw']->template->pfp('out','cat_list_t',True);
$GLOBALS['egw']->template->pfp('out','cat_list_t',True);
}
function edit()
@ -325,13 +325,13 @@
$cat_access = $_POST['cat_access'];
$old_parent = $_POST['old_parent'];
$GLOBALS['phpgw']->template->set_file(array('form' => 'category_form.tpl'));
$GLOBALS['phpgw']->template->set_block('form','data_row','row');
$GLOBALS['phpgw']->template->set_block('form','add','addhandle');
$GLOBALS['phpgw']->template->set_block('form','edit','edithandle');
$GLOBALS['egw']->template->set_file(array('form' => 'category_form.tpl'));
$GLOBALS['egw']->template->set_block('form','data_row','row');
$GLOBALS['egw']->template->set_block('form','add','addhandle');
$GLOBALS['egw']->template->set_block('form','edit','edithandle');
$this->set_langs();
$GLOBALS['phpgw']->template->set_var('cancel_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['egw']->template->set_var('cancel_url',$GLOBALS['egw']->link('/index.php',$link_data));
if ($new_parent)
{
@ -363,13 +363,13 @@
$error = $this->bo->check_values($values);
if (is_array($error))
{
$GLOBALS['phpgw']->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error));
$GLOBALS['egw']->template->set_var('message',$GLOBALS['egw']->common->error_list($error));
}
else
{
$cat_id = $this->bo->save_cat($values);
return $this->index();
//$GLOBALS['phpgw']->template->set_var('message',lang('Category %1 has been updated !',$cat_name));
//$GLOBALS['egw']->template->set_var('message',lang('Category %1 has been updated !',$cat_name));
}
}
@ -391,10 +391,10 @@
}
$link_data['menuaction'] = 'preferences.uicategories.edit';
$GLOBALS['phpgw']->template->set_var('actionurl',$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['egw']->template->set_var('actionurl',$GLOBALS['egw']->link('/index.php',$link_data));
$GLOBALS['phpgw']->template->set_var('cat_name',$GLOBALS['phpgw']->strip_html($cat['name']));
$GLOBALS['phpgw']->template->set_var('cat_description',$GLOBALS['phpgw']->strip_html($cat['description']));
$GLOBALS['egw']->template->set_var('cat_name',$GLOBALS['egw']->strip_html($cat['name']));
$GLOBALS['egw']->template->set_var('cat_description',$GLOBALS['egw']->strip_html($cat['description']));
$hidden_vars = '<input type="hidden" name="old_parent" value="' . $cat['parent'] . '">';
@ -407,19 +407,19 @@
$type = 'mains';
}
$GLOBALS['phpgw']->template->set_var('category_list',$this->bo->cats->formated_list(array(
$GLOBALS['egw']->template->set_var('category_list',$this->bo->cats->formated_list(array(
'type' => $type,'selected' => $cat['parent'],
'globals' => $global_cats, 'self' => $cat_id
)));
$GLOBALS['phpgw']->template->set_var('access','<input type="checkbox" name="cat_access" value="True"'
$GLOBALS['egw']->template->set_var('access','<input type="checkbox" name="cat_access" value="True"'
. ($cat['access'] == 'private' ? ' checked' : '') . '>');
if (!is_object($GLOBALS['phpgw']->html))
if (!is_object($GLOBALS['egw']->html))
{
$GLOBALS['phpgw']->html = CreateObject('phpgwapi.html');
$GLOBALS['egw']->html = CreateObject('phpgwapi.html');
}
$GLOBALS['phpgw']->template->set_var('color',$GLOBALS['phpgw']->html->inputColor('cat_data[color]',$cat['data']['color'],lang('Click to select a color')));
$GLOBALS['egw']->template->set_var('color',$GLOBALS['egw']->html->inputColor('cat_data[color]',$cat['data']['color'],lang('Click to select a color')));
$options = '<option value=""'.(!$cat['data']['icon'] ? ' selected="1"':'').'>'.lang('none')."</options>\n";
foreach ($this->icons as $icon)
@ -427,8 +427,8 @@
$options .= '<option value="'.$icon.'"'.($icon == $cat['data']['icon'] ? ' selected="1"':'').'>'.
ucfirst(preg_replace('/\\.(png|gif|jpe?g)$/i','',$icon))."</option>\n";
}
$GLOBALS['phpgw']->template->set_var('select_icon', '<select name="cat_data[icon]" onchange="document.images[\'icon\'].src=\''.$this->img_url.'\' + this.value;">'.$options."</select>\n");
$GLOBALS['phpgw']->template->set_var('icon','<img id="icon" src="'. $this->img_url.$cat['data']['icon'] .'">');
$GLOBALS['egw']->template->set_var('select_icon', '<select name="cat_data[icon]" onchange="document.images[\'icon\'].src=\''.$this->img_url.'\' + this.value;">'.$options."</select>\n");
$GLOBALS['egw']->template->set_var('icon','<img id="icon" src="'. $this->img_url.$cat['data']['icon'] .'">');
$already_done = array('icon','color');
@ -436,10 +436,10 @@
{
foreach(explode(',',$extra) as $i => $name)
{
$GLOBALS['phpgw']->template->set_var('class',($i & 1) ? 'row_on' : 'row_off');
$GLOBALS['phpgw']->template->set_var('td_data','<input name="cat_data[' . htmlspecialchars($name) . ']" size="50" value="' . htmlspecialchars($cat['data'][$name]) . '">');
$GLOBALS['phpgw']->template->set_var('lang_data',lang($name));
$GLOBALS['phpgw']->template->fp('row','data_row',True);
$GLOBALS['egw']->template->set_var('class',($i & 1) ? 'row_on' : 'row_off');
$GLOBALS['egw']->template->set_var('td_data','<input name="cat_data[' . htmlspecialchars($name) . ']" size="50" value="' . htmlspecialchars($cat['data'][$name]) . '">');
$GLOBALS['egw']->template->set_var('lang_data',lang($name));
$GLOBALS['egw']->template->fp('row','data_row',True);
$already_done[] = $name;
}
}
@ -454,28 +454,28 @@
}
}
}
$GLOBALS['phpgw']->template->set_var('hidden_vars',$hidden_vars);
$GLOBALS['egw']->template->set_var('hidden_vars',$hidden_vars);
if ($cat['owner'] == $this->account)
{
$link_data['menuaction'] = 'preferences.uicategories.delete';
$GLOBALS['phpgw']->template->set_var('delete','<form method="POST" action="' . $GLOBALS['phpgw']->link('/index.php',$link_data)
$GLOBALS['egw']->template->set_var('delete','<form method="POST" action="' . $GLOBALS['egw']->link('/index.php',$link_data)
. '"><input type="submit" value="' . lang('Delete') .'"></form>');
}
else
{
$GLOBALS['phpgw']->template->set_var('delete','&nbsp;');
$GLOBALS['egw']->template->set_var('delete','&nbsp;');
}
$GLOBALS['phpgw_info']['flags']['app_header'] = lang($cat_id ? 'Edit %1 category for' : 'Add %1 category for',
$GLOBALS['phpgw_info']['apps'][$cats_app]['title']).':&nbsp;'.$this->user;
$GLOBALS['phpgw']->common->phpgw_header();
$GLOBALS['egw_info']['flags']['app_header'] = lang($cat_id ? 'Edit %1 category for' : 'Add %1 category for',
$GLOBALS['egw_info']['apps'][$cats_app]['title']).':&nbsp;'.$this->user;
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
$GLOBALS['phpgw']->template->set_var('edithandle','');
$GLOBALS['phpgw']->template->set_var('addhandle','');
$GLOBALS['phpgw']->template->pfp('out','form');
$GLOBALS['phpgw']->template->pfp('edithandle','edit');
$GLOBALS['egw']->template->set_var('edithandle','');
$GLOBALS['egw']->template->set_var('addhandle','');
$GLOBALS['egw']->template->pfp('out','form');
$GLOBALS['egw']->template->pfp('edithandle','edit');
}
function delete()
@ -498,7 +498,7 @@
if (!$cat_id || $_POST['cancel'])
{
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
$GLOBALS['egw']->redirect_link('/index.php',$link_data);
}
if ($_POST['confirm'])
@ -511,17 +511,17 @@
{
$this->bo->delete($cat_id,False);
}
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
$GLOBALS['egw']->redirect_link('/index.php',$link_data);
}
else
{
$GLOBALS['phpgw']->template->set_file(array('category_delete' => 'delete.tpl'));
$GLOBALS['egw']->template->set_file(array('category_delete' => 'delete.tpl'));
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Delete Categories');
$GLOBALS['phpgw']->common->phpgw_header();
$GLOBALS['egw_info']['flags']['app_header'] = lang('Delete Categories');
$GLOBALS['egw']->common->phpgw_header();
echo parse_navbar();
$GLOBALS['phpgw']->template->set_var('deleteheader',lang('Are you sure you want to delete this category ?'));
$GLOBALS['egw']->template->set_var('deleteheader',lang('Are you sure you want to delete this category ?'));
$exists = $this->bo->exists(array
(
@ -532,20 +532,20 @@
if ($exists)
{
$GLOBALS['phpgw']->template->set_var('lang_subs',lang('Do you also want to delete all subcategories ?'));
$GLOBALS['phpgw']->template->set_var('subs','<input type="checkbox" name="subs" value="True">');
$GLOBALS['egw']->template->set_var('lang_subs',lang('Do you also want to delete all subcategories ?'));
$GLOBALS['egw']->template->set_var('subs','<input type="checkbox" name="subs" value="True">');
}
else
{
$GLOBALS['phpgw']->template->set_var('lang_subs','');
$GLOBALS['phpgw']->template->set_var('subs', '');
$GLOBALS['egw']->template->set_var('lang_subs','');
$GLOBALS['egw']->template->set_var('subs', '');
}
$GLOBALS['phpgw']->template->set_var('lang_no',lang('No'));
$GLOBALS['egw']->template->set_var('lang_no',lang('No'));
$link_data['menuaction'] = 'preferences.uicategories.delete';
$GLOBALS['phpgw']->template->set_var('action_url',$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['phpgw']->template->set_var('lang_yes',lang('Yes'));
$GLOBALS['phpgw']->template->pfp('out','category_delete');
$GLOBALS['egw']->template->set_var('action_url',$GLOBALS['egw']->link('/index.php',$link_data));
$GLOBALS['egw']->template->set_var('lang_yes',lang('Yes'));
$GLOBALS['egw']->template->pfp('out','category_delete');
}
}
}

View File

@ -15,9 +15,7 @@
// Delete all records for a user
$table_locks = Array('phpgw_preferences');
$GLOBALS['phpgw']->db->lock($table_locks);
$GLOBALS['phpgw']->db->query('DELETE FROM phpgw_preferences WHERE preference_owner='.$GLOBALS['HTTP_POST_VARS']['account_id'],__LINE__,__FILE__);
$GLOBALS['phpgw']->db->unlock();
$GLOBALS['egw']->db->lock($table_locks);
$GLOBALS['egw']->db->query('DELETE FROM phpgw_preferences WHERE preference_owner='.$GLOBALS['HTTP_POST_VARS']['account_id'],__LINE__,__FILE__);
$GLOBALS['egw']->db->unlock();
?>

View File

@ -12,12 +12,11 @@
/* $Id$ */
if ($GLOBALS['phpgw']->acl->check('changepassword',1))
if ($GLOBALS['egw']->acl->check('changepassword',1))
{
$file['Change your Password'] = $GLOBALS['phpgw']->link('/preferences/changepassword.php');
$file['Change your Password'] = $GLOBALS['egw']->link('/preferences/changepassword.php');
}
$file['change your settings'] = $GLOBALS['phpgw']->link('/preferences/preferences.php','appname=preferences');
$file['change your settings'] = $GLOBALS['egw']->link('/preferences/preferences.php','appname=preferences');
display_section('preferences',$file);
?>

View File

@ -11,13 +11,13 @@
/* $Id$ */
$templates = $GLOBALS['phpgw']->common->list_templates();
$templates = $GLOBALS['egw']->common->list_templates();
while (list($var,$value) = each($templates))
{
$_templates[$var] = $templates[$var]['title'];
}
$themes = $GLOBALS['phpgw']->common->list_themes();
$themes = $GLOBALS['egw']->common->list_themes();
while (list(,$value) = each($themes))
{
$_themes[$value] = $value;
@ -38,9 +38,9 @@
create_select_box('Show navigation bar as','navbar_format',$navbar_format,
'You can show the applications as icons only, icons with app-name or both.');
$format = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
$format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'];
$format = ($format ? $format : 'Y/m/d') . ', ';
if ($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] == '12')
if ($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '12')
{
$format .= 'h:i a';
}
@ -84,8 +84,8 @@
$sbox = createobject('phpgwapi.sbox');
create_select_box('Country','country',$sbox->country_array,
'In which country are you. This is used to set certain defaults for you.');
$langs = $GLOBALS['phpgw']->translation->get_installed_langs();
$langs = $GLOBALS['egw']->translation->get_installed_langs();
create_select_box('Language','lang',$langs,
'Select the language of texts and messages within eGroupWare.<br>Some languages may not contain all messages, in that case you will see an english message.');
@ -96,12 +96,12 @@
'Should the number of active sessions be displayed for you all the time.');
}
reset($GLOBALS['phpgw_info']['user']['apps']);
while (list($app) = each($GLOBALS['phpgw_info']['user']['apps']))
reset($GLOBALS['egw_info']['user']['apps']);
while (list($app) = each($GLOBALS['egw_info']['user']['apps']))
{
if ($GLOBALS['phpgw_info']['apps'][$app]['status'] != 2 && $app)
if ($GLOBALS['egw_info']['apps'][$app]['status'] != 2 && $app)
{
$user_apps[$app] = $GLOBALS['phpgw_info']['apps'][$app]['title'] ? $GLOBALS['phpgw_info']['apps'][$app]['title'] : lang($app);
$user_apps[$app] = $GLOBALS['egw_info']['apps'][$app]['title'] ? $GLOBALS['egw_info']['apps'][$app]['title'] : lang($app);
}
}
create_select_box('Default application','default_app',$user_apps,
@ -109,7 +109,7 @@
create_input_box('Currency','currency',
'Which currency symbol or name should be used in eGroupWare.');
$account_sels = array(
'selectbox' => lang('Selectbox'),
'primary_group' => lang('Selectbox with primary group and search'),

View File

@ -12,14 +12,14 @@
/* $Id$ */
$phpgw_info = array();
$GLOBALS['phpgw_info']['flags'] = array(
$egw_info = array();
$GLOBALS['egw_info']['flags'] = array(
'currentapp' => 'preferences',
'disable_Template_class' => True
);
include('../header.inc.php');
$pref_tpl = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
$pref_tpl = CreateObject('phpgwapi.Template',EGW_APP_TPL);
$templates = Array(
'pref' => 'index.tpl'
);
@ -32,16 +32,16 @@
$pref_tpl->set_block('pref','link_row');
$pref_tpl->set_block('pref','spacer_row');
if ($GLOBALS['phpgw']->acl->check('run',1,'admin'))
if ($GLOBALS['egw']->acl->check('run',1,'admin'))
{
// This is where we will keep track of our position.
// Developers won't have to pass around a variable then
$session_data = $GLOBALS['phpgw']->session->appsession('session_data','preferences');
$session_data = $GLOBALS['egw']->session->appsession('session_data','preferences');
if (! is_array($session_data))
{
$session_data = array('type' => 'user');
$GLOBALS['phpgw']->session->appsession('session_data','preferences',$session_data);
$GLOBALS['egw']->session->appsession('session_data','preferences',$session_data);
}
if (! $GLOBALS['HTTP_GET_VARS']['type'])
@ -52,20 +52,20 @@
{
$type = $GLOBALS['HTTP_GET_VARS']['type'];
$session_data = array('type' => $type);
$GLOBALS['phpgw']->session->appsession('session_data','preferences',$session_data);
$GLOBALS['egw']->session->appsession('session_data','preferences',$session_data);
}
$tabs[] = array(
'label' => lang('Your preferences'),
'link' => $GLOBALS['phpgw']->link('/preferences/index.php','type=user')
'link' => $GLOBALS['egw']->link('/preferences/index.php','type=user')
);
$tabs[] = array(
'label' => lang('Default preferences'),
'link' => $GLOBALS['phpgw']->link('/preferences/index.php','type=default')
'link' => $GLOBALS['egw']->link('/preferences/index.php','type=default')
);
$tabs[] = array(
'label' => lang('Forced preferences'),
'link' => $GLOBALS['phpgw']->link('/preferences/index.php','type=forced')
'link' => $GLOBALS['egw']->link('/preferences/index.php','type=forced')
);
switch($type)
@ -74,7 +74,7 @@
case 'default': $selected = 1; break;
case 'forced': $selected = 2; break;
}
$pref_tpl->set_var('tabs',$GLOBALS['phpgw']->common->create_tabs($tabs,$selected));
$pref_tpl->set_var('tabs',$GLOBALS['egw']->common->create_tabs($tabs,$selected));
}
// This func called by the includes to dump a row header
@ -83,7 +83,7 @@
global $pref_tpl;
$pref_tpl->set_var('a_name',$appname);
$pref_tpl->set_var('app_name',$GLOBALS['phpgw_info']['apps'][$appname]['title']);
$pref_tpl->set_var('app_name',$GLOBALS['egw_info']['apps'][$appname]['title']);
$pref_tpl->set_var('app_icon',$icon);
if ($icon)
{
@ -101,7 +101,7 @@
$pref_tpl->set_var('pref_link',$pref_link);
if (strtolower($pref_text) == 'grant access' && $GLOBALS['phpgw_info']['server']['deny_user_grants_access'])
if (strtolower($pref_text) == 'grant access' && $GLOBALS['egw_info']['server']['deny_user_grants_access'])
{
return False;
}
@ -126,7 +126,7 @@
{
$file = $file2;
}
section_start($appname,$GLOBALS['phpgw']->common->image($appname,Array('navbar',$appname)));
section_start($appname,$GLOBALS['egw']->common->image($appname,Array('navbar',$appname)));
while(list($text,$url) = each($file))
{
@ -135,7 +135,7 @@
section_end();
}
$GLOBALS['phpgw']->hooks->process('preferences',array('preferences'));
$GLOBALS['egw']->hooks->process('preferences',array('preferences'));
$pref_tpl->pfp('out','list');
$GLOBALS['phpgw']->common->phpgw_footer();
$GLOBALS['egw']->common->phpgw_footer();
?>

View File

@ -19,12 +19,12 @@
'enable_nextmatchs_class' => True
);
include('../header.inc.php');
if ($_POST['cancel'])
{
$GLOBALS['egw']->redirect_link('/preferences/index.php');
}
$user = get_var('user',Array('POST'));
$forced = get_var('forced',Array('POST'));
$default = get_var('default',Array('POST'));
@ -37,7 +37,7 @@
$t->set_block('preferences','row','rowhandle');
$t->set_block('preferences','help_row','help_rowhandle');
$t->set_var(array('rowhandle' => '','help_rowhandle' => '','messages' => ''));
if ($_GET['appname'] != 'preferences')
{
$GLOBALS['egw']->translation->add_app('preferences'); // we need the prefs translations too
@ -72,7 +72,7 @@
function create_password_box($label_name,$preference_name,$help='',$size = '',$max_size = '',$run_lang=True)
{
global $user,$forced,$default;
$_appname = check_app();
if (is_forced_value($_appname,$preference_name))
{
@ -80,7 +80,7 @@
}
create_input_box($label_name,$preference_name.'][pw',$help,'',$size,$max_size,'password',$run_lang);
}
function create_input_box($label,$name,$help='',$default='',$size = '',$max_size = '',$type='',
$run_lang=True)
{
@ -111,7 +111,7 @@
{
$default = $prefs[$name];
}
if ($GLOBALS['type'] == 'user')
{
$def_text = !$GLOBALS['egw']->preferences->user[$_appname][$name] ? $GLOBALS['egw']->preferences->data[$_appname][$name] : $GLOBALS['egw']->preferences->default[$_appname][$name];
@ -129,7 +129,7 @@
$t->fp('rows',process_help($help,$run_lang) ? 'help_row' : 'row',True);
}
function process_help($help,$run_lang=True)
{
global $t,$show_help,$has_help;
@ -137,11 +137,11 @@
if (!empty($help))
{
$has_help = True;
if ($show_help)
{
$t->set_var('help_value',$run_lang ? lang($help) : $help);
return True;
}
}
@ -152,7 +152,7 @@
{
// checkboxes itself can't be use as they return nothing if uncheckt !!!
global $prefs;
if ($GLOBALS['type'] != 'user')
{
$default = ''; // no defaults for default or forced prefs
@ -161,7 +161,7 @@
{
$prefs[$name] = (int)(!!$prefs[$name]); // to care for '' and 'True'
}
return create_select_box($label,$name,array(
'0' => lang('No'),
'1' => lang('Yes')
@ -215,7 +215,7 @@
{
return True;
}
if (isset($prefs[$name]) || $GLOBALS['type'] != 'user')
{
$default = $prefs[$name];
@ -245,12 +245,12 @@
$t->fp('rows',process_help($help,$run_lang) ? 'help_row' : 'row',True);
}
/**
* creates text-area or inputfield with subtitution-variables
*
* @param $label untranslated label
* @param $name name of the pref
* @param $name name of the pref
* @param $rows, $cols of the textarea or input-box ($rows==1)
* @param $help untranslated help-text
* @param $default default-value
@ -293,7 +293,7 @@
function create_text_area($label,$name,$rows,$cols,$help='',$default='',$run_lang=True)
{
global $t,$prefs,$notifys;
$charSet = $GLOBALS['egw']->translation->charset();
$_appname = check_app();
@ -301,7 +301,7 @@
{
return True;
}
if (isset($prefs[$name]) || $GLOBALS['type'] != 'user')
{
$default = $prefs[$name];
@ -367,8 +367,8 @@
}
//echo "prefix='$prefix', prefs=<pre>"; print_r($repository[$_appname]); echo "</pre>\n";
// the following hook can be used to verify the prefs
// if you return something else than False, it is treated as an error-msg and
// the following hook can be used to verify the prefs
// if you return something else than False, it is treated as an error-msg and
// displayed to the user (the prefs get not saved !!!)
//
if ($error = $GLOBALS['egw']->hooks->single(array(
@ -380,9 +380,9 @@
{
return $error;
}
$GLOBALS['egw']->preferences->save_repository(True,$GLOBALS['type']);
return False;
}
@ -408,7 +408,7 @@
return False;
}
}
function show_list($header = '&nbsp;')
{
global $t,$list_shown;
@ -423,7 +423,7 @@
$session_data = $GLOBALS['egw']->session->appsession('session_data','preferences');
$prefix = get_var('prefix',array('GET'),$session_data['appname'] == $_GET['appname'] ? $session_data['prefix'] : '');
if (is_admin())
{
/* This is where we will keep track of our postion. */
@ -440,7 +440,7 @@
{
$GLOBALS['type'] = 'user';
}
$show_help = "$session_data[show_help]" != '' && $session_data['appname'] == $_GET['appname'] ?
$show_help = "$session_data[show_help]" != '' && $session_data['appname'] == $_GET['appname'] ?
$session_data['show_help'] : (int)$GLOBALS['egw_info']['user']['preferences']['common']['show_help'];
if ($toggle_help = get_var('toggle_help','POST'))
@ -471,7 +471,7 @@
{
$GLOBALS['egw']->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
@ -497,10 +497,10 @@
switch ($GLOBALS['type']) // set up some globals to be used by the hooks
{
case 'forced':
$prefs = &$GLOBALS['egw']->preferences->forced[check_app()];
case 'forced':
$prefs = &$GLOBALS['egw']->preferences->forced[check_app()];
break;
case 'default':
case 'default':
$prefs = &$GLOBALS['egw']->preferences->default[check_app()];
break;
default:
@ -516,13 +516,13 @@
}
}
//echo "prefs=<pre>"; print_r($prefs); echo "</pre>\n";
$notifys = array();
if (!$GLOBALS['egw']->hooks->single('settings',$_GET['appname']))
{
$t->set_block('preferences','form','formhandle'); // skip the form
$t->set_var('formhandle','');
$t->set_var('messages',lang('Error: There was a problem finding the preference file for %1 in %2',
$GLOBALS['egw_info']['navbar'][$_GET['appname']]['title'],EGW_SERVER_ROOT . SEP
. $_GET['appname'] . SEP . 'inc' . SEP . 'hook_settings.inc.php'));
@ -584,8 +584,8 @@
show_list();
}
$t->pfp('phpgw_body','preferences');
//echo '<pre style="text-align: left;">'; print_r($GLOBALS['egw']->preferences->data); echo "</pre>\n";
$GLOBALS['egw']->common->egw_footer();
?>