From: Alexander Ebert Date: Wed, 10 Jul 2013 12:23:10 +0000 (+0200) Subject: UserGroupOptions now behave the same as back in WCF 1.x X-Git-Tag: 2.0.0_Beta_5~81^2~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=53506605fa1bedd1af44da2f713c1aed2436f5ef;p=GitHub%2FWoltLab%2FWCF.git UserGroupOptions now behave the same as back in WCF 1.x --- diff --git a/wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php index 8e70c4b127..f0118e7438 100755 --- a/wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php @@ -139,17 +139,6 @@ class UserGroupAddForm extends AbstractOptionListForm { // get default group $defaultGroup = UserGroup::getGroupByType(UserGroup::EVERYONE); $optionValues = $this->optionHandler->save(); - $saveOptions = array(); - foreach ($this->optionHandler->getCategoryOptions() as $option) { - $option = $option['object']; - $defaultValue = $defaultGroup->getGroupOption($option->optionName); - $typeObject = $this->optionHandler->getTypeObject($option->optionType); - - $newValue = $typeObject->diff($defaultValue, $optionValues[$option->optionID]); - if ($newValue !== null) { - $saveOptions[$option->optionID] = $newValue; - } - } $data = array( 'data' => array_merge($this->additionalFields, array( @@ -158,7 +147,7 @@ class UserGroupAddForm extends AbstractOptionListForm { 'userOnlineMarking' => $this->userOnlineMarking, 'showOnTeamPage' => $this->showOnTeamPage )), - 'options' => $saveOptions + 'options' => $optionValues ); $this->objectAction = new UserGroupAction(array(), 'create', $data); $this->objectAction->executeAction(); diff --git a/wcfsetup/install/files/lib/acp/form/UserGroupEditForm.class.php b/wcfsetup/install/files/lib/acp/form/UserGroupEditForm.class.php index a0993b4594..1b6bae350b 100755 --- a/wcfsetup/install/files/lib/acp/form/UserGroupEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserGroupEditForm.class.php @@ -124,25 +124,6 @@ class UserGroupEditForm extends UserGroupAddForm { // save group $optionValues = $this->optionHandler->save(); - $saveOptions = array(); - if ($this->group->groupType == UserGroup::EVERYONE) { - $saveOptions = $optionValues; - } - else { - // get default group - $defaultGroup = UserGroup::getGroupByType(UserGroup::EVERYONE); - foreach ($this->optionHandler->getCategoryOptions() as $option) { - $option = $option['object']; - $defaultValue = $defaultGroup->getGroupOption($option->optionName); - $typeObject = $this->optionHandler->getTypeObject($option->optionType); - - $newValue = $typeObject->diff($defaultValue, $optionValues[$option->optionID]); - if ($newValue !== null) { - $saveOptions[$option->optionID] = $newValue; - } - } - } - $this->groupName = 'wcf.acp.group.group'.$this->group->groupID; if (I18nHandler::getInstance()->isPlainValue('groupName')) { I18nHandler::getInstance()->remove($this->groupName, 1); @@ -159,7 +140,7 @@ class UserGroupEditForm extends UserGroupAddForm { 'userOnlineMarking' => $this->userOnlineMarking, 'showOnTeamPage' => $this->showOnTeamPage ), $this->additionalFields), - 'options' => $saveOptions + 'options' => $optionValues ); $this->objectAction = new UserGroupAction(array($this->groupID), 'update', $data); $this->objectAction->executeAction(); diff --git a/wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php b/wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php index 0e2b56bfc2..fa89cd68c0 100644 --- a/wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserGroupOptionForm.class.php @@ -195,17 +195,6 @@ class UserGroupOptionForm extends AbstractForm { catch (UserInputException $e) { $this->errorType[$e->getField()] = $e->getType(); } - - // check if not editing default value - if ($groupID != $this->groupEveryone->groupID) { - $newValue = $this->optionType->diff($this->defaultValue, $optionValue); - if ($newValue === null) { - unset($this->values[$groupID]); - } - else { - $this->values[$groupID] = $newValue; - } - } } if (!empty($this->errorType)) { diff --git a/wcfsetup/install/files/lib/system/option/user/group/BBCodeSelectUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/BBCodeSelectUserGroupOptionType.class.php index ad24c4549d..bed95f4503 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/BBCodeSelectUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/BBCodeSelectUserGroupOptionType.class.php @@ -70,35 +70,6 @@ class BBCodeSelectUserGroupOptionType extends AbstractOptionType implements IUse asort($this->bbCodes); } - /** - * @see wcf\system\option\user\group\IUserGroupOptionType::merge() - */ - public function diff($defaultValue, $groupValue) { - if ($this->bbCodes === null) { - $this->loadBBCodeSelection(); - } - - if ($defaultValue == 'all') { - $defaultValue = $this->bbCodes; - } - else { - $defaultValue = explode(',', StringUtil::unifyNewlines($defaultValue)); - } - if ($groupValue == 'all') { - $groupValue = $this->bbCodes; - } - else { - $groupValue = explode(',', StringUtil::unifyNewlines($groupValue)); - } - - $result = array_diff($groupValue, $defaultValue); - if (empty($result)) { - return null; - } - - return implode(',', $result); - } - /** * @see wcf\system\option\user\group\IUserGroupOptionType::merge() */ diff --git a/wcfsetup/install/files/lib/system/option/user/group/BooleanUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/BooleanUserGroupOptionType.class.php index f260338550..a9f63e126b 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/BooleanUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/BooleanUserGroupOptionType.class.php @@ -15,13 +15,6 @@ use wcf\system\option\BooleanOptionType; * @category Community Framework */ class BooleanUserGroupOptionType extends BooleanOptionType implements IUserGroupOptionType { - /** - * @see wcf\system\option\user\group\IUserGroupOptionType::diff() - */ - public function diff($defaultValue, $groupValue) { - return $this->merge($defaultValue, $groupValue); - } - /** * @see wcf\system\option\user\group\IUserGroupOptionType::merge() */ diff --git a/wcfsetup/install/files/lib/system/option/user/group/FileSizeUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/FileSizeUserGroupOptionType.class.php index 61703b96a8..293b24b0fa 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/FileSizeUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/FileSizeUserGroupOptionType.class.php @@ -15,13 +15,6 @@ use wcf\system\option\FileSizeOptionType; * @category Community Framework */ class FileSizeUserGroupOptionType extends FileSizeOptionType implements IUserGroupOptionType { - /** - * @see wcf\system\option\user\group\IUserGroupOptionType::diff() - */ - public function diff($defaultValue, $groupValue) { - return $this->merge($defaultValue, $groupValue); - } - /** * @see wcf\system\option\user.group\IUserGroupOptionType::merge() */ diff --git a/wcfsetup/install/files/lib/system/option/user/group/IUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/IUserGroupOptionType.class.php index 44ca6f425f..9eccdd8253 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/IUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/IUserGroupOptionType.class.php @@ -13,16 +13,6 @@ use wcf\system\option\IOptionType; * @category Community Framework */ interface IUserGroupOptionType extends IOptionType { - /** - * Returns the value which results by calculating the difference of the - * given values. - * - * @param mixed $defaultValue - * @param mixed $groupValue - * @return mixed - */ - public function diff($defaultValue, $groupValue); - /** * Returns the value which results by merging or null if nothing should be saved. * diff --git a/wcfsetup/install/files/lib/system/option/user/group/InfiniteIntegerUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/InfiniteIntegerUserGroupOptionType.class.php index 8e36355e05..f669eedbf2 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/InfiniteIntegerUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/InfiniteIntegerUserGroupOptionType.class.php @@ -16,13 +16,6 @@ namespace wcf\system\option\user\group; * @category Community Framework */ class InfiniteIntegerUserGroupOptionType extends IntegerUserGroupOptionType { - /** - * @see wcf\system\option\user\group\IUserGroupOptionType::diff() - */ - public function diff($defaultValue, $groupValue) { - return $this->merge($defaultValue, $groupValue); - } - /** * @see wcf\system\option\user\group\IUserGroupOptionType::merge() */ diff --git a/wcfsetup/install/files/lib/system/option/user/group/InfiniteInverseIntegerUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/InfiniteInverseIntegerUserGroupOptionType.class.php index 4c8595e666..f1d4c1ae2e 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/InfiniteInverseIntegerUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/InfiniteInverseIntegerUserGroupOptionType.class.php @@ -15,13 +15,6 @@ namespace wcf\system\option\user\group; * @category Community Framework */ class InfiniteInverseIntegerUserGroupOptionType extends InverseIntegerUserGroupOptionType { - /** - * @see wcf\system\option\user\group\IUserGroupOptionType::diff() - */ - public function diff($defaultValue, $groupValue) { - return $this->merge($defaultValue, $groupValue); - } - /** * @see wcf\system\option\user\group\IUserGroupOptionType::merge() */ diff --git a/wcfsetup/install/files/lib/system/option/user/group/IntegerUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/IntegerUserGroupOptionType.class.php index 6949cba4f8..39224bbd33 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/IntegerUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/IntegerUserGroupOptionType.class.php @@ -15,13 +15,6 @@ use wcf\system\option\IntegerOptionType; * @category Community Framework */ class IntegerUserGroupOptionType extends IntegerOptionType implements IUserGroupOptionType { - /** - * @see wcf\system\option\user\group\IUserGroupOptionType::diff() - */ - public function diff($defaultValue, $groupValue) { - return $this->merge($defaultValue, $groupValue); - } - /** * @see wcf\system\option\user.group\IUserGroupOptionType::merge() */ diff --git a/wcfsetup/install/files/lib/system/option/user/group/InverseIntegerUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/InverseIntegerUserGroupOptionType.class.php index 3bbb60e699..ae5509865b 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/InverseIntegerUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/InverseIntegerUserGroupOptionType.class.php @@ -15,13 +15,6 @@ use wcf\system\option\IntegerOptionType; * @category Community Framework */ class InverseIntegerUserGroupOptionType extends IntegerOptionType implements IUserGroupOptionType { - /** - * @see wcf\system\option\user\group\IUserGroupOptionType::diff() - */ - public function diff($defaultValue, $groupValue) { - return $this->merge($defaultValue, $groupValue); - } - /** * @see wcf\system\option\user\group\IUserGroupOptionType::merge() */ diff --git a/wcfsetup/install/files/lib/system/option/user/group/TextUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/TextUserGroupOptionType.class.php index f2e819a7e4..5334e08bdd 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/TextUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/TextUserGroupOptionType.class.php @@ -19,21 +19,6 @@ use wcf\util\StringUtil; * values? what to do? */ class TextUserGroupOptionType extends TextOptionType implements IUserGroupOptionType { - /** - * @see wcf\system\option\user\group\IUserGroupOptionType::diff() - */ - public function diff($defaultValue, $groupValue) { - $defaultValue = explode("\n", StringUtil::unifyNewlines($defaultValue)); - $groupValue = explode("\n", StringUtil::unifyNewlines($groupValue)); - - $result = array_diff($groupValue, $defaultValue); - if (empty($result)) { - return null; - } - - return implode("\n", $result); - } - /** * @see wcf\system\option\user\group\IUserGroupOptionType::merge() */ diff --git a/wcfsetup/install/files/lib/system/option/user/group/TextareaUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/TextareaUserGroupOptionType.class.php index 0f99bf4170..f29d7061a6 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/TextareaUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/TextareaUserGroupOptionType.class.php @@ -16,21 +16,6 @@ use wcf\util\StringUtil; * @category Community Framework */ class TextareaUserGroupOptionType extends TextareaOptionType implements IUserGroupOptionType { - /** - * @see wcf\system\option\user\group\IUserGroupOptionType::diff() - */ - public function diff($defaultValue, $groupValue) { - $defaultValue = explode("\n", StringUtil::unifyNewlines($defaultValue)); - $groupValue = explode("\n", StringUtil::unifyNewlines($groupValue)); - - $result = array_diff($groupValue, $defaultValue); - if (empty($result)) { - return null; - } - - return implode("\n", $result); - } - /** * @see wcf\system\option\user\group\IUserGroupOptionType::merge() */ diff --git a/wcfsetup/install/files/lib/system/option/user/group/UserGroupsUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/UserGroupsUserGroupOptionType.class.php index ecc0be2716..ad61f90cd2 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/UserGroupsUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/UserGroupsUserGroupOptionType.class.php @@ -66,21 +66,6 @@ class UserGroupsUserGroupOptionType extends AbstractOptionType implements IUserG return implode(',', $newValue); } - /** - * @see wcf\system\option\user\group\IUserGroupOptionType::diff() - */ - public function diff($defaultValue, $groupValue) { - $defaultValue = explode(',', $defaultValue); - $groupValue = explode(',', $groupValue); - - $result = array_diff($groupValue, $defaultValue); - if (empty($result)) { - return null; - } - - return implode(',', $result); - } - /** * @see wcf\system\option\user\group\IUserGroupOptionType::merge() */