Use similar Global category's delete confirmation dialog as it is used in edit popup too

This commit is contained in:
Hadi Nategh 2014-07-15 13:21:54 +00:00
parent 6e96b74e5d
commit b51ad6a8f1
3 changed files with 24 additions and 14 deletions

View File

@ -601,9 +601,9 @@ class admin_categories
'delete' => array( 'delete' => array(
'caption' => 'Delete', 'caption' => 'Delete',
'allowOnMultiple' => true, 'allowOnMultiple' => true,
'nm_action' => 'open_popup',
'group' => ++$group, 'group' => ++$group,
'disableClass' => 'rowNoDelete', 'disableClass' => 'rowNoDelete',
'onExecute' => 'javaScript:app.admin.delete_category'
), ),
); );

View File

@ -772,20 +772,41 @@ app.classes.admin = AppJS.extend(
/** /**
* Delete confirmation dialog * Delete confirmation dialog
* *
* @param {egw action} _action
*/ */
delete_category: function () delete_category: function (_action)
{ {
var _buttons = [ var _buttons = [
{"button_id": "delete[cancel]","text": 'Cancel', id: 'delete[cancel]', image: 'cancel', "default":true}, {"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[delete]","text": 'Delete', id: 'delete[delete]', image: 'delete'},
{"button_id": "delete[subs]","text": 'Delete including sub-enteries', id: 'delete[subs]', image: 'delete'}, {"button_id": "delete[subs]","text": 'Delete including sub-enteries', id: 'delete[subs]', image: 'delete'},
]; ];
var action = _action;
var self = this; var self = this;
var delDialog_callBack = function (_buttons) var delDialog_callBack = function (_buttons)
{ {
if (_buttons != "delete[cancel]") 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); et2_dialog.show_dialog(delDialog_callBack,"Are you sure you want to delete this category ?","Delete",{},_buttons);

View File

@ -78,17 +78,6 @@
</row> </row>
</rows> </rows>
</grid> </grid>
<box class="action_popup prompt" id="delete_popup">
<vbox class="prompt">
<description value="Delete" class="promptheader"/>
<description value="Delete selected entries?" id="delete_prompt"/>
<hbox>
<button label="Yes - Delete" id="delete" onclick="nm_submit_popup(this); return false;"/>
<button label="Yes - Delete including sub-entries" id="delete_sub" onclick="nm_popup_action.id = 'delete_sub'; nm_submit_popup(this); return false;"/>
<buttononly label="No - Cancel" onclick="nm_hide_popup(this,'delete_popup');"/>
</hbox>
</vbox>
</box>
<box class="action_popup prompt" id="owner_popup"> <box class="action_popup prompt" id="owner_popup">
<vbox> <vbox>
<description value="Change owner" class="promptheader"/> <description value="Change owner" class="promptheader"/>