From: Matthias Schmidt Date: Sun, 30 Dec 2012 18:10:59 +0000 (+0100) Subject: Adds active menu item handling to AbstractPage and removes ACPForm X-Git-Tag: 2.0.0_Beta_1~641^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=264c6eeadab0caa395ba713ab9886b0e2e81b3b3;p=GitHub%2FWoltLab%2FWCF.git Adds active menu item handling to AbstractPage and removes ACPForm --- diff --git a/wcfsetup/install/files/lib/acp/form/ACPForm.class.php b/wcfsetup/install/files/lib/acp/form/ACPForm.class.php deleted file mode 100755 index 1bda404911..0000000000 --- a/wcfsetup/install/files/lib/acp/form/ACPForm.class.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @package com.woltlab.wcf - * @subpackage acp.form - * @category Community Framework - */ -class ACPForm extends AbstractForm { - /** - * active acp menu item - * @var string - */ - public $activeMenuItem = ''; - - /** - * @see wcf\page\IPage::show() - */ - public function show() { - // set active acp menu item - if (!empty($this->activeMenuItem)) { - ACPMenu::getInstance()->setActiveMenuItem($this->activeMenuItem); - } - - parent::show(); - } -} diff --git a/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php b/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php index 6a492ea0fd..035cafc346 100644 --- a/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php @@ -4,6 +4,7 @@ use wcf\data\application\Application; use wcf\data\application\ApplicationAction; use wcf\data\application\ViewableApplication; use wcf\system\application\ApplicationHandler; +use wcf\form\AbstractForm; use wcf\system\exception\IllegalLinkException; use wcf\system\exception\UserInputException; use wcf\system\Regex; @@ -21,9 +22,9 @@ use wcf\util\StringUtil; * @subpackage acp.form * @category Community Framework */ -class ApplicationEditForm extends ACPForm { +class ApplicationEditForm extends AbstractForm { /** - * @see wcf\acp\form\ACPForm::$activeMenuItem + * @see wcf\page\AbstractPage::$activeMenuItem */ public $activeMenuItem = 'wcf.acp.menu.link.application'; diff --git a/wcfsetup/install/files/lib/acp/form/CronjobAddForm.class.php b/wcfsetup/install/files/lib/acp/form/CronjobAddForm.class.php index 32f68f34e4..758a6d8081 100755 --- a/wcfsetup/install/files/lib/acp/form/CronjobAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/CronjobAddForm.class.php @@ -2,6 +2,7 @@ namespace wcf\acp\form; use wcf\data\cronjob\CronjobAction; use wcf\data\cronjob\CronjobEditor; +use wcf\form\AbstractForm; use wcf\system\exception\SystemException; use wcf\system\exception\UserInputException; use wcf\system\language\I18nHandler; @@ -19,9 +20,9 @@ use wcf\util\StringUtil; * @subpackage acp.form * @category Community Framework */ -class CronjobAddForm extends ACPForm { +class CronjobAddForm extends AbstractForm { /** - * @see wcf\acp\form\ACPForm::$activeMenuItem + * @see wcf\page\AbstractPage::$activeMenuItem */ public $activeMenuItem = 'wcf.acp.menu.link.cronjob.add'; diff --git a/wcfsetup/install/files/lib/acp/form/CronjobEditForm.class.php b/wcfsetup/install/files/lib/acp/form/CronjobEditForm.class.php index e47d607475..3259b720a6 100755 --- a/wcfsetup/install/files/lib/acp/form/CronjobEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/CronjobEditForm.class.php @@ -2,6 +2,7 @@ namespace wcf\acp\form; use wcf\data\cronjob\Cronjob; use wcf\data\cronjob\CronjobAction; +use wcf\form\AbstractForm; use wcf\system\exception\IllegalLinkException; use wcf\system\language\I18nHandler; use wcf\system\WCF; @@ -18,7 +19,7 @@ use wcf\system\WCF; */ class CronjobEditForm extends CronjobAddForm { /** - * @see wcf\acp\form\ACPForm::$activeMenuItem + * @see wcf\page\AbstractPage::$activeMenuItem */ public $activeMenuItem = 'wcf.acp.menu.link.cronjob'; @@ -58,7 +59,7 @@ class CronjobEditForm extends CronjobAddForm { * @see wcf\form\IForm::save() */ public function save() { - ACPForm::save(); + AbstractForm::save(); $this->description = 'wcf.acp.cronjob.description.cronjob'.$this->cronjob->cronjobID; if (I18nHandler::getInstance()->isPlainValue('description')) { diff --git a/wcfsetup/install/files/lib/acp/form/MasterPasswordForm.class.php b/wcfsetup/install/files/lib/acp/form/MasterPasswordForm.class.php index 246c988dd7..46059b02e0 100755 --- a/wcfsetup/install/files/lib/acp/form/MasterPasswordForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/MasterPasswordForm.class.php @@ -1,5 +1,6 @@ masterPassword)) { throw new UserInputException('masterPassword'); diff --git a/wcfsetup/install/files/lib/acp/form/OptionImportForm.class.php b/wcfsetup/install/files/lib/acp/form/OptionImportForm.class.php index 2cb4593e5a..000075f88f 100755 --- a/wcfsetup/install/files/lib/acp/form/OptionImportForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/OptionImportForm.class.php @@ -1,6 +1,7 @@ save('pageMenuItem', $this->menuItem->menuItem, 'wcf.page'); diff --git a/wcfsetup/install/files/lib/acp/form/UpdateServerAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UpdateServerAddForm.class.php index f5ecc85f41..5fc82c528b 100755 --- a/wcfsetup/install/files/lib/acp/form/UpdateServerAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UpdateServerAddForm.class.php @@ -2,6 +2,7 @@ namespace wcf\acp\form; use wcf\data\package\update\server\PackageUpdateServer; use wcf\data\package\update\server\PackageUpdateServerAction; +use wcf\form\AbstractForm; use wcf\system\exception\UserInputException; use wcf\system\WCF; use wcf\system\WCFACP; @@ -17,9 +18,9 @@ use wcf\util\StringUtil; * @subpackage acp.form * @category Community Framework */ -class UpdateServerAddForm extends ACPForm { +class UpdateServerAddForm extends AbstractForm { /** - * @see wcf\acp\form\ACPForm::$activeMenuItem + * @see wcf\page\AbstractPage::$activeMenuItem */ public $activeMenuItem = 'wcf.acp.menu.link.package.server.add'; diff --git a/wcfsetup/install/files/lib/acp/form/UpdateServerEditForm.class.php b/wcfsetup/install/files/lib/acp/form/UpdateServerEditForm.class.php index 8f901df853..c506b7c059 100755 --- a/wcfsetup/install/files/lib/acp/form/UpdateServerEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UpdateServerEditForm.class.php @@ -18,7 +18,7 @@ use wcf\system\WCF; */ class UpdateServerEditForm extends UpdateServerAddForm { /** - * @see wcf\acp\form\ACPForm::$activeMenuItem + * @see wcf\page\AbstractPage::$activeMenuItem */ public $activeMenuItem = 'wcf.acp.menu.link.package.server'; diff --git a/wcfsetup/install/files/lib/acp/form/UserAssignToGroupForm.class.php b/wcfsetup/install/files/lib/acp/form/UserAssignToGroupForm.class.php index 9f344b435e..3038522386 100755 --- a/wcfsetup/install/files/lib/acp/form/UserAssignToGroupForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserAssignToGroupForm.class.php @@ -2,6 +2,7 @@ namespace wcf\acp\form; use wcf\data\user\group\UserGroup; use wcf\data\user\UserEditor; +use wcf\form\AbstractForm; use wcf\system\clipboard\ClipboardHandler; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\exception\IllegalLinkException; @@ -22,14 +23,14 @@ use wcf\util\ArrayUtil; * @subpackage acp.form * @category Community Framework */ -class UserAssignToGroupForm extends ACPForm { +class UserAssignToGroupForm extends AbstractForm { /** * @see wcf\page\AbstractPage::$neededPermissions */ public $neededPermissions = array('admin.user.canEditUser'); /** - * @see wcf\acp\form\ACPForm::$activeMenuItem + * @see wcf\page\AbstractPage::$activeMenuItem */ public $activeMenuItem = 'wcf.acp.menu.link.user.management'; diff --git a/wcfsetup/install/files/lib/acp/form/UserEmailAddressExportForm.class.php b/wcfsetup/install/files/lib/acp/form/UserEmailAddressExportForm.class.php index 5cdcf590fc..e43e9c6667 100755 --- a/wcfsetup/install/files/lib/acp/form/UserEmailAddressExportForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserEmailAddressExportForm.class.php @@ -1,5 +1,6 @@ setActiveMenuItem('wcf.acp.menu.link.log.session'); - - parent::show(); - } } diff --git a/wcfsetup/install/files/lib/acp/page/ACPSessionLogPage.class.php b/wcfsetup/install/files/lib/acp/page/ACPSessionLogPage.class.php index 84657047f2..41167a406c 100755 --- a/wcfsetup/install/files/lib/acp/page/ACPSessionLogPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/ACPSessionLogPage.class.php @@ -3,7 +3,6 @@ namespace wcf\acp\page; use wcf\data\acp\session\log\ACPSessionLog; use wcf\page\SortablePage; use wcf\system\exception\IllegalLinkException; -use wcf\system\menu\acp\ACPMenu; use wcf\system\WCF; /** @@ -17,6 +16,11 @@ use wcf\system\WCF; * @category Community Framework */ class ACPSessionLogPage extends SortablePage { + /** + * @see wcf\page\AbstractPage::$activeMenuItem + */ + public $activeMenuItem = 'wcf.acp.menu.link.log.session'; + /** * @see wcf\page\AbstractPage::$templateName */ @@ -97,14 +101,4 @@ class ACPSessionLogPage extends SortablePage { 'sessionLog' => $this->sessionLog )); } - - /** - * @see wcf\page\IPage::show() - */ - public function show() { - // enable menu item - ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.log.session'); - - parent::show(); - } } diff --git a/wcfsetup/install/files/lib/acp/page/ApplicationManagementPage.class.php b/wcfsetup/install/files/lib/acp/page/ApplicationManagementPage.class.php index b3665bfbe0..ea70f6007b 100644 --- a/wcfsetup/install/files/lib/acp/page/ApplicationManagementPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/ApplicationManagementPage.class.php @@ -2,7 +2,6 @@ namespace wcf\acp\page; use wcf\data\application\ViewableApplicationList; use wcf\page\AbstractPage; -use wcf\system\menu\acp\ACPMenu; use wcf\system\WCF; /** @@ -16,6 +15,11 @@ use wcf\system\WCF; * @category Community Framework */ class ApplicationManagementPage extends AbstractPage { + /** + * @see wcf\page\AbstractPage::$activeMenuItem + */ + public $activeMenuItem = 'wcf.acp.menu.link.application.management'; + /** * list of applications * @var wcf\data\application\ViewableApplicationList @@ -48,14 +52,4 @@ class ApplicationManagementPage extends AbstractPage { 'applicationList' => $this->applicationList )); } - - /** - * @see wcf\page\IPage::show() - */ - public function show() { - // enable menu item - ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.application.management'); - - parent::show(); - } } diff --git a/wcfsetup/install/files/lib/acp/page/CacheListPage.class.php b/wcfsetup/install/files/lib/acp/page/CacheListPage.class.php index 22bdc6077a..155f111310 100755 --- a/wcfsetup/install/files/lib/acp/page/CacheListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/CacheListPage.class.php @@ -1,8 +1,6 @@ $this->cleared )); } - - /** - * @see wcf\page\IPage::show() - */ - public function show() { - // enable menu item - ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.application.cache'); - - parent::show(); - } } diff --git a/wcfsetup/install/files/lib/acp/page/CronjobListPage.class.php b/wcfsetup/install/files/lib/acp/page/CronjobListPage.class.php index 2174125007..47d5b8bb28 100755 --- a/wcfsetup/install/files/lib/acp/page/CronjobListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/CronjobListPage.class.php @@ -1,7 +1,6 @@ sqlOrderBy = "cronjob.".$this->sortField." ".$this->sortOrder; } - - /** - * @see wcf\page\IPage::show() - */ - public function show() { - // set active menu item. - ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.cronjob.list'); - - parent::show(); - } } diff --git a/wcfsetup/install/files/lib/acp/page/CronjobLogListPage.class.php b/wcfsetup/install/files/lib/acp/page/CronjobLogListPage.class.php index a62d96d420..9712f488c7 100755 --- a/wcfsetup/install/files/lib/acp/page/CronjobLogListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/CronjobLogListPage.class.php @@ -1,7 +1,6 @@ setActiveMenuItem('wcf.acp.menu.link.log.cronjob'); - - parent::show(); - } } diff --git a/wcfsetup/install/files/lib/acp/page/IndexPage.class.php b/wcfsetup/install/files/lib/acp/page/IndexPage.class.php index 9e65fae0d1..b8e1752e5e 100755 --- a/wcfsetup/install/files/lib/acp/page/IndexPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/IndexPage.class.php @@ -8,7 +8,6 @@ use wcf\system\image\adapter\ImagickImageAdapter; use wcf\system\language\LanguageFactory; use wcf\system\package\PackageInstallationDispatcher; use wcf\system\WCF; -use wcf\system\WCFACP; /** * Shows the welcome page in admin control panel. diff --git a/wcfsetup/install/files/lib/acp/page/PackageAutoUpdateListPage.class.php b/wcfsetup/install/files/lib/acp/page/PackageAutoUpdateListPage.class.php index d49bf0b540..a7ac55ba06 100755 --- a/wcfsetup/install/files/lib/acp/page/PackageAutoUpdateListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackageAutoUpdateListPage.class.php @@ -1,7 +1,6 @@ setActiveMenuItem('wcf.acp.menu.link.package.autoupdate'); - // check master password WCFACP::checkMasterPassword(); diff --git a/wcfsetup/install/files/lib/acp/page/PackageInstallationConfirmPage.class.php b/wcfsetup/install/files/lib/acp/page/PackageInstallationConfirmPage.class.php index 96c1a4a305..fb3740cbf5 100644 --- a/wcfsetup/install/files/lib/acp/page/PackageInstallationConfirmPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackageInstallationConfirmPage.class.php @@ -3,7 +3,6 @@ namespace wcf\acp\page; use wcf\data\package\installation\queue\PackageInstallationQueue; use wcf\page\AbstractPage; use wcf\system\exception\IllegalLinkException; -use wcf\system\menu\acp\ACPMenu; use wcf\system\package\PackageInstallationDispatcher; use wcf\system\WCF; use wcf\system\WCFACP; @@ -19,6 +18,11 @@ use wcf\system\WCFACP; * @category Community Framework */ class PackageInstallationConfirmPage extends AbstractPage { + /** + * @see wcf\page\AbstractPage::$activeMenuItem + */ + public $activeMenuItem = 'wcf.acp.menu.link.package.install'; + /** * number of missing packages * @var integer @@ -123,8 +127,6 @@ class PackageInstallationConfirmPage extends AbstractPage { * @see wcf\page\IPage::show() */ public function show() { - ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.package.install'); - // check master password WCFACP::checkMasterPassword(); diff --git a/wcfsetup/install/files/lib/acp/page/PackageListDetailedPage.class.php b/wcfsetup/install/files/lib/acp/page/PackageListDetailedPage.class.php index 619a8164e0..8b27d61c66 100644 --- a/wcfsetup/install/files/lib/acp/page/PackageListDetailedPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackageListDetailedPage.class.php @@ -1,7 +1,6 @@ setActiveMenuItem('wcf.acp.menu.link.package.list'); - - parent::show(); - } } diff --git a/wcfsetup/install/files/lib/acp/page/PackageListPage.class.php b/wcfsetup/install/files/lib/acp/page/PackageListPage.class.php index 3c0ec75088..65aedd9dfa 100755 --- a/wcfsetup/install/files/lib/acp/page/PackageListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackageListPage.class.php @@ -3,7 +3,6 @@ namespace wcf\acp\page; use wcf\data\package\Package; use wcf\data\package\PackageList; use wcf\page\AbstractPage; -use wcf\system\menu\acp\ACPMenu; use wcf\system\request\RouteHandler; use wcf\system\WCF; use wcf\util\HeaderUtil; @@ -19,6 +18,11 @@ use wcf\util\HeaderUtil; * @category Community Framework */ class PackageListPage extends AbstractPage { + /** + * @see wcf\page\AbstractPage::$activeMenuItem + */ + public $activeMenuItem = 'wcf.acp.menu.link.package.list'; + /** * list of applications * @var wcf\data\package\PackageList @@ -88,9 +92,6 @@ class PackageListPage extends AbstractPage { exit; } - // enable menu item - ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.package.list'); - parent::show(); } } diff --git a/wcfsetup/install/files/lib/acp/page/PackagePage.class.php b/wcfsetup/install/files/lib/acp/page/PackagePage.class.php index 29d2b2131c..8c8e42ce42 100755 --- a/wcfsetup/install/files/lib/acp/page/PackagePage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackagePage.class.php @@ -3,7 +3,6 @@ namespace wcf\acp\page; use wcf\data\package\Package; use wcf\page\AbstractPage; use wcf\system\exception\IllegalLinkException; -use wcf\system\menu\acp\ACPMenu; use wcf\system\WCF; /** @@ -17,6 +16,11 @@ use wcf\system\WCF; * @category Community Framework */ class PackagePage extends AbstractPage { + /** + * @see wcf\page\AbstractPage::$activeMenuItem + */ + public $activeMenuItem = 'wcf.acp.menu.link.package'; + /** * @see wcf\page\AbstractPage::$neededPermissions */ @@ -55,14 +59,4 @@ class PackagePage extends AbstractPage { WCF::getTPL()->assign('package', $this->package); } - - /** - * @see wcf\page\IPage::show() - */ - public function show() { - // enable menu item - ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.package'); - - parent::show(); - } } diff --git a/wcfsetup/install/files/lib/acp/page/PackageUpdateSearchResultPage.class.php b/wcfsetup/install/files/lib/acp/page/PackageUpdateSearchResultPage.class.php index 421196db96..a028d41c8d 100755 --- a/wcfsetup/install/files/lib/acp/page/PackageUpdateSearchResultPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PackageUpdateSearchResultPage.class.php @@ -5,7 +5,6 @@ use wcf\data\search\Search; use wcf\page\SortablePage; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\exception\IllegalLinkException; -use wcf\system\menu\acp\ACPMenu; use wcf\system\WCF; /** @@ -19,6 +18,11 @@ use wcf\system\WCF; * @category Community Framework */ class PackageUpdateSearchResultPage extends SortablePage { + /** + * @see wcf\page\AbstractPage::$activeMenuItem + */ + public $activeMenuItem = 'wcf.acp.menu.link.package.database'; + /** * @see wcf\page\AbstractPage::$neededPermissions */ @@ -166,14 +170,4 @@ class PackageUpdateSearchResultPage extends SortablePage { 'selectedPackages' => array() )); } - - /** - * @see wcf\page\IPage::show() - */ - public function show() { - // set active menu item - ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.package.database'); - - parent::show(); - } } diff --git a/wcfsetup/install/files/lib/acp/page/PageMenuItemListPage.class.php b/wcfsetup/install/files/lib/acp/page/PageMenuItemListPage.class.php index 5e1c9dd1cf..d92df71cb1 100644 --- a/wcfsetup/install/files/lib/acp/page/PageMenuItemListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/PageMenuItemListPage.class.php @@ -3,7 +3,6 @@ namespace wcf\acp\page; use wcf\data\page\menu\item\PageMenuItemList; use wcf\data\page\menu\item\ViewablePageMenuItem; use wcf\page\AbstractPage; -use wcf\system\menu\acp\ACPMenu; use wcf\system\WCF; /** @@ -17,6 +16,11 @@ use wcf\system\WCF; * @category Community Framework */ class PageMenuItemListPage extends AbstractPage { + /** + * @see wcf\page\AbstractPage::$activeMenuItem + */ + public $activeMenuItem = 'wcf.acp.menu.link.pageMenu.list'; + /** * list of footer page menu items * @var array @@ -75,14 +79,4 @@ class PageMenuItemListPage extends AbstractPage { 'headerItems' => $this->headerItems )); } - - /** - * @see wcf\page\IPage::show() - */ - public function show() { - // set active menu item. - ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.pageMenu.list'); - - parent::show(); - } } diff --git a/wcfsetup/install/files/lib/acp/page/UpdateServerListPage.class.php b/wcfsetup/install/files/lib/acp/page/UpdateServerListPage.class.php index 94e4391817..b1dbf8eceb 100755 --- a/wcfsetup/install/files/lib/acp/page/UpdateServerListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/UpdateServerListPage.class.php @@ -1,7 +1,6 @@ $this->deletedPackageUpdateServerID )); } - - /** - * @see wcf\page\IPage::show() - */ - public function show() { - // enable menu item - ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.package.server.list'); - - parent::show(); - } } diff --git a/wcfsetup/install/files/lib/acp/page/UserGroupListPage.class.php b/wcfsetup/install/files/lib/acp/page/UserGroupListPage.class.php index 5a7ae22239..81b9f074be 100755 --- a/wcfsetup/install/files/lib/acp/page/UserGroupListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/UserGroupListPage.class.php @@ -1,7 +1,6 @@ $this->deletedGroups )); } - - /** - * @see wcf\page\IPage::show() - */ - public function show() { - // enable menu item - ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.group.list'); - - parent::show(); - } } diff --git a/wcfsetup/install/files/lib/acp/page/UserListPage.class.php b/wcfsetup/install/files/lib/acp/page/UserListPage.class.php index a16d12bb7c..9fadcb72e1 100755 --- a/wcfsetup/install/files/lib/acp/page/UserListPage.class.php +++ b/wcfsetup/install/files/lib/acp/page/UserListPage.class.php @@ -9,7 +9,6 @@ use wcf\system\clipboard\ClipboardHandler; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\event\EventHandler; use wcf\system\exception\IllegalLinkException; -use wcf\system\menu\acp\ACPMenu; use wcf\system\request\LinkHandler; use wcf\system\WCF; use wcf\util\DateUtil; @@ -177,8 +176,7 @@ class UserListPage extends SortablePage { * @see wcf\page\IPage::show() */ public function show() { - // set active menu item - ACPMenu::getInstance()->setActiveMenuItem('wcf.acp.menu.link.user.'.($this->searchID ? 'search' : 'list')); + $this->activeMenuItem = 'wcf.acp.menu.link.user.'.($this->searchID ? 'search' : 'list'); parent::show(); } diff --git a/wcfsetup/install/files/lib/page/AbstractPage.class.php b/wcfsetup/install/files/lib/page/AbstractPage.class.php index 7d5cd2c886..16a3cf0252 100644 --- a/wcfsetup/install/files/lib/page/AbstractPage.class.php +++ b/wcfsetup/install/files/lib/page/AbstractPage.class.php @@ -3,11 +3,18 @@ namespace wcf\page; use wcf\system\event\EventHandler; use wcf\system\exception\IllegalLinkException; use wcf\system\exception\PermissionDeniedException; +use wcf\system\menu\acp\ACPMenu; +use wcf\system\menu\page\PageMenu; +use wcf\system\request\RequestHandler; use wcf\system\WCF; /** - * This class provides default implementations for the Page interface. - * This includes the call of the default event listeners for a page: readParameters, readData, assignVariables and show. + * Abstract implementation of a page which fires the default event actions of a + * page: + * - readParameters + * - readData + * - assignVariables + * - show * * @author Marcel Werk * @copyright 2001-2012 WoltLab GmbH @@ -29,6 +36,12 @@ abstract class AbstractPage implements IPage, ITrackablePage { */ public $useTemplate = true; + /** + * name of the active menu item + * @var string + */ + public $activeMenuItem = ''; + /** * value of the given action parameter * @var string @@ -153,6 +166,9 @@ abstract class AbstractPage implements IPage, ITrackablePage { throw new PermissionDeniedException(); } + // sets the active menu item + $this->setActiveMenuItem(); + // check modules $this->checkModules(); @@ -190,6 +206,20 @@ abstract class AbstractPage implements IPage, ITrackablePage { } } + /** + * Sets the active menu item of the page. + */ + protected function setActiveMenuItem() { + if (!empty($this->activeMenuItem)) { + if (RequestHandler::getInstance()->isACPRequest()) { + ACPMenu::getInstance()->setActiveMenuItem($this->activeMenuItem); + } + else { + PageMenu::getInstance()->setActiveMenuItem($this->activeMenuItem); + } + } + } + /** * @see wcf\page\ITrackablePage::isTracked() */