From: Matthias Schmidt Date: Thu, 6 Oct 2016 15:24:03 +0000 (+0200) Subject: Add box controller for article comments X-Git-Tag: 3.0.0_Beta_3~50^2~74 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0943780a1c054ad75baa8f1773f364d0447f0c2e;p=GitHub%2FWoltLab%2FWCF.git Add box controller for article comments --- 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]]> +