From 6fdf8c98d160128a5f908004180b3a195981b00c Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 1 Apr 2014 15:49:08 +0000 Subject: [PATCH] open preferences and ACL in a popup (ACL still needs a little more work: use et2_dialog to add/edit instead of an other popup) --- admin/inc/class.admin_hooks.inc.php | 14 +++++++++-- admin/inc/class.admin_ui.inc.php | 14 ++++------- admin/js/app.js | 8 ------- admin/lang/egw_de.lang | 1 + admin/lang/egw_en.lang | 1 + phpgwapi/js/jsapi/egw_preferences.js | 7 +++--- .../inc/class.preferences_hooks.inc.php | 8 ++++--- .../inc/class.preferences_settings.inc.php | 23 +++++-------------- preferences/templates/default/settings.xet | 6 ++--- 9 files changed, 36 insertions(+), 46 deletions(-) diff --git a/admin/inc/class.admin_hooks.inc.php b/admin/inc/class.admin_hooks.inc.php index 70a5c6570f..a324ae6a71 100644 --- a/admin/inc/class.admin_hooks.inc.php +++ b/admin/inc/class.admin_hooks.inc.php @@ -185,12 +185,21 @@ class admin_hooks { $actions = array(); + $actions[] = array( + 'id' => 'acl', + 'caption' => 'Access control', + 'url' => 'menuaction=admin.admin_acl.index&account_id=$id', + 'popup' => '900x450', + 'icon' => 'lock', + ); + if (!$GLOBALS['egw']->acl->check('current_sessions_access',1,'admin')) // no rights to view { $actions[] = array( 'description' => 'Login History', 'url' => '/index.php', - 'extradata' => 'menuaction=admin.admin_accesslog.index' + 'extradata' => 'menuaction=admin.admin_accesslog.index', + 'icon' => 'timesheet', ); } @@ -199,7 +208,8 @@ class admin_hooks $actions[] = array( 'description' => 'Deny access', 'url' => '/index.php', - 'extradata' => 'menuaction=admin.uiaclmanager.list_apps' + 'extradata' => 'menuaction=admin.uiaclmanager.list_apps', + 'icon' => 'cancel', ); } return $actions; diff --git a/admin/inc/class.admin_ui.inc.php b/admin/inc/class.admin_ui.inc.php index ac93c656bb..9e6be3b1a5 100644 --- a/admin/inc/class.admin_ui.inc.php +++ b/admin/inc/class.admin_ui.inc.php @@ -115,6 +115,8 @@ class admin_ui 'onExecute' => 'javaScript:app.admin.group', 'caption' => 'Access control', 'enableId' => '^/groups/-\\d+', + 'url' => 'menuaction=admin.admin_acl.index&account_id=$id', + 'popup' => '900x450', 'icon' => 'lock', 'group' => 2, ), @@ -186,14 +188,6 @@ class admin_ui 'onExecute' => 'javaScript:app.admin.account', 'group' => $group, ), - 'acl' => array( - 'caption' => 'Access control', - 'allowOnMultiple' => false, - 'url' => 'menuaction=admin.admin_acl.index&account_id=$id', - 'group' => $group, - 'onExecute' => 'javaScript:app.admin.iframe_location', - 'icon' => 'lock', - ), ); // generate urls for add/edit accounts via addressbook $edit = egw_link::get_registry('addressbook', 'edit'); @@ -234,14 +228,14 @@ if ($app == 'felamimail') continue; // disabled fmail for now, as it break whole if ($item['options'] && preg_match('/(egw_openWindowCentered2?|window.open)\([^)]+,(\d+),(\d+).*(title="([^"]+)")?/', $item['options'], $matches)) { $item['popup'] = $matches[2].'x'.$matches[3]; - $item['onExecute'] = 'javaScript:nm_action'; if (isset($matches[5])) $item['tooltip'] = $matches[5]; unset($item['options']); } } if (empty($item['icon'])) $item['icon'] = $app.'/navbar'; if (empty($item['group'])) $item['group'] = $group; - if (empty($item['onExecute'])) $item['onExecute'] = 'javaScript:app.admin.iframe_location'; + if (empty($item['onExecute'])) $item['onExecute'] = $item['popup'] ? + 'javaScript:nm_action' : 'javaScript:app.admin.iframe_location'; if (!isset($item['allowOnMultiple'])) $item['allowOnMultiple'] = false; $actions[$item['id']] = $item; diff --git a/admin/js/app.js b/admin/js/app.js index aaf2945565..e51fb0863d 100644 --- a/admin/js/app.js +++ b/admin/js/app.js @@ -272,14 +272,6 @@ app.classes.admin = AppJS.extend( this.egw.json('admin_account::ajax_delete_group', [account_id]).sendRequest(); break; - case 'acl': - this.splitter.dock(); - this.iframe.set_src(egw.link('/index.php', { - menuaction: 'admin.admin_acl.index', - account_id: _senders[0].id.split('/')[2] - })); - break; - default: if (!_action.data.url) { diff --git a/admin/lang/egw_de.lang b/admin/lang/egw_de.lang index dea2d91b14..06578812d1 100644 --- a/admin/lang/egw_de.lang +++ b/admin/lang/egw_de.lang @@ -199,6 +199,7 @@ delete this user admin de Benutzer löschen deleted admin de gelöscht deletes this field admin de löscht dieses Feld deliver extern admin de Extern ausliefern +deny access admin de Zugriff verweigern deny access to access log admin de Zugriff auf Zugangsprotokoll verbieten deny access to application registery admin de Zugriff auf Anwendungsdatenbank verbieten deny access to applications admin de Zugriff auf Anwendungen verbieten diff --git a/admin/lang/egw_en.lang b/admin/lang/egw_en.lang index b65fc54764..6ec26f7469 100644 --- a/admin/lang/egw_en.lang +++ b/admin/lang/egw_en.lang @@ -199,6 +199,7 @@ delete this user admin en Delete this user deleted admin en deleted deletes this field admin en Deletes this field deliver extern admin en Deliver extern +deny access admin en Deny access deny access to access log admin en Deny access to access log deny access to application registery admin en Deny access to application registery deny access to applications admin en Deny access to applications diff --git a/phpgwapi/js/jsapi/egw_preferences.js b/phpgwapi/js/jsapi/egw_preferences.js index b74d4af2fd..2a1b3d57a7 100644 --- a/phpgwapi/js/jsapi/egw_preferences.js +++ b/phpgwapi/js/jsapi/egw_preferences.js @@ -97,7 +97,7 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function() { show_preferences: function (name, apps) { var current_app = this.app_name(); - var query = {}; + 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' || !$j.isArray(apps) && (typeof apps[current_app] == 'undefined' || !apps[current_app])) @@ -112,11 +112,13 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function() { case 'prefs': query.menuaction ='preferences.preferences_settings.index'; if ($j.inArray(current_app, apps) != -1) query.appname=current_app; + egw.open_link(egw.link(url, query), '_blank', '900x450'); break; case 'acl': query.menuaction='preferences.preferences_acl.index'; query.acl_app=current_app; + egw.open_link(egw.link(url, query), '_blank', '900x450'); break; case 'cats': @@ -132,10 +134,9 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function() { query.menuaction='preferences.preferences_categories_ui.index'; query.cats_app=current_app; } + egw.link_handler(egw.link(url, query), current_app); break; } - query.current_app = current_app; - egw.link_handler(egw.link(url, query), current_app); } } }; diff --git a/preferences/inc/class.preferences_hooks.inc.php b/preferences/inc/class.preferences_hooks.inc.php index d2f2fe868e..e23f97db23 100644 --- a/preferences/inc/class.preferences_hooks.inc.php +++ b/preferences/inc/class.preferences_hooks.inc.php @@ -433,9 +433,10 @@ class preferences_hooks global $menuData; $menuData[] = array( - 'description' => 'Preferences', - 'url' => '/index.php', - 'extradata' => 'menuaction=preferences.preferences_settings.index' + 'description' => 'Preferences', + 'url' => '/index.php', + 'extradata' => 'menuaction=preferences.preferences_settings.index', + 'popup' => '900x450', ); } @@ -446,6 +447,7 @@ class preferences_hooks */ static function admin($args) { + unset($args); // unused, but required by function signature $appname = 'preferences'; $file = Array( 'Site configuration' => egw::link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname), diff --git a/preferences/inc/class.preferences_settings.inc.php b/preferences/inc/class.preferences_settings.inc.php index 82ece82e7e..9bc9c7c9f9 100644 --- a/preferences/inc/class.preferences_settings.inc.php +++ b/preferences/inc/class.preferences_settings.inc.php @@ -96,21 +96,8 @@ class preferences_settings } if (in_array($button, array('save','cancel'))) { - if ($content['current_app'] && ($app_data = $GLOBALS['egw_info']['user']['apps'][$content['current_app']])) - { - if ($app_data['index']) - { - egw::redirect_link('/index.php', 'menuaction='.$app_data['index'], $content['current_app']); - } - else - { - egw::redirect_link('/'.$content['current_app'].'/index.php', null, $content['current_app']); - } - } - else - { - egw::redirect_link('/index.php'); - } + egw_json_response::get()->call('egw.message', $msg, $msg_type); + egw_framework::window_close(); } } $appname = $content['appname'] ? $content['appname'] : 'common'; @@ -130,7 +117,9 @@ class preferences_settings $old_tab = $content['tabs']; } // we need to run under calling app, to be able to restore it to it's index page after - $GLOBALS['egw_info']['flags']['currentapp'] = $preserve['current_app'] = $content['current_app']; + $preserve['current_app'] = $content['current_app']; + $GLOBALS['egw_info']['flags']['currentapp'] = $content['current_app'] == 'common' ? + 'preferences' : $content['current_app']; egw_framework::includeCSS('preferences','app'); $sel_options = $readonlys = null; @@ -148,7 +137,7 @@ class preferences_settings } if ($msg) egw_framework::message($msg, $msg_type ? $msg_type : 'error'); - $tpl->exec('preferences.preferences_settings.index', $content, $sel_options, $readonlys, $preserve); + $tpl->exec('preferences.preferences_settings.index', $content, $sel_options, $readonlys, $preserve, 2); } /** diff --git a/preferences/templates/default/settings.xet b/preferences/templates/default/settings.xet index 24aa28f58f..0be62da9f7 100644 --- a/preferences/templates/default/settings.xet +++ b/preferences/templates/default/settings.xet @@ -36,8 +36,8 @@ \ No newline at end of file