Index: lib/javascript-static.js
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/javascript-static.js,v
retrieving revision 1.87
diff -u -r1.87 javascript-static.js
--- lib/javascript-static.js	16 Aug 2009 04:21:30 -0000	1.87
+++ lib/javascript-static.js	26 Aug 2009 07:58:34 -0000
@@ -1215,6 +1215,7 @@
 function confirm_dialog(event, args) {
     var message = args.message;
     var target = this;
+    target.args = args;
     YAHOO.util.Event.preventDefault(event);
 
     var simpledialog = new YAHOO.widget.SimpleDialog('confirmdialog',
@@ -1230,13 +1231,17 @@
     simpledialog.setBody(message);
     simpledialog.cfg.setProperty('icon', YAHOO.widget.SimpleDialog.ICON_WARN);
 
-    var handle_cancel = function() {
+    this.handle_cancel = function() {
         this.hide();
     };
 
-    var handle_yes = function() {
+    this.handle_yes = function() {
         this.hide();
         
+        if (target.args.callback) {
+            target.args.callback.apply(this);
+        }
+
         if (target.tagName.toLowerCase() == 'a') {
             window.location = target.href;
         } else if (target.tagName.toLowerCase() == 'input') {
@@ -1252,11 +1257,12 @@
         }
     };
 
-    var buttons = [ { text: mstr.moodle.cancel, handler: handle_cancel, isDefault: true },
-                    { text: mstr.moodle.yes, handler: handle_yes } ];
+    var buttons = [ { text: mstr.moodle.cancel, handler: this.handle_cancel, isDefault: true },
+                    { text: mstr.moodle.yes, handler: this.handle_yes } ];
 
     simpledialog.cfg.queueProperty('buttons', buttons);
 
     simpledialog.render(document.body);
     simpledialog.show();
+    return simpledialog;
 }
