Add confirm method, with fixed YES_NO buttons and submit functionality, which could be exchanged by old javascript confirm() function

This commit is contained in:
Hadi Nategh 2013-12-05 08:53:11 +00:00
parent fac4e68213
commit 53006083e9

View File

@ -494,5 +494,33 @@ jQuery.extend(et2_dialog,
template: egw.webserverUrl+'/etemplate/templates/default/prompt.xet', template: egw.webserverUrl+'/etemplate/templates/default/prompt.xet',
class: "et2_prompt" class: "et2_prompt"
}); });
},
/**
* Method to build a confirmation dialog only with
* YES OR NO buttons and submit content back to server
*
* @param {widget} _senders widget that has been clicked
* @param {String} _dialogMsg message shows in dialog box
* @param {String} _titleMsg message shows as a title of the dialog box
*
* @description submit the form contents including the button that has been pressed
*/
confirm: function(_senders,_dialogMsg, _titleMsg)
{
var senders = _senders;
var buttonId = _senders.id;
var dialogMsg = (typeof _dialogMsg !="undefined") ? _dialogMsg : '';
var titleMsg = (typeof _titleMsg !="undefined") ? _titleMsg : '';
var callbackDialog = function (button_id)
{
if (button_id == et2_dialog.YES_BUTTON )
{
senders.getRoot().getInstanceManager().submit(buttonId);
} }
}
et2_dialog.show_dialog(callbackDialog, egw.lang(dialogMsg),egw.lang(titleMsg), {},et2_dialog.BUTTON_YES_NO, et2_dialog.WARNING_MESSAGE);
},
}); });