Added support for complex pages
authorAlexander Ebert <ebert@woltlab.com>
Wed, 6 Jan 2016 15:46:29 +0000 (16:46 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 6 Jan 2016 15:46:29 +0000 (16:46 +0100)
18 files changed:
com.woltlab.wcf/menu.xml
com.woltlab.wcf/page.xml
com.woltlab.wcf/templates/__menu.tpl
wcfsetup/install/files/lib/data/DatabaseObjectList.class.php
wcfsetup/install/files/lib/data/menu/Menu.class.php
wcfsetup/install/files/lib/data/menu/MenuCache.class.php
wcfsetup/install/files/lib/data/menu/item/MenuItem.class.php
wcfsetup/install/files/lib/data/menu/item/MenuItemList.class.php
wcfsetup/install/files/lib/data/menu/item/MenuItemNodeTree.class.php
wcfsetup/install/files/lib/data/page/Page.class.php
wcfsetup/install/files/lib/system/cache/builder/MenuCacheBuilder.class.php
wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/page/handler/AbstractLookupPageHandler.class.php
wcfsetup/install/files/lib/system/page/handler/ILookupPageHandler.class.php
wcfsetup/setup/db/install.sql

index 475d08994970cf8aafc4acf864c33ea78c87d34a..6703ae7d18ca5d84284456940b88d9fce33c1751 100644 (file)
@@ -7,9 +7,9 @@
                        
                        <box>
                                <position>mainMenu</position>
-                               <cssclassname>mainMenu</cssclassname>
-                               <showheader>0</showheader>
-                               <visibleeveryhwere>1</visibleeveryhwere>
+                               <cssClassName>mainMenu</cssClassName>
+                               <showHeader>0</showHeader>
+                               <visibleEveryhwere>1</visibleEveryhwere>
                        </box>
                </menu>
                
@@ -19,8 +19,8 @@
                        
                        <box>
                                <position>footer</position>
-                               <showheader>0</showheader>
-                               <visibleeveryhwere>1</visibleeveryhwere>
+                               <showHeader>0</showHeader>
+                               <visibleEveryhwere>1</visibleEveryhwere>
                        </box>
                </menu>
        </import>
index f9e286562480b344a7444dbe43ee965532a8d9a1..85995c9c95ef837b5362eeceaeaa2fa9fd5c3f21 100644 (file)
@@ -67,7 +67,7 @@
 <li><a href="https://support.apple.com/kb/ph17191?locale=en_US" class="externalURL" rel="nofollow">Safari</a></li>
 <li><a href="http://windows.microsoft.com/en-US/internet-explorer/delete-manage-cookies" class="externalURL" rel="nofollow">Windows Internet Explorer</a></li>
 </ul>]]></content>
-                               <customurl>cookie-policy</customurl>
+                               <customURL>cookie-policy</customURL>
                        </content>
                        
                        <content language="de">
@@ -94,7 +94,7 @@
 <li><a href="https://support.apple.com/kb/ph17191?locale=de_DE" class="externalURL" rel="nofollow">Safari</a></li>
 <li><a href="http://windows.microsoft.com/de-DE/internet-explorer/delete-manage-cookies" class="externalURL" rel="nofollow">Windows Internet Explorer</a></li>
 </ul>]]></content>
-                               <customurl>cookie-richtlinie</customurl>
+                               <customURL>cookie-richtlinie</customURL>
                        </content>
                </page>
                
 <p>If you have questions regarding this privacy policy, please contact us.</p>
 
 <p><small><em>Source: <a rel="nofollow" href="http://forum-template.wikidot.com/legal:privacy-policy" target="_blank">forum-template.wikidot.com</a></em></small></p>]]></content>
