From: Alexander Ebert Date: Wed, 14 Sep 2011 14:33:14 +0000 (+0200) Subject: Fixed mail worker X-Git-Tag: 2.0.0_Beta_1~1765^2~12 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2c566f61559427a487dc051f7f8cd44cca31ac09;p=GitHub%2FWoltLab%2FWCF.git Fixed mail worker --- diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index 66509e65b0..cc2fce3add 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -603,7 +603,8 @@ WCF.ACP.Worker.prototype = { type: 'POST', data: { className: $data.className, - loopCount: $data.loopCount + loopCount: $data.loopCount, + parameters: $data.parameters }, success: $.proxy(function(data) { this._dialog.data('responseData', data); diff --git a/wcfsetup/install/files/acp/templates/userMail.tpl b/wcfsetup/install/files/acp/templates/userMail.tpl index 52dd548e1f..4014fe6d01 100644 --- a/wcfsetup/install/files/acp/templates/userMail.tpl +++ b/wcfsetup/install/files/acp/templates/userMail.tpl @@ -1,5 +1,17 @@ {include file='header'} +{if $mailID|isset} + +{/if} +
diff --git a/wcfsetup/install/files/lib/acp/form/UserMailForm.class.php b/wcfsetup/install/files/lib/acp/form/UserMailForm.class.php index 0fc6863a8e..c17861a3c5 100755 --- a/wcfsetup/install/files/lib/acp/form/UserMailForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserMailForm.class.php @@ -5,6 +5,7 @@ use wcf\data\user\UserList; use wcf\util\ArrayUtil; use wcf\util\StringUtil; use wcf\system\WCF; +use wcf\system\clipboard\ClipboardHandler; use wcf\system\exception\IllegalLinkException; use wcf\system\exception\UserInputException; @@ -106,13 +107,7 @@ class UserMailForm extends ACPForm { WCF::getSession()->register('userMailData', $userMailData); $this->saved(); - // show worker template - WCF::getTPL()->assign(array( - 'pageTitle' => WCF::getLanguage()->get(($this->action == 'all' ? 'wcf.acp.user.sendMail.all' : ($this->action == 'group' ? 'wcf.acp.user.sendMail.group' : 'wcf.acp.user.sendMail'))), - 'url' => 'index.php?action=UserMail&mailID='.$mailID.''.SID_ARG_2ND_NOT_ENCODED - )); - WCF::getTPL()->display('worker'); - exit; + WCF::getTPL()->assign('mailID', $mailID); } /** @@ -124,16 +119,26 @@ class UserMailForm extends ACPForm { if (!count($_POST)) { // get marked user ids if (empty($this->action)) { - $markedUsers = WCF::getSession()->getVar('markedUsers'); - if (is_array($markedUsers)) $this->userIDs = implode(',', $markedUsers); - if (empty($this->userIDs)) throw new IllegalLinkException(); + // get type id + $typeID = ClipboardHandler::getInstance()->getTypeID('com.woltlab.wcf.user'); + if ($typeID === null) { + throw new SystemException("clipboard item type 'com.woltlab.wcf.user' is unknown."); + } + + // get user ids + $users = ClipboardHandler::getInstance()->getMarkedItems($typeID); + if (!isset($users['com.woltlab.wcf.user']) || empty($users['com.woltlab.wcf.user'])) throw new IllegalLinkException(); + + // load users + $this->userIDs = array_keys($users['com.woltlab.wcf.user']); + $this->users = $users['com.woltlab.wcf.user']; } if (MAIL_USE_FORMATTED_ADDRESS) $this->from = MAIL_FROM_NAME . ' <' . MAIL_FROM_ADDRESS . '>'; else $this->from = MAIL_FROM_ADDRESS; } - if (!empty($this->userIDs)) { + if (!empty($this->userIDs) && empty($this->users)) { $userList = new UserList(); $userList->getConditionBuilder()->add("user.userID IN (?)", array($this->userIDs)); $userList->sqlOrderBy = "user.username ASC"; diff --git a/wcfsetup/install/files/lib/system/worker/MailWorker.class.php b/wcfsetup/install/files/lib/system/worker/MailWorker.class.php index f634af53f8..4d9a55530a 100644 --- a/wcfsetup/install/files/lib/system/worker/MailWorker.class.php +++ b/wcfsetup/install/files/lib/system/worker/MailWorker.class.php @@ -39,7 +39,7 @@ class MailWorker extends AbstractWorker { * @see wcf\system\worker\IWorker::validate() */ public function validate() { - WCF::getSession()->checkPermission('admin.user.canMailUser'); + WCF::getSession()->checkPermissions(array('admin.user.canMailUser')); if (!isset($this->parameters['mailID'])) { throw new SystemException("mailID missing");