From: Matthias Schmidt Date: Wed, 14 Jan 2015 18:02:58 +0000 (+0100) Subject: Fix language export X-Git-Tag: 2.1.0_Beta_4~98 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=40b6801547a2548352688b7185cb646ae2344241;p=GitHub%2FWoltLab%2FWCF.git Fix language export --- diff --git a/wcfsetup/install/files/acp/templates/languageExport.tpl b/wcfsetup/install/files/acp/templates/languageExport.tpl index 4940d06e11..b0f2b9757e 100644 --- a/wcfsetup/install/files/acp/templates/languageExport.tpl +++ b/wcfsetup/install/files/acp/templates/languageExport.tpl @@ -10,21 +10,30 @@ -
+
{lang}wcf.acp.language.export{/lang} -
+
{htmlOptions options=$languages selected=$languageID name='languageID' id='languageID'} + {if $errorField == 'languageID'} + + {if $errorType == 'noValidSelection'} + {lang}wcf.global.form.error.noValidSelection{/lang} + {else} + {lang}wcf.acp.language.languageID.error.{@$errorType}{/lang} + {/if} + + {/if}
@@ -61,4 +70,4 @@
-{include file='footer'} \ No newline at end of file +{include file='footer'} diff --git a/wcfsetup/install/files/lib/acp/form/LanguageExportForm.class.php b/wcfsetup/install/files/lib/acp/form/LanguageExportForm.class.php index 8503d1c12c..8496570a43 100644 --- a/wcfsetup/install/files/lib/acp/form/LanguageExportForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LanguageExportForm.class.php @@ -4,6 +4,7 @@ use wcf\data\language\LanguageEditor; use wcf\data\package\Package; use wcf\form\AbstractForm; use wcf\system\exception\IllegalLinkException; +use wcf\system\exception\UserInputException; use wcf\system\language\LanguageFactory; use wcf\system\WCF; use wcf\util\ArrayUtil; @@ -12,7 +13,7 @@ use wcf\util\ArrayUtil; * Shows the language export form. * * @author Marcel Werk - * @copyright 2001-2014 WoltLab GmbH + * @copyright 2001-2015 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage acp.form @@ -71,13 +72,7 @@ class LanguageExportForm extends AbstractForm { public function readParameters() { parent::readParameters(); - // get language editor object if (isset($_REQUEST['id'])) $this->languageID = intval($_REQUEST['id']); - $language = LanguageFactory::getInstance()->getLanguage($this->languageID); - if ($language === null) { - throw new IllegalLinkException(); - } - $this->language = new LanguageEditor($language); } /** @@ -92,9 +87,21 @@ class LanguageExportForm extends AbstractForm { if (isset($this->selectedPackages[0])) unset($this->selectedPackages[0]); } - if (isset($_POST['exportCustomValues'])) { - $this->exportCustomValues = intval($_POST['exportCustomValues']); + if (isset($_POST['exportCustomValues'])) $this->exportCustomValues = intval($_POST['exportCustomValues']); + if (isset($_POST['languageID'])) $this->languageID = intval($_POST['languageID']); + } + + /** + * @see \wcf\form\IForm::validate() + */ + public function validate() { + parent::validate(); + + $language = LanguageFactory::getInstance()->getLanguage($this->languageID); + if ($language === null) { + throw new UserInputException('languageID', 'noValidSelection'); } + $this->language = new LanguageEditor($language); } /** @@ -103,6 +110,14 @@ class LanguageExportForm extends AbstractForm { public function readData() { parent::readData(); + if (empty($_POST) && $this->languageID) { + $language = LanguageFactory::getInstance()->getLanguage($this->languageID); + if ($language === null) { + throw new IllegalLinkException(); + } + $this->language = new LanguageEditor($language); + } + $this->readPackages(); }