- Only show user to user, admins pick from groups

- Don't allow empty owner, use 0 if empty
This commit is contained in:
Nathan Gray 2011-06-16 15:51:42 +00:00
parent 0514391fde
commit 1ab285100a

View File

@ -139,6 +139,7 @@ class admin_categories
{ {
case 'save': case 'save':
case 'apply': case 'apply':
if($content['owner'] == '') $content['owner'] = 0;
if ($content['id'] && self::$acl_edit) if ($content['id'] && self::$acl_edit)
{ {
try { try {
@ -195,8 +196,11 @@ class admin_categories
$sel_options['owner'] = array(0 => lang('All users')); $sel_options['owner'] = array(0 => lang('All users'));
// User's category - add current value to be able to preserve owner // User's category - add current value to be able to preserve owner
if(!$GLOBALS['egw_info']['user']['apps']['admin']) {
if($content['owner'] > 0) $sel_options['owner'][$content['owner']] = common::grab_owner_name($content['owner']); if($content['owner'] > 0) $sel_options['owner'][$content['owner']] = common::grab_owner_name($content['owner']);
}
else
{
$accs = $GLOBALS['egw']->accounts->get_list('groups'); $accs = $GLOBALS['egw']->accounts->get_list('groups');
foreach($accs as $acc) foreach($accs as $acc)
{ {
@ -205,6 +209,7 @@ class admin_categories
$sel_options['owner'][$acc['account_id']] = ExecMethod2('etemplate.select_widget.accountInfo',$acc['account_id'],$acc,$type2,$type=='both'); $sel_options['owner'][$acc['account_id']] = ExecMethod2('etemplate.select_widget.accountInfo',$acc['account_id'],$acc,$type2,$type=='both');
} }
} }
}
egw_framework::validate_file('.','global_categories','admin'); egw_framework::validate_file('.','global_categories','admin');
egw_framework::set_onload('$(document).ready(function() { egw_framework::set_onload('$(document).ready(function() {