Moderation queue entries now support comments / moderation queue overhaul (WIP)
authorMarcel Werk <burntime@woltlab.com>
Tue, 15 Jul 2014 15:12:44 +0000 (17:12 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 15 Jul 2014 15:12:44 +0000 (17:12 +0200)
17 files changed:
com.woltlab.wcf/objectType.xml
com.woltlab.wcf/templates/__commentJavaScript.tpl
com.woltlab.wcf/templates/commentList.tpl
com.woltlab.wcf/templates/commentResponseList.tpl
com.woltlab.wcf/templates/moderationActivation.tpl
com.woltlab.wcf/templates/moderationReport.tpl
wcfsetup/install/files/lib/data/comment/CommentAction.class.php
wcfsetup/install/files/lib/data/comment/StructuredCommentList.class.php
wcfsetup/install/files/lib/data/comment/response/CommentResponseAction.class.php
wcfsetup/install/files/lib/form/AbstractModerationForm.class.php
wcfsetup/install/files/lib/form/ModerationReportForm.class.php
wcfsetup/install/files/lib/system/comment/manager/AbstractCommentManager.class.php
wcfsetup/install/files/lib/system/comment/manager/ICommentManager.class.php
wcfsetup/install/files/lib/system/comment/manager/ModerationQueueCommentManager.class.php [new file with mode: 0644]
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml
wcfsetup/setup/db/install.sql

index 567794498b9f567e27f30cac5a265fe72caca6c8..0080bf9e0c451f285483c49bfc9970aa9df24ad1 100644 (file)
                        <classname><![CDATA[wcf\system\user\notification\object\type\UserProfileCommentResponseLikeUserNotificationObjectType]]></classname>
                        <category>com.woltlab.wcf.user</category>
                </type>
+               
+               <type>
+                       <name>com.woltlab.wcf.moderation.queue</name>
+                       <definitionname>com.woltlab.wcf.comment.commentableContent</definitionname>
+                       <classname><![CDATA[wcf\system\comment\manager\ModerationQueueCommentManager]]></classname>
+               </type>
                <!-- /comments -->
                
                <!-- moderation -->
index 04337db0aaeaeb7ccf6b1068d2e11c2dc25655ef..2a070de5d8c407a5ff887334e5c9244fced6fecc 100644 (file)
                });
                
                new {if $commentHandlerClass|isset}{@$commentHandlerClass}{else}WCF.Comment.Handler{/if}('{$commentContainerID}', '{@$__wcf->getUserProfileHandler()->getAvatar()->getImageTag(32)}');
-               {if MODULE_LIKE && $__wcf->getSession()->getPermission('user.like.canViewLike')}
+               {if MODULE_LIKE && $commentList->getCommentManager()->supportsLike() && $__wcf->getSession()->getPermission('user.like.canViewLike')}
                        new WCF.Comment.Like({if $__wcf->getUser()->userID && $__wcf->getSession()->getPermission('user.like.canLike')}1{else}0{/if}, {@LIKE_ENABLE_DISLIKE}, false, {@LIKE_ALLOW_FOR_OWN_CONTENT});
                        new WCF.Comment.Response.Like({if $__wcf->getUser()->userID && $__wcf->getSession()->getPermission('user.like.canLike')}1{else}0{/if}, {@LIKE_ENABLE_DISLIKE}, false, {@LIKE_ALLOW_FOR_OWN_CONTENT});
                {/if}
                
-               {if $__wcf->session->getPermission('user.profile.canReportContent')}
+               {if $commentList->getCommentManager()->supportsReport() && $__wcf->session->getPermission('user.profile.canReportContent')}
                        new WCF.Moderation.Report.Content('com.woltlab.wcf.comment.comment', '.jsReportCommentComment');
                        new WCF.Moderation.Report.Content('com.woltlab.wcf.comment.response', '.jsReportCommentResponse');
                {/if}
index 9238db9371d60f0b9d2ca33cb43c61271bf92f42..440492168055cd3eb81215bcf65db59095feafd1 100644 (file)
@@ -1,3 +1,4 @@
+{if !$commentManager|isset}{assign var='commentManager' value=$commentList->getCommentManager()}{/if}
 {foreach from=$commentList item=comment}
        <li class="comment jsComment" data-comment-id="{@$comment->commentID}" data-object-type="com.woltlab.wcf.comment" data-like-liked="{if $likeData[comment][$comment->commentID]|isset}{@$likeData[comment][$comment->commentID]->liked}{/if}" data-like-likes="{if $likeData[comment][$comment->commentID]|isset}{@$likeData[comment][$comment->commentID]->likes}{else}0{/if}" data-like-dislikes="{if $likeData[comment][$comment->commentID]|isset}{@$likeData[comment][$comment->commentID]->dislikes}{else}0{/if}" data-like-users='{if $likeData[comment][$comment->commentID]|isset}{ {implode from=$likeData[comment][$comment->commentID]->getUsers() item=likeUser}"{@$likeUser->userID}": { "username": "{$likeUser->username|encodeJSON}" }{/implode} }{else}{ }{/if}' data-can-edit="{if $comment->isEditable()}true{else}false{/if}" data-can-delete="{if $comment->isDeletable()}true{else}false{/if}" data-responses="{@$comment->responses}" data-last-response-time="{@$comment->getLastResponseTime()}" data-user-id="{@$comment->userID}">
                <div class="box32">
