From: Matthias Schmidt Date: Mon, 21 May 2012 11:13:55 +0000 (+0200) Subject: Adds better support for additional category data X-Git-Tag: 2.0.0_Beta_1~1096^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4ff55582a90655ef0fae89e7b540c22313d3be40;p=GitHub%2FWoltLab%2FWCF.git Adds better support for additional category data --- diff --git a/wcfsetup/install/files/lib/acp/form/AbstractCategoryAddForm.class.php b/wcfsetup/install/files/lib/acp/form/AbstractCategoryAddForm.class.php index d35768ea51..b68bdf5177 100644 --- a/wcfsetup/install/files/lib/acp/form/AbstractCategoryAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/AbstractCategoryAddForm.class.php @@ -10,6 +10,7 @@ use wcf\system\exception\SystemException; use wcf\system\exception\UserInputException; use wcf\system\language\I18nHandler; use wcf\system\WCF; +use wcf\util\ArrayUtil; use wcf\util\StringUtil; /** @@ -35,6 +36,12 @@ abstract class AbstractCategoryAddForm extends ACPForm { */ public $addController = ''; + /** + * additional category data + * @var array + */ + public $additionalData = array(); + /** * list with the category nodes * @var wcf\data\category\CategoryNodeList @@ -202,6 +209,9 @@ abstract class AbstractCategoryAddForm extends ACPForm { I18nHandler::getInstance()->readValues(); + if (isset($_POST['additionalData'])) { + $this->additionalData = ArrayUtil::trim($_POST['additionalData']); + } if (isset($_POST['description'])) { $this->description = StringUtil::trim($_POST['description']); } @@ -237,6 +247,7 @@ abstract class AbstractCategoryAddForm extends ACPForm { $this->objectAction = new CategoryAction(array(), 'create', array( 'data' => array( + 'additionalData' => serialize($this->additionalData), 'description' => $this->description, 'isDisabled' => $this->isDisabled, 'objectTypeID' => $this->objectType->objectTypeID, diff --git a/wcfsetup/install/files/lib/acp/form/AbstractCategoryEditForm.class.php b/wcfsetup/install/files/lib/acp/form/AbstractCategoryEditForm.class.php index 6dcad76e2b..740114b182 100644 --- a/wcfsetup/install/files/lib/acp/form/AbstractCategoryEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/AbstractCategoryEditForm.class.php @@ -89,6 +89,7 @@ class AbstractCategoryEditForm extends AbstractCategoryAddForm { I18nHandler::getInstance()->setOptions('description', $this->packageID, $this->category->description, $this->objectType->getProcessor()->getI18nLangVarPrefix().'.description.category\d+'); I18nHandler::getInstance()->setOptions('title', $this->packageID, $this->category->title, $this->objectType->getProcessor()->getI18nLangVarPrefix().'.title.category\d+'); + $this->additionalData = $this->category->additionalData; $this->isDisabled = $this->category->isDisabled; $this->parentCategoryID = $this->category->parentCategoryID; $this->showOrder = $this->category->showOrder; @@ -124,6 +125,7 @@ class AbstractCategoryEditForm extends AbstractCategoryAddForm { // update category $this->objectAction = new CategoryAction(array($this->category), 'update', array( 'data' => array( + 'additionalData' => serialize($this->additionalData), 'description' => $this->description, 'isDisabled' => $this->isDisabled, 'parentCategoryID' => $this->parentCategoryID, diff --git a/wcfsetup/install/files/lib/data/category/CategoryEditor.class.php b/wcfsetup/install/files/lib/data/category/CategoryEditor.class.php index 47de399d6d..3a05137cf2 100644 --- a/wcfsetup/install/files/lib/data/category/CategoryEditor.class.php +++ b/wcfsetup/install/files/lib/data/category/CategoryEditor.class.php @@ -139,9 +139,8 @@ class CategoryEditor extends DatabaseObjectEditor implements IEditableCachedObje // handle additionalData if (!isset($parameters['additionalData'])) { - $parameters['additionalData'] = array(); + $parameters['additionalData'] = serialize(array()); } - $parameters['additionalData'] = serialize($parameters['additionalData']); return parent::create($parameters); }