From c9b3eb008ab8470d937392939b28be0e5ab1007b Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Mon, 6 Jun 2011 18:06:51 +0000 Subject: [PATCH] confirmation dialog --- lam/templates/lib/500_lam.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lam/templates/lib/500_lam.js b/lam/templates/lib/500_lam.js index 4cf1b2a6..a268cb30 100644 --- a/lam/templates/lib/500_lam.js +++ b/lam/templates/lib/500_lam.js @@ -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' + }); +} + +