From 00cbf4b6fbc044b10f4f8ef811c8b59da39a5fa0 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 27 Jun 2011 15:49:42 +0000 Subject: [PATCH] - Use full warning message for translation - Rename phpgw to Global in app list --- admin/inc/class.admin_categories.inc.php | 38 +++++++++++++++++++----- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/admin/inc/class.admin_categories.inc.php b/admin/inc/class.admin_categories.inc.php index 027117518f..b3876be8ff 100644 --- a/admin/inc/class.admin_categories.inc.php +++ b/admin/inc/class.admin_categories.inc.php @@ -246,7 +246,7 @@ class admin_categories egw_framework::validate_file('.','global_categories','admin'); egw_framework::set_onload('$(document).ready(function() { cat_original_owner = [' . ($content['owner'] ? $content['owner'] : $content['id'] ? '0' : '') .']; - permission_prompt = \'' . lang('cat_permission_confirm').'\'; + permission_prompt = \'' . lang('Removing access for groups may cause problems for data in this category. Are you sure? Users in these groups may no longer have access:').'\'; });'); $readonlys['button[delete]'] = !$content['id'] || !self::$acl_delete || // cant delete not yet saved category @@ -303,10 +303,6 @@ class admin_categories { self::init_static(); - if (!isset($query['appname'])) - { - throw new egw_exception_assertion_failed(__METHOD__.'($query,...) $query[appname] NOT set!'); - } $filter = array(); $globalcat = ($query['filter'] === categories::GLOBAL_ACCOUNT || !$query['filter']); if (isset($query['global_cats']) && $query['global_cats']===false) @@ -316,17 +312,18 @@ class admin_categories if ($globalcat) $filter['access'] = 'public'; egw_cache::setSession(__CLASS__.$query['appname'],'nm',$query); - if($query['filter'] > 0 || $query['col_filter']['owner']) { + if($query['filter'] > 0 || $query['col_filter']['owner']) + { $owner = $query['col_filter']['owner'] ? $query['col_filter']['owner'] : $query['filter']; } - $cats = new categories($filter['owner'],$query['appname']); $globalcat = isset($GLOBALS['egw_info']['user']['apps']['admin']) ? 'all_no_acl' : 1; // ignore acl only for admins $rows = $cats->return_sorted_array($query['start'],false,$query['search'],$query['sort'],$query['order'],$globalcat,$parent=0,true,$filter); $count = $cats->total_records; foreach($rows as $key => &$row) { - if($owner && $owner != $row['owner'] || ((string)$query['filter'] === (string)categories::GLOBAL_ACCOUNT && $row['owner'] > 0)) + $row['owner'] = explode(',',$row['owner']); + if(($owner && !in_array($owner, $row['owner'])) || ((string)$query['filter'] === (string)categories::GLOBAL_ACCOUNT && $row['owner'][0] > 0)) { unset($rows[$key]); $count--; @@ -456,6 +453,9 @@ class admin_categories $content['msg'] = $msg; $content['add_link']= $this->add_link.'&appname='.$appname; $content['edit_link']= $this->edit_link.'&appname='.$appname; + + $sel_options['appname'] = $this->get_app_list(); + $readonlys['add'] = !self::$acl_add; if(!$GLOBALS['egw_info']['user']['apps']['admin']) { @@ -558,6 +558,28 @@ class admin_categories return $failed == 0; } + + /** + * Get a list of apps for selectbox / filter + */ + protected function get_app_list() { + $apps = array(); + foreach ($GLOBALS['egw_info']['apps'] as $app => $data) + { + if ($app == 'phpgwapi') + { + $apps['phpgw'] = lang('Global'); + continue; + } + // Skip apps that don't show in the app bar, they [usually] don't have categories + if($data['status'] > 1 || in_array($app, array('home','admin','felamimail','sitemgr','sitemgr-link'))) continue; + if ($GLOBALS['egw_info']['user']['apps'][$app]) + { + $apps[$app] = $data['title'] ? $data['title'] : lang($app); + } + } + return $apps; + } } admin_categories::init_static();