Index: popups.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/popups/popups.js,v retrieving revision 1.9.8.2 diff -u -p -r1.9.8.2 popups.js --- popups.js 21 Nov 2008 08:51:13 -0000 1.9.8.2 +++ popups.js 6 Jan 2009 19:31:01 -0000 @@ -373,7 +373,7 @@ Drupal.popups.openPath = function(elemen Drupal.settings.popups = Drupal.popups.originalSettings.popups; function jsDoneLoading() { - Drupal.popups.openContent(json.title, json.messages + json.content, options); + Drupal.popups.openContent(json.title, json.messages + json.content, options, element); $('body').css("cursor", "auto"); // Return the cursor to normal state. } @@ -410,8 +410,10 @@ Drupal.popups.openPath = function(elemen * HTML to show in the popups. * @param options * Hash of options controlling how the popups interacts with the underlying page. + * @param element + * A DOM object containing the element that was clicked to initiate the popup. */ -Drupal.popups.openContent = function(title, content, options) { +Drupal.popups.openContent = function(title, content, options, element) { Drupal.popups.open(title, content, null, options.width); // Add behaviors to content in popups. // TODO: d-n-d: need to click to let go of selection. @@ -428,7 +430,7 @@ Drupal.popups.openContent = function(tit beforeSubmit: Drupal.popups.beforeSubmit, beforeSend: Drupal.popups.beforeSend, success: function(response, status) { - Drupal.popups.formSuccess(response, options); + Drupal.popups.formSuccess(response, options, element); }, error: function() { Drupal.popups.message("Bad Response form submission"); @@ -462,15 +464,24 @@ Drupal.popups.beforeSubmit = function(fo * nonModal: bool, does the popups block access to the underlying page. * targetSelectors: hash of jQuery selectors, overrides defaultTargetSelector. * titleSelectors: array of jQuery selectors, where to put the the new title of the page. + * @param element + * A DOM object containing the element that was clicked to initiate the popup. */ -Drupal.popups.formSuccess = function(data, options) { +Drupal.popups.formSuccess = function(data, options, element) { // Determine if we are at an end point, or just moving from one popups to another. var done = (data.path === Drupal.settings.popups.originalPath) || (data.path === options.forceReturn); if (!done) { // Not done yet, so show new page in new popups. Drupal.popups.removeLoading(); - Drupal.popups.openContent(data.title, data.messages + data.content, options); + Drupal.popups.openContent(data.title, data.messages + data.content, options, element); } else { // Done. + if (optons.afterSubmit) { // Execute an afterSubmit callback if available. + var afterSubmitResult = eval(options.afterSubmit +'(data, options, element)'); + if (afterSubmitResult == false) { + return; + } + } + if (options.reloadWhenDone) { // Force a non-ajax, complete reload of the page. location.reload(); }