From fc3d134b4fd153f7fa6e1c2fede49eea89dc9762 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 17 Sep 2012 09:56:16 +0200 Subject: [PATCH] Fixes category collapsing --- wcfsetup/install/files/acp/js/WCF.ACP.js | 11 +---------- .../files/lib/data/category/CategoryAction.class.php | 8 +++++++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index be267ab325..f6e0fd3268 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -868,9 +868,7 @@ WCF.ACP.Category.Collapsible = WCF.Collapsible.SimpleRemote.extend({ /** * @see WCF.Collapsible.Remote.init() */ - init: function(className, objectTypeID) { - this._objectTypeID = objectTypeID; - + init: function(className) { var sortButton = $('.formSubmit > button[data-type="submit"]'); if (sortButton) { sortButton.click($.proxy(this._sort, this)); @@ -879,13 +877,6 @@ WCF.ACP.Category.Collapsible = WCF.Collapsible.SimpleRemote.extend({ this._super(className); }, - /** - * @see WCF.Collapsible.Remote._getAdditionalParameters() - */ - _getAdditionalParameters: function(containerID) { - return {objectTypeID : this._objectTypeID}; - }, - /** * @see WCF.Collapsible.Remote._getButtonContainer() */ diff --git a/wcfsetup/install/files/lib/data/category/CategoryAction.class.php b/wcfsetup/install/files/lib/data/category/CategoryAction.class.php index d20bab41a7..0d2c5833fd 100644 --- a/wcfsetup/install/files/lib/data/category/CategoryAction.class.php +++ b/wcfsetup/install/files/lib/data/category/CategoryAction.class.php @@ -3,6 +3,7 @@ namespace wcf\data\category; use wcf\data\AbstractDatabaseObjectAction; use wcf\system\category\CategoryHandler; use wcf\system\exception\PermissionDeniedException; +use wcf\system\exception\SystemException; use wcf\system\exception\ValidateActionException; use wcf\system\user\collapsible\content\UserCollapsibleContentHandler; use wcf\system\WCF; @@ -53,7 +54,12 @@ class CategoryAction extends AbstractDatabaseObjectAction { * Toggles the collapse status of categories. */ public function toggleContainer() { - $objectTypeID = UserCollapsibleContentHandler::getInstance()->getObjectTypeID($this->objects[0]->getCategoryType()->getCollapsibleObjectTypeName()); + $collapsibleObjectTypeName = $this->objects[0]->getCategoryType()->getObjectTypeName('com.woltlab.wcf.collapsibleContent'); + if ($collapsibleObjectTypeName === null) { + throw new SystemException("Categories of this type don't support collapsing"); + } + + $objectTypeID = UserCollapsibleContentHandler::getInstance()->getObjectTypeID($collapsibleObjectTypeName); $collapsedCategories = UserCollapsibleContentHandler::getInstance()->getCollapsedContent($objectTypeID); $categoryID = $this->objects[0]->categoryID; -- 2.20.1