Fix validation of menu title and menu item title
authorMatthias Schmidt <gravatronics@live.com>
Sun, 31 Jul 2016 16:14:03 +0000 (18:14 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 31 Jul 2016 16:14:03 +0000 (18:14 +0200)
wcfsetup/install/files/acp/templates/menuAdd.tpl
wcfsetup/install/files/acp/templates/menuItemAdd.tpl
wcfsetup/install/files/lib/acp/form/MenuItemAddForm.class.php

index a1eee9c64f4fff9026cdfddcc70f0d748965cdba..943fc33857eae4b605261bb998133134c09a0c82 100644 (file)
@@ -31,7 +31,7 @@
                                <input type="text" id="title" name="title" value="{$i18nPlainValues['title']}" autofocus class="long">
                                {if $errorField == 'title'}
                                        <small class="innerError">
-                                               {if $errorType == 'title' || $errorType == 'multilingual'}
+                                               {if $errorType == 'empty' || $errorType == 'multilingual'}
                                                        {lang}wcf.global.form.error.{@$errorType}{/lang}
                                                {else}
                                                        {lang}wcf.acp.menu.title.error.{@$errorType}{/lang}
index 10ee12c06adb9b8c3f52c94f1ba2ad4ea936e61d..33e1eed008f2b7b3ee3891be96991e50f8f48844 100644 (file)
@@ -69,8 +69,8 @@
                                <input type="text" name="title" id="title" value="{$title}" class="long" required>
                                {if $errorField == 'title'}
                                        <small class="innerError">
-                                               {if $errorType == 'multilingual'}
-                                                       {lang}wcf.global.form.error.multilingual{/lang}
+                                               {if $errorType == 'empty' || $errorType == 'multilingual'}
+                                                       {lang}wcf.global.form.error.{@$errorType}{/lang}
                                                {else}
                                                        {lang}wcf.acp.menu.item.title.error.{$errorType}{/lang}
                                                {/if}
index 7b60b8fa1dbb3faabbbcd8180dd4e97d7880ab69..3023d99b0fd20048a141d3472367b7e12560e84b 100644 (file)
@@ -202,7 +202,12 @@ class MenuItemAddForm extends AbstractForm {
                
                // validate page menu item name
                if (!I18nHandler::getInstance()->validateValue('title')) {
-                       throw new UserInputException('title');
+                       if (I18nHandler::getInstance()->isPlainValue('title')) {
+                               throw new UserInputException('title');
+                       }
+                       else {
+                               throw new UserInputException('title', 'multilingual');
+                       }
                }
                
                // validate parent menu item