Fixes error handling for multilingual input elements in several ACP forms
authorMatthias Schmidt <gravatronics@live.com>
Thu, 19 Dec 2013 17:28:40 +0000 (18:28 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 19 Dec 2013 17:28:40 +0000 (18:28 +0100)
wcfsetup/install/files/acp/templates/bbcodeAdd.tpl
wcfsetup/install/files/acp/templates/pageMenuItemAdd.tpl
wcfsetup/install/files/acp/templates/userGroupAdd.tpl
wcfsetup/install/files/acp/templates/userOptionAdd.tpl
wcfsetup/install/files/acp/templates/userOptionCategoryAdd.tpl
wcfsetup/install/files/lib/acp/form/BBCodeAddForm.class.php
wcfsetup/install/files/lib/acp/form/PageMenuItemAddForm.class.php
wcfsetup/install/files/lib/acp/form/UserGroupAddForm.class.php
wcfsetup/install/files/lib/acp/form/UserOptionAddForm.class.php
wcfsetup/install/files/lib/acp/form/UserOptionCategoryAddForm.class.php

index 463010ccfbcb96fc6ca6a9d0ee9caf2f6e737974..c3cca1c1ff97ea0ceebcb9e41666561e71549255 100644 (file)
                                                        <small class="innerError">
                                                                {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}
index 88d3b3c8f6cf6615ac04c1bd3e5da73baddba57d..2b427ee997be572043f24f2dbd33a20d59710eb6 100644 (file)
                                        <input type="text" name="pageMenuItem" id="pageMenuItem" value="{$i18nPlainValues['pageMenuItem']}" class="long" required="required" />
                                        {if $errorField == 'pageMenuItem'}
                                                <small class="innerError">
-                                                       {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}
index 736f69560b87f387ab9e84823077f6a485e0c870..7b1d8bcfad243662e39653123c119ff583aebcc5 100644 (file)
@@ -59,6 +59,8 @@
                                                <small class="innerError">
                                                        {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}
index 933c35f00aa1434817dc58e60fb7e94926671616..9a452eae9896d35378ab6ad98c76392f57d3c0a4 100644 (file)
@@ -32,8 +32,8 @@
                                                <input type="text" id="optionName" name="optionName" value="{$i18nPlainValues['optionName']}" required="required" autofocus="autofocus" class="long" />
                                                {if $errorField == 'optionName'}
                                                        <small class="innerError">
-                                                               {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}
index 64143dc09cb756b42e250e32f6bd66cc595099e5..25d5ebb58f1dbe1577403b9b0938328b1a5c964b 100644 (file)
@@ -31,8 +31,8 @@
                                        <input type="text" id="categoryName" name="categoryName" value="{$i18nPlainValues['categoryName']}" required="required" autofocus="autofocus" class="long" />
                                        {if $errorField == 'categoryName'}
                                                <small class="innerError">
-                                                       {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}
index 2ddc366fdc3727f4090713900d425037685ac8d3..d9c316bf3712b4967156be64614ddd3c5021194d 100644 (file)
@@ -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
index d8bd2c32332ca4b83d9f2eebb9a30e942427fb75..5c36d65825c24aefaa77ae9f95a34a25efb560cb 100644 (file)
@@ -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
index 9a5bf9d9e38fedff897c528c2c0f6c71be1216f1..00fca513319c4ce03e6556afd55b84914c9cd19f 100755 (executable)
@@ -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');
index f9c67cd96ab94a58031229a47e050bf711eb004a..6247b7c84ddf1370f440776469427c9d2b8564e3 100644 (file)
@@ -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
index 6c7cd060cdc94d390bd2f37b87875a70650f5ee1..760c610f3540c3881e141b5fb1cac6a8e089f663 100644 (file)
@@ -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');
                }
        }