From 891d1d67b29307424dc4fef8aea8df67ae04f0c4 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 14 Sep 2011 16:02:46 +0200 Subject: [PATCH] Added a proceed URL after worker has finished --- wcfsetup/install/files/acp/js/WCF.ACP.js | 11 +++++++++++ .../files/lib/acp/action/WorkerProxyAction.class.php | 6 ++++-- .../install/files/lib/system/worker/IWorker.class.php | 7 +++++++ .../files/lib/system/worker/MailWorker.class.php | 7 +++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index f09fda84c7..66509e65b0 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -614,5 +614,16 @@ WCF.ACP.Worker.prototype = { } }); } + else { + // display proceed button + var $proceedButton = $('').appendTo('#workerInnerContent'); + $proceedButton.click(function() { + window.location = $data.proceedURL; + }); + + $('#workerInnerContentContainer').wcfBlindIn(); + + this._dialog.wcfDialog('redraw'); + } } }; \ No newline at end of file diff --git a/wcfsetup/install/files/lib/acp/action/WorkerProxyAction.class.php b/wcfsetup/install/files/lib/acp/action/WorkerProxyAction.class.php index ac0268b45b..874950cd6c 100644 --- a/wcfsetup/install/files/lib/acp/action/WorkerProxyAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/WorkerProxyAction.class.php @@ -109,7 +109,7 @@ class WorkerProxyAction extends AbstractSecureAction { $this->worker->execute(); // send current state - $this->sendResponse($progress, $this->worker->getParameters()); + $this->sendResponse($progress, $this->worker->getParameters(), $this->worker->getProceedURL()); } @@ -118,8 +118,9 @@ class WorkerProxyAction extends AbstractSecureAction { * * @param integer $progress * @param array $parameters + * @param string $proceedURL */ - protected function sendResponse($progress = 0, array $parameters = null) { + protected function sendResponse($progress = 0, array $parameters = null, $proceedURL = '') { if ($parameters === null) $parameters = $this->parameters; // build return values @@ -127,6 +128,7 @@ class WorkerProxyAction extends AbstractSecureAction { 'className' => $this->className, 'loopCount' => ($this->loopCount + 1), 'parameters' => $parameters, + 'proceedURL' => $proceedURL, 'progress' => $progress ); diff --git a/wcfsetup/install/files/lib/system/worker/IWorker.class.php b/wcfsetup/install/files/lib/system/worker/IWorker.class.php index b30c396b13..27fc66d20a 100644 --- a/wcfsetup/install/files/lib/system/worker/IWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/IWorker.class.php @@ -50,4 +50,11 @@ interface IWorker { * Validates parameters. */ public function validate(); + + /** + * Returns URL for redirect after worker finished. + * + * @return string + */ + public function getProceedURL(); } diff --git a/wcfsetup/install/files/lib/system/worker/MailWorker.class.php b/wcfsetup/install/files/lib/system/worker/MailWorker.class.php index 1a2f11430a..f634af53f8 100644 --- a/wcfsetup/install/files/lib/system/worker/MailWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/MailWorker.class.php @@ -131,4 +131,11 @@ class MailWorker extends AbstractWorker { } catch (SystemException $e) {} // ignore errors } + + /** + * @see wcf\system\worker\IWorker::getProceedURL() + */ + public function getProceedURL() { + return 'index.php?page=UserList' . SID_ARG_2ND_NOT_ENCODED; + } } -- 2.20.1