From 2d899c0ed16b1e1b3f5d2d38543d48a140a86185 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 31 Jul 2013 14:01:12 +0000 Subject: [PATCH] group context menu --- admin/inc/class.admin_ui.inc.php | 25 ++++++++++++++++++-- admin/js/app.js | 38 ++++++++++++++++++++++++++++++- admin/templates/default/index.xet | 2 +- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/admin/inc/class.admin_ui.inc.php b/admin/inc/class.admin_ui.inc.php index 4b39c6e0ff..37af0ddd20 100644 --- a/admin/inc/class.admin_ui.inc.php +++ b/admin/inc/class.admin_ui.inc.php @@ -22,7 +22,7 @@ class admin_ui * @var array */ public $public_functions = array( - 'index' => true, + 'index' => true, ); /** @@ -74,6 +74,27 @@ class admin_ui $sel_options['account_primary_group'] = $sel_options['filter']; unset($sel_options['account_primary_group']['']); + $actions = array( + 'view' => array( + 'onExecute' => 'javaScript:app.admin.group', + 'caption' => 'Show members', + 'enableId' => '^/groups/-\\d+', + 'default' => true, + ), + 'edit' => array( + 'onExecute' => 'javaScript:app.admin.group', + 'caption' => 'Edit group', + 'enableId' => '^/groups/-\\d+', + ), + 'delete' => array( + 'onExecute' => 'javaScript:app.admin.group', + 'confirm' => 'Delete this group', + 'caption' => 'Delete group', + 'enableId' => '^/groups/-\\d+', + ), + ); + $tpl->setElementAttribute('tree', 'actions', $actions); + $tpl->exec('admin.admin_ui.index', $content, $sel_options); } @@ -177,7 +198,7 @@ if ($app == 'felamimail') continue; // disabled fmail for now, as it break whole } $rows = self::$accounts->search($params); - error_log(__METHOD__."() accounts->search(".array2string($params).") total=".self::$accounts->total); + //error_log(__METHOD__."() accounts->search(".array2string($params).") total=".self::$accounts->total); foreach($rows as &$row) { diff --git a/admin/js/app.js b/admin/js/app.js index 3fb598db13..86e0278769 100644 --- a/admin/js/app.js +++ b/admin/js/app.js @@ -121,5 +121,41 @@ app.admin = AppJS.extend( { eval(link.substr(11)); } - } + }, + + /** + * View, edit or delete a group callback for tree + * + * @param Object _action egwAction + * @param Object _senders egwActionObject _senders[0].id holds id + */ + group: function(_action, _senders) + { + switch(_action.id) + { + case 'view': + this.run(_senders[0].id, this.et2.getWidgetById('tree')); + break; + + case 'edit': + case 'delete': + this.splitter.dock(); + this.iframe.set_src(egw.link('/index.php', { + menuaction: _action.id == 'edit' ? 'admin.uiaccounts.edit_group' : 'admin.uiaccounts.delete_group', + account_id: _senders[0].id.split('/')[2] + })); + break; + } + }, + + /** + * Delete a group callback for tree + * + * @param Object _action egwAction + * @param Object _senders egwActionObject _senders[0].iface.id holds the id + */ + delete_group: function(_action, _senders) + { + alert('delete_group '+_senders[0].iface.id); + }, }); diff --git a/admin/templates/default/index.xet b/admin/templates/default/index.xet index fe370684a0..ed883dc4ba 100644 --- a/admin/templates/default/index.xet +++ b/admin/templates/default/index.xet @@ -43,7 +43,7 @@