Mail folder management dialog:

- Add delete confirmation dialog in order to warn user
This commit is contained in:
Hadi Nategh 2015-08-13 11:54:50 +00:00
parent fb6d06e322
commit 6a1f5393e4

View File

@ -4969,33 +4969,41 @@ app.classes.mail = AppJS.extend(
var tree = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('tree'); var tree = etemplate2.getByApplication('mail')[0].widgetContainer.getWidgetById('tree');
var menuaction= 'mail.mail_ui.ajax_folderMgmt_delete'; var menuaction= 'mail.mail_ui.ajax_folderMgmt_delete';
if (tree) var callbackDialog = function(_btn)
{ {
var selFolders = tree.input.getAllChecked(); if (_btn === et2_dialog.YES_BUTTON)
if (selFolders)
{ {
var selFldArr = selFolders.split(tree.input.dlmtr); if (tree)
var msg = egw.lang('Folders deleting in progress ...'); {
et2_dialog.long_task(function(_val, _resp){ var selFolders = tree.input.getAllChecked();
console.log(_val, _resp); if (selFolders)
if (_val && _resp.type !== 'error')
{ {
var stat = []; var selFldArr = selFolders.split(tree.input.dlmtr);
var folderName = ''; var msg = egw.lang('Folders deleting in progress ...');
for(var i=0;i<selFldArr.length;i++) et2_dialog.long_task(function(_val, _resp){
{ console.log(_val, _resp);
folderName = selFldArr[i].split('::'); if (_val && _resp.type !== 'error')
stat[selFldArr[i]] = folderName[1]; {
} var stat = [];
// delete the item from index folderTree var folderName = '';
egw.window.app.mail.mail_removeLeaf(stat); for(var i=0;i<selFldArr.length;i++)
// submit {
etemplate2.getByApplication('mail')[0].widgetContainer._inst.submit(); folderName = selFldArr[i].split('::');
stat[selFldArr[i]] = folderName[1];
}
// delete the item from index folderTree
egw.window.app.mail.mail_removeLeaf(stat);
// submit
etemplate2.getByApplication('mail')[0].widgetContainer._inst.submit();
}
}, msg, 'Deleting folders', menuaction, selFldArr, 'mail');
return true;
} }
}, msg, 'Deleting folders', menuaction, selFldArr, 'mail'); }
return true;
} }
} };
et2_dialog.show_dialog(callbackDialog, egw.lang('Are you sure you want to delete all selected folders?'), egw.lang('Delete folders'), {},
et2_dialog.BUTTON_YES_NO, et2_dialog.WARNING_MESSAGE, undefined, egw);
} }