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)

This commit is contained in:
Ralf Becker 2014-04-01 15:49:08 +00:00
parent 4c52fe5e65
commit 6fdf8c98d1
9 changed files with 36 additions and 46 deletions

View File

@ -185,12 +185,21 @@ class admin_hooks
{ {
$actions = array(); $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 if (!$GLOBALS['egw']->acl->check('current_sessions_access',1,'admin')) // no rights to view
{ {
$actions[] = array( $actions[] = array(
'description' => 'Login History', 'description' => 'Login History',
'url' => '/index.php', '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( $actions[] = array(
'description' => 'Deny access', 'description' => 'Deny access',
'url' => '/index.php', 'url' => '/index.php',
'extradata' => 'menuaction=admin.uiaclmanager.list_apps' 'extradata' => 'menuaction=admin.uiaclmanager.list_apps',
'icon' => 'cancel',
); );
} }
return $actions; return $actions;

View File

@ -115,6 +115,8 @@ class admin_ui
'onExecute' => 'javaScript:app.admin.group', 'onExecute' => 'javaScript:app.admin.group',
'caption' => 'Access control', 'caption' => 'Access control',
'enableId' => '^/groups/-\\d+', 'enableId' => '^/groups/-\\d+',
'url' => 'menuaction=admin.admin_acl.index&account_id=$id',
'popup' => '900x450',
'icon' => 'lock', 'icon' => 'lock',
'group' => 2, 'group' => 2,
), ),
@ -186,14 +188,6 @@ class admin_ui
'onExecute' => 'javaScript:app.admin.account', 'onExecute' => 'javaScript:app.admin.account',
'group' => $group, '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 // generate urls for add/edit accounts via addressbook
$edit = egw_link::get_registry('addressbook', 'edit'); $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)) if ($item['options'] && preg_match('/(egw_openWindowCentered2?|window.open)\([^)]+,(\d+),(\d+).*(title="([^"]+)")?/', $item['options'], $matches))
{ {
$item['popup'] = $matches[2].'x'.$matches[3]; $item['popup'] = $matches[2].'x'.$matches[3];
$item['onExecute'] = 'javaScript:nm_action';
if (isset($matches[5])) $item['tooltip'] = $matches[5]; if (isset($matches[5])) $item['tooltip'] = $matches[5];
unset($item['options']); unset($item['options']);
} }
} }
if (empty($item['icon'])) $item['icon'] = $app.'/navbar'; if (empty($item['icon'])) $item['icon'] = $app.'/navbar';
if (empty($item['group'])) $item['group'] = $group; 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; if (!isset($item['allowOnMultiple'])) $item['allowOnMultiple'] = false;
$actions[$item['id']] = $item; $actions[$item['id']] = $item;

View File

