Added support for content delete reason
authorAlexander Ebert <ebert@woltlab.com>
Thu, 13 Jun 2013 23:57:13 +0000 (01:57 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 13 Jun 2013 23:57:13 +0000 (01:57 +0200)
com.woltlab.wcf/templates/moderationReport.tpl
wcfsetup/install/files/js/WCF.Moderation.js
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 7ccadf38b6c861cf2ea5d08cf64637f23791e5f0..b4a3432d04e25daf7f80922ddd719888a2612329 100644 (file)
@@ -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}'
                        });
                });
index 44c64705392ad68db944b2b7dd6850cd8d87133c..71c56bccac86b4613c9dcff5622cbe24327095f8 100644 (file)
@@ -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 = $('<fieldset><dl><dt><label for="message">' + WCF.Language.get('wcf.moderation.report.removeContent.reason') + '</label></dt><dd><textarea name="message" id="message" cols="40" rows="3" /></dd></dl></fieldset>');
        }
 });
 
index 5e0817a5e5ca5776e2b7e87cca8e88dc4cdc7cfa..6cb3107de2509ec595a34b11a0e64df703e9bca1 100644 (file)
@@ -1719,6 +1719,7 @@ Erlaubte Dateiendungen: {', '|implode:$attachmentHandler->getAllowedExtensions()
                <item name="wcf.moderation.report.reason.description"><![CDATA[Diese Funktion ist ausschließlich zu verwenden bei: Spam, Werbung und anderen problematischen (rassistischen, gewaltverherrlichenden, agressiven, beleidigenden oder sexistischen) Inhalten.]]></item>
                <item name="wcf.moderation.report.removeContent"><![CDATA[Gemeldeten Inhalt löschen]]></item>
                <item name="wcf.moderation.report.removeContent.confirmMessage"><![CDATA[Wollen Sie den gemeldeten Inhalt wirklich löschen?]]></item>
+               <item name="wcf.moderation.report.removeContent.reason"><![CDATA[Begründung (optional)]]></item>
                <item name="wcf.moderation.report.removeReport"><![CDATA[Meldung löschen]]></item>
                <item name="wcf.moderation.report.removeReport.confirmMessage"><![CDATA[Wollen Sie diese Meldung wirklich löschen?]]></item>
                <item name="wcf.moderation.report.reportContent"><![CDATA[Inhalt melden]]></item>
index 63f4099e16c91a08cbc08ccb3a76f5e9d6024e2f..e53c295d85af1b24bf53ed3f69b6945a6c595413 100644 (file)
@@ -1718,6 +1718,7 @@ Allowed extensions: {', '|implode:$attachmentHandler->getAllowedExtensions()}]]>
                <item name="wcf.moderation.report.reason.description"><![CDATA[This function is reserved for: Spam, Advertisement and other questionable (rassism, glorification of violence, offending or sexist) content]]></item>
                <item name="wcf.moderation.report.removeContent"><![CDATA[Delete Reported Content]]></item>
                <item name="wcf.moderation.report.removeContent.confirmMessage"><![CDATA[Do you really want to delete the reported content?]]></item>
+               <item name="wcf.moderation.report.removeContent.reason"><![CDATA[Reason (optional)]]></item>
                <item name="wcf.moderation.report.removeReport"><![CDATA[Delete Report]]></item>
                <item name="wcf.moderation.report.removeReport.confirmMessage"><![CDATA[Do you really want to delete this report?]]></item>
                <item name="wcf.moderation.report.reportContent"><![CDATA[Report Content]]></item>