Access dialog

- If current app has no special support, show general dialog instead of message
- Sort apps in add dialog
- Filter app list (filter2) to all apps for run rights, or only supporting apps otherwise
This commit is contained in:
Nathan Gray 2015-09-16 15:54:51 +00:00
parent 558492d439
commit 249732b594
3 changed files with 40 additions and 9 deletions

View File

@ -248,6 +248,34 @@ class admin_acl
}
//error_log(__METHOD__."(".array2string($query).") returning ".$total);
// Get supporting or all apps for filter2 depending on filter
if($query['filter'] == 'run')
{
$rows['sel_options']['filter2'] = array(
'' => lang('All applications'),
)+etemplate_widget_menupopup::app_options('enabled');
}
else
{
$rows['sel_options']['filter2'] = array(
array('value' => '', 'label' => lang('All applications'))
);
$apps = $GLOBALS['egw']->hooks->process(array(
'location' => 'acl_rights',
'owner' => $query['account_id'],
), array(), true);
foreach($apps as $appname => $rights)
{
$rows['sel_options']['filter2'][] = array(
'value' => $appname,
'label' => lang($appname)
);
}
usort($rows['sel_options']['filter2'], function($a,$b) {
return strcasecmp($a['label'], $b['label']);
});
}
return $total;
}
@ -388,12 +416,9 @@ class admin_acl
'other' => lang('Access to %1 data by others', $user),
'own' => lang('%1 access to other data', $user),
'run' => lang('%1 run rights for applications', $user),
),
'filter2' => array(
'' => lang('All applications'),
)+etemplate_widget_menupopup::app_options('enabled'),
)
);
$tpl->exec('admin.admin_acl.index', $content, $sel_options);
}

View File

@ -447,11 +447,17 @@ app.classes.admin = AppJS.extend(
else
{
// Restrict application selectbox to only apps that support ACL
sel_options.acl_appname = {};
sel_options.acl_appname = [];
for(var app in acl_rights)
{
sel_options.acl_appname[app] = this.egw.lang(app);
sel_options.acl_appname.push({value: app, label: this.egw.lang(app)});
}
// Sort list
sel_options.acl_appname.sort(function(a,b) {
if(a.label > b.label) return 1;
if(a.label < b.label) return -1;
return 0;
});
}
}

View File

@ -116,7 +116,7 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function() {
var current_app = this.app_name();
var query = {current_app: current_app};
// give warning, if app does not support given type, but all apps link to common prefs, if they dont support prefs themselfs
if ($j.isArray(apps) && $j.inArray(current_app, apps) == -1 && name != 'prefs' ||
if ($j.isArray(apps) && $j.inArray(current_app, apps) == -1 && (name != 'prefs' && name != 'acl') ||
!$j.isArray(apps) && (typeof apps[current_app] == 'undefined' || !apps[current_app]))
{
egw_message(egw.lang('Not supported by current application!'), 'warning');
@ -134,7 +134,7 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function() {
case 'acl':
query.menuaction='preferences.preferences_acl.index';
query.acl_app=current_app;
if ($j.inArray(current_app, apps) != -1) query.acl_app=current_app;
egw.open_link(egw.link(url, query), '_blank', '900x450');
break;