From 3cf640a1281392577db16865242fc9869c573663 Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Mon, 19 May 2025 14:36:13 +0200 Subject: [PATCH] Remove support for collapsible categories The basic implementation was not used anywhere. Closes #6099 --- wcfsetup/install/files/acp/js/WCF.ACP.js | 70 ------------------- .../files/acp/templates/categoryList.tpl | 24 +++---- .../page/AbstractCategoryListPage.class.php | 32 --------- .../data/category/CategoryAction.class.php | 35 +--------- 4 files changed, 9 insertions(+), 152 deletions(-) diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index dc0c09ff2ca..65fc3e22fe5 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -807,76 +807,6 @@ WCF.ACP.Worker = Class.extend({ } }); -/** - * Namespace for category-related functions. - */ -WCF.ACP.Category = { }; - -/** - * Handles collapsing categories. - * - * @param string className - * @param integer objectTypeID - */ -WCF.ACP.Category.Collapsible = WCF.Collapsible.SimpleRemote.extend({ - /** - * @see WCF.Collapsible.Remote.init() - */ - init: function(className) { - var sortButton = $('.formSubmit > button[data-type="submit"]'); - if (sortButton) { - sortButton.click($.proxy(this._sort, this)); - } - - this._super(className); - }, - - /** - * @see WCF.Collapsible.Remote._getButtonContainer() - */ - _getButtonContainer: function(containerID) { - return $('#' + containerID + ' > .buttons'); - }, - - /** - * @see WCF.Collapsible.Remote._getContainers() - */ - _getContainers: function() { - return $('.jsCategory').has('ol').has('li'); - }, - - /** - * @see WCF.Collapsible.Remote._getTarget() - */ - _getTarget: function(containerID) { - return $('#' + containerID + ' > ol'); - }, - - /** - * Handles a click on the sort button. - */ - _sort: function() { - // remove existing collapsible buttons - $('.collapsibleButton').remove(); - - // reinit containers - this._containers = { }; - this._containerData = { }; - - var $containers = this._getContainers(); - if ($containers.length == 0) { - console.debug('[WCF.ACP.Category.Collapsible] Empty container set given, aborting.'); - } - $containers.each($.proxy(function(index, container) { - var $container = $(container); - var $containerID = $container.wcfIdentify(); - this._containers[$containerID] = $container; - - this._initContainer($containerID); - }, this)); - } -}); - /** * Provides the search dropdown for ACP * diff --git a/wcfsetup/install/files/acp/templates/categoryList.tpl b/wcfsetup/install/files/acp/templates/categoryList.tpl index a32fbeadf63..3309cf9227a 100644 --- a/wcfsetup/install/files/acp/templates/categoryList.tpl +++ b/wcfsetup/install/files/acp/templates/categoryList.tpl @@ -1,21 +1,13 @@ {include file='header'} -{if $categoryNodeList->hasChildren()} +{if $categoryNodeList->hasChildren() && $objectType->getProcessor()->canEditCategory()} {/if} @@ -48,7 +40,7 @@ {foreach from=$categoryNodeList item='category'} {section name=i loop=$oldDepth-$categoryNodeList->getDepth()}{/section} -
  • +
  • {event name='beforeTitle'} diff --git a/wcfsetup/install/files/lib/acp/page/AbstractCategoryListPage.class.php b/wcfsetup/install/files/lib/acp/page/AbstractCategoryListPage.class.php index a7a75aade74..55700b116a4 100644 --- a/wcfsetup/install/files/lib/acp/page/AbstractCategoryListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/AbstractCategoryListPage.class.php @@ -8,7 +8,6 @@ use wcf\system\category\CategoryHandler; use wcf\system\exception\InvalidObjectTypeException; use wcf\system\exception\PermissionDeniedException; -use wcf\system\user\collapsible\content\UserCollapsibleContentHandler; use wcf\system\WCF; /** @@ -33,18 +32,6 @@ abstract class AbstractCategoryListPage extends AbstractPage */ public $categoryNodeTree; - /** - * ids of collapsed categories - * @var int[] - */ - public $collapsedCategoryIDs; - - /** - * id of the collapsible category object type - * @var int - */ - public $collapsibleObjectTypeID = 0; - /** * name of the controller used to edit categories * @var string @@ -103,8 +90,6 @@ public function assignVariables() WCF::getTPL()->assign([ 'addController' => $this->addController, 'categoryNodeList' => $this->categoryNodeTree->getIterator(), - 'collapsedCategoryIDs' => $this->collapsedCategoryIDs, - 'collapsibleObjectTypeID' => $this->collapsibleObjectTypeID, 'editController' => $this->editController, 'objectType' => $this->objectType, ]); @@ -151,23 +136,6 @@ public function readData() $this->readCategories(); - // note that the implementation of wcf\system\category\ICategoryType - // needs to support a object type of the pseudo definition - // 'com.woltlab.wcf.collapsibleContent.acp' which has to be registered - // during package installation as a 'com.woltlab.wcf.collapsibleContent' - // object type if you want to support collapsible categories in the - // acp; the pseudo object type is used to distinguish between - // collapsible categories in the frontend and the acp - $collapsibleObjectTypeName = $this->objectType->getProcessor()->getObjectTypeName('com.woltlab.wcf.collapsibleContent.acp'); - if ($collapsibleObjectTypeName) { - $this->collapsibleObjectTypeID = UserCollapsibleContentHandler::getInstance()->getObjectTypeID($collapsibleObjectTypeName); - // get ids of collapsed category - if ($this->collapsibleObjectTypeID !== null) { - $this->collapsedCategoryIDs = UserCollapsibleContentHandler::getInstance()->getCollapsedContent($this->collapsibleObjectTypeID); - $this->collapsedCategoryIDs = \array_flip($this->collapsedCategoryIDs); - } - } - parent::readData(); } } diff --git a/wcfsetup/install/files/lib/data/category/CategoryAction.class.php b/wcfsetup/install/files/lib/data/category/CategoryAction.class.php index be8b9e11bb1..123544014d0 100644 --- a/wcfsetup/install/files/lib/data/category/CategoryAction.class.php +++ b/wcfsetup/install/files/lib/data/category/CategoryAction.class.php @@ -5,16 +5,13 @@ use wcf\data\AbstractDatabaseObjectAction; use wcf\data\ISortableAction; use wcf\data\IToggleAction; -use wcf\data\IToggleContainerAction; use wcf\data\language\item\LanguageItemAction; use wcf\data\TDatabaseObjectToggle; use wcf\system\acl\ACLHandler; use wcf\system\category\CategoryHandler; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\exception\PermissionDeniedException; -use wcf\system\exception\SystemException; use wcf\system\exception\UserInputException; -use wcf\system\user\collapsible\content\UserCollapsibleContentHandler; use wcf\system\WCF; /** @@ -28,8 +25,7 @@ */ class CategoryAction extends AbstractDatabaseObjectAction implements ISortableAction, - IToggleAction, - IToggleContainerAction + IToggleAction { use TDatabaseObjectToggle; @@ -105,27 +101,6 @@ public function delete() return $returnValue; } - /** - * @inheritDoc - */ - public function toggleContainer() - { - $collapsibleObjectTypeName = $this->getObjects()[0]->getProcessor()->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; - if (\array_search($categoryID, $collapsedCategories) !== false) { - UserCollapsibleContentHandler::getInstance()->markAsOpened($objectTypeID, (string)$categoryID); - } else { - UserCollapsibleContentHandler::getInstance()->markAsCollapsed($objectTypeID, (string)$categoryID); - } - } - /** * @inheritDoc */ @@ -241,14 +216,6 @@ public function validateDelete() } } - /** - * @inheritDoc - */ - public function validateToggleContainer() - { - $this->validateUpdate(); - } - /** * @inheritDoc */