<title>Comments</title>
</content>
</box>
+
+ <box identifier="com.woltlab.wcf.ArticleCategories">
+ <name language="de">Kategorien (Artikel)</name>
+ <name language="en">Categories (Articles)</name>
+ <boxType>system</boxType>
+ <objectType>com.woltlab.wcf.articleCategories</objectType>
+ <position>sidebarRight</position>
+ <showHeader>1</showHeader>
+ <visibleEverywhere>0</visibleEverywhere>
+ <visibilityExceptions>
+ <page>com.woltlab.wcf.ArticleList</page>
+ <page>com.woltlab.wcf.CategoryArticleList</page>
+ <page>com.woltlab.wcf.Article</page>
+ </visibilityExceptions>
+
+ <content language="de">
+ <title>Kategorien</title>
+ </content>
+ <content language="en">
+ <title>Categories</title>
+ </content>
+ </box>
</import>
</data>
<definitionname>com.woltlab.wcf.boxController</definitionname>
<classname>wcf\system\box\PageCommentListBoxController</classname>
</type>
+ <type>
+ <name>com.woltlab.wcf.articleCategories</name>
+ <definitionname>com.woltlab.wcf.boxController</definitionname>
+ <classname>wcf\system\box\ArticleCategoriesBoxController</classname>
+ </type>
<!-- /box controllers -->
<!-- deprecated -->
--- /dev/null
+<ol class="boxMenu">
+ {foreach from=$categoryList item=categoryItem}
+ <li{if $activeCategory && $activeCategory->categoryID == $categoryItem->categoryID} class="active"{/if} data-category-id="{@$categoryItem->categoryID}">
+ <a href="{@$categoryItem->getLink()}" class="boxMenuLink">{$categoryItem->getTitle()}</a>
+
+ {if $activeCategory && ($activeCategory->categoryID == $categoryItem->categoryID || $activeCategory->isParentCategory($categoryItem->getDecoratedObject())) && $categoryItem->hasChildren()}
+ <ol class="boxMenuDepth1">
+ {foreach from=$categoryItem item=subCategoryItem}
+ <li{if $activeCategory && $activeCategory->categoryID == $subCategoryItem->categoryID} class="active"{/if} data-category-id="{@$subCategoryItem->categoryID}">
+ <a href="{@$subCategoryItem->getLink()}" class="boxMenuLink">{$subCategoryItem->getTitle()}</a>
+
+ {if $activeCategory && ($activeCategory->categoryID == $subCategoryItem->categoryID || $activeCategory->parentCategoryID == $subCategoryItem->categoryID) && $subCategoryItem->hasChildren()}
+ <ol class="boxMenuDepth2">
+ {foreach from=$subCategoryItem item=subSubCategoryItem}
+ <li{if $activeCategory && $activeCategory->categoryID == $subSubCategoryItem->categoryID} class="active"{/if} data-category-id="{@$subSubCategoryItem->categoryID}">
+ <a href="{@$subSubCategoryItem->getLink()}" class="boxMenuLink">{$subSubCategoryItem->getTitle()}</a>
+ </li>
+ {/foreach}
+ </ol>
+ {/if}
+ </li>
+ {/foreach}
+ </ol>
+ {/if}
+ </li>
+ {/foreach}
+</ol>
--- /dev/null
+<?php
+namespace wcf\data\article\category;
+use wcf\data\category\CategoryNode;
+
+/**
+ * Represents an article category node.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2016 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Data\Article\Category
+ * @since 3.0
+ *
+ * @method ArticleCategory getDecoratedObject()
+ * @mixin ArticleCategory
+ */
+class ArticleCategoryNode extends CategoryNode {
+ /**
+ * @inheritDoc
+ */
+ protected static $baseClass = ArticleCategory::class;
+}
--- /dev/null
+<?php
+namespace wcf\data\article\category;
+use wcf\data\category\CategoryNode;
+use wcf\data\category\CategoryNodeTree;
+
+/**
+ * Represents a list of article category nodes.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2016 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\Data\Article\Category
+ * @since 3.0
+ */
+class ArticleCategoryNodeTree extends CategoryNodeTree {
+ /**
+ * name of the category node class
+ * @var string
+ */
+ protected $nodeClassName = ArticleCategoryNode::class;
+
+ /**
+ * @inheritDoc
+ */
+ public function isIncluded(CategoryNode $categoryNode) {
+ /** @var ArticleCategoryNode $categoryNode */
+
+ return parent::isIncluded($categoryNode) && $categoryNode->isAccessible();
+ }
+}
<?php
namespace wcf\page;
+use wcf\data\article\category\ArticleCategory;
use wcf\data\article\content\ViewableArticleContent;
use wcf\data\article\AccessibleArticleList;
use wcf\data\article\ArticleEditor;
*/
public $articleLikeData = [];
+ /**
+ * category object
+ * @var ArticleCategory
+ */
+ public $category;
+
/**
* @inheritDoc
*/
}
$this->article = ViewableArticle::getArticle($this->articleContent->articleID);
$this->canonicalURL = $this->articleContent->getLink();
+ $this->category = $this->article->getCategory();
}
/**
--- /dev/null
+<?php
+namespace wcf\system\box;
+use wcf\data\article\category\ArticleCategoryNodeTree;
+use wcf\page\ArticlePage;
+use wcf\page\CategoryArticleListPage;
+use wcf\system\request\RequestHandler;
+use wcf\system\WCF;
+
+/**
+ * Box for article categories.
+ *
+ * @author Marcel Werk
+ * @copyright 2001-2016 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\Core\System\Box
+ * @since 3.0
+ */
+class ArticleCategoriesBoxController extends AbstractBoxController {
+ /**
+ * @inheritDoc
+ */
+ protected $supportedPositions = ['footerBoxes', 'sidebarLeft', 'sidebarRight', 'contentTop', 'contentBottom', 'footer'];
+
+ /**
+ * @inheritDoc
+ */
+ protected function loadContent() {
+ // get categories
+ $categoryTree = new ArticleCategoryNodeTree('com.woltlab.wcf.article.category');
+ $categoryList = $categoryTree->getIterator();
+ $categoryList->setMaxDepth(0);
+
+ if (iterator_count($categoryList)) {
+ // get active category
+ $activeCategory = null;
+ if (RequestHandler::getInstance()->getActiveRequest()->getRequestObject() instanceof CategoryArticleListPage || RequestHandler::getInstance()->getActiveRequest()->getRequestObject() instanceof ArticlePage) {
+ if (RequestHandler::getInstance()->getActiveRequest()->getRequestObject()->category !== null) {
+ $activeCategory = RequestHandler::getInstance()->getActiveRequest()->getRequestObject()->category;
+ }
+ }
+
+ $this->content = WCF::getTPL()->fetch('boxArticleCategories', 'wcf', ['categoryList' => $categoryList, 'activeCategory' => $activeCategory]);
+ }
+ }
+}
{foreach from=$showOrder item=$application}
<dl{if $errors[$application]|isset} class="formError"{/if}>
<dt>
- <label for="application_{$application}">{'/^WoltLab Suite /'|preg_replace:'':$packages[$application][packageName]}</label>
+ <label for="application_{$application}">{$packages[$application][packageName]}</label>
</dt>
<dd>
<input type="text" id="application_{$application}" class="long jsApplicationDirectory" name="directories[{$application}]" value="{$directories[$application]}">