From: Alexander Ebert Date: Thu, 29 Sep 2011 19:25:23 +0000 (+0200) Subject: i18n now working for textareas X-Git-Tag: 2.0.0_Beta_1~1744^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=12445303f7c7f0d9e564d14baf76e4b671c6a41e;p=GitHub%2FWoltLab%2FWCF.git i18n now working for textareas Changes some more fields to support i18n. Meanwhile textareas with enabled i18n support may look a bit weird, @Luzifr will be fixing this within time. --- diff --git a/com.woltlab.wcf/option.xml b/com.woltlab.wcf/option.xml index 17fcb33fe1..b1e5d6a5c4 100644 --- a/com.woltlab.wcf/option.xml +++ b/com.woltlab.wcf/option.xml @@ -117,7 +117,8 @@ diff --git a/wcfsetup/install/files/acp/templates/optionTypeTextareaI18n.tpl b/wcfsetup/install/files/acp/templates/optionTypeTextareaI18n.tpl new file mode 100644 index 0000000000..ecc8981bc2 --- /dev/null +++ b/wcfsetup/install/files/acp/templates/optionTypeTextareaI18n.tpl @@ -0,0 +1,10 @@ + + diff --git a/wcfsetup/install/files/lib/system/option/TextI18nOptionType.class.php b/wcfsetup/install/files/lib/system/option/TextI18nOptionType.class.php index 05a2bf2c8a..5283210001 100644 --- a/wcfsetup/install/files/lib/system/option/TextI18nOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/TextI18nOptionType.class.php @@ -4,6 +4,16 @@ use wcf\data\option\Option; use wcf\system\language\I18nHandler; use wcf\system\WCF; +/** + * TextI18nOptionType is an implementation of IOptionType for 'input type="text"' tags with i18n support. + * + * @author Alexander Ebert + * @copyright 2001-2011 WoltLab GmbH + * @license GNU Lesser General Public License + * @package com.woltlab.wcf + * @subpackage system.option + * @category Community Framework + */ class TextI18nOptionType extends TextOptionType { /** * @see wcf\system\option\AbstractOptionType::$supportI18n diff --git a/wcfsetup/install/files/lib/system/option/TextareaI18nOptionType.class.php b/wcfsetup/install/files/lib/system/option/TextareaI18nOptionType.class.php new file mode 100644 index 0000000000..b63366f03e --- /dev/null +++ b/wcfsetup/install/files/lib/system/option/TextareaI18nOptionType.class.php @@ -0,0 +1,45 @@ + + * @package com.woltlab.wcf + * @subpackage system.option + * @category Community Framework + */ +class TextareaI18nOptionType extends TextareaOptionType { + /** + * @see wcf\system\option\AbstractOptionType::$supportI18n + */ + protected $supportI18n = true; + + /** + * @see wcf\system\option\IOptionType::getFormElement() + */ + public function getFormElement(Option $option, $value) { + $useRequestData = (count($_POST)) ? true : false; + I18nHandler::getInstance()->assignVariables($useRequestData); + + WCF::getTPL()->assign(array( + 'option' => $option, + 'value' => $value + )); + return WCF::getTPL()->fetch('optionTypeTextareaI18n'); + } + + /** + * @see wcf\system\option\IOptionType::validate() + */ + public function validate(Option $option, $newValue) { + if (!I18nHandler::getInstance()->validateValue($option->optionName)) { + throw new UserInputException($option->optionName, 'validationFailed'); + } + } +}