From 0943780a1c054ad75baa8f1773f364d0447f0c2e Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 6 Oct 2016 17:24:03 +0200 Subject: [PATCH] Add box controller for article comments --- com.woltlab.wcf/objectType.xml | 5 +++ .../ArticleCommentListBoxController.class.php | 45 +++++++++++++++++++ wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 4 files changed, 52 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/box/ArticleCommentListBoxController.class.php diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index 8391774765..5e14c1269d 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -1084,6 +1084,11 @@ com.woltlab.wcf.boxController wcf\system\box\ArticleListBoxController + + com.woltlab.wcf.articleCommentList + com.woltlab.wcf.boxController + wcf\system\box\ArticleCommentListBoxController + com.woltlab.wcf.whoWasOnline com.woltlab.wcf.boxController diff --git a/wcfsetup/install/files/lib/system/box/ArticleCommentListBoxController.class.php b/wcfsetup/install/files/lib/system/box/ArticleCommentListBoxController.class.php new file mode 100644 index 0000000000..f83d04e723 --- /dev/null +++ b/wcfsetup/install/files/lib/system/box/ArticleCommentListBoxController.class.php @@ -0,0 +1,45 @@ + + * @package WoltLabSuite\Core\System\Box + */ +class ArticleCommentListBoxController extends AbstractCommentListBoxController { + /** + * @inheritDoc + */ + protected $objectTypeName = 'com.woltlab.wcf.articleComment'; + + /** + * @inheritDoc + */ + protected function applyObjectTypeFilters(ViewableCommentList $commentList) { + $accessibleCategoryIDs = ArticleCategory::getAccessibleCategoryIDs(); + if (!empty($accessibleCategoryIDs)) { + $commentList->sqlJoins .= ' INNER JOIN wcf' . WCF_N . '_article_content article_content ON (article_content.articleContentID = comment.objectID)'; + $commentList->sqlJoins .= ' INNER JOIN wcf' . WCF_N . '_article article ON (article.articleID = article_content.articleID)'; + $commentList->sqlSelects = 'article_content.title'; + + $commentList->getConditionBuilder()->add('article.categoryID IN (?)', [$accessibleCategoryIDs]); + $commentList->getConditionBuilder()->add('article.publicationStatus = ?', [Article::PUBLISHED]); + + // apply language filter + if (LanguageFactory::getInstance()->multilingualismEnabled() && !empty(WCF::getUser()->getLanguageIDs())) { + $commentList->getConditionBuilder()->add('(article_content.languageID IN (?) OR article_content.languageID IS NULL)', [WCF::getUser()->getLanguageIDs()]); + } + } + else { + $commentList->getConditionBuilder()->add('0 = 1'); + } + } +} diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index a367266d18..02662fa00e 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -196,6 +196,7 @@ explizit anzeigen]]> nicht anzeigen]]> + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index f065d85ec5..594eff83cf 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -193,6 +193,7 @@ Examples for medium ID detection: Visible]]> Hidden]]> + -- 2.20.1