From 27cc87cd67a5cd5d3428339243347dd94a7bcdf5 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 26 Jun 2018 12:19:11 +0200 Subject: [PATCH] Discussion provider support for articles See #2615 See #2585 See WoltLab/com.woltlab.wbb#299 See WoltLab/com.woltlab.wbb#301 --- com.woltlab.wcf/objectType.xml | 5 ++ com.woltlab.wcf/objectTypeDefinition.xml | 5 ++ com.woltlab.wcf/templates/article.tpl | 21 +----- com.woltlab.wcf/templates/articleComments.tpl | 12 +++ .../templates/articleListItems.tpl | 6 +- com.woltlab.wcf/templates/boxArticleList.tpl | 4 +- .../files/lib/data/article/Article.class.php | 75 +++++++++++++++++++ .../article/ViewableArticleList.class.php | 7 +- .../lib/page/AbstractArticlePage.class.php | 1 + .../files/lib/page/ArticlePage.class.php | 14 ++-- ...bstractArticleDiscussionProvider.class.php | 43 +++++++++++ ...CommentArticleDiscussionProvider.class.php | 58 ++++++++++++++ .../IArticleDiscussionProvider.class.php | 54 +++++++++++++ .../VoidArticleDiscussionProvider.class.php | 44 +++++++++++ 14 files changed, 320 insertions(+), 29 deletions(-) create mode 100644 com.woltlab.wcf/templates/articleComments.tpl create mode 100644 wcfsetup/install/files/lib/system/article/discussion/AbstractArticleDiscussionProvider.class.php create mode 100644 wcfsetup/install/files/lib/system/article/discussion/CommentArticleDiscussionProvider.class.php create mode 100644 wcfsetup/install/files/lib/system/article/discussion/IArticleDiscussionProvider.class.php create mode 100644 wcfsetup/install/files/lib/system/article/discussion/VoidArticleDiscussionProvider.class.php diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index 20a83cd7c8..30445adad8 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -81,6 +81,11 @@ com.woltlab.wcf.label.objectType wcf\system\label\object\type\ArticleCategoryLabelObjectTypeHandler + + com.woltlab.wcf.article.comment + com.woltlab.wcf.article.discussionProvider + wcf\system\article\discussion\CommentArticleDiscussionProvider + diff --git a/com.woltlab.wcf/objectTypeDefinition.xml b/com.woltlab.wcf/objectTypeDefinition.xml index 8fcb1f0b50..61a6f0227b 100644 --- a/com.woltlab.wcf/objectTypeDefinition.xml +++ b/com.woltlab.wcf/objectTypeDefinition.xml @@ -236,6 +236,11 @@ com.woltlab.wcf.sitemap.object wcf\system\sitemap\object\ISitemapObjectObjectType + + + com.woltlab.wcf.article.discussionProvider + wcf\system\article\discussion\IArticleDiscussionProvider + diff --git a/com.woltlab.wcf/templates/article.tpl b/com.woltlab.wcf/templates/article.tpl index 4e0fde5bfd..1bc906b4e6 100644 --- a/com.woltlab.wcf/templates/article.tpl +++ b/com.woltlab.wcf/templates/article.tpl @@ -36,12 +36,12 @@ - {if $article->enableComments} + {if $article->getDiscussionProvider()->getDiscussionCountPhrase()}
  • - {lang}wcf.article.articleComments{/lang} + {$article->getDiscussionProvider()->getDiscussionCountPhrase()} - +
  • {/if} @@ -331,20 +331,7 @@ {event name='beforeComments'} -{if $article->enableComments} - {if $commentList|count || $commentCanAdd} -
    -

    {lang}wcf.global.comments{/lang}{if $article->comments} {#$article->comments}{/if}

    - - {include file='__commentJavaScript' commentContainerID='articleCommentList'} - -
      - {if $commentCanAdd}{include file='commentListAddComment' wysiwygSelector='articleCommentListAddComment'}{/if} - {include file='commentList'} -
    -
    - {/if} -{/if} +{@$article->getDiscussionProvider()->renderDiscussions()} {if MODULE_LIKE && ARTICLE_ENABLE_LIKE}