Change how app filter works:

- Only list All and current app
- All shows app + globals, app shows just app categories
- App filter hidden when editing super globals
This commit is contained in:
Nathan Gray 2011-07-07 17:19:04 +00:00
parent 2b0278fbbd
commit 283a2a01ff

View File

@ -324,10 +324,10 @@ class admin_categories
} }
if($query['col_filter']['app']) if($query['col_filter']['app'])
{ {
$query['appname'] = $query['col_filter']['app']; $globalcat = false;
} }
$cats = new categories($filter['owner'],$query['appname']); $cats = new categories($filter['owner'],$query['appname']);
$globalcat = isset($GLOBALS['egw_info']['user']['apps']['admin']) ? 'all_no_acl' : 1; // ignore acl only for admins $globalcat = $globalcat && isset($GLOBALS['egw_info']['user']['apps']['admin']) ? 'all_no_acl' : $globalcat; // ignore acl only for admins
$rows = $cats->return_sorted_array($query['start'],false,$query['search'],$query['sort'],$query['order'],$globalcat,$parent=0,true,$filter); $rows = $cats->return_sorted_array($query['start'],false,$query['search'],$query['sort'],$query['order'],$globalcat,$parent=0,true,$filter);
$count = $cats->total_records; $count = $cats->total_records;
foreach($rows as $key => &$row) foreach($rows as $key => &$row)
@ -425,7 +425,7 @@ class admin_categories
{ {
$content['nm']['start']=0; $content['nm']['start']=0;
} }
$content['nm']['appname'] = $content['nm']['col_filter']['app'] = $appname = $_GET['appname'] ? $_GET['appname'] : $appname; $content['nm']['appname'] = $appname = $_GET['appname'] ? $_GET['appname'] : $appname;
$content['nm']['actions'] = $this->get_actions($appname); $content['nm']['actions'] = $this->get_actions($appname);
$content['nm']['global_cats'] = true; $content['nm']['global_cats'] = true;
@ -481,7 +481,11 @@ class admin_categories
$content['edit_link']= $this->edit_link.'&appname='.$appname; $content['edit_link']= $this->edit_link.'&appname='.$appname;
$content['owner'] = ''; $content['owner'] = '';
$sel_options['appname'] = $sel_options['app'] = $this->get_app_list(); $sel_options['appname'] = $this->get_app_list();
$sel_options['app'] = array(
'' => lang('All'),
$appname => lang($appname)
);
$sel_options['owner'][0] = lang('All users'); $sel_options['owner'][0] = lang('All users');
$accs = $GLOBALS['egw']->accounts->get_list('groups'); $accs = $GLOBALS['egw']->accounts->get_list('groups');
@ -499,6 +503,10 @@ class admin_categories
$readonlys['nm']['rows']['owner'] = true; $readonlys['nm']['rows']['owner'] = true;
$readonlys['nm']['col_filter']['owner'] = true; $readonlys['nm']['col_filter']['owner'] = true;
} }
if($appname == categories::GLOBAL_APPNAME) {
$sel_options['app'] = array(''=>'');
$readonlys['nm']['rows']['app'] = true;
}
$tmpl = new etemplate('admin.categories.index'); $tmpl = new etemplate('admin.categories.index');
$tmpl->exec($this->list_link,$content,$sel_options,$readonlys,array( $tmpl->exec($this->list_link,$content,$sel_options,$readonlys,array(