Fixed issues in page menu administration
authorMarcel Werk <burntime@woltlab.com>
Wed, 1 May 2013 17:36:16 +0000 (19:36 +0200)
committerMarcel Werk <burntime@woltlab.com>
Wed, 1 May 2013 17:36:16 +0000 (19:36 +0200)
wcfsetup/install/files/acp/templates/pageMenuItemAdd.tpl
wcfsetup/install/files/lib/acp/form/PageMenuItemEditForm.class.php
wcfsetup/install/files/lib/acp/page/PageMenuItemListPage.class.php

index 4a8f040419b0071609214a1f9365201efefa7a63..4750e11f953bfbebb3483fb7e8a50910e03183a5 100644 (file)
@@ -60,8 +60,8 @@
        </nav>
 </div>
 
-<div class="container containerPadding marginTop">
-       <form method="post" action="{if $action == 'add'}{link controller='PageMenuItemAdd'}{/link}{else}{link controller='PageMenuItemEdit' id=$menuItem->menuItemID}{/link}{/if}">
+<form method="post" action="{if $action == 'add'}{link controller='PageMenuItemAdd'}{/link}{else}{link controller='PageMenuItemEdit' id=$menuItem->menuItemID}{/link}{/if}">
+       <div class="container containerPadding marginTop">
                <fieldset>
                        <legend>{lang}wcf.acp.pageMenu.data{/lang}</legend>
                        
                </fieldset>
                
                {event name='fields'}
-               
-               <div class="formSubmit">
-                       <input type="submit" value="{lang}wcf.global.button.submit{/lang}" />
-               </div>
-       </form>
-</div>
+       </div>
+       
+       <div class="formSubmit">
+               <input type="submit" value="{lang}wcf.global.button.submit{/lang}" />
+       </div>
+</form>
 
 {include file='footer'}
index eb3c43a1a4ed5a665e871d0acea94a839c8546b3..ed8317061c2706bded8b6675b4ac4d419763fc01 100644 (file)
@@ -109,6 +109,14 @@ class PageMenuItemEditForm extends PageMenuItemAddForm {
                )));
                $this->objectAction->executeAction();
                
+               // update children
+               if ($this->menuItem->menuPosition == 'header' && $this->menuPosition != 'header') {
+                       $sql = "UPDATE  wcf".WCF_N."_page_menu_item
+                               SET     parentMenuItem = ''
+                               WHERE   parentMenuItem = ?";
+                       $statement = WCF::getDB()->prepareStatement($sql);
+                       $statement->execute(array($this->menuItem->menuItem));
+               }
                $this->saved();
                
                WCF::getTPL()->assign('success', true);
index d92df71cb1b51ea6582fdf945991fbe57144902d..7aae2e95ae0018c1180c25c9fdc9951d953e5c80 100644 (file)
@@ -59,7 +59,9 @@ class PageMenuItemListPage extends AbstractPage {
                        }
                        else {
                                if ($menuItem->parentMenuItem) {
-                                       $this->headerItems[$menuItem->parentMenuItem]->addChild($menuItem);
+                                       if (isset($this->headerItems[$menuItem->parentMenuItem])) {
+                                               $this->headerItems[$menuItem->parentMenuItem]->addChild($menuItem);
+                                       }
                                }
                                else {
                                        $this->headerItems[$menuItem->menuItem] = new ViewablePageMenuItem($menuItem);