-                               <customurl>privacy-policy</customurl>
+                               <customURL>privacy-policy</customURL>
                        </content>
                        
                        <content language="de">
      <a href="http://twitter.com/account/settings" target="_blank">http://twitter.com/account/settings</a> ändern.</p>
 
 <p><small><em>Quellenangaben: <a rel="nofollow" href="http://www.e-recht24.de/muster-datenschutzerklaerung.html" target="_blank">eRecht24</a>, <a rel="nofollow" href="http://www.e-recht24.de/artikel/datenschutz/6590-facebook-like-button-datenschutz-disclaimer.html" target="_blank">Facebook-Disclaimer von eRecht24</a>, <a rel="nofollow" href="http://www.google.com/intl/de/+/policy/+1button.html" target="_blank">Google +1 Bedingungen</a>, <a rel="nofollow" href="http://twitter.com/privacy" target="_blank">Datenschutzerklärung Twitter</a></em></small></p>]]></content>
-                               <customurl>datenschutzerklaerung</customurl>
+                               <customURL>datenschutzerklaerung</customURL>
                        </content>
                </page>
        </import>
index c7c049dcf5dca7768472aa6ea357cf3d8e7f9853..00e028adc19c8091d42588ce551631f3dabd6f9c 100644 (file)
@@ -2,7 +2,12 @@
        <ol class="boxMenu">
                {foreach from=$menuItemNodeList item=menuItemNode}
                        <li{if $menuItemNode->hasChildren()} class="boxMenuHasChildren"{/if}>
