From 7462bd01773171aa8dbc9e7870be1f68f46f90e1 Mon Sep 17 00:00:00 2001 From: nathangray Date: Tue, 7 Apr 2020 11:48:52 -0600 Subject: [PATCH] * Api: Fix missing translations in ACL dialog --- admin/inc/class.admin_acl.inc.php | 1 + admin/js/app.ts | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/admin/inc/class.admin_acl.inc.php b/admin/inc/class.admin_acl.inc.php index 0bf65cadf9..89a5368cdb 100644 --- a/admin/inc/class.admin_acl.inc.php +++ b/admin/inc/class.admin_acl.inc.php @@ -436,6 +436,7 @@ class admin_acl ($GLOBALS['egw_info']['flags']['currentapp'] != 'admin' ? 'other' : $GLOBALS['egw_info']['user']['preferences']['admin']['acl_filter']), 'filter2' => !empty($_GET['acl_app']) ? $_GET['acl_app'] : '', + 'filter2_onchange' => 'app.admin.acl_app_change', 'lettersearch' => false, 'order' => 'acl_appname', 'sort' => 'ASC', diff --git a/admin/js/app.ts b/admin/js/app.ts index 207a81747d..34c740ff08 100644 --- a/admin/js/app.ts +++ b/admin/js/app.ts @@ -637,6 +637,10 @@ class AdminApp extends EgwApp // Load checkboxes & their values content.acl_rights = content.acl_rights ? parseInt(content.acl_rights) : null; jQuery.extend(content, {acl:[],right:[],label:[]}); + + // Use this to make sure we get correct app translations + let app_egw = egw(content.acl_appname, window); + for( var right in acl_rights[content.acl_appname]) { // only user himself is allowed to grant private (16) rights @@ -646,7 +650,7 @@ class AdminApp extends EgwApp } content.acl.push(content.acl_rights & parseInt(right)); content.right.push(right); - content.label.push(egw.lang(acl_rights[content.acl_appname][right])); + content.label.push(app_egw.lang(acl_rights[content.acl_appname][right])); } } @@ -779,6 +783,20 @@ class AdminApp extends EgwApp this._acl_dialog(content); } + /** + * Load the new application's lang files when the app filter is changed + */ + acl_app_change(event, nm) + { + let appname = nm.getWidgetById('filter2').getValue() || ''; + if(appname) + { + let app_egw = egw(appname); + app_egw.langRequireApp(window, appname); + nm.getRoot().setApiInstance(app_egw); + } + } + /** * Callback called on successfull call of serverside ACL handling *