@@ -27,7 +28,7 @@
                                        
                                        <nav class="jsMobileNavigation buttonGroupNavigation">
                                                <ul class="commentOptions">
-                                                       {if $__wcf->session->getPermission('user.profile.canReportContent')}
+                                                       {if $commentManager->supportsReport() && $__wcf->session->getPermission('user.profile.canReportContent')}
                                                                <li class="jsReportCommentComment jsOnly" data-object-id="{@$comment->commentID}"><a title="{lang}wcf.moderation.report.reportContent{/lang}" class="jsTooltip"><span class="icon icon16 icon-warning-sign"></span> <span class="invisible">{lang}wcf.moderation.report.reportContent{/lang}</span></a></li>
                                                        {/if}
                                                        
index 90c8e7ced6c715b7b838e46c7e33f6cf0bb54ab4..9aaaa032469e9cccd017f127af4e20c866c30419 100644 (file)
@@ -26,7 +26,7 @@
                                
                                <nav class="jsMobileNavigation buttonGroupNavigation">
                                        <ul class="commentOptions">
-                                               {if $__wcf->session->getPermission('user.profile.canReportContent')}
+                                               {if $commentManager->supportsReport() && $__wcf->session->getPermission('user.profile.canReportContent')}
                                                        <li class="jsReportCommentResponse jsOnly" data-object-id="{@$response->responseID}"><a title="{lang}wcf.moderation.report.reportContent{/lang}" class="jsTooltip"><span class="icon icon16 icon-warning-sign"></span> <span class="invisible">{lang}wcf.moderation.report.reportContent{/lang}</span></a></li>
                                                {/if}
                                                
index 703a27725eed9cfd65582f212bb867cb67ef3bc8..baf7b2d074d8a307b8015458217e27688ab84882 100644 (file)
@@ -1,7 +1,7 @@
 {include file='documentHeader'}
 
 <head>
-       <title>{lang}wcf.moderation.activation{/lang} - {PAGE_TITLE|language}</title>
+       <title>{lang}wcf.moderation.activation{/lang}: {$queue->getTitle()} - {PAGE_TITLE|language}</title>
        
        {include file='headInclude'}
        
 
 <body id="tpl{$templateName|ucfirst}">
 
-{include file='header' sidebarOrientation='left'}
+{capture assign='sidebar'}
+       <form method="post" action="{link controller='ModerationActivation' id=$queue->queueID}{/link}">
+               <fieldset>
+                       <legend>{lang}wcf.moderation.report.details{/lang}</legend>
+                       
+                       <dl>
+                               <dt>{lang}wcf.moderation.assignedUser{/lang}</dt>
+                               <dd>
+                                       <ul>
+                                               {if $assignedUserID && ($assignedUserID != $__wcf->getUser()->userID)}
+                                                       <li><label><input type="radio" name="assignedUserID" value="{@$assignedUserID}" checked="checked" /> {$queue->assignedUsername}</label></li>
+                                               {/if}
+                                               <li><label><input type="radio" name="assignedUserID" value="{@$__wcf->getUser()->userID}"{if $assignedUserID == $__wcf->getUser()->userID} checked="checked"{/if} /> {$__wcf->getUser()->username}</label></li>
+                                               <li><label><input type="radio" name="assignedUserID" value="0"{if !$assignedUserID} checked="checked"{/if} /> {lang}wcf.moderation.assignedUser.nobody{/lang}</label></li>
+                                       </ul>
+                               </dd>
+                       </dl>
+                       {if $queue->assignedUser}
+                               <dl>
+                                       <dt></dt>
+                                       <dd><a href="{link controller='User' id=$assignedUserID}{/link}" class="userLink" data-user-id="{@$assignedUserID}">{$queue->assignedUsername}</a></dd>
+                               </dl>
+                       {/if}
+                       
+                       {event name='detailsFields'}
+                       
+                       <div class="formSubmit">
+                               <input type="submit" value="{lang}wcf.global.button.submit{/lang}" />
+                               {@SECURITY_TOKEN_INPUT_TAG}
+                       </div>
+               </fieldset>
+               
+               {event name='fieldsets'}
+       </form>
+       
+       {event name='boxes'}
+{/capture}
+
+{include file='header' sidebarOrientation='right'}
 
 <header class="boxHeadline">
-       <h1>{lang}wcf.moderation.activation{/lang}</h1>
+       <h1>{lang}wcf.moderation.activation{/lang}: {$queue->getTitle()}</h1>
+       
+       {if $queue->lastChangeTime}
+               <dl class="plain inlineDataList">
+                       <dt>{lang}wcf.moderation.lastChangeTime{/lang}</dt>
+                       <dd>{@$queue->lastChangeTime|time}</dd>
+               </dl>
+       {/if}
 </header>
 
 {include file='userNotice'}
 
 {include file='formError'}
 
