From 86dbae33cc8b43d7832706e61290c19c40d57841 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 6 Jan 2016 16:46:29 +0100 Subject: [PATCH] Added support for complex pages --- com.woltlab.wcf/menu.xml | 10 +-- com.woltlab.wcf/page.xml | 8 +-- com.woltlab.wcf/templates/__menu.tpl | 7 ++- .../lib/data/DatabaseObjectList.class.php | 2 +- .../files/lib/data/menu/Menu.class.php | 24 ++++--- .../files/lib/data/menu/MenuCache.class.php | 19 +++++- .../lib/data/menu/item/MenuItem.class.php | 63 ++++++++++++++++++- .../lib/data/menu/item/MenuItemList.class.php | 12 +++- .../data/menu/item/MenuItemNodeTree.class.php | 35 ++++++++--- .../files/lib/data/page/Page.class.php | 3 +- .../cache/builder/MenuCacheBuilder.class.php | 24 ++++++- .../BoxPackageInstallationPlugin.class.php | 8 +-- ...enuItemPackageInstallationPlugin.class.php | 2 +- .../MenuPackageInstallationPlugin.class.php | 6 +- .../PagePackageInstallationPlugin.class.php | 17 ++--- .../AbstractLookupPageHandler.class.php | 9 +-- .../page/handler/ILookupPageHandler.class.php | 8 +++ wcfsetup/setup/db/install.sql | 2 + 18 files changed, 197 insertions(+), 62 deletions(-) diff --git a/com.woltlab.wcf/menu.xml b/com.woltlab.wcf/menu.xml index 475d089949..6703ae7d18 100644 --- a/com.woltlab.wcf/menu.xml +++ b/com.woltlab.wcf/menu.xml @@ -7,9 +7,9 @@ mainMenu - mainMenu - 0 - 1 + mainMenu + 0 + 1 @@ -19,8 +19,8 @@ footer - 0 - 1 + 0 + 1 diff --git a/com.woltlab.wcf/page.xml b/com.woltlab.wcf/page.xml index f9e2865624..85995c9c95 100644 --- a/com.woltlab.wcf/page.xml +++ b/com.woltlab.wcf/page.xml @@ -67,7 +67,7 @@
  • Safari
  • Windows Internet Explorer
  • ]]> - cookie-policy + cookie-policy @@ -94,7 +94,7 @@
  • Safari
  • Windows Internet Explorer
  • ]]>
    - cookie-richtlinie + cookie-richtlinie @@ -189,7 +189,7 @@

    If you have questions regarding this privacy policy, please contact us.

    Source: forum-template.wikidot.com

    ]]> - privacy-policy + privacy-policy @@ -280,7 +280,7 @@ http://twitter.com/account/settings ändern.

    Quellenangaben: eRecht24, Facebook-Disclaimer von eRecht24, Google +1 Bedingungen, Datenschutzerklärung Twitter

    ]]>
    - datenschutzerklaerung + datenschutzerklaerung diff --git a/com.woltlab.wcf/templates/__menu.tpl b/com.woltlab.wcf/templates/__menu.tpl index c7c049dcf5..00e028adc1 100644 --- a/com.woltlab.wcf/templates/__menu.tpl +++ b/com.woltlab.wcf/templates/__menu.tpl @@ -2,7 +2,12 @@
      {foreach from=$menuItemNodeList item=menuItemNode} hasChildren()} class="boxMenuHasChildren"{/if}> - {lang}{$menuItemNode->getMenuItem()->title}{/lang} + + {lang}{$menuItemNode->getMenuItem()->title}{/lang} + {if $menuItemNode->getMenuItem()->getOutstandingItems() > 0} + {#$menuItemNode->getMenuItem()->getOutstandingItems()} + {/if} + {if $menuItemNode->hasChildren()}
        {else}{/if} diff --git a/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php b/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php index 7f6df86dd6..52094685d3 100644 --- a/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php +++ b/wcfsetup/install/files/lib/data/DatabaseObjectList.class.php @@ -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() */ diff --git a/wcfsetup/install/files/lib/data/menu/Menu.class.php b/wcfsetup/install/files/lib/data/menu/Menu.class.php index 631255f3fc..c38c5d8f32 100644 --- a/wcfsetup/install/files/lib/data/menu/Menu.class.php +++ b/wcfsetup/install/files/lib/data/menu/Menu.class.php @@ -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; + } } diff --git a/wcfsetup/install/files/lib/data/menu/MenuCache.class.php b/wcfsetup/install/files/lib/data/menu/MenuCache.class.php index e9ad23864e..0a8ef35bdd 100644 --- a/wcfsetup/install/files/lib/data/menu/MenuCache.class.php +++ b/wcfsetup/install/files/lib/data/menu/MenuCache.class.php @@ -1,6 +1,6 @@ * @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]; diff --git a/wcfsetup/install/files/lib/data/menu/item/MenuItem.class.php b/wcfsetup/install/files/lib/data/menu/item/MenuItem.class.php index 169160dcb4..14a7386d23 100644 --- a/wcfsetup/install/files/lib/data/menu/item/MenuItem.class.php +++ b/wcfsetup/install/files/lib/data/menu/item/MenuItem.class.php @@ -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 * @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; + } } diff --git a/wcfsetup/install/files/lib/data/menu/item/MenuItemList.class.php b/wcfsetup/install/files/lib/data/menu/item/MenuItemList.class.php index 6707ac4cce..db3fcb5a23 100644 --- a/wcfsetup/install/files/lib/data/menu/item/MenuItemList.class.php +++ b/wcfsetup/install/files/lib/data/menu/item/MenuItemList.class.php @@ -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 * @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); + } } diff --git a/wcfsetup/install/files/lib/data/menu/item/MenuItemNodeTree.class.php b/wcfsetup/install/files/lib/data/menu/item/MenuItemNodeTree.class.php index efe838e27f..a96a02c164 100644 --- a/wcfsetup/install/files/lib/data/menu/item/MenuItemNodeTree.class.php +++ b/wcfsetup/install/files/lib/data/menu/item/MenuItemNodeTree.class.php @@ -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 * @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)); diff --git a/wcfsetup/install/files/lib/data/page/Page.class.php b/wcfsetup/install/files/lib/data/page/Page.class.php index 322f97b7fd..c74bb4315d 100644 --- a/wcfsetup/install/files/lib/data/page/Page.class.php +++ b/wcfsetup/install/files/lib/data/page/Page.class.php @@ -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] ]); diff --git a/wcfsetup/install/files/lib/system/cache/builder/MenuCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/MenuCacheBuilder.class.php index 2af4e50819..043bf99cbc 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/MenuCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/MenuCacheBuilder.class.php @@ -1,5 +1,6 @@ * @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; diff --git a/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php index 4ca155a858..beb5f9b4df 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/BoxPackageInstallationPlugin.class.php @@ -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 ]; diff --git a/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php index 61bfc1bc07..6fa6fafc54 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/MenuItemPackageInstallationPlugin.class.php @@ -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."); diff --git a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php index aab9b37618..468b244388 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/MenuPackageInstallationPlugin.class.php @@ -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() ]; diff --git a/wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php index 196ea40097..1eef245549 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/PagePackageInstallationPlugin.class.php @@ -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 ]; } diff --git a/wcfsetup/install/files/lib/system/page/handler/AbstractLookupPageHandler.class.php b/wcfsetup/install/files/lib/system/page/handler/AbstractLookupPageHandler.class.php index d077291f91..20c2b17b10 100644 --- a/wcfsetup/install/files/lib/system/page/handler/AbstractLookupPageHandler.class.php +++ b/wcfsetup/install/files/lib/system/page/handler/AbstractLookupPageHandler.class.php @@ -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 {} diff --git a/wcfsetup/install/files/lib/system/page/handler/ILookupPageHandler.class.php b/wcfsetup/install/files/lib/system/page/handler/ILookupPageHandler.class.php index 48976d04ac..ff32b11abd 100644 --- a/wcfsetup/install/files/lib/system/page/handler/ILookupPageHandler.class.php +++ b/wcfsetup/install/files/lib/system/page/handler/ILookupPageHandler.class.php @@ -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. diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index f888d2332a..1e5296d320 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -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 ); -- 2.20.1