From c20f41f997245ab437484535cdc28cfbcc6e0802 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Thu, 19 Dec 2013 18:28:40 +0100 Subject: [PATCH] Fixes error handling for multilingual input elements in several ACP forms --- wcfsetup/install/files/acp/templates/bbcodeAdd.tpl | 2 ++ wcfsetup/install/files/acp/templates/pageMenuItemAdd.tpl | 4 ++-- wcfsetup/install/files/acp/templates/userGroupAdd.tpl | 2 ++ wcfsetup/install/files/acp/templates/userOptionAdd.tpl | 4 ++-- .../install/files/acp/templates/userOptionCategoryAdd.tpl | 4 ++-- .../install/files/lib/acp/form/BBCodeAddForm.class.php | 7 ++++++- .../files/lib/acp/form/PageMenuItemAddForm.class.php | 2 +- .../install/files/lib/acp/form/UserGroupAddForm.class.php | 7 ++++++- .../install/files/lib/acp/form/UserOptionAddForm.class.php | 2 +- .../files/lib/acp/form/UserOptionCategoryAddForm.class.php | 2 +- 10 files changed, 25 insertions(+), 11 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/bbcodeAdd.tpl b/wcfsetup/install/files/acp/templates/bbcodeAdd.tpl index 463010ccfb..c3cca1c1ff 100644 --- a/wcfsetup/install/files/acp/templates/bbcodeAdd.tpl +++ b/wcfsetup/install/files/acp/templates/bbcodeAdd.tpl @@ -186,6 +186,8 @@ {if $errorType == 'empty'} {lang}wcf.global.form.error.empty{/lang} + {elseif $errorType == 'multilingual'} + {lang}wcf.global.form.error.multilingual{/lang} {else} {lang}wcf.acp.bbcode.buttonLabel.error.{@$errorType}{/lang} {/if} diff --git a/wcfsetup/install/files/acp/templates/pageMenuItemAdd.tpl b/wcfsetup/install/files/acp/templates/pageMenuItemAdd.tpl index 88d3b3c8f6..2b427ee997 100644 --- a/wcfsetup/install/files/acp/templates/pageMenuItemAdd.tpl +++ b/wcfsetup/install/files/acp/templates/pageMenuItemAdd.tpl @@ -112,8 +112,8 @@ {if $errorField == 'pageMenuItem'} - {if $errorType == 'empty'} - {lang}wcf.global.form.error.empty{/lang} + {if $errorType == 'multilingual'} + {lang}wcf.global.form.error.multilingual{/lang} {else} {lang}wcf.acp.pageMenu.pageMenuItem.error.{$errorType}{/lang} {/if} diff --git a/wcfsetup/install/files/acp/templates/userGroupAdd.tpl b/wcfsetup/install/files/acp/templates/userGroupAdd.tpl index 736f69560b..7b1d8bcfad 100644 --- a/wcfsetup/install/files/acp/templates/userGroupAdd.tpl +++ b/wcfsetup/install/files/acp/templates/userGroupAdd.tpl @@ -59,6 +59,8 @@ {if $errorType.groupName == 'empty'} {lang}wcf.global.form.error.empty{/lang} + {elseif $errorType.groupName == 'multilingual'} + {lang}wcf.global.form.error.multilingual{/lang} {else} {lang}wcf.acp.group.groupName.error.{@$errorType}{/lang} {/if} diff --git a/wcfsetup/install/files/acp/templates/userOptionAdd.tpl b/wcfsetup/install/files/acp/templates/userOptionAdd.tpl index 933c35f00a..9a452eae98 100644 --- a/wcfsetup/install/files/acp/templates/userOptionAdd.tpl +++ b/wcfsetup/install/files/acp/templates/userOptionAdd.tpl @@ -32,8 +32,8 @@ {if $errorField == 'optionName'} - {if $errorType == 'empty'} - {lang}wcf.global.form.error.empty{/lang} + {if $errorType == 'multilingual'} + {lang}wcf.global.form.error.multilingual{/lang} {else} {lang}wcf.acp.user.option.name.error.{@$errorType}{/lang} {/if} diff --git a/wcfsetup/install/files/acp/templates/userOptionCategoryAdd.tpl b/wcfsetup/install/files/acp/templates/userOptionCategoryAdd.tpl index 64143dc09c..25d5ebb58f 100644 --- a/wcfsetup/install/files/acp/templates/userOptionCategoryAdd.tpl +++ b/wcfsetup/install/files/acp/templates/userOptionCategoryAdd.tpl @@ -31,8 +31,8 @@ {if $errorField == 'categoryName'} - {if $errorType == 'empty'} - {lang}wcf.global.form.error.empty{/lang} + {if $errorType == 'multilingual'} + {lang}wcf.global.form.error.multilingual{/lang} {else} {lang}wcf.acp.user.option.category.name.error.{@$errorType}{/lang} {/if} diff --git a/wcfsetup/install/files/lib/acp/form/BBCodeAddForm.class.php b/wcfsetup/install/files/lib/acp/form/BBCodeAddForm.class.php index 2ddc366fdc..d9c316bf37 100644 --- a/wcfsetup/install/files/lib/acp/form/BBCodeAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/BBCodeAddForm.class.php @@ -196,7 +196,12 @@ class BBCodeAddForm extends AbstractForm { if ($this->showButton) { // validate label if (!I18nHandler::getInstance()->validateValue('buttonLabel')) { - throw new UserInputException('buttonLabel'); + if (I18nHandler::getInstance()->isPlainValue('buttonLabel')) { + throw new UserInputException('buttonLabel'); + } + else { + throw new UserInputException('buttonLabel', 'multilingual'); + } } // validate image path diff --git a/wcfsetup/install/files/lib/acp/form/PageMenuItemAddForm.class.php b/wcfsetup/install/files/lib/acp/form/PageMenuItemAddForm.class.php index d8bd2c3233..5c36d65825 100644 --- a/wcfsetup/install/files/lib/acp/form/PageMenuItemAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PageMenuItemAddForm.class.php @@ -180,7 +180,7 @@ class PageMenuItemAddForm extends AbstractForm { // validate page menu item name if (!I18nHandler::getInstance()->validateValue('pageMenuItem', true)) { - throw new UserInputException('pageMenuItem'); + throw new UserInputException('pageMenuItem', 'multilingual'); } // validate parent menu item diff --git a/wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php index 9a5bf9d9e3..00fca51331 100755 --- a/wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php @@ -118,7 +118,12 @@ class UserGroupAddForm extends AbstractOptionListForm { // validate group name try { if (!I18nHandler::getInstance()->validateValue('groupName')) { - throw new UserInputException('groupName'); + if (I18nHandler::getInstance()->isPlainValue('groupName')) { + throw new UserInputException('groupName'); + } + else { + throw new UserInputException('groupName', 'multilingual'); + } } if (mb_strpos($this->userOnlineMarking, '%s') === false) { throw new UserInputException('userOnlineMarking', 'notValid'); diff --git a/wcfsetup/install/files/lib/acp/form/UserOptionAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserOptionAddForm.class.php index f9c67cd96a..6247b7c84d 100644 --- a/wcfsetup/install/files/lib/acp/form/UserOptionAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserOptionAddForm.class.php @@ -187,7 +187,7 @@ class UserOptionAddForm extends AbstractForm { // option name if (!I18nHandler::getInstance()->validateValue('optionName', true)) { - throw new UserInputException('optionName'); + throw new UserInputException('optionName', 'multilingual'); } // category name diff --git a/wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php index 6c7cd060cd..760c610f35 100644 --- a/wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php @@ -68,7 +68,7 @@ class UserOptionCategoryAddForm extends AbstractForm { parent::validate(); if (!I18nHandler::getInstance()->validateValue('categoryName', true)) { - throw new UserInputException('categoryName'); + throw new UserInputException('categoryName', 'multilingual'); } } -- 2.20.1