confirmation dialog

This commit is contained in:
Roland Gruber 2011-06-06 18:06:51 +00:00
parent e37ff12f93
commit c9b3eb008a
1 changed files with 24 additions and 0 deletions

View File

@ -282,3 +282,27 @@ function passwordHandleReply(data) {
jQuery('#passwordDialogMessageArea').html(data.messages);
}
}
/**
* Shows a general confirmation dialog and submits a form if the user accepted.
*
* @param title dialog title
* @param okText text for Ok button
* @param cancelText text for Cancel button
* @param dialogDiv div that contains dialog content
* @param formName form to submit
*/
function showConfirmationDialog(title, okText, cancelText, dialogDiv, formName) {
var buttonList = {};
buttonList[cancelText] = function() { jQuery(this).dialog("close"); };
buttonList[okText] = function() { document.forms[formName].submit(); };
jQuery('#' + dialogDiv).dialog({
modal: true,
title: title,
dialogClass: 'defaultBackground',
buttons: buttonList,
width: 'auto'
});
}