--- /dev/null
+<dl{if $errorField == $reasonFieldName} class="formError"{/if}>
+ <dt><label for="{$reasonFieldName}">{lang}wcf.global.reason{/lang}</label></dt>
+ <dd>
+ <textarea name="{$reasonFieldName}" id="{$reasonFieldName}" cols="40" rows="3">{$reason}</textarea>
+
+ {if $errorField == $reasonFieldName}
+ <small class="innerError">{lang}wcf.global.form.error.{$errorType}{/lang}</small>
+ {/if}
+ </dd>
+</dl>
--- /dev/null
+<?php
+namespace wcf\system\bulk\processing;
+use wcf\util\StringUtil;
+use wcf\system\WCF;
+
+/**
+ * Trait for bulk processing actions allowing given a reason for executing the action.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2015 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.bulk.processing
+ * @category Community Framework
+ */
+trait TReasonedBulkProcessingAction {
+ /**
+ * reason
+ * @var string
+ */
+ protected $reason = '';
+
+ /**
+ * @see \wcf\system\bulk\processing\IBulkProcessingAction::getHTML()
+ */
+ public function getHTML() {
+ return WCF::getTPL()->fetch('reasonedBulkProcessingAction', 'wcf', [
+ 'reason' => $this->reason,
+ 'reasonFieldName' => $this->getReasonFieldName()
+ ]);
+ }
+
+ /**
+ * Returns the name of the reason field.
+ *
+ * @return string
+ */
+ abstract protected function getReasonFieldName();
+
+ /**
+ * @see \wcf\system\bulk\processing\IBulkProcessingAction::readFormParameters()
+ */
+ public function readFormParameters() {
+ if (isset($_POST[$this->getReasonFieldName()])) $this->reason = StringUtil::trim($_POST[$this->getReasonFieldName()]);
+ }
+
+ /**
+ * @see \wcf\system\bulk\processing\IBulkProcessingAction::reset()
+ */
+ public function reset() {
+ $this->reason = '';
+ }
+}