Added ability to invoke a callback on worker completion
authorAlexander Ebert <ebert@woltlab.com>
Wed, 26 Jun 2013 17:29:46 +0000 (19:29 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 26 Jun 2013 17:29:46 +0000 (19:29 +0200)
wcfsetup/install/files/acp/js/WCF.ACP.js

index ed2a30cf6467a559ea2575c5a3e78cd93917465d..42c8cb9ac389ad728c5d96cf241176b1f1c73dd0 100644 (file)
@@ -1682,9 +1682,17 @@ WCF.ACP.Options.Group = Class.extend({
  * 
  * @param      string          dialogID
  * @param      string          className
- * @param      object          options
+ * @param      string          title
+ * @param      object          parameters
+ * @param      object          callback
  */
 WCF.ACP.Worker = Class.extend({
+       /**
+        * callback invoked after worker completed
+        * @var object
+        */
+       _callback: null,
+       
        /**
         * dialog id
         * @var string
@@ -1716,8 +1724,10 @@ WCF.ACP.Worker = Class.extend({
         * @param       string          className
         * @param       string          title
         * @param       object          parameters
+        * @param       object          callback
         */
-       init: function(dialogID, className, title, parameters) {
+       init: function(dialogID, className, title, parameters, callback) {
+               this._callback = callback || null;
                this._dialogID = dialogID + 'Worker';
                this._dialog = null;
                this._proxy = new WCF.Action.Proxy({
@@ -1767,6 +1777,9 @@ WCF.ACP.Worker = Class.extend({
                        });
                        this._proxy.sendRequest();
                }
+               else if (this._callback !== null) {
+                       this._callback(this, data);
+               }
                else {
                        // display continue button
                        var $formSubmit = $('<div class="formSubmit" />').appendTo(this._dialog);