-<div class="contentNavigation">
-       <nav>
-               <ul>
-                       <li><a href="{link controller='ModerationList'}{/link}" class="button"><span class="icon icon16 icon-list"></span> <span>{lang}wcf.moderation.moderation{/lang}</span></a></li>
-                       
-                       {event name='contentNavigationButtonsTop'}
-               </ul>
-       </nav>
-</div>
-
-<form method="post" action="{link controller='ModerationActivation' id=$queue->queueID}{/link}" class="container containerPadding marginTop">
-       <fieldset>
-               <legend>{lang}wcf.moderation.activation.details{/lang}</legend>
-               
-               <dl>
-                       <dt>{lang}wcf.global.objectID{/lang}</dt>
-                       <dd>{#$queue->queueID}</dd>
-               </dl>
-               {if $queue->lastChangeTime}
-                       <dl>
-                               <dt>{lang}wcf.moderation.lastChangeTime{/lang}</dt>
-                               <dd>{@$queue->lastChangeTime|time}</dd>
-                       </dl>
-               {/if}
-               <dl>
-                       <dt>{lang}wcf.moderation.assignedUser{/lang}</dt>
-                       <dd>
-                               <ul>
-                                       {if $assignedUserID && ($assignedUserID != $__wcf->getUser()->userID)}
-                                               <li><label><input type="radio" name="assignedUserID" value="{@$assignedUserID}" checked="checked" /> {$queue->assignedUsername}</label></li>
-                                       {/if}
-                                       <li><label><input type="radio" name="assignedUserID" value="{@$__wcf->getUser()->userID}"{if $assignedUserID == $__wcf->getUser()->userID} checked="checked"{/if} /> {$__wcf->getUser()->username}</label></li>
-                                       <li><label><input type="radio" name="assignedUserID" value="0"{if !$assignedUserID} checked="checked"{/if} /> {lang}wcf.moderation.assignedUser.nobody{/lang}</label></li>
-                               </ul>
-                       </dd>
-               </dl>
-               {if $queue->assignedUser}
-                       <dl>
-                               <dt></dt>
-                               <dd><a href="{link controller='User' id=$assignedUserID}{/link}" class="userLink" data-user-id="{@$assignedUserID}">{$queue->assignedUsername}</a></dd>
-                       </dl>
-               {/if}
-               <dl>
-                       <dt><label for="comment">{lang}wcf.moderation.comment{/lang}</label></dt>
-                       <dd><textarea id="comment" name="comment" rows="4" cols="40">{$comment}</textarea></dd>
-               </dl>
-               
-               {event name='detailsFields'}
-               
-               <div class="formSubmit">
-                       <input type="submit" value="{lang}wcf.global.button.submit{/lang}" />
-                       {@SECURITY_TOKEN_INPUT_TAG}
-               </div>
-       </fieldset>
-       
-       {event name='fieldsets'}
-</form>
-
 <header class="boxHeadline boxSubHeadline">
        <h2>{lang}wcf.moderation.activation.content{/lang}</h2>
 </header>
                                {if $queueManager->canRemoveContent($queue->getDecoratedObject())}<li class="jsOnly"><a id="enableContent" class="button"><span class="icon icon16 icon-check"></span> <span>{lang}wcf.moderation.activation.enableContent{/lang}</span></a></li>{/if}
                                <li class="jsOnly"><a id="removeContent" class="button"><span class="icon icon16 icon-remove"></span> <span>{lang}wcf.moderation.activation.removeContent{/lang}</span></a></li>
                        {/if}
-                       <li><a href="{link controller='ModerationList'}{/link}" class="button"><span class="icon icon16 icon-list"></span> <span>{lang}wcf.moderation.moderation{/lang}</span></a></li>
+                       {if $queue->getAffectedObject()}<li><a href="{$queue->getAffectedObject()->getLink()}" class="button"><span class="icon icon16 fa-arrow-right"></span> <span>{lang}wcf.moderation.jumpToContent{/lang}</span></a></li>{/if}
                        
-                       {event name='contentNavigationButtonsBottom'}
+                       {event name='contentNavigationButtons'}
                </ul>
        </nav>
 </div>
 
+<header id="comments" class="boxHeadline boxSubHeadline">
+       <h2>{lang}wcf.moderation.comments{/lang} <span class="badge">{#$queue->comments}</span></h2>
+       <p>{lang}wcf.moderation.comments.description{/lang}</p>
+</header>
+
+{include file='__commentJavaScript' commentContainerID='moderationQueueCommentList'}
+
+<div class="container containerList marginTop blogEntryComments">
+       <ul id="moderationQueueCommentList" class="commentList containerList" data-can-add="true" data-object-id="{@$queueID}" data-object-type-id="{@$commentObjectTypeID}" data-comments="{@$commentList->countObjects()}" data-last-comment-time="{@$lastCommentTime}">
+               {include file='commentList'}
+       </ul>
+</div>
+
 {include file='footer'}
 
 </body>
index f12eb39212649fc9a9d665b12f5ecf3f4e99ef39..06685a596a4277e4b10646fcecfbb15adb40bd7f 100644 (file)
@@ -1,7 +1,7 @@
 {include file='documentHeader'}
 
 <head>
-       <title>{lang}wcf.moderation.report{/lang} - {PAGE_TITLE|language}</title>
+       <title>{lang}wcf.moderation.report{/lang}: {$queue->getTitle()} - {PAGE_TITLE|language}</title>
        
        {include file='headInclude'}
        
 
 <body id="tpl{$templateName|ucfirst}">
 
-{include file='header' sidebarOrientation='left'}
+{capture assign='sidebar'}
+       <form method="post" action="{link controller='ModerationReport' id=$queue->queueID}{/link}">
+               <fieldset>
+                       <legend>{lang}wcf.moderation.report.details{/lang}</legend>
+                       
+                       <dl>
+                               <dt>{lang}wcf.moderation.assignedUser{/lang}</dt>
+                               <dd>
+                                       <ul>
+                                               {if $assignedUserID && ($assignedUserID != $__wcf->getUser()->userID)}
+                                                       <li><label><input type="radio" name="assignedUserID" value="{@$assignedUserID}" checked="checked" /> {$queue->assignedUsername}</label></li>
+                                               {/if}
+                                               <li><label><input type="radio" name="assignedUserID" value="{@$__wcf->getUser()->userID}"{if $assignedUserID == $__wcf->getUser()->userID} checked="checked"{/if} /> {$__wcf->getUser()->username}</label></li>
+                                               <li><label><input type="radio" name="assignedUserID" value="0"{if !$assignedUserID} checked="checked"{/if} /> {lang}wcf.moderation.assignedUser.nobody{/lang}</label></li>
+                                       </ul>
+                               </dd>
+                       </dl>
+                       {if $queue->assignedUser}
+                               <dl>
+                                       <dt></dt>
+                                       <dd><a href="{link controller='User' id=$assignedUserID}{/link}" class="userLink" data-user-id="{@$assignedUserID}">{$queue->assignedUsername}</a></dd>
+                               </dl>
+                       {/if}
+                       
+                       {event name='detailsFields'}
+                       
+                       <div class="formSubmit">
+                               <input type="submit" value="{lang}wcf.global.button.submit{/lang}" />
+                               {@SECURITY_TOKEN_INPUT_TAG}
+                       </div>
+               </fieldset>
+               
+               {event name='fieldsets'}
+       </form>
+       
+       {event name='boxes'}
+{/capture}
+
+{include file='header' sidebarOrientation='right'}
 
 <header class="boxHeadline">
-       <h1>{lang}wcf.moderation.report{/lang}</h1>
+       <h1>{lang}wcf.moderation.report{/lang}: {$queue->getTitle()}</h1>
+       
+       {if $queue->lastChangeTime}
+               <dl class="plain inlineDataList">
+                       <dt>{lang}wcf.moderation.lastChangeTime{/lang}</dt>
+                       <dd>{@$queue->lastChangeTime|time}</dd>
+               </dl>
+       {/if}
 </header>
 
 {include file='userNotice'}
 
 {include file='formError'}
 
-<div class="contentNavigation">
-       <nav>
-               <ul>
-                       <li><a href="{link controller='ModerationList'}{/link}" class="button"><span class="icon icon16 icon-list"></span> <span>{lang}wcf.moderation.moderation{/lang}</span></a></li>
-                       
-                       {event name='contentNavigationButtonsTop'}
-               </ul>
-       </nav>
-</div>
-
-<form method="post" action="{link controller='ModerationReport' id=$queue->queueID}{/link}" class="container containerPadding marginTop">
-       <fieldset>
-               <legend>{lang}wcf.moderation.report.details{/lang}</legend>
-               
-               <dl>
-                       <dt>{lang}wcf.global.objectID{/lang}</dt>
-                       <dd>{#$queue->queueID}</dd>
-               </dl>
-               <dl>
-                       <dt>{lang}wcf.moderation.report.reportedBy{/lang}</dt>
-                       <dd>{if $queue->userID}<a href="{link controller='User' id=$queue->userID}{/link}" class="userLink" data-user-id="{@$queue->userID}">{$queue->username}</a>{else}{lang}wcf.user.guest{/lang}{/if} ({@$queue->time|time})</dd>
-               </dl>
-               {if $queue->lastChangeTime}
-                       <dl>
-                               <dt>{lang}wcf.moderation.lastChangeTime{/lang}</dt>
-                               <dd>{@$queue->lastChangeTime|time}</dd>
-                       </dl>
-               {/if}
-               <dl>
-                       <dt>{lang}wcf.moderation.assignedUser{/lang}</dt>
-                       <dd>
-                               <ul>
-                                       {if $assignedUserID && ($assignedUserID != $__wcf->getUser()->userID)}
-                                               <li><label><input type="radio" name="assignedUserID" value="{@$assignedUserID}" checked="checked" /> {$queue->assignedUsername}</label></li>
-                                       {/if}
-                                       <li><label><input type="radio" name="assignedUserID" value="{@$__wcf->getUser()->userID}"{if $assignedUserID == $__wcf->getUser()->userID} checked="checked"{/if} /> {$__wcf->getUser()->username}</label></li>
-                                       <li><label><input type="radio" name="assignedUserID" value="0"{if !$assignedUserID} checked="checked"{/if} /> {lang}wcf.moderation.assignedUser.nobody{/lang}</label></li>
-                               </ul>
-                       </dd>
-               </dl>
-               {if $queue->assignedUser}
-                       <dl>
-                               <dt></dt>
-                               <dd><a href="{link controller='User' id=$assignedUserID}{/link}" class="userLink" data-user-id="{@$assignedUserID}">{$queue->assignedUsername}</a></dd>
-                       </dl>
-               {/if}
-               <dl>
-                       <dt>{lang}wcf.moderation.report.reason{/lang}</dt>
-                       <dd>{@$queue->getFormattedMessage()}</dd>
-               </dl>
-               <dl>
-                       <dt><label for="comment">{lang}wcf.moderation.comment{/lang}</label></dt>
-                       <dd><textarea id="comment" name="comment" rows="4" cols="40">{$comment}</textarea></dd>
-               </dl>
-               
-               {event name='detailsFields'}
-               
-               <div class="formSubmit">
-                       <input type="submit" value="{lang}wcf.global.button.submit{/lang}" />
-                       {@SECURITY_TOKEN_INPUT_TAG}
-               </div>
-       </fieldset>
-       
-       {event name='fieldsets'}
-</form>
-
 <header class="boxHeadline boxSubHeadline">
        <h2>{lang}wcf.moderation.report.reportedContent{/lang}</h2>
 </header>
                                {if $queueManager->canRemoveContent($queue->getDecoratedObject())}<li class="jsOnly"><a id="removeContent" class="button"><span class="icon icon16 icon-remove"></span> <span>{lang}wcf.moderation.report.removeContent{/lang}</span></a></li>{/if}
                                <li class="jsOnly"><a id="removeReport" class="button"><span class="icon icon16 icon-remove"></span> <span>{lang}wcf.moderation.report.removeReport{/lang}</span></a></li>
                        {/if}
-                       <li><a href="{link controller='ModerationList'}{/link}" class="button"><span class="icon icon16 icon-list"></span> <span>{lang}wcf.moderation.moderation{/lang}</span></a></li>
+                       {if $queue->getAffectedObject()}<li><a href="{$queue->getAffectedObject()->getLink()}" class="button"><span class="icon icon16 fa-arrow-right"></span> <span>{lang}wcf.moderation.jumpToContent{/lang}</span></a></li>{/if}
                        
-                       {event name='contentNavigationButtonsBottom'}
+                       {event name='contentNavigationButtons'}
                </ul>
        </nav>
 </div>
 
+<header class="boxHeadline boxSubHeadline">
+       <h2>{lang}wcf.moderation.report.reportedBy{/lang}</h2>
+</header>
+
+<div class="container containerPadding marginTop">
+       <div class="box32">
+               {if $reportUser->userID}
+                       <a href="{link controller='User' object=$reportUser}{/link}" title="{$reportUser->username}" class="framed">
+                               {@$reportUser->getAvatar()->getImageTag(32)}
+                       </a>
+               {else}
+                       <span class="framed">{@$reportUser->getAvatar()->getImageTag(32)}</span>
+               {/if}
+               
+               <div>
+                       <div class="containerHeadline">
+                               <h3>
+                                       {if $queue->userID}
+                                               <a href="{link controller='User' id=$queue->userID}{/link}" class="userLink" data-user-id="{@$queue->userID}">{$queue->username}</a>
+                                       {else}
+                                               {lang}wcf.user.guest{/lang}
+                                       {/if}
+                                       
+                                       <small> - {@$queue->time|time}</small>
+                               </h3>
+                       </div>
+                       
+                       <div>{@$queue->getFormattedMessage()}</div>
+               </div>
+       </div>
+</div>
+
+<header id="comments" class="boxHeadline boxSubHeadline">
+       <h2>{lang}wcf.moderation.comments{/lang} <span class="badge">{#$queue->comments}</span></h2>
+       <p>{lang}wcf.moderation.comments.description{/lang}</p>
+</header>
+
+{include file='__commentJavaScript' commentContainerID='moderationQueueCommentList'}
+
+<div class="container containerList marginTop blogEntryComments">
+       <ul id="moderationQueueCommentList" class="commentList containerList" data-can-add="true" data-object-id="{@$queueID}" data-object-type-id="{@$commentObjectTypeID}" data-comments="{@$commentList->countObjects()}" data-last-comment-time="{@$lastCommentTime}">
+               {include file='commentList'}
+       </ul>
+</div>
+
 {include file='footer'}
 
 </body>
index 1c3b2dd048919753bd7085b718017dcb1c008079..948fcfdbea93630f2745550ac56e96b33216c26a 100644 (file)
@@ -630,7 +630,8 @@ class CommentAction extends AbstractDatabaseObjectAction {
                }
                
                WCF::getTPL()->assign(array(
-                       'commentList' => array($comment)
+                       'commentList' => array($comment),
+                       'commentManager' => $this->commentProcessor
                ));
                return WCF::getTPL()->fetch('commentList');
        }
@@ -654,7 +655,8 @@ class CommentAction extends AbstractDatabaseObjectAction {
                
                // render response
                WCF::getTPL()->assign(array(
-                       'responseList' => array($response)
+                       'responseList' => array($response),
+                       'commentManager' => $this->commentProcessor
                ));
                return WCF::getTPL()->fetch('commentResponseList');
        }
index 23e01bd4da9eea39a44a77a7ba319b463b37e44a..1e3c07a477857ff66f7a855139ed98edbb657fec 100644 (file)
@@ -171,4 +171,13 @@ class StructuredCommentList extends CommentList {
        public function getMinCommentTime() {
                return $this->minCommentTime;
        }
+       
+       /**
+        * Returns the comment manager object.
+        * 
+        * @return      \wcf\system\comment\manager\ICommentManager
+        */
+       public function getCommentManager() {
+               return $this->commentManager;
+       }
 }
index 2b3dbe929f4ea75e94be40d6c736077828287abb..6675ca008503947e932797d77cdacebf4b43b6a8 100644 (file)
@@ -165,7 +165,8 @@ class CommentResponseAction extends AbstractDatabaseObjectAction {
                
                WCF::getTPL()->assign(array(
                        'likeData' => (MODULE_LIKE ? $responseList->getLikeData() : array()),
-                       'responseList' => $responseList
+                       'responseList' => $responseList,
+                       'commentManager' => $this->commentManager
                ));
                
                return array(
index 45a1197e78220709deb6718acef1ef647424ed81..0fbc68f50f202a51878c88cb751b724003c2dd49 100644 (file)
@@ -4,12 +4,13 @@ use wcf\data\moderation\queue\ModerationQueue;
 use wcf\data\moderation\queue\ModerationQueueAction;
 use wcf\data\moderation\queue\ViewableModerationQueue;
 use wcf\system\breadcrumb\Breadcrumb;
+use wcf\system\comment\CommentHandler;
 use wcf\system\event\EventHandler;
 use wcf\system\exception\IllegalLinkException;
 use wcf\system\exception\PermissionDeniedException;
 use wcf\system\request\LinkHandler;
+use wcf\system\user\collapsible\content\UserCollapsibleContentHandler;
 use wcf\system\WCF;
-use wcf\util\StringUtil;
 
 /**
  * Provides an abstract form for moderation queue processing.
@@ -28,12 +29,6 @@ abstract class AbstractModerationForm extends AbstractForm {
         */
        public $assignedUserID = 0;
        
-       /**
-        * comment
-        * @var string
-        */
-       public $comment = '';
-       
        /**
         * data used for moderation queue update
         * @var array
@@ -62,6 +57,24 @@ abstract class AbstractModerationForm extends AbstractForm {
         */
        public $queueID = 0;
        
+       /**
+        * comment object type id
+        * @var integer
+        */
+       public $commentObjectTypeID = 0;
+       
+       /**
+        * comment manager object
+        * @var \wcf\system\comment\manager\ICommentManager
+        */
+       public $commentManager = null;
+       
+       /**
+        * list of comments
+        * @var \wcf\data\comment\StructuredCommentList
+        */
+       public $commentList = null;
+       
        /**
         * @see \wcf\page\IPage::readParameters()
         */
@@ -85,8 +98,6 @@ abstract class AbstractModerationForm extends AbstractForm {
        public function readFormParameters() {
                parent::readFormParameters();
                
-               if (isset($_POST['comment'])) $this->comment = StringUtil::trim($_POST['comment']);
-               
                // verify assigned user id
                if (isset($_POST['assignedUserID'])) {
                        $this->assignedUserID = intval($_POST['assignedUserID']);
@@ -107,13 +118,16 @@ abstract class AbstractModerationForm extends AbstractForm {
                
                if (empty($_POST)) {
                        $this->assignedUserID = $this->queue->assignedUserID;
-                       $this->comment = $this->queue->comment;
                }
                
                WCF::getBreadcrumbs()->add(new Breadcrumb(
                        WCF::getLanguage()->get('wcf.moderation.moderation'),
                        LinkHandler::getInstance()->getLink('ModerationList')
                ));
+               
+               $this->commentObjectTypeID = CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.moderation.queue');
+               $this->commentManager = CommentHandler::getInstance()->getObjectType($this->commentObjectTypeID)->getProcessor();
+               $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->commentObjectTypeID, $this->queueID);
        }
        
        /**
@@ -124,8 +138,14 @@ abstract class AbstractModerationForm extends AbstractForm {
                
                WCF::getTPL()->assign(array(
                        'assignedUserID' => $this->assignedUserID,
-                       'comment' => $this->comment,
-                       'queue' => $this->queue
+                       'queue' => $this->queue,
+                       'queueID' => $this->queueID,
+                       'commentCanAdd' => true,
+                       'commentList' => $this->commentList,
+                       'commentObjectTypeID' => $this->commentObjectTypeID,
+                       'lastCommentTime' => ($this->commentList ? $this->commentList->getMinCommentTime() : 0),
+                       'sidebarCollapsed' => UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'com.woltlab.wcf.ModerationForm'),
+                       'sidebarName' => 'com.woltlab.wcf.ModerationForm'
                ));
        }
        
@@ -137,7 +157,6 @@ abstract class AbstractModerationForm extends AbstractForm {
                
                $this->data = array(
                        'assignedUserID' => ($this->assignedUserID ?: null),
-                       'comment' => $this->comment
                );
                if ($this->queue->status != ModerationQueue::STATUS_DONE) {
                        if ($this->assignedUserID) {
index d86a864a519cf3d088cf47da9761913f0c17eedf..0cad79a81463377cefc82d474c028b8f397b730f 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 namespace wcf\form;
+use wcf\data\user\UserProfile;
+use wcf\data\user\User;
 use wcf\system\moderation\queue\ModerationQueueReportManager;
 use wcf\system\WCF;
 
@@ -20,9 +22,12 @@ class ModerationReportForm extends AbstractModerationForm {
        public function assignVariables() {
                parent::assignVariables();
                
+               $reportUser = UserProfile::getUserProfile($this->queue->userID);
+               if ($reportUser === null) $reportUser = new UserProfile(new User(null, array()));
                WCF::getTPL()->assign(array(
                        'reportedContent' => ModerationQueueReportManager::getInstance()->getReportedContent($this->queue),
-                       'queueManager' => ModerationQueueReportManager::getInstance()
+                       'queueManager' => ModerationQueueReportManager::getInstance(),
+                       'reportUser' => $reportUser
                ));
        }
 }
index 8ece8fa2a1bf5fdc8eb641d979ac68b7878f8ba4..73c3cfd53173a51e1a41f5f66f65379048db0496 100644 (file)
@@ -160,4 +160,18 @@ abstract class AbstractCommentManager extends SingletonFactory implements IComme
        public function getCommentsPerPage() {
                return $this->commentsPerPage;
        }
+       
+       /**
+        * @see \wcf\system\comment\manager\ICommentManager::supportsLike()
+        */
+       public function supportsLike() {
+               return true;
+       }
+       
+       /**
+        * @see \wcf\system\comment\manager\ICommentManager::supportsReport()
+        */
+       public function supportsReport() {
+               return true;
+       }
 }
index e4289a84cf7ff6760c5fa9e5e52c06e306c17473..b4de3799be5d930b7a08de2bed234348229ad9dc 100644 (file)
@@ -106,4 +106,18 @@ interface ICommentManager {
         * @param       integer         $value
         */
        public function updateCounter($objectID, $value);
+       
+       /**
+        * Returns true, if this comment type supports likes.
+        * 
+        * @return      boolean
+        */
+       public function supportsLike();
+       
+       /**
+        * Returns true, if this comment type supports reports.
+        *
+        * @return      boolean
+        */
+       public function supportsReport();
 }
diff --git a/wcfsetup/install/files/lib/system/comment/manager/ModerationQueueCommentManager.class.php b/wcfsetup/install/files/lib/system/comment/manager/ModerationQueueCommentManager.class.php
new file mode 100644 (file)
index 0000000..faff440
--- /dev/null
@@ -0,0 +1,90 @@
+<?php
+namespace wcf\system\comment\manager;
+use wcf\data\moderation\queue\ModerationQueue;
+use wcf\data\moderation\queue\ModerationQueueEditor;
+use wcf\data\moderation\queue\ViewableModerationQueue;
+
+/**
+ * Moderation queue comment manager implementation.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2014 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.comment.manager
+ * @category   Community Framework
+ */
+class ModerationQueueCommentManager extends AbstractCommentManager {
+       /**
+        * @see \wcf\system\comment\manager\ICommentManager::isAccessible()
+        */
+       public function isAccessible($objectID, $validateWritePermission = false) {
+               $entry = new ModerationQueue($objectID);
+               return $entry->canEdit();
+       }
+       
+       /**
+        * @see \wcf\system\comment\manager\ICommentManager::getLink()
+        */
+       public function getLink($objectTypeID, $objectID) {
+               $entry = new ViewableModerationQueue(new ModerationQueue($objectID));
+               return $entry->getLink();
+       }
+       
+       /**
+        * @see \wcf\system\comment\manager\ICommentManager::getTitle()
+        */
+       public function getTitle($objectTypeID, $objectID, $isResponse = false) {
+               return '';
+       }
+       
+       /**
+        * @see \wcf\system\comment\manager\ICommentManager::updateCounter()
+        */
+       public function updateCounter($objectID, $value) {
+               $entry = new ModerationQueue($objectID);
+               $editor = new ModerationQueueEditor($entry);
+               $editor->updateCounters(array(
+                       'comments' => $value
+               ));
+       }
+       
+       /**
+        * @see \wcf\system\comment\manager\ICommentManager::canAdd()
+        */
+       public function canAdd($objectID) {
+               if (!$this->isAccessible($objectID, true)) {
+                       return false;
+               }
+       
+               return true;
+       }
+       
+       /**
+        * @see \wcf\system\comment\manager\AbstractCommentManager::canEdit()
+        */
+       protected function canEdit($isOwner) {
+               return $isOwner;
+       }
+       
+       /**
+        * @see \wcf\system\comment\manager\AbstractCommentManager::canDelete()
+        */
+       protected function canDelete($isOwner) {
+               return $isOwner;
+       }
+       
+       /**
+        * @see \wcf\system\comment\manager\ICommentManager::supportsLike()
+        */
+       public function supportsLike() {
+               return false;
+       }
+       
+       /**
+        * @see \wcf\system\comment\manager\ICommentManager::supportsReport()
+        */
+       public function supportsReport() {
+               return false;
+       }
+}
index 4887b1448f005fa8bcad1dc4f0a23b4d6c152a0c..7b3763e09647ed6333de85b4927c157aad85804c 100644 (file)
@@ -2171,7 +2171,6 @@ Fehler sind beispielsweise:
        <category name="wcf.moderation">
                <item name="wcf.moderation.assignedUser"><![CDATA[Zugewiesener Benutzer]]></item>
                <item name="wcf.moderation.assignedUser.nobody"><![CDATA[Niemand]]></item>
-               <item name="wcf.moderation.comment"><![CDATA[Kommentar (intern)]]></item>
                <item name="wcf.moderation.filterByType"><![CDATA[Typ]]></item>
                <item name="wcf.moderation.filterByUser"><![CDATA[Zugewiesener Benutzer]]></item>
                <item name="wcf.moderation.filterByUser.allEntries"><![CDATA[Alle Einträge]]></item>
@@ -2210,7 +2209,7 @@ Fehler sind beispielsweise:
        </category>
        
        <category name="wcf.moderation.report">
-               <item name="wcf.moderation.report"><![CDATA[Meldung bearbeiten]]></item>
+               <item name="wcf.moderation.report"><![CDATA[Meldung]]></item>
                <item name="wcf.moderation.report.alreadyReported"><![CDATA[Dieser Inhalt wurde bereits gemeldet.]]></item>
                <item name="wcf.moderation.report.details"><![CDATA[Informationen]]></item>
                <item name="wcf.moderation.report.reason"><![CDATA[Grund der Meldung]]></item>
index 2af13aaa5b828952bed0b0108b5907ce1bda66a9..4205787ccf5a4b0505b6d770ba1bf2cbc8793280 100644 (file)
@@ -2139,7 +2139,6 @@ Errors are:
        <category name="wcf.moderation">
                <item name="wcf.moderation.assignedUser"><![CDATA[Assigned User]]></item>
                <item name="wcf.moderation.assignedUser.nobody"><![CDATA[Nobody]]></item>
-               <item name="wcf.moderation.comment"><![CDATA[Comment (internal)]]></item>
                <item name="wcf.moderation.filterByType"><![CDATA[Type]]></item>
                <item name="wcf.moderation.filterByUser"><![CDATA[Assigned User]]></item>
                <item name="wcf.moderation.filterByUser.allEntries"><![CDATA[All Items]]></item>
@@ -2178,7 +2177,7 @@ Errors are:
        </category>
        
        <category name="wcf.moderation.report">
-               <item name="wcf.moderation.report"><![CDATA[Edit Report]]></item>
+               <item name="wcf.moderation.report"><![CDATA[Report]]></item>
                <item name="wcf.moderation.report.alreadyReported"><![CDATA[This content has already been reported.]]></item>
                <item name="wcf.moderation.report.details"><![CDATA[Information]]></item>
                <item name="wcf.moderation.report.reason"><![CDATA[Reason]]></item>
index ac4dae266cfbfb55c211202fdfee11323a74b7d2..d425ce9717b6e0b606c35da3f7cd71fe430aa90b 100644 (file)
@@ -507,7 +507,7 @@ CREATE TABLE wcf1_moderation_queue (
        -- internal
        assignedUserID INT(10) NULL,
        status TINYINT(1) NOT NULL DEFAULT 0,
-       comment TEXT,
+       comments SMALLINT(5) NOT NULL DEFAULT 0,
        lastChangeTime INT(10) NOT NULL DEFAULT 0,
        
        -- additional data, e.g. message if reporting content