-                               <a href="{$menuItemNode->getMenuItem()->getURL()}">{lang}{$menuItemNode->getMenuItem()->title}{/lang}</a>
+                               <a href="{$menuItemNode->getMenuItem()->getURL()}" class="boxMenuLink">
+                                       <span class="boxMenuLinkTitle">{lang}{$menuItemNode->getMenuItem()->title}{/lang}</span>
+                                       {if $menuItemNode->getMenuItem()->getOutstandingItems() > 0}
+                                               <span class="boxMenuLinkOutstandingItems badge badgeInverse">{#$menuItemNode->getMenuItem()->getOutstandingItems()}</span>
+                                       {/if}
+                               </a>
                                
                                {if $menuItemNode->hasChildren()}<ol class="boxMenuDepth{@$menuItemNode->getDepth()}">{else}</li>{/if}
                                        
index 7f6df86dd6674255127e54eafcb497b65dfe6624..52094685d3bfbf995999bd2b223f031af39bd8be 100644 (file)
@@ -300,7 +300,7 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject {
        
        /**
         * CAUTION: This methods does not return the current iterator index,
-        * rather than the object key which maps to that index.
+        * but the object key which maps to that index.
         * 
         * @see \Iterator::key()
         */
index 631255f3fc6b82d83ad89012628caa80407d50bc..c38c5d8f325def2953654b0e794b366b1d53fe09 100644 (file)
@@ -2,6 +2,7 @@
 namespace wcf\data\menu;
 use wcf\data\box\Box;
 use wcf\data\DatabaseObject;
+use wcf\data\menu\item\MenuItemNodeTree;
 use wcf\system\WCF;
 
 /**
@@ -27,10 +28,10 @@ class Menu extends DatabaseObject {
        protected static $databaseTableIndexName = 'menuID';
        
        /**
-        * menu item node list
-        * @var \RecursiveIteratorIterator
+        * menu item node tree
+        * @var MenuItemNodeTree
         */
-       protected $menuItemNodeList = null;
+       protected $menuItemNodeTree = null;
        
        /**
         * box object
@@ -57,11 +58,7 @@ class Menu extends DatabaseObject {
         * @return      \RecursiveIteratorIterator
         */
        public function getMenuItemNodeList() {
-               if ($this->menuItemNodeList === null) {
-                       $this->menuItemNodeList = MenuCache::getInstance()->getMenuItemsByMenuID($this->menuID)->getNodeList();
-               }
-               
-               return $this->menuItemNodeList;
+               return $this->getMenuItemNodeTree()->getNodeList();
        }
        
        /**
@@ -105,4 +102,15 @@ class Menu extends DatabaseObject {
                
                return $this->box;
        }
+       
+       /**
+        * @return MenuItemNodeTree
+        */
+       protected function getMenuItemNodeTree() {
+               if ($this->menuItemNodeTree === null) {
+                       $this->menuItemNodeTree = new MenuItemNodeTree($this->menuID, MenuCache::getInstance()->getMenuItemsByMenuID($this->menuID));
+               }
+               
+               return $this->menuItemNodeTree;
+       }
 }
index e9ad23864e9bf091cb0447e176140db2a9dcca58..0a8ef35bdda464cd461cd9637261333ac20fb360 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 namespace wcf\data\menu;
-use wcf\data\menu\item\MenuItemNodeTree;
+use wcf\data\menu\item\MenuItemList;
 use wcf\system\cache\builder\MenuCacheBuilder;
 use wcf\system\SingletonFactory;
 
@@ -8,11 +8,12 @@ use wcf\system\SingletonFactory;
  * Manages the menu cache.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.menu
  * @category   Community Framework
+ * @since       2.2
  */
 class MenuCache extends SingletonFactory {
        /**
@@ -21,7 +22,7 @@ class MenuCache extends SingletonFactory {
        protected $cachedMenus;
        
        /**
-        * @var MenuItemNodeTree[]
+        * @var MenuItemList[]
         */
        protected $cachedMenuItems;
        
@@ -33,6 +34,12 @@ class MenuCache extends SingletonFactory {
                $this->cachedMenuItems = MenuCacheBuilder::getInstance()->getData([], 'menuItems');
        }
        
+       /**
+        * Returns a menu by id.
+        * 
+        * @param       integer         $menuID         menu id
+        * @return      Menu|null       menu object or null if menu id is unknown
+        */
        public function getMenuByID($menuID) {
                if (isset($this->cachedMenus[$menuID])) {
                        return $this->cachedMenus[$menuID];
@@ -41,6 +48,12 @@ class MenuCache extends SingletonFactory {
                return null;
        }
        
+       /**
+        * Returns a menu item list by menu id.
+        * 
+        * @param       integer         $menuID         menu id
+        * @return      MenuItemList|null       menu item list object or null if menu id is unknown
+        */
        public function getMenuItemsByMenuID($menuID) {
                if (isset($this->cachedMenuItems[$menuID])) {
                        return $this->cachedMenuItems[$menuID];
index 169160dcb479b2ae18aae72a771904038af342a5..14a7386d23ba3f9f92dfb7d56d98356a1d8a86b0 100644 (file)
@@ -2,13 +2,16 @@
 namespace wcf\data\menu\item;
 use wcf\data\page\Page;
 use wcf\data\DatabaseObject;
+use wcf\system\exception\SystemException;
+use wcf\system\page\handler\ILookupPageHandler;
+use wcf\system\page\handler\IMenuPageHandler;
 use wcf\system\WCF;
 
 /**
  * Represents a menu item.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.menu.item
@@ -26,11 +29,16 @@ class MenuItem extends DatabaseObject {
         */
        protected static $databaseTableIndexName = 'itemID';
        
+       /**
+        * @var IMenuPageHandler
+        */
+       protected $handler;
+       
        /**
         * page object
         * @var Page
         */
-       protected $page = null;
+       protected $page;
        
        /**
         * Returns true if the active user can delete this menu item.
@@ -64,6 +72,13 @@ class MenuItem extends DatabaseObject {
         * @return      string
         */
        public function getURL() {
+               if ($this->pageObjectID) {
+                       $handler = $this->getMenuPageHandler();
+                       if ($handler && $handler instanceof ILookupPageHandler) {
+                               return $handler->getLink($this->pageObjectID);
+                       }
+               }
+               
                if ($this->pageID) {
                        return $this->getPage()->getURL();
                }
@@ -86,4 +101,48 @@ class MenuItem extends DatabaseObject {
                
                return $this->page;
        }
+       
+       /**
+        * Returns false if this item should be hidden from menu.
+        * 
+        * @return      boolean
+        */
+       public function isVisible() {
+               if ($this->getMenuPageHandler() !== null) {
+                       return $this->getMenuPageHandler()->isVisible($this->pageObjectID ?: null);
+               }
+               
+               return true;
+       }
+       
+       /**
+        * Returns the number of outstanding items for this menu.
+        * 
+        * @return      integer
+        */
+       public function getOutstandingItems() {
+               if ($this->getMenuPageHandler() !== null) {
+                       return $this->getMenuPageHandler()->getOutstandingItemCount($this->pageObjectID ?: null);
+               }
+               
+               return 0;
+       }
+       
+       /**
+        * @return      IMenuPageHandler
+        */
+       protected function getMenuPageHandler() {
+               $page = $this->getPage();
+               if ($page !== null && $page->handler) {
+                       if ($this->handler === null) {
+                               $className = $this->getPage()->handler;
+                               $this->handler = new $className;
+                               if (!($this->handler instanceof IMenuPageHandler)) {
+                                       throw new SystemException("Expected a valid handler implementing '" . IMenuPageHandler::class . "'.");
+                               }
+                       }
+               }
+               
+               return $this->handler;
+       }
 }
index 6707ac4cce1323e772e44d4ba23a5bd1ffd5b528..db3fcb5a23786bb5a47da39922e016b6354189b0 100644 (file)
@@ -6,7 +6,7 @@ use wcf\data\DatabaseObjectList;
  * Represents a list of menu items.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.menu.item
@@ -18,4 +18,14 @@ class MenuItemList extends DatabaseObjectList {
         * @inheritDoc
         */
        public $className = MenuItem::class;
+       
+       /**
+        * Sets the menu items used to improve menu cache performance.
+        * 
+        * @param       MenuItem[]      $menuItems      list of menu item objects
+        */
+       public function setMenuItems(array $menuItems) {
+               $this->objects = $menuItems;
+               $this->indexToObject = $this->objectIDs = array_keys($this->objects);
+       }
 }
index efe838e27f6060985b211ecba43f965e224e52af..a96a02c1641f4d517afc1078798fed7ab9e0e762 100644 (file)
@@ -5,7 +5,7 @@ namespace wcf\data\menu\item;
  * Represents a menu item node tree.
  * 
  * @author     Marcel Werk
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage data.menu.item
@@ -39,27 +39,42 @@ class MenuItemNodeTree {
        
        /**
         * Creates a new MenuItemNodeTree object.
-        *
-        * @param       integer         $menuID
+        * 
+        * @param       integer         $menuID         menu id
+        * @param       MenuItemList    $menuItemList   optional object to be provided when building the tree from cache
         */
-       public function __construct($menuID) {
+       public function __construct($menuID, MenuItemList $menuItemList = null) {
                $this->menuID = $menuID;
                
                // load menu items
-               $menuItemList = new MenuItemList();
-               $menuItemList->getConditionBuilder()->add('menu_item.menuID = ?', array($this->menuID));
-               $menuItemList->sqlOrderBy = "menu_item.showOrder";
-               $menuItemList->readObjects();
+               if ($menuItemList === null) {
+                       $menuItemList = new MenuItemList();
+                       $menuItemList->getConditionBuilder()->add('menu_item.menuID = ?', [$this->menuID]);
+                       $menuItemList->sqlOrderBy = "menu_item.showOrder";
+                       $menuItemList->readObjects();
+               }
                
                foreach ($menuItemList as $menuItem) {
                        $this->menuItems[$menuItem->itemID] = $menuItem;
                                
                        if (!isset($this->menuItemStructure[$menuItem->parentItemID])) {
-                               $this->menuItemStructure[$menuItem->parentItemID] = array();
+                               $this->menuItemStructure[$menuItem->parentItemID] = [];
                        }
                        $this->menuItemStructure[$menuItem->parentItemID][] = $menuItem->itemID;
                }
                
+               // filter items by visibility
+               foreach ($this->menuItems as $menuItemID => $menuItem) {
+                       if (!$menuItem->isVisible()) {
+                               unset($this->menuItems[$menuItemID]);
+                               unset($this->menuItemStructure[$menuItemID]);
+                               
+                               // remove item from parent item structure
+                               $key = array_search($menuItemID, $this->menuItemStructure[$menuItem->parentItemID]);
+                               array_splice($this->menuItemStructure[$menuItem->parentItemID], $key, 1);
+                       }
+               }
+               
                // generate node tree
                $this->node = new MenuItemNode();
                $this->node->setChildren($this->generateNodeTree(null, $this->node));
@@ -75,7 +90,7 @@ class MenuItemNodeTree {
        protected function generateNodeTree($parentID = null, MenuItemNode $parentNode = null) {
                $nodes = array();
                
-               $itemIDs = (isset($this->menuItemStructure[$parentID]) ? $this->menuItemStructure[$parentID] : array());
+               $itemIDs = (isset($this->menuItemStructure[$parentID]) ? $this->menuItemStructure[$parentID] : []);
                foreach ($itemIDs as $itemID) {
                        $menuItem = $this->menuItems[$itemID];
                        $node = new MenuItemNode($parentNode, $menuItem, ($parentNode !== null ? ($parentNode->getDepth() + 1) : 0));
index 322f97b7fdd97e7cf4db8fe648ad30f6b69da9fb..c74bb4315da7b6ce4e572892d162aa9cfe37b198 100644 (file)
@@ -106,7 +106,7 @@ class Page extends DatabaseObject {
        /**
         * Returns the page URL.
         * 
-        * @return string
+        * @return      string
         */
        public function getURL() {
                if ($this->controller) {
@@ -114,6 +114,7 @@ class Page extends DatabaseObject {
                        $controllerParts = explode('\\', $this->controller);
                        $controllerName = $controllerParts[count($controllerParts) - 1];
                        $controllerName = preg_replace('/(page|action|form)$/i', '', $controllerName);
+                       
                        return LinkHandler::getInstance()->getLink($controllerName, [
                                'application' => $controllerParts[0]
                        ]);
index 2af4e50819534e780a151a075450e54a9c811764..043bf99cbc083a6a397aff95502134e237086369 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\system\cache\builder;
+use wcf\data\menu\item\MenuItemList;
 use wcf\data\menu\item\MenuItemNodeTree;
 use wcf\data\menu\MenuList;
 
@@ -7,11 +8,12 @@ use wcf\data\menu\MenuList;
  * Caches menus and menu item node trees.
  * 
  * @author     Alexander Ebert
- * @copyright  2001-2015 WoltLab GmbH
+ * @copyright  2001-2016 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    com.woltlab.wcf
  * @subpackage system.cache.builder
  * @category   Community Framework
+ * @since       2.2
  */
 class MenuCacheBuilder extends AbstractCacheBuilder {
        /**
@@ -25,9 +27,27 @@ class MenuCacheBuilder extends AbstractCacheBuilder {
                
                $menuList = new MenuList();
                $menuList->readObjects();
+               
+               $menuItemList = new MenuItemList();
+               $menuItemList->sqlOrderBy = "menu_item.showOrder";
+               $menuItemList->readObjects();
+               $menuItems = [];
+               foreach ($menuItemList as $menuItem) {
+                       if (!isset($menuItems[$menuItem->menuID])) {
+                               $menuItems[$menuItem->menuID] = [];
+                       }
+                       
+                       $menuItems[$menuItem->menuID][$menuItem->itemID] = $menuItem;
+               }
+               
                foreach ($menuList as $menu) {
+                       $menuItemList = new MenuItemList();
+                       if (!empty($menuItems[$menu->menuID])) {
+                               $menuItemList->setMenuItems($menuItems[$menu->menuID]);
+                       }
+                       
                        $data['menus'][$menu->menuID] = $menu;
-                       $data['menuItems'][$menu->menuID] = new MenuItemNodeTree($menu->menuID);
+                       $data['menuItems'][$menu->menuID] = $menuItemList;
                }
                
                return $data;
index 4ca155a8580eeb0fd604ff98383bb23b6cb7e501..beb5f9b4dfbd7512b375828f9f226c80f0f4b5f9 100644 (file)
@@ -106,11 +106,11 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                
                switch ($boxType) {
                        case 'system':
-                               if (empty($data['elements']['classname'])) {
+                               if (empty($data['elements']['className'])) {
                                        throw new SystemException("Missing required element 'classname' for 'system'-type box '{$identifier}'");
                                }
                                
-                               $className = $data['elements']['classname'];
+                               $className = $data['elements']['className'];
                                break;
                        
                        case 'html':
@@ -145,10 +145,10 @@ class BoxPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                        'boxType' => $boxType,
                        'position' => $position,
                        'showOrder' => $this->getItemOrder($position),
-                       'visibleEverywhere' => (isset($data['elements']['visibleeverywhere']) && $data['elements']['visibleeverywhere'] === '1') ? '1' : '0',
+                       'visibleEverywhere' => (!empty($data['elements']['visibleEverywhere'])) ? 1 : 0,
                        'isMultilingual' => ($isMultilingual) ? '1' : '0',
                        'cssClassName' => (!empty($data['elements']['cssClassName'])) ? $data['elements']['cssClassName'] : '',
-                       'showHeader' => (isset($data['elements']['showheader']) && $data['elements']['showheader'] === '1') ? '1' : '0',
+                       'showHeader' => (!empty($data['elements']['showHeader'])) ? 1 : 0,
                        'originIsSystem' => 1,
                        'className' => $className
                ];
index 61bfc1bc07e7c3ed5b6ffe0fd64f5e86ebb111fe..6fa6fafc54b6fef40542439a71a0d74166d0e0f4 100644 (file)
@@ -127,7 +127,7 @@ class MenuItemPackageInstallationPlugin extends AbstractXMLPackageInstallationPl
                        $pageID = $row['pageID'];
                }
                
-               $externalURL = (!empty($data['elements']['externalurl'])) ? $data['elements']['externalurl'] : '';
+               $externalURL = (!empty($data['elements']['externalURL'])) ? $data['elements']['externalURL'] : '';
                
                if ($pageID === null && empty($externalURL)) {
                        throw new SystemException("The menu item '" . $data['attributes']['identifier'] . "' must either have an associated page or an external url set.");
index aab9b3761828c9b260ac9c1d31e4b46b7ffc661d..468b244388f9f3666077c685963ca2879769697d 100644 (file)
@@ -119,9 +119,9 @@ class MenuPackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                                'name' => $this->getI18nValues($data['elements']['title'], true),
                                'boxType' => 'menu',
                                'position' => $position,
-                               'showHeader' => (!empty($data['elements']['box']['showheader']) ? 1 : 0),
-                               'visibleEverywhere' => (!empty($data['elements']['box']['visibleeveryhwere']) ? 1 : 0),
-                               'cssClassName' => (!empty($data['elements']['box']['cssclassname'])) ? $data['elements']['box']['cssclassname'] : '',
+                               'showHeader' => (!empty($data['elements']['box']['showHeader']) ? 1 : 0),
+                               'visibleEverywhere' => (!empty($data['elements']['box']['visibleEverywhere']) ? 1 : 0),
+                               'cssClassName' => (!empty($data['elements']['box']['cssClassName'])) ? $data['elements']['box']['cssClassName'] : '',
                                'originIsSystem' => 1,
                                'packageID' => $this->installation->getPackageID()
                        ];
index 196ea400972d7ca28bcaf64e38a7d4b8fe873abb..1eef245549e4c077dba4f5243a8d1732f7068fb8 100644 (file)
@@ -93,15 +93,15 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                        
                        $content = [];
                        foreach ($data['elements']['content'] as $language => $contentData) {
-                               if (!RouteHandler::isValidCustomUrl($contentData['customurl'])) {
+                               if (!RouteHandler::isValidCustomUrl($contentData['customURL'])) {
                                        throw new SystemException("Invalid custom url for page content '" . $language . "', page identifier '" . $data['attributes']['identifier'] . "'");
                                }
                                
                                $content[$language] = [
                                        'content' => $contentData['content'],
-                                       'customURL' => $contentData['customurl'],
-                                       'metaDescription' => (!empty($contentData['metadescription'])) ? StringUtil::trim($contentData['metadescription']) : '',
-                                       'metaKeywords' => (!empty($contentData['metakeywords'])) ? StringUtil::trim($contentData['metakeywords']) : '',
+                                       'customURL' => $contentData['customURL'],
+                                       'metaDescription' => (!empty($contentData['metaDescription'])) ? StringUtil::trim($contentData['metaDescription']) : '',
+                                       'metaKeywords' => (!empty($contentData['metaKeywords'])) ? StringUtil::trim($contentData['metaKeywords']) : '',
                                        'title' => $contentData['title']
                                ];
                        }
@@ -139,8 +139,8 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                        $parentPageID = $row['pageID'];
                }
                
-               $customUrl = ($isStatic || empty($data['elements']['customurl'])) ? '' : $data['elements']['customurl'];
-               if ($customUrl && !RouteHandler::isValidCustomUrl($customUrl)) {
+               $controllerCustomURL = ($isStatic || empty($data['elements']['controllerCustomURL'])) ? '' : $data['elements']['controllerCustomURL'];
+               if ($controllerCustomURL && !RouteHandler::isValidCustomUrl($controllerCustomURL)) {
                        throw new SystemException("Invalid custom url for page identifier '" . $data['attributes']['identifier'] . "'");
                }
                
@@ -148,13 +148,14 @@ class PagePackageInstallationPlugin extends AbstractXMLPackageInstallationPlugin
                        'content' => ($isStatic) ? $data['elements']['content'] : [],
                        'controller' => ($isStatic) ? '' : $data['elements']['controller'],
                        'handler' => (!$isStatic && !empty($data['elements']['handler'])) ? $data['elements']['handler'] : '',
-                       'controllerCustomURL' => $customUrl,
+                       'controllerCustomURL' => $controllerCustomURL,
                        'identifier' => $data['attributes']['identifier'],
                        'isMultilingual' => ($isStatic) ? 1 : 0,
                        'lastUpdateTime' => TIME_NOW,
                        'name' => $name,
                        'originIsSystem' => 1,
-                       'parentPageID' => $parentPageID
+                       'parentPageID' => $parentPageID,
+                       'requireObjectID' => (!empty($data['elements']['requireObjectID'])) ? 1 : 0
                ];
        }
        
index d077291f9101589509d1b2d5058cc561fedc00a0..20c2b17b1049dd42613c7ae462b70e08d99e353c 100644 (file)
@@ -16,11 +16,4 @@ namespace wcf\system\page\handler;
  * @category   Community Framework
  * @since      2.2
  */
-abstract class AbstractLookupPageHandler implements ILookupPageHandler {
-       /**
-        * @inheritDoc
-        */
-       public function lookup($searchString) {
-               return [];
-       }
-}
+abstract class AbstractLookupPageHandler extends AbstractMenuPageHandler implements ILookupPageHandler {}
index 48976d04ac01b9d4850b50dc753785dd0f384517..ff32b11abdabff820d74efde202770d4f1e38fae 100644 (file)
@@ -14,6 +14,14 @@ namespace wcf\system\page\handler;
  * @since      2.2
  */
 interface ILookupPageHandler extends IMenuPageHandler {
+       /**
+        * Returns the link for a page with an object id.
+        * 
+        * @param       integer         $objectID       page object id
+        * @return      string          page url
+        */
+       public function getLink($objectID);
+       
        /**
         * Performs a search for pages using a query string, returning an array containing
         * an `objectID => title` relation.
index f888d2332ab4a243669a0114f32d54a745083194..1e5296d320eea699137b22534308d5b36d848fbf 100644 (file)
@@ -601,6 +601,7 @@ CREATE TABLE wcf1_menu_item (
        identifier VARCHAR(255) NOT NULL,
        title VARCHAR(255) NOT NULL,
        pageID INT(10),
+       pageObjectID INT(10) NOT NULL DEFAULT 0,
        externalURL VARCHAR(255) NOT NULL DEFAULT '',
        showOrder INT(10) NOT NULL DEFAULT 0,
        isDisabled TINYINT(1) NOT NULL DEFAULT 0,
@@ -913,6 +914,7 @@ CREATE TABLE wcf1_page (
        controller VARCHAR(255) NOT NULL DEFAULT '',
        handler VARCHAR(255) NOT NULL DEFAULT '',
        controllerCustomURL VARCHAR(255) NOT NULL DEFAULT '',
+       requireObjectID TINYINT(1) NOT NULL DEFAULT 0,
        lastUpdateTime INT(10) NOT NULL DEFAULT 0
 );