From: Marcel Werk Date: Wed, 16 Nov 2011 17:45:29 +0000 (+0100) Subject: Fixed outstanding option types X-Git-Tag: 2.0.0_Beta_1~1590 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=38aacf8b95922a3e16ceab860a051053538f382e;p=GitHub%2FWoltLab%2FWCF.git Fixed outstanding option types --- diff --git a/com.woltlab.wcf/template/optionTypeBoolean.tpl b/com.woltlab.wcf/template/optionTypeBoolean.tpl index 905ef43758..5250110731 100644 --- a/com.woltlab.wcf/template/optionTypeBoolean.tpl +++ b/com.woltlab.wcf/template/optionTypeBoolean.tpl @@ -1,3 +1 @@ - \ No newline at end of file + diff --git a/com.woltlab.wcf/template/optionTypeMultiselect.tpl b/com.woltlab.wcf/template/optionTypeMultiselect.tpl index 11bbeb1156..3c8ce8570d 100644 --- a/com.woltlab.wcf/template/optionTypeMultiselect.tpl +++ b/com.woltlab.wcf/template/optionTypeMultiselect.tpl @@ -1,5 +1,5 @@ - +{foreach from=$selectOptions key=key item=selectOption} + {/foreach} - \ No newline at end of file + diff --git a/com.woltlab.wcf/template/optionTypeRadiobuttons.tpl b/com.woltlab.wcf/template/optionTypeRadiobuttons.tpl index 0162d06019..744a94841e 100644 --- a/com.woltlab.wcf/template/optionTypeRadiobuttons.tpl +++ b/com.woltlab.wcf/template/optionTypeRadiobuttons.tpl @@ -1,10 +1,9 @@ - \ No newline at end of file +
+
+ {foreach from=$selectOptions key=key item=selectOption} +
+ +
+ {/foreach} +
+
diff --git a/com.woltlab.wcf/template/optionTypeSelect.tpl b/com.woltlab.wcf/template/optionTypeSelect.tpl index 255cd2fad6..caa4a50af8 100644 --- a/com.woltlab.wcf/template/optionTypeSelect.tpl +++ b/com.woltlab.wcf/template/optionTypeSelect.tpl @@ -1,5 +1,5 @@ - +{foreach from=$selectOptions key=key item=selectOption} + {/foreach} \ No newline at end of file diff --git a/com.woltlab.wcf/template/optionTypeTextarea.tpl b/com.woltlab.wcf/template/optionTypeTextarea.tpl index 85fd945abe..657ee51eba 100644 --- a/com.woltlab.wcf/template/optionTypeTextarea.tpl +++ b/com.woltlab.wcf/template/optionTypeTextarea.tpl @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/wcfsetup/install/files/acp/templates/optionTypeMultiselect.tpl b/wcfsetup/install/files/acp/templates/optionTypeMultiselect.tpl index cc32ba7d24..3c8ce8570d 100644 --- a/wcfsetup/install/files/acp/templates/optionTypeMultiselect.tpl +++ b/wcfsetup/install/files/acp/templates/optionTypeMultiselect.tpl @@ -1,5 +1,5 @@ - +{foreach from=$selectOptions key=key item=selectOption} + {/foreach} - \ No newline at end of file + diff --git a/wcfsetup/install/files/lib/system/option/MultiselectOptionType.class.php b/wcfsetup/install/files/lib/system/option/MultiselectOptionType.class.php index 1db2609c93..329ff7b93b 100644 --- a/wcfsetup/install/files/lib/system/option/MultiselectOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/MultiselectOptionType.class.php @@ -5,7 +5,6 @@ use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\exception\UserInputException; use wcf\system\WCF; use wcf\util\ArrayUtil; -use wcf\util\OptionUtil; /** * MultiselectOptionType is an implementation of IOptionType for multiple 'select' tags. @@ -21,21 +20,11 @@ class MultiselectOptionType extends SelectOptionType { /** * @see wcf\system\option\IOptionType::getFormElement() */ - public function getFormElement(array &$optionData) { - if (!isset($optionData['optionValue'])) { - if (isset($optionData['defaultValue'])) $optionData['optionValue'] = explode("\n", $optionData['defaultValue']); - else $optionData['optionValue'] = array(); - } - else if (!is_array($optionData['optionValue'])) { - $optionData['optionValue'] = explode("\n", $optionData['optionValue']); - } - - // get options - $options = OptionUtil::parseSelectOptions($optionData['selectOptions']); - + public function getFormElement(Option $option, $value) { WCF::getTPL()->assign(array( - 'optionData' => $optionData, - 'options' => $options + 'option' => $option, + 'selectOptions' => $option->parseSelectOptions(), + 'value' => explode("\n", $value) )); return WCF::getTPL()->fetch('optionTypeMultiselect'); } @@ -43,33 +32,28 @@ class MultiselectOptionType extends SelectOptionType { /** * @see wcf\system\option\IOptionType::validate() */ - public function validate(array $optionData, $newValue) { + public function validate(Option $option, $newValue) { if (!is_array($newValue)) $newValue = array(); - $options = OptionUtil::parseSelectOptions($optionData['selectOptions']); + $options = $option->parseSelectOptions(); foreach ($newValue as $value) { - if (!isset($options[$value])) throw new UserInputException($optionData['optionName'], 'validationFailed'); + if (!isset($options[$value])) { + throw new UserInputException($option->optionName, 'validationFailed'); + } } } /** * @see wcf\system\option\IOptionType::getData() */ - public function getData(array $optionData, $newValue) { + public function getData(Option $option, $newValue) { if (!is_array($newValue)) $newValue = array(); return implode("\n", $newValue); } - /** - * @see wcf\system\option\ISearchableUserOption::getSearchFormElement() - */ - public function getSearchFormElement(array &$optionData) { - return $this->getFormElement($optionData); - } - /** * @see wcf\system\option\ISearchableUserOption::getCondition() */ - public function getCondition(PreparedStatementConditionBuilder &$conditions, Option $options, $value) { + public function getCondition(PreparedStatementConditionBuilder &$conditions, Option $option, $value) { if (!is_array($value) || !count($value)) return false; $value = ArrayUtil::trim($value); if (!count($value)) return false;