From b51ad6a8f1fb8c4b0731fe6b3890d41804b2f1b9 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 15 Jul 2014 13:21:54 +0000 Subject: [PATCH] Use similar Global category's delete confirmation dialog as it is used in edit popup too --- admin/inc/class.admin_categories.inc.php | 2 +- admin/js/app.js | 25 ++++++++++++++++++-- admin/templates/default/categories.index.xet | 11 --------- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/admin/inc/class.admin_categories.inc.php b/admin/inc/class.admin_categories.inc.php index 451c97ad28..255f632ed5 100644 --- a/admin/inc/class.admin_categories.inc.php +++ b/admin/inc/class.admin_categories.inc.php @@ -601,9 +601,9 @@ class admin_categories 'delete' => array( 'caption' => 'Delete', 'allowOnMultiple' => true, - 'nm_action' => 'open_popup', 'group' => ++$group, 'disableClass' => 'rowNoDelete', + 'onExecute' => 'javaScript:app.admin.delete_category' ), ); diff --git a/admin/js/app.js b/admin/js/app.js index 20f8bd392f..b6cd96589d 100644 --- a/admin/js/app.js +++ b/admin/js/app.js @@ -772,20 +772,41 @@ app.classes.admin = AppJS.extend( /** * Delete confirmation dialog * + * @param {egw action} _action */ - delete_category: function () + delete_category: function (_action) { var _buttons = [ {"button_id": "delete[cancel]","text": 'Cancel', id: 'delete[cancel]', image: 'cancel', "default":true}, {"button_id": "delete[delete]","text": 'Delete', id: 'delete[delete]', image: 'delete'}, {"button_id": "delete[subs]","text": 'Delete including sub-enteries', id: 'delete[subs]', image: 'delete'}, ]; + var action = _action; var self = this; var delDialog_callBack = function (_buttons) { if (_buttons != "delete[cancel]") { - self.et2.getInstanceManager().submit(_buttons); + if (self.et2._inst.name == "admin.categories.index") + { + var nm_widget = self.et2.getWidgetById('nm'); + if (nm_widget) + { + if (_buttons == "delete[delete]") + { + nm_action(action); + } + else + { + action.id = 'delete_sub'; + nm_action(action); + } + } + } + else + { + self.et2.getInstanceManager().submit(_buttons); + } } }; et2_dialog.show_dialog(delDialog_callBack,"Are you sure you want to delete this category ?","Delete",{},_buttons); diff --git a/admin/templates/default/categories.index.xet b/admin/templates/default/categories.index.xet index 7125b7dd89..61527b04d6 100644 --- a/admin/templates/default/categories.index.xet +++ b/admin/templates/default/categories.index.xet @@ -78,17 +78,6 @@ - - - - - -