diff --git a/admin/inc/class.boaccounts.inc.php b/admin/inc/class.boaccounts.inc.php index 5e7c1f71bb..8cb133d479 100755 --- a/admin/inc/class.boaccounts.inc.php +++ b/admin/inc/class.boaccounts.inc.php @@ -78,6 +78,24 @@ } } + function check_rights($action, $access = 'group_access') + { + switch($action) + { + case 'view': $right = '8'; break; + case 'add': $right = '4'; break; + case 'edit': $right = '16'; break; + case 'delete': $right = '32'; break; + case 'search': $right = '2'; break; + } + + if (!$GLOBALS['phpgw']->acl->check($access,$right,'admin')) + { + return True; + } + return False; + } + function delete_group($account_id) { if ($GLOBALS['phpgw']->acl->check('group_access',32,'admin')) diff --git a/admin/inc/class.uiaccounts.inc.php b/admin/inc/class.uiaccounts.inc.php index 7cdbc30f8e..34b4794481 100755 --- a/admin/inc/class.uiaccounts.inc.php +++ b/admin/inc/class.uiaccounts.inc.php @@ -65,6 +65,8 @@ $GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'search_field', $GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'nextmatchs')); +/* what should this be for??? this is the same call for both cases! can this be removed? [ceb] */ + if ($GLOBALS['phpgw']->acl->check('group_access',2,'admin')) { $account_info = $GLOBALS['phpgw']->accounts->get_list('groups',$start,$sort, $order, $query, $total); @@ -91,40 +93,20 @@ 'lang_sort_statustext' => lang('sort the entries') ); - if (! $GLOBALS['phpgw']->acl->check('group_access',8,'admin')) - { - $can_view = True; - } - - if (! $GLOBALS['phpgw']->acl->check('group_access',16,'admin')) - { - $can_edit = True; - } - - if (! $GLOBALS['phpgw']->acl->check('group_access',32,'admin')) - { - $can_delete = True; - } - while (list($null,$account) = each($account_info)) { $group_data[] = Array ( - 'edit_url' => ($can_edit?$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.edit_group&account_id=' . $account['account_id']):''), - 'lang_edit' => ($can_edit?lang('edit'):''), - 'lang_edit_statustext' => ($can_edit?lang('edit this group'):''), + 'edit_url' => ($this->bo->check_rights('edit')?$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.edit_group&account_id=' . $account['account_id']):''), + 'lang_edit' => ($this->bo->check_rights('edit')?lang('edit'):''), + 'lang_edit_statustext' => ($this->bo->check_rights('edit')?lang('edit this group'):''), 'group_name' => (!$account['account_lid']?'':$account['account_lid']), - 'delete_url' => ($can_delete?$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.delete_group&account_id=' . $account['account_id']):''), - 'lang_delete_statustext' => ($can_delete?lang('delete this group'):''), - 'lang_delete' => ($can_delete?lang('delete'):'') + 'delete_url' => ($this->bo->check_rights('delete')?$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.delete_group&account_id=' . $account['account_id']):''), + 'lang_delete_statustext' => ($this->bo->check_rights('delete')?lang('delete this group'):''), + 'lang_delete' => ($this->bo->check_rights('delete')?lang('delete'):'') ); } - if (! $GLOBALS['phpgw']->acl->check('group_access',4,'admin')) - { - $add_access = 'yes'; - } - $group_add = array ( 'lang_add' => lang('add'), @@ -133,14 +115,9 @@ 'lang_done' => lang('done'), 'lang_done_statustext' => lang('return to admin mainscreen'), 'done_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.mainscreen'), - 'add_access' => $add_access, + 'add_access' => ($this->bo->check_rights('add')?'yes':''), ); - if (! $GLOBALS['phpgw']->acl->check('group_access',2,'admin')) - { - $search_access = 'yes'; - } - $data = array ( 'start_record' => $start, @@ -154,11 +131,10 @@ 'lang_searchbutton_statustext' => lang('Submit the search string'), 'query' => $query, 'lang_search' => lang('search'), - 'lang_groups' => lang('user groups'), 'group_header' => $group_header, 'group_data' => $group_data, 'group_add' => $group_add, - 'search_access' => $search_access + 'search_access' => ($this->bo->check_rights('search')?'yes':'') ); $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('group_list' => $data)); } @@ -195,21 +171,14 @@ { $sort = 'ASC'; } - - unset($GLOBALS['phpgw_info']['flags']['noheader']); - unset($GLOBALS['phpgw_info']['flags']['nonavbar']); - $GLOBALS['phpgw']->common->phpgw_header(); - $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); + $GLOBALS['phpgw_info']['flags']['app_header'] = lang('administration') . ': ' . lang('list users'); - $p->set_file( - Array( - 'accounts' => 'accounts.tpl' - ) - ); - $p->set_block('accounts','list','list'); - $p->set_block('accounts','row','row'); - $p->set_block('accounts','row_empty','row_empty'); + $GLOBALS['phpgw']->xslttpl->add_file(array('app_data','users', + $GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'search_field', + $GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi','default') . SEP . 'nextmatchs')); + +/* the same like in groups... we really should remove this... :) [ceb] */ if ($GLOBALS['phpgw']->acl->check('account_access',2,'admin')) { @@ -222,101 +191,87 @@ $total = $GLOBALS['phpgw']->accounts->total; } - $url = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_users'); - - $var = Array( - 'bg_color' => $GLOBALS['phpgw_info']['theme']['bg_color'], - 'th_bg' => $GLOBALS['phpgw_info']['theme']['th_bg'], - 'left_next_matchs' => $this->nextmatchs->left($url,$start,$total,'menuaction=admin.uiaccounts.list_users'), - 'lang_user_accounts' => lang('user accounts'), - 'right_next_matchs' => $this->nextmatchs->right($url,$start,$total,'menuaction=admin.uiaccounts.list_users'), - 'lang_loginid' => $this->nextmatchs->show_sort_order($sort,'account_lid',$order,$url,lang('LoginID')), - 'lang_lastname' => $this->nextmatchs->show_sort_order($sort,'account_lastname',$order,$url,lang('last name')), - 'lang_firstname' => $this->nextmatchs->show_sort_order($sort,'account_firstname',$order,$url,lang('first name')), - 'lang_edit' => lang('edit'), - 'lang_delete' => lang('delete'), - 'lang_view' => lang('view'), - 'actionurl' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.add_user'), - 'accounts_url' => $url, - 'lang_search' => lang('search'), - 'lang_done' => lang('Done'), - 'doneurl' => $GLOBALS['phpgw']->link('/admin/index.php') + $user_header = array + ( + 'sort_lid' => $this->nextmatchs->show_sort_order(array + ( + 'sort' => $sort, + 'var' => 'account_lid', + 'order' => $order, + 'extra' => 'menuaction=admin.uiaccounts.list_users' + )), + 'lang_lid' => lang('loginid'), + 'sort_lastname' => $this->nextmatchs->show_sort_order(array + ( + 'sort' => $sort, + 'var' => 'account_lastname', + 'order' => $order, + 'extra' => 'menuaction=admin.uiaccounts.list_users' + )), + 'lang_lastname' => lang('Lastname'), + 'sort_firstname' => $this->nextmatchs->show_sort_order(array + ( + 'sort' => $sort, + 'var' => 'account_firstname', + 'order' => $order, + 'extra' => 'menuaction=admin.uiaccounts.list_users' + )), + 'lang_firstname' => lang('firstname'), + 'lang_view' => lang('view'), + 'lang_edit' => lang('edit'), + 'lang_delete' => lang('delete'), + 'lang_sort_statustext' => lang('sort the entries') ); - $p->set_var($var); - if (! $GLOBALS['phpgw']->acl->check('account_access',4,'admin')) + while (list($null,$account) = each($account_info)) { - $p->set_var('input_add',''); + $user_data[] = Array + ( + 'view_url' => ($this->bo->check_rights('view','account_access')?$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.view_user&account_id=' . $account['account_id']):''), + 'lang_view' => ($this->bo->check_rights('view','account_access')?lang('view'):''), + 'lang_view_statustext' => ($this->bo->check_rights('view','account_access')?lang('view this user'):''), + 'edit_url' => ($this->bo->check_rights('edit','account_access')?$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.edit_user&account_id=' . $account['account_id']):''), + 'lang_edit' => ($this->bo->check_rights('edit','account_access')?lang('edit'):''), + 'lang_edit_statustext' => ($this->bo->check_rights('edit','account_access')?lang('edit this user'):''), + 'lid' => (!$account['account_lid']?'':$account['account_lid']), + 'firstname' => (!$account['account_firstname']?'':$account['account_firstname']), + 'lastname' => (!$account['account_lastname']?'':$account['account_lastname']), + 'delete_url' => ($this->bo->check_rights('delete','account_access')?$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.delete_user&account_id=' . $account['account_id']):''), + 'lang_delete_statustext' => ($this->bo->check_rights('delete','account_access')?lang('delete this user'):''), + 'lang_delete' => ($this->bo->check_rights('delete','account_access')?lang('delete'):'') + ); } - if (! $GLOBALS['phpgw']->acl->check('account_access',2,'admin')) - { - $p->set_var('input_search',lang('Search') . ' '); - } + $user_add = array + ( + 'lang_add' => lang('add'), + 'lang_add_statustext' => lang('add a user'), + 'add_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.edit_user'), + 'lang_done' => lang('done'), + 'lang_done_statustext' => lang('return to admin mainscreen'), + 'done_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.mainscreen'), + 'add_access' => ($this->bo->check_rights('add','account_access')?'yes':''), + ); - if (!count($account_info) || !$total) - { - $p->set_var('message',lang('No matches found')); - $p->parse('rows','row_empty',True); - } - else - { - if (! $GLOBALS['phpgw']->acl->check('account_access',8,'admin')) - { - $can_view = True; - } - - if (! $GLOBALS['phpgw']->acl->check('account_access',16,'admin')) - { - $can_edit = True; - } - - if (! $GLOBALS['phpgw']->acl->check('account_access',32,'admin')) - { - $can_delete = True; - } - - while (list($null,$account) = each($account_info)) - { - $this->nextmatchs->template_alternate_row_color($p); - - $var = array( - 'row_loginid' => $account['account_lid'], - 'row_firstname' => (!$account['account_firstname']?' ':$account['account_firstname']), - 'row_lastname' => (!$account['account_lastname']?' ':$account['account_lastname']) - ); - $p->set_var($var); - - if ($can_edit) - { - $p->set_var('row_edit',$this->row_action('edit','user',$account['account_id'])); - } - else - { - $p->set_var('row_edit',' '); - } - - if ($can_delete) - { - $p->set_var('row_delete',($GLOBALS['phpgw_info']['user']['userid'] != $account['account_lid']?$this->row_action('delete','user',$account['account_id']):' ')); - } - else - { - $p->set_var('row_delete',' '); - } - - if ($can_view) - { - $p->set_var('row_view',$this->row_action('view','user',$account['account_id'])); - } - else - { - $p->set_var('row_view',' '); - } - $p->parse('rows','row',True); - } - } // End else - $p->pfp('out','list'); + $data = array + ( + 'start_record' => $start, + 'record_limit' => $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'], + 'num_records' => count($account_info), + 'all_records' => $total, + 'nextmatchs_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_users'), + 'nextmatchs_img_path' => $GLOBALS['phpgw']->common->get_image_path('phpgwapi','default'), + 'select_url' => $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_users'), + 'lang_searchfield_statustext' => lang('Enter the search string. To show all entries, empty this field and press the SUBMIT button again'), + 'lang_searchbutton_statustext' => lang('Submit the search string'), + 'query' => $query, + 'lang_search' => lang('search'), + 'user_header' => $user_header, + 'user_data' => $user_data, + 'user_add' => $user_add, + 'search_access' => ($this->bo->check_rights('search','account_access')?'yes':'') + ); + $GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('account_list' => $data)); } function add_user() diff --git a/admin/inc/hook_admin.inc.php b/admin/inc/hook_admin.inc.php index 92fe31fa82..8d322e88a8 100644 --- a/admin/inc/hook_admin.inc.php +++ b/admin/inc/hook_admin.inc.php @@ -8,37 +8,36 @@ * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * \**************************************************************************/ - /* $Id$ */ if (! $GLOBALS['phpgw']->acl->check('site_config_access',1,'admin')) { - $file['Site Configuration'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=admin'); + $file['Site Configuration'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiconfig.index&appname=admin'); } if (! $GLOBALS['phpgw']->acl->check('peer_server_access',1,'admin')) { - $file['Peer Servers'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.list_servers'); + $file['Peer Servers'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiserver.list_servers'); } if (! $GLOBALS['phpgw']->acl->check('account_access',1,'admin')) { - $file['User Accounts'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_users'); + $file['User Accounts'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_users'); } if (! $GLOBALS['phpgw']->acl->check('group_access',1,'admin')) { - $file['User Groups'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'); + $file['User Groups'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiaccounts.list_groups'); } if (! $GLOBALS['phpgw']->acl->check('applications_access',1,'admin')) { - $file['Applications'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiapplications.get_list'); + $file['Applications'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uiapplications.get_list'); } if (! $GLOBALS['phpgw']->acl->check('global_categories_access',1,'admin')) { - $file['Global Categories'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index'); + $file['Global Categories'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uicategories.index'); } if (! $GLOBALS['phpgw']->acl->check('mainscreen_message_access',1,'admin')) @@ -58,7 +57,7 @@ if (! $GLOBALS['phpgw']->acl->check('error_log_access',1,'admin')) { - $file['View Error Log'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uilog.list_log'); + $file['View Error Log'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uilog.list_log'); } if (! $GLOBALS['phpgw']->acl->check('appreg_access',1,'admin')) @@ -68,7 +67,7 @@ if (! $GLOBALS['phpgw']->acl->check('info_access',1,'admin')) { - $file['phpInfo'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/admin/phpinfo.php') . "')"; //$GLOBALS['phpgw']->link('/admin/phpinfo.php'); + $file['phpInfo'] = "javascript:openwindow('" . $GLOBALS['phpgw']->link('/admin/phpinfo.php') . "')"; //$GLOBALS['phpgw']->link('/admin/phpinfo.php'); } /* Do not modify below this line */ diff --git a/admin/templates/default/app_data.xsl b/admin/templates/default/app_data.xsl index 1923a7addd..4ed524c4ba 100644 --- a/admin/templates/default/app_data.xsl +++ b/admin/templates/default/app_data.xsl @@ -17,6 +17,9 @@ + + + diff --git a/admin/templates/default/users.xsl b/admin/templates/default/users.xsl new file mode 100644 index 0000000000..9e346b36cb --- /dev/null +++ b/admin/templates/default/users.xsl @@ -0,0 +1,262 @@ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+ +
+ + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + row_off + + + row_on + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + window.status=' + + '; return true; + + +
+
+
+ + + + + + +
+ + + window.status=' + + '; return true; + + +
+ + +
+ + + + + + + + + + + + + + +
+ + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+ +
+ + + + + + + +
 
+
+ + +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + row_off + + + row_on + + + + + + + + + + + + + + + + + + + + + {$img_name} + + + + +