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$ */ /* $Id$ */
$GLOBALS['phpgw_info']['flags'] = array( $GLOBALS['egw_info']['flags'] = array(
'noheader' => True, 'noheader' => True,
'nonavbar' => True, 'nonavbar' => True,
'currentapp' => 'preferences' 'currentapp' => 'preferences'
); );
include('../header.inc.php'); include('../header.inc.php');
$n_passwd = $_POST['n_passwd']; $n_passwd = $_POST['n_passwd'];
$n_passwd_2 = $_POST['n_passwd_2']; $n_passwd_2 = $_POST['n_passwd_2'];
$o_passwd_2 = $_POST['o_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['egw']->redirect_link('/preferences/index.php');
$GLOBALS['phpgw']->common->phpgw_exit(); $GLOBALS['egw']->common->phpgw_exit();
} }
$GLOBALS['phpgw']->template->set_file(array( $GLOBALS['egw']->template->set_file(array(
'form' => 'changepassword.tpl' 'form' => 'changepassword.tpl'
)); ));
$GLOBALS['phpgw']->template->set_var('lang_enter_password',lang('Enter your new password')); $GLOBALS['egw']->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['egw']->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['egw']->template->set_var('lang_enter_old_password',lang('Enter your old password'));
$GLOBALS['phpgw']->template->set_var('lang_change',lang('Change')); $GLOBALS['egw']->template->set_var('lang_change',lang('Change'));
$GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel')); $GLOBALS['egw']->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('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.')); . 'need to be done manually.'));
} }
if ($_POST['change']) if ($_POST['change'])
{ {
$o_passwd = $GLOBALS['phpgw_info']['user']['passwd']; $o_passwd = $GLOBALS['egw_info']['user']['passwd'];
if ($o_passwd != $o_passwd_2) if ($o_passwd != $o_passwd_2)
{ {
@ -67,45 +66,45 @@
if(is_array($errors)) if(is_array($errors))
{ {
$GLOBALS['phpgw']->common->phpgw_header(); $GLOBALS['egw']->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();
$GLOBALS['phpgw']->template->set_var('messages',$GLOBALS['phpgw']->common->error_list($errors)); $GLOBALS['egw']->template->set_var('messages',$GLOBALS['egw']->common->error_list($errors));
$GLOBALS['phpgw']->template->pfp('out','form'); $GLOBALS['egw']->template->pfp('out','form');
$GLOBALS['phpgw']->common->phpgw_exit(True); $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) if(!$passwd_changed)
{ {
$errors[] = lang('Failed to change password. Please contact your administrator.'); $errors[] = lang('Failed to change password. Please contact your administrator.');
$GLOBALS['phpgw']->common->phpgw_header(); $GLOBALS['egw']->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();
$GLOBALS['phpgw']->template->set_var('messages',$GLOBALS['phpgw']->common->error_list($errors)); $GLOBALS['egw']->template->set_var('messages',$GLOBALS['egw']->common->error_list($errors));
$GLOBALS['phpgw']->template->pfp('out','form'); $GLOBALS['egw']->template->pfp('out','form');
$GLOBALS['phpgw']->common->phpgw_exit(True); $GLOBALS['egw']->common->phpgw_exit(True);
} }
else else
{ {
$GLOBALS['phpgw']->session->appsession('password','phpgwapi',base64_encode($n_passwd)); $GLOBALS['egw']->session->appsession('password','phpgwapi',base64_encode($n_passwd));
$GLOBALS['phpgw_info']['user']['passwd'] = $n_passwd; $GLOBALS['egw_info']['user']['passwd'] = $n_passwd;
$GLOBALS['hook_values']['account_id'] = $GLOBALS['phpgw_info']['user']['account_id']; $GLOBALS['hook_values']['account_id'] = $GLOBALS['egw_info']['user']['account_id'];
$GLOBALS['hook_values']['old_passwd'] = $o_passwd; $GLOBALS['hook_values']['old_passwd'] = $o_passwd;
$GLOBALS['hook_values']['new_passwd'] = $n_passwd; $GLOBALS['hook_values']['new_passwd'] = $n_passwd;
// called for every app now, not only for the ones enabled for the user // 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', 'location' => 'changepassword',
),False,True); ),False,True);
$GLOBALS['phpgw']->redirect_link('/preferences/index.php','cd=18'); $GLOBALS['egw']->redirect_link('/preferences/index.php','cd=18');
} }
} }
else else
{ {
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Change your password'); $GLOBALS['egw_info']['flags']['app_header'] = lang('Change your password');
$GLOBALS['phpgw']->common->phpgw_header(); $GLOBALS['egw']->common->phpgw_header();
echo parse_navbar(); echo parse_navbar();
$GLOBALS['phpgw']->template->pfp('out','form'); $GLOBALS['egw']->template->pfp('out','form');
$GLOBALS['phpgw']->common->phpgw_footer(); $GLOBALS['egw']->common->phpgw_footer();
} }
?> ?>

View File

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

View File

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

View File

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

View File

@ -12,12 +12,11 @@
/* $Id$ */ /* $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); display_section('preferences',$file);
?> ?>

View File

@ -11,13 +11,13 @@
/* $Id$ */ /* $Id$ */
$templates = $GLOBALS['phpgw']->common->list_templates(); $templates = $GLOBALS['egw']->common->list_templates();
while (list($var,$value) = each($templates)) while (list($var,$value) = each($templates))
{ {
$_templates[$var] = $templates[$var]['title']; $_templates[$var] = $templates[$var]['title'];
} }
$themes = $GLOBALS['phpgw']->common->list_themes(); $themes = $GLOBALS['egw']->common->list_themes();
while (list(,$value) = each($themes)) while (list(,$value) = each($themes))
{ {
$_themes[$value] = $value; $_themes[$value] = $value;
@ -38,9 +38,9 @@
create_select_box('Show navigation bar as','navbar_format',$navbar_format, 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.'); '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') . ', '; $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'; $format .= 'h:i a';
} }
@ -85,7 +85,7 @@
create_select_box('Country','country',$sbox->country_array, create_select_box('Country','country',$sbox->country_array,
'In which country are you. This is used to set certain defaults for you.'); '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, 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.'); '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.'); 'Should the number of active sessions be displayed for you all the time.');
} }
reset($GLOBALS['phpgw_info']['user']['apps']); reset($GLOBALS['egw_info']['user']['apps']);
while (list($app) = each($GLOBALS['phpgw_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, create_select_box('Default application','default_app',$user_apps,

View File

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