From 796fdcf2d43569744f80c16ec29a2141da5700d8 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 1 May 2013 12:37:34 +0200 Subject: [PATCH] Overhauls category implementation Closes #1222 --- .../template/categoryOptionList.tpl | 4 +- .../files/acp/templates/categoryAdd.tpl | 4 +- .../files/acp/templates/categoryList.tpl | 193 ++++++++---------- .../acp/templates/categoryOptionList.tpl | 4 +- .../form/AbstractCategoryAddForm.class.php | 33 ++- .../form/AbstractCategoryEditForm.class.php | 6 +- .../page/AbstractCategoryListPage.class.php | 12 +- .../AbstractDecoratedCategory.class.php | 94 +++++++++ .../lib/data/category/Category.class.php | 56 ++++- .../lib/data/category/CategoryNode.class.php | 53 ++--- .../data/category/CategoryNodeList.class.php | 84 -------- .../data/category/CategoryNodeTree.class.php | 148 ++++++++++++++ .../UncachedCategoryNodeTree.class.php | 67 ++++++ .../data/category/ViewableCategory.class.php | 96 --------- .../category/ViewableCategoryNode.class.php | 31 --- .../ViewableCategoryNodeList.class.php | 14 -- .../category/AbstractCategoryType.class.php | 2 +- .../system/category/CategoryHandler.class.php | 22 +- 18 files changed, 506 insertions(+), 417 deletions(-) create mode 100644 wcfsetup/install/files/lib/data/category/AbstractDecoratedCategory.class.php delete mode 100644 wcfsetup/install/files/lib/data/category/CategoryNodeList.class.php create mode 100644 wcfsetup/install/files/lib/data/category/CategoryNodeTree.class.php create mode 100644 wcfsetup/install/files/lib/data/category/UncachedCategoryNodeTree.class.php delete mode 100644 wcfsetup/install/files/lib/data/category/ViewableCategory.class.php delete mode 100644 wcfsetup/install/files/lib/data/category/ViewableCategoryNode.class.php delete mode 100644 wcfsetup/install/files/lib/data/category/ViewableCategoryNodeList.class.php diff --git a/com.woltlab.wcf/template/categoryOptionList.tpl b/com.woltlab.wcf/template/categoryOptionList.tpl index 2e47acffa8..f362f14359 100644 --- a/com.woltlab.wcf/template/categoryOptionList.tpl +++ b/com.woltlab.wcf/template/categoryOptionList.tpl @@ -1,5 +1,5 @@ -{foreach from=$categoryNodeList item=category} - {if !$maximumNestingLevel|isset || $maximumNestingLevel == -2 || $categoryNodeList->getDepth() <= $maximumNestingLevel} +{foreach from=$categoryNodeList item='category'} + {if !$maximumNestingLevel|isset || $maximumNestingLevel == -1 || $categoryNodeList->getDepth() <= $maximumNestingLevel} {/if} {/foreach} \ No newline at end of file diff --git a/wcfsetup/install/files/acp/templates/categoryAdd.tpl b/wcfsetup/install/files/acp/templates/categoryAdd.tpl index 8796968bcc..383205d0b1 100644 --- a/wcfsetup/install/files/acp/templates/categoryAdd.tpl +++ b/wcfsetup/install/files/acp/templates/categoryAdd.tpl @@ -48,13 +48,13 @@
{lang}wcf.global.form.data{/lang} - {if $objectType->getProcessor()->getMaximumNestingLevel() && $categoryNodeList|count} + {if $categoryNodeList->hasChildren() && $objectType->getProcessor()->getMaximumNestingLevel()}
{if $errorField == 'parentCategoryID'} diff --git a/wcfsetup/install/files/acp/templates/categoryList.tpl b/wcfsetup/install/files/acp/templates/categoryList.tpl index eb69daba67..f84f3ef490 100644 --- a/wcfsetup/install/files/acp/templates/categoryList.tpl +++ b/wcfsetup/install/files/acp/templates/categoryList.tpl @@ -1,66 +1,65 @@ {include file='header'} -{if $categoryNodeList|count} +{if $categoryNodeList->hasChildren()}