From 865142667d5d0d211fb301263a4cead312b777af Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 14 Jun 2013 01:57:13 +0200 Subject: [PATCH] Added support for content delete reason --- .../templates/moderationReport.tpl | 1 + wcfsetup/install/files/js/WCF.Moderation.js | 36 +++++++++++++++++-- wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/com.woltlab.wcf/templates/moderationReport.tpl b/com.woltlab.wcf/templates/moderationReport.tpl index 7ccadf38b6..b4a3432d04 100644 --- a/com.woltlab.wcf/templates/moderationReport.tpl +++ b/com.woltlab.wcf/templates/moderationReport.tpl @@ -13,6 +13,7 @@ WCF.Language.addObject({ 'wcf.moderation.report.removeContent.confirmMessage': '{lang}wcf.moderation.report.removeContent.confirmMessage{/lang}', + 'wcf.moderation.report.removeContent.reason': '{lang}wcf.moderation.report.removeContent.reason{/lang}', 'wcf.moderation.report.removeReport.confirmMessage': '{lang}wcf.moderation.report.removeReport.confirmMessage{/lang}' }); }); diff --git a/wcfsetup/install/files/js/WCF.Moderation.js b/wcfsetup/install/files/js/WCF.Moderation.js index 44c6470539..71c56bccac 100644 --- a/wcfsetup/install/files/js/WCF.Moderation.js +++ b/wcfsetup/install/files/js/WCF.Moderation.js @@ -26,6 +26,12 @@ WCF.Moderation.Management = Class.extend({ */ _className: '', + /** + * list of templates for confirmation message by action name + * @var object + */ + _confirmationTemplate: { }, + /** * language item pattern * @var string @@ -85,19 +91,41 @@ WCF.Moderation.Management = Class.extend({ */ _click: function(event) { var $actionName = $(event.currentTarget).wcfIdentify(); + var $innerTemplate = ''; + if (this._confirmationTemplate[$actionName]) { + $innerTemplate = this._confirmationTemplate[$actionName]; + } WCF.System.Confirmation.show(WCF.Language.get(this._languageItem.replace(/{actionName}/, $actionName)), $.proxy(function(action) { if (action === 'confirm') { - this._proxy.setOption('data', { + var $parameters = { actionName: $actionName, className: this._className, objectIDs: [ this._queueID ] - }); + }; + if (this._confirmationTemplate[$actionName]) { + $parameters.parameters = { }; + $innerTemplate.find('input, textarea').each(function(index, element) { + var $element = $(element); + var $value = $element.val(); + if ($element.getTagName() === 'input' && $element.attr('type') === 'checkbox') { + if (!$element.is(':checked')) { + $value = null; + } + } + + if ($value !== null) { + $parameters.parameters[$element.attr('name')] = $value; + } + }); + } + + this._proxy.setOption('data', $parameters); this._proxy.sendRequest(); $(this._buttonSelector).disable(); } - }, this)); + }, this), { }, $innerTemplate); }, /** @@ -338,6 +366,8 @@ WCF.Moderation.Report.Management = WCF.Moderation.Management.extend({ this._className = 'wcf\\data\\moderation\\queue\\ModerationQueueReportAction'; this._super(queueID, redirectURL, 'wcf.moderation.report.{actionName}.confirmMessage'); + + this._confirmationTemplate.removeContent = $('