@ -272,14 +272,6 @@ app.classes.admin = AppJS.extend(
this.egw.json('admin_account::ajax_delete_group', [account_id]).sendRequest(); this.egw.json('admin_account::ajax_delete_group', [account_id]).sendRequest();
break; 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: default:
if (!_action.data.url) if (!_action.data.url)
{ {

View File

@ -199,6 +199,7 @@ delete this user admin de Benutzer löschen
deleted admin de gelöscht deleted admin de gelöscht
deletes this field admin de löscht dieses Feld deletes this field admin de löscht dieses Feld
deliver extern admin de Extern ausliefern 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 access log admin de Zugriff auf Zugangsprotokoll verbieten
deny access to application registery admin de Zugriff auf Anwendungsdatenbank verbieten deny access to application registery admin de Zugriff auf Anwendungsdatenbank verbieten
deny access to applications admin de Zugriff auf Anwendungen verbieten deny access to applications admin de Zugriff auf Anwendungen verbieten

View File

@ -199,6 +199,7 @@ delete this user admin en Delete this user
deleted admin en deleted deleted admin en deleted
deletes this field admin en Deletes this field deletes this field admin en Deletes this field
deliver extern admin en Deliver extern 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 access log admin en Deny access to access log
deny access to application registery admin en Deny access to application registery deny access to application registery admin en Deny access to application registery
deny access to applications admin en Deny access to applications deny access to applications admin en Deny access to applications

View File

@ -97,7 +97,7 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function() {
show_preferences: function (name, apps) show_preferences: function (name, apps)
{ {
var current_app = this.app_name(); 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 // 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' ||
!$j.isArray(apps) && (typeof apps[current_app] == 'undefined' || !apps[current_app])) !$j.isArray(apps) && (typeof apps[current_app] == 'undefined' || !apps[current_app]))
@ -112,11 +112,13 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function() {
case 'prefs': case 'prefs':
query.menuaction ='preferences.preferences_settings.index'; query.menuaction ='preferences.preferences_settings.index';
if ($j.inArray(current_app, apps) != -1) query.appname=current_app; if ($j.inArray(current_app, apps) != -1) query.appname=current_app;
egw.open_link(egw.link(url, query), '_blank', '900x450');
break; break;
case 'acl': case 'acl':
query.menuaction='preferences.preferences_acl.index'; query.menuaction='preferences.preferences_acl.index';
query.acl_app=current_app; query.acl_app=current_app;
egw.open_link(egw.link(url, query), '_blank', '900x450');
break; break;
case 'cats': case 'cats':
@ -132,10 +134,9 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function() {
query.menuaction='preferences.preferences_categories_ui.index'; query.menuaction='preferences.preferences_categories_ui.index';
query.cats_app=current_app; query.cats_app=current_app;
} }
egw.link_handler(egw.link(url, query), current_app);
break; break;
} }
query.current_app = current_app;
egw.link_handler(egw.link(url, query), current_app);
} }
} }
}; };

View File

@ -433,9 +433,10 @@ class preferences_hooks
global $menuData; global $menuData;
$menuData[] = array( $menuData[] = array(
'description' => 'Preferences', 'description' => 'Preferences',
'url' => '/index.php', 'url' => '/index.php',
'extradata' => 'menuaction=preferences.preferences_settings.index' 'extradata' => 'menuaction=preferences.preferences_settings.index',
'popup' => '900x450',
); );
} }
@ -446,6 +447,7 @@ class preferences_hooks
*/ */
static function admin($args) static function admin($args)
{ {
unset($args); // unused, but required by function signature
$appname = 'preferences'; $appname = 'preferences';
$file = Array( $file = Array(
'Site configuration' => egw::link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname), 'Site configuration' => egw::link('/index.php','menuaction=admin.uiconfig.index&appname=' . $appname),

View File

@ -96,21 +96,8 @@ class preferences_settings
} }
if (in_array($button, array('save','cancel'))) if (in_array($button, array('save','cancel')))
{ {
if ($content['current_app'] && ($app_data = $GLOBALS['egw_info']['user']['apps'][$content['current_app']])) egw_json_response::get()->call('egw.message', $msg, $msg_type);
{ egw_framework::window_close();
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');
}
} }
} }
$appname = $content['appname'] ? $content['appname'] : 'common'; $appname = $content['appname'] ? $content['appname'] : 'common';
@ -130,7 +117,9 @@ class preferences_settings
$old_tab = $content['tabs']; $old_tab = $content['tabs'];
} }
// we need to run under calling app, to be able to restore it to it's index page after // 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'); egw_framework::includeCSS('preferences','app');
$sel_options = $readonlys = null; $sel_options = $readonlys = null;
@ -148,7 +137,7 @@ class preferences_settings
} }
if ($msg) egw_framework::message($msg, $msg_type ? $msg_type : 'error'); 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);
} }
/** /**

View File

@ -36,8 +36,8 @@
<template id="preferences.settings.tab1" content="tab1"/> <template id="preferences.settings.tab1" content="tab1"/>
</tabpanels> </tabpanels>
</tabbox> </tabbox>
<button label="Save" id="button[save]" image="save" background_image="1"/> <button label="Save" id="button[save]"/>
<button label="Apply" id="button[apply]" image="apply" background_image="1"/> <button label="Apply" id="button[apply]"/>
<button label="Cancel" id="button[cancel]" image="cancel" background_image="1"/> <button label="Cancel" id="button[cancel]" onclick="window.close();"/>
</template> </template>
</overlay> </overlay>