* Continuous numeration of edit history version in template.
* `\wcf\data\user\UserProfile::getGuestUserProfile()` added.
+#### CMS
+
+* User online location is handled via the `wcf\data\page\Page` objects. Static locations only need a language item `wcf.page.onlineLocation.{$page->identifier}`, more complex locations can use the online location-related methods of `wcf\system\page\handler\IMenuPageHandler`. For CMS pages, their title is used.
+
#### New Traits
* `wcf\data\TDatabaseObjectOptions` for database object-bound options validation.
<classname>wcf\system\moderation\queue\report\UserModerationQueueReportHandler</classname>
</type>
- <!-- user online locations -->
- <type>
- <name>com.woltlab.wcf.user.UserPage</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <classname><![CDATA[wcf\system\user\online\location\UserLocation]]></classname>
- <controller><![CDATA[wcf\page\UserPage]]></controller>
- <languagevariable>wcf.user.usersOnline.location.UserPage</languagevariable>
- </type>
- <type>
- <name>com.woltlab.wcf.user.UsersOnlineListPage</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <controller><![CDATA[wcf\page\UsersOnlineListPage]]></controller>
- <languagevariable>wcf.user.usersOnline.location.UsersOnlineListPage</languagevariable>
- </type>
- <type>
- <name>com.woltlab.wcf.user.MembersListPage</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <controller><![CDATA[wcf\page\MembersListPage]]></controller>
- <languagevariable>wcf.user.usersOnline.location.MembersListPage</languagevariable>
- </type>
- <type>
- <name>com.woltlab.wcf.user.TeamPage</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <controller><![CDATA[wcf\page\TeamPage]]></controller>
- <languagevariable>wcf.user.usersOnline.location.TeamPage</languagevariable>
- </type>
- <type>
- <name>com.woltlab.wcf.user.DashboardPage</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <controller><![CDATA[wcf\page\DashboardPage]]></controller>
- <languagevariable>wcf.user.usersOnline.location.DashboardPage</languagevariable>
- </type>
- <type>
- <name>com.woltlab.wcf.user.RecentActivityListPage</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <controller><![CDATA[wcf\page\RecentActivityListPage]]></controller>
- <languagevariable>wcf.user.usersOnline.location.RecentActivityListPage</languagevariable>
- </type>
-
- <type>
- <name>com.woltlab.wcf.user.RegisterForm</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <controller><![CDATA[wcf\form\RegisterForm]]></controller>
- <languagevariable>wcf.user.usersOnline.location.RegisterForm</languagevariable>
- </type>
- <type>
- <name>com.woltlab.wcf.user.LostPasswordForm</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <controller><![CDATA[wcf\form\LostPasswordForm]]></controller>
- <languagevariable>wcf.user.usersOnline.location.LostPasswordForm</languagevariable>
- </type>
- <type>
- <name>com.woltlab.wcf.user.NewPasswordForm</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <controller><![CDATA[wcf\form\NewPasswordForm]]></controller>
- <languagevariable>wcf.user.usersOnline.location.LostPasswordForm</languagevariable>
- </type>
- <type>
- <name>com.woltlab.wcf.user.LoginForm</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <controller><![CDATA[wcf\form\LoginForm]]></controller>
- <languagevariable>wcf.user.usersOnline.location.LoginForm</languagevariable>
- </type>
- <type>
- <name>com.woltlab.wcf.user.AccountManagementForm</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <controller><![CDATA[wcf\form\AccountManagementForm]]></controller>
- <languagevariable>wcf.user.usersOnline.location.AccountManagementForm</languagevariable>
- </type>
- <type>
- <name>com.woltlab.wcf.user.AvatarEditForm</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <controller><![CDATA[wcf\form\AvatarEditForm]]></controller>
- <languagevariable>wcf.user.usersOnline.location.AvatarEditForm</languagevariable>
- </type>
- <type>
- <name>com.woltlab.wcf.user.SettingsForm</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <controller><![CDATA[wcf\form\SettingsForm]]></controller>
- <languagevariable>wcf.user.usersOnline.location.SettingsForm</languagevariable>
- </type>
- <type>
- <name>com.woltlab.wcf.user.SignatureEditForm</name>
- <definitionname>com.woltlab.wcf.user.online.location</definitionname>
- <controller><![CDATA[wcf\form\SignatureEditForm]]></controller>
- <languagevariable>wcf.user.usersOnline.location.SignatureEditForm</languagevariable>
- </type>
-
<!-- moderation type -->
<type>
<name>com.woltlab.wcf.moderation.activation</name>
<name>com.woltlab.wcf.user.dashboardContainer</name>
</definition>
- <definition>
- <name>com.woltlab.wcf.user.online.location</name>
- <interfacename><![CDATA[wcf\system\user\online\location\IUserOnlineLocation]]></interfacename>
- </definition>
-
<definition>
<name>com.woltlab.wcf.user.objectWatch</name>
<interfacename><![CDATA[wcf\system\user\object\watch\IUserObjectWatch]]></interfacename>
<name>com.woltlab.wcf.bulkProcessing.user.action</name>
<interfacename><![CDATA[wcf\system\bulk\processing\IBulkProcessingAction]]></interfacename>
</definition>
+
+ <!-- deprecated -->
+ <definition>
+ <name>com.woltlab.wcf.user.online.location</name>
+ <interfacename><![CDATA[wcf\system\user\online\location\IUserOnlineLocation]]></interfacename>
+ </definition>
+ <!-- /deprecated -->
</import>
<delete>
<options>module_members_list</options>
</page>
+ <page identifier="com.woltlab.wcf.AccountManagement">
+ <controller>wcf\form\AccountManagementForm</controller>
+ <name language="de"><![CDATA[Benutzerkonto-Verwaltung]]></name>
+ <name language="en"><![CDATA[Account Management]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.AvatarEdit">
+ <controller>wcf\form\AvatarEditForm</controller>
+ <name language="de"><![CDATA[Avatar-Verwaltung]]></name>
+ <name language="en"><![CDATA[Avatar Management]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.Disclaimer">
+ <controller>wcf\form\DisclaimerForm</controller>
+ <name language="de"><![CDATA[Disclaimer]]></name>
+ <name language="en"><![CDATA[Disclaimer]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.EmailActivation">
+ <controller>wcf\form\EmailActivationForm</controller>
+ <name language="de"><![CDATA[Aktivierung neuer E-Mail-Adresse]]></name>
+ <name language="en"><![CDATA[New Email Address Verification]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.EmailNewActivationCode">
+ <controller>wcf\form\EmailNewActivationCodeForm</controller>
+ <name language="de"><![CDATA[E-Mail-Aktivierungscode-Anforderung]]></name>
+ <name language="en"><![CDATA[New Email Activation Code Request]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.Login">
+ <controller>wcf\form\LoginForm</controller>
+ <name language="de"><![CDATA[Anmeldung]]></name>
+ <name language="en"><![CDATA[Login]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.LostPassword">
+ <controller>wcf\form\LostPasswordForm</controller>
+ <name language="de"><![CDATA[Kennwort vergessen]]></name>
+ <name language="en"><![CDATA[Lost Password]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.Mail">
+ <controller>wcf\form\MailForm</controller>
+ <name language="de"><![CDATA[E-Mail-Formular]]></name>
+ <name language="en"><![CDATA[Mail Form]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.NewPassword">
+ <controller>wcf\form\NewPasswordForm</controller>
+ <name language="de"><![CDATA[Neues Kennwort]]></name>
+ <name language="en"><![CDATA[New Password Request]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.NotificationSettings">
+ <controller>wcf\form\NotificationSettingsForm</controller>
+ <name language="de"><![CDATA[Benachrichtigungseinstellungen]]></name>
+ <name language="en"><![CDATA[Notification Settings]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.RegisterActivation">
+ <controller>wcf\form\RegisterActivationForm</controller>
+ <name language="de"><![CDATA[Registrierung abschließen]]></name>
+ <name language="en"><![CDATA[Complete Registration]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.Register">
+ <controller>wcf\form\RegisterForm</controller>
+ <name language="de"><![CDATA[Registrierung]]></name>
+ <name language="en"><![CDATA[Registration]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.RegisterNewActivationCode">
+ <controller>wcf\form\RegisterNewActivationCodeForm</controller>
+ <name language="de"><![CDATA[Aktivierungscode-Anforderung]]></name>
+ <name language="en"><![CDATA[New Activation Code Request]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.Search">
+ <controller>wcf\form\SearchForm</controller>
+ <name language="de"><![CDATA[Suche]]></name>
+ <name language="en"><![CDATA[Search]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.Settings">
+ <controller>wcf\form\SettingsForm</controller>
+ <name language="de"><![CDATA[Einstellungen]]></name>
+ <name language="en"><![CDATA[Settings]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.SignatureEdit">
+ <controller>wcf\form\SignatureEditForm</controller>
+ <name language="de"><![CDATA[Signatur-Verwaltung]]></name>
+ <name language="en"><![CDATA[Signature Management]]></name>
+ <options>module_user_signature</options>
+ </page>
+ <page identifier="com.woltlab.wcf.DeletedContentList">
+ <controller>wcf\page\DeletedContentListPage</controller>
+ <name language="de"><![CDATA[Gelöschte Inhalte]]></name>
+ <name language="en"><![CDATA[Deleted Content]]></name>
+ <permissions>mod.general.canUseModeration</permissions>
+ </page>
+ <page identifier="com.woltlab.wcf.EditHistory">
+ <controller>wcf\page\EditHistoryPage</controller>
+ <name language="de"><![CDATA[TODO]]></name>
+ <name language="en"><![CDATA[TODO]]></name>
+ <options>module_edit_history</options>
+ <requireObjectID>1</requireObjectID>
+ </page>
+ <page identifier="com.woltlab.wcf.Following">
+ <controller>wcf\page\FollowingPage</controller>
+ <name language="de"><![CDATA[Benutzer, denen Sie folgen]]></name>
+ <name language="en"><![CDATA[Followed Users]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.IgnoredUsers">
+ <controller>wcf\page\IgnoredUsersPage</controller>
+ <name language="de"><![CDATA[Blockierte Benutzer]]></name>
+ <name language="en"><![CDATA[Blocked Users]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.ModerationList">
+ <controller>wcf\page\ModerationListPage</controller>
+ <name language="de"><![CDATA[Moderation]]></name>
+ <name language="en"><![CDATA[Moderation]]></name>
+ <permissions>mod.general.canUseModeration</permissions>
+ </page>
+ <page identifier="com.woltlab.wcf.ModerationActivation">
+ <controller>wcf\form\ModerationActivationForm</controller>
+ <name language="de"><![CDATA[Inhaltsfreischaltung]]></name>
+ <name language="en"><![CDATA[Content Approval]]></name>
+ <parent>com.woltlab.wcf.ModerationList</parent>
+ <permissions>mod.general.canUseModeration</permissions>
+ <requireObjectID>1</requireObjectID>
+ </page>
+ <page identifier="com.woltlab.wcf.ModerationReport">
+ <controller>wcf\form\ModerationReportForm</controller>
+ <name language="de"><![CDATA[Inhaltsmeldung]]></name>
+ <name language="en"><![CDATA[Content Report]]></name>
+ <parent>com.woltlab.wcf.ModerationList</parent>
+ <permissions>mod.general.canUseModeration</permissions>
+ <requireObjectID>1</requireObjectID>
+ </page>
+ <page identifier="com.woltlab.wcf.NotificationList">
+ <controller>wcf\page\NotificationListPage</controller>
+ <name language="de"><![CDATA[Benachrichtigungen]]></name>
+ <name language="en"><![CDATA[Notifications]]></name>
+ </page>
+ <page identifier="com.woltlab.wcf.PaidSubscriptionList">
+ <controller>wcf\page\PaidSubscriptionListPage</controller>
+ <name language="de"><![CDATA[Bezahlte Mitgliedschaften]]></name>
+ <name language="en"><![CDATA[Paid Subscriptions]]></name>
+ <options>module_paid_subscription</options>
+ </page>
+ <page identifier="com.woltlab.wcf.SearchResult">
+ <controller>wcf\page\SearchResultPage</controller>
+ <name language="de"><![CDATA[Suchergebnisse]]></name>
+ <name language="en"><![CDATA[Search Results]]></name>
+ <parent>com.woltlab.wcf.Search</parent>
+ <requireObjectID>1</requireObjectID>
+ </page>
+ <page identifier="com.woltlab.wcf.Tagged">
+ <controller>wcf\page\TaggedPage</controller>
+ <name language="de"><![CDATA[Inhalte mit bestimmtem Tag]]></name>
+ <name language="en"><![CDATA[Content With Particular Tag]]></name>
+ <permissions>user.tag.canViewTag</permissions>
+ <requireObjectID>1</requireObjectID>
+ </page>
+ <page identifier="com.woltlab.wcf.User">
+ <controller>wcf\page\UserPage</controller>
+ <handler>wcf\system\page\handler\UserPageHandler</handler>
+ <name language="de"><![CDATA[Benutzerprofil]]></name>
+ <name language="en"><![CDATA[User Profile]]></name>
+ <parent>com.woltlab.wcf.MembersList</parent>
+ <requireObjectID>1</requireObjectID>
+ </page>
+
<!-- static -->
<page identifier="com.woltlab.wcf.CookiePolicy">
<name language="en">Cookie Policy</name>
use wcf\system\cache\builder\UserGroupPermissionCacheBuilder;
use wcf\system\cache\runtime\UserProfileRuntimeCache;
use wcf\system\request\LinkHandler;
-use wcf\system\user\online\location\UserOnlineLocationHandler;
use wcf\system\user\signature\SignatureCache;
use wcf\system\user\storage\UserStorageHandler;
use wcf\system\WCF;
*/
public function getCurrentLocation() {
if ($this->currentLocation === null) {
- $this->currentLocation = '';
- $this->currentLocation = UserOnlineLocationHandler::getInstance()->getLocation(new UserOnline(new User(null, [
- 'controller' => $this->controller,
- 'objectID' => $this->locationObjectID
- ])));
+ $userOnline = new UserOnline($this->getDecoratedObject());
+ $userOnline->setLocation();
+
+ $this->currentLocation = $userOnline->getLocation();
}
return $this->currentLocation;
<?php
namespace wcf\data\user\online;
+use wcf\data\page\PageCache;
+use wcf\data\spider\Spider;
use wcf\data\user\UserProfile;
+use wcf\page\CmsPage;
use wcf\system\cache\builder\SpiderCacheBuilder;
+use wcf\system\page\handler\IOnlineLocationPageHandler;
use wcf\system\WCF;
use wcf\util\StringUtil;
use wcf\util\UserUtil;
* Represents a user who is online.
*
* @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.user.online
/**
* spider object
- * @var \wcf\data\spider\Spider
+ * @var Spider
*/
protected $spider = null;
}
/**
- * Sets the location of the user.
+ * Sets the location of the user. If no location is given, the method tries to
+ * automatically determine the location.
+ * Returns true if the location has been successfully set.
*
- * @param string $location
+ * @param string|null $location
+ * @return boolean
*/
- public function setLocation($location) {
+ public function setLocation($location = null) {
+ if ($location === null) {
+ if ($this->controller) {
+ if ($this->controller === CmsPage::class) {
+ // create location based on cms page title
+ if ($this->objectType) {
+ $page = PageCache::getInstance()->getPageByIdentifier($this->objectType);
+ if ($page !== null) {
+ // TODO: check if active user may access the page
+ $pageContent = $page->getPageContentByLanguage(WCF::getLanguage()->languageID);
+ if (isset($pageContent['title'])) {
+ $this->location = $pageContent['title'];
+
+ return false;
+ }
+ }
+ }
+ }
+ else {
+ $page = PageCache::getInstance()->getPageByController($this->controller);
+ if ($page !== null) {
+ if ($page->getHandler() !== null && $page->getHandler() instanceof IOnlineLocationPageHandler) {
+ // refer to page handler
+ $this->location = $page->getHandler()->getOnlineLocation($page, $this);
+
+ return true;
+ }
+ else {
+ // check if static language item exists
+ $languageItem = 'wcf.page.onlineLocation.' . $page->identifier;
+ $languageItemValue = WCF::getLanguage()->get($languageItem);
+
+ if ($languageItemValue !== $languageItem) {
+ $this->location = $languageItemValue;
+
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ $this->location = '';
+ return false;
+ }
+
$this->location = $location;
+ return true;
}
/**
/**
* Returns the spider object
*
- * @return \wcf\data\spider\Spider
+ * @return Spider
*/
public function getSpider() {
if (!$this->spiderID) return null;
* Generic controller to display cms content.
*
* @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 page
*/
public $content;
+ /**
+ * @inheritDoc
+ */
+ public $enableTracking = true;
+
/**
* @var integer
*/
'pageID' => $this->pageID
]);
}
+
+ /**
+ * @inheritDoc
+ */
+ public function getObjectType() {
+ return $this->page ? $this->page->identifier : '';
+ }
}
<?php
namespace wcf\page;
use wcf\data\object\type\ObjectTypeCache;
+use wcf\data\page\PageCache;
+use wcf\data\user\online\UserOnline;
+use wcf\data\user\online\UsersOnlineList;
use wcf\system\breadcrumb\Breadcrumb;
use wcf\system\dashboard\DashboardHandler;
+use wcf\system\page\handler\IOnlineLocationPageHandler;
use wcf\system\request\LinkHandler;
use wcf\system\user\collapsible\content\UserCollapsibleContentHandler;
use wcf\system\WCF;
* Shows page which lists all users who are online.
*
* @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 page
*/
class UsersOnlineListPage extends SortablePage {
/**
- * @see \wcf\page\AbstractPage::$activeMenuItem
+ * @inheritDoc
*/
public $activeMenuItem = 'wcf.user.usersOnline';
/**
- * @see \wcf\page\AbstractPage::$neededPermissions
+ * @inheritDoc
*/
- public $neededPermissions = array('user.profile.canViewUsersOnlineList');
+ public $neededPermissions = ['user.profile.canViewUsersOnlineList'];
/**
- * @see \wcf\page\AbstractPage::$enableTracking
+ * @inheritDoc
*/
public $enableTracking = true;
/**
- * @see \wcf\page\SortablePage::$defaultSortField
+ * @inheritDoc
*/
public $defaultSortField = USERS_ONLINE_DEFAULT_SORT_FIELD;
/**
- * @see \wcf\page\SortablePage::$defaultSortOrder
+ * @inheritDoc
*/
public $defaultSortOrder = USERS_ONLINE_DEFAULT_SORT_ORDER;
/**
- * @see \wcf\page\SortablePage::$validSortFields
+ * @inheritDoc
*/
- public $validSortFields = array('username', 'lastActivityTime', 'requestURI');
+ public $validSortFields = ['username', 'lastActivityTime', 'requestURI'];
/**
- * @see \wcf\page\MultipleLinkPage::$objectListClassName
+ * @inheritDoc
*/
- public $objectListClassName = 'wcf\data\user\online\UsersOnlineList';
+ public $objectListClassName = UsersOnlineList::class;
/**
* page locations
* @var array
*/
- public $locations = array();
+ public $locations = [];
/**
- * @see \wcf\page\IPage::readParameters()
+ * @inheritDoc
*/
public function readParameters() {
parent::readParameters();
}
if (!empty($_POST)) {
- HeaderUtil::redirect(LinkHandler::getInstance()->getLink('UsersOnlineList', array(), 'sortField=' . $this->sortField . '&sortOrder=' . $this->sortOrder));
+ HeaderUtil::redirect(LinkHandler::getInstance()->getLink('UsersOnlineList', [], 'sortField=' . $this->sortField . '&sortOrder=' . $this->sortOrder));
exit;
}
}
/**
- * @see \wcf\page\MultipleLinkPage::initObjectList()
+ * @inheritDoc
*/
protected function initObjectList() {
parent::initObjectList();
}
/**
- * @see \wcf\page\IPage::readData()
+ * @inheritDoc
*/
public function readData() {
parent::readData();
// add breadcrumbs
- if (MODULE_MEMBERS_LIST) WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('wcf.user.members'), LinkHandler::getInstance()->getLink('MembersList')));
-
- // load locations
- foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.user.online.location') as $objectType) {
- $this->locations[$objectType->controller] = $objectType;
+ if (MODULE_MEMBERS_LIST) {
+ WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('wcf.user.members'), LinkHandler::getInstance()->getLink('MembersList')));
}
- // cache data
+ // cache all necessary data for showing locations
foreach ($this->objectList as $userOnline) {
- if (isset($this->locations[$userOnline->controller]) && $this->locations[$userOnline->controller]->getProcessor()) {
- $this->locations[$userOnline->controller]->getProcessor()->cache($userOnline);
+ if ($userOnline->controller) {
+ $page = PageCache::getInstance()->getPageByController($userOnline->controller);
+ if ($page !== null && $page->getHandler() !== null && $page->getHandler() instanceof IOnlineLocationPageHandler) {
+ $page->getHandler()->prepareOnlineLocation($page, $userOnline);
+ }
}
}
// set locations
+ /** @var UserOnline $userOnline */
foreach ($this->objectList as $userOnline) {
- if (isset($this->locations[$userOnline->controller])) {
- if ($this->locations[$userOnline->controller]->getProcessor()) {
- $userOnline->setLocation($this->locations[$userOnline->controller]->getProcessor()->get($userOnline, $this->locations[$userOnline->controller]->languagevariable));
- }
- else {
- $userOnline->setLocation(WCF::getLanguage()->get($this->locations[$userOnline->controller]->languagevariable));
- }
- }
+ $userOnline->setLocation();
}
}
/**
- * @see \wcf\page\IPage::assignVariables()
+ * @inheritDoc
*/
public function assignVariables() {
parent::assignVariables();
DashboardHandler::getInstance()->loadBoxes('com.woltlab.wcf.user.MembersListPage', $this);
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'sidebarCollapsed' => UserCollapsibleContentHandler::getInstance()->isCollapsed('com.woltlab.wcf.collapsibleSidebar', 'com.woltlab.wcf.user.MembersListPage'),
'sidebarName' => 'com.woltlab.wcf.user.MembersListPage',
'allowSpidersToIndexThisPage' => true
- ));
+ ]);
}
/**
- * @see \wcf\page\MultipleLinkPage::readObjects()
+ * @inheritDoc
*/
protected function readObjects() {
$this->objectList->sqlLimit = 0;
* Returns the number of outstanding items for this page for display as a badge, optionally
* specifying a corresponding object id to limit the scope.
*
- * @param integer $objectID optional page object id
+ * @param integer|null $objectID optional page object id
* @return integer number of outstanding items
*/
public function getOutstandingItemCount($objectID = null);
* Returns false if this page should be hidden from menus, but does not control the accessibility
* of the page itself. The visibility can optionally be scoped to the given object id.
*
- * @param integer $objectID optional page object id
+ * @param integer|null $objectID optional page object id
* @return boolean false if the page should be hidden from menus
*/
public function isVisible($objectID = null);
--- /dev/null
+<?php
+namespace wcf\system\page\handler;
+use wcf\data\page\Page;
+use wcf\data\user\online\UserOnline;
+
+/**
+ * Interface for pages supporting online location.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2016 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.page.handler
+ * @category Community Framework
+ * @since 2.2
+ */
+interface IOnlineLocationPageHandler {
+ /**
+ * Returns the textual description if a user is currently online viewing this page.
+ *
+ * @param Page $page visited page
+ * @param UserOnline $user user online object with request data
+ * @return string
+ */
+ public function getOnlineLocation(Page $page, UserOnline $user);
+
+ /**
+ * Prepares fetching all necessary data for the textual description if a user is currently online
+ * viewing this page.
+ *
+ * @param Page $page visited page
+ * @param UserOnline $user user online object with request data
+ */
+ public function prepareOnlineLocation(Page $page, UserOnline $user);
+}
--- /dev/null
+<?php
+namespace wcf\system\page\handler;
+use wcf\data\page\Page;
+use wcf\data\user\online\UserOnline;
+
+/**
+ * Default implementation of the interface for pages supporting online location.
+ *
+ * It is highly recommended to use this trait in any case to achieve better upwards-compatibility
+ * in case of interface changes.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2016 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package com.woltlab.wcf
+ * @subpackage system.page.handler
+ * @category Community Framework
+ * @since 2.2
+ */
+trait TOnlineLocationPageHandler {
+ /**
+ * @see IOnlineLocationPageHandler::getOnlineLocation()
+ */
+ public function getOnlineLocation(Page $page, UserOnline $user) {
+ return '';
+ }
+
+ /**
+ * @see IOnlineLocationPageHandler::prepareOnlineLocation()
+ */
+ public function prepareOnlineLocation(Page $page, UserOnline $user) {
+ // does nothing
+ }
+}
\ No newline at end of file
--- /dev/null
+<?php
+namespace wcf\system\page\handler;
+use wcf\data\page\Page;
+use wcf\data\user\online\UserOnline;
+use wcf\system\cache\runtime\UserRuntimeCache;
+use wcf\system\WCF;
+
+/**
+ * Menu page handler for the user profile page.
+ *
+ * @author Matthias Schmidt
+ * @copyright 2001-2016 WoltLab GmbH
+ * @license WoltLab License <http://www.woltlab.com/license-agreement.html>
+ * @package com.woltlab.wbb
+ * @subpackage system.page.handler
+ * @category Burning Board
+ * @since 2.2
+ */
+class UserPageHandler extends AbstractMenuPageHandler implements IOnlineLocationPageHandler {
+ use TOnlineLocationPageHandler;
+
+ /**
+ * @inheritDoc
+ */
+ public function getOnlineLocation(Page $page, UserOnline $user) {
+ if ($user->objectID === null) {
+ return '';
+ }
+
+ $visitedUser = UserRuntimeCache::getInstance()->getObject($user->objectID);
+ if ($visitedUser === null) {
+ return '';
+ }
+
+ return WCF::getLanguage()->getDynamicVariable('wcf.page.onlineLocation.'.$page->identifier, ['user' => $visitedUser]);
+ }
+
+ /**
+ * @inheritDoc
+ */
+ public function prepareOnlineLocation(Page $page, UserOnline $user) {
+ if ($user->objectID !== null) {
+ UserRuntimeCache::getInstance()->cacheObjectID($user->objectID);
+ }
+ }
+}
* @package com.woltlab.wcf
* @subpackage system.user.online.location
* @category Community Framework
+ * @deprecated since 2.2
*/
interface IUserOnlineLocation {
/**
* @package com.woltlab.wcf
* @subpackage system.user.online.location
* @category Community Framework
+ * @deprecated since 2.2
*/
class UserLocation implements IUserOnlineLocation {
/**
<?php
namespace wcf\system\user\online\location;
-use wcf\data\object\type\ObjectTypeCache;
+use wcf\data\page\PageCache;
use wcf\data\user\online\UserOnline;
+use wcf\system\page\handler\IOnlineLocationPageHandler;
use wcf\system\SingletonFactory;
-use wcf\system\WCF;
/**
* Handles user online locations.
*
- * @author Marcel Werk
- * @copyright 2001-2015 WoltLab GmbH
+ * @author Matthias Schmidt
+ * @copyright 2001-2016 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package com.woltlab.wcf
* @subpackage system.user.online.location
* @category Community Framework
+ * @deprecated since 2.2
*/
class UserOnlineLocationHandler extends SingletonFactory {
/**
- * page locations
- * @var array
- */
- public $locations = array();
-
- /**
- * @see \wcf\system\SingletonFactory::init()
- */
- protected function init() {
- // load locations
- foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.user.online.location') as $objectType) {
- $this->locations[$objectType->controller] = $objectType;
- }
- }
-
- /**
- * Gets the location of a given user.
+ * Returns the location of the given user.
*
- * @param \wcf\data\user\online\UserOnline $user
+ * @param UserOnline $user
* @return string
*/
public function getLocation(UserOnline $user) {
- if (isset($this->locations[$user->controller])) {
- if ($this->locations[$user->controller]->getProcessor()) {
- $this->locations[$user->controller]->getProcessor()->cache($user);
- return $this->locations[$user->controller]->getProcessor()->get($user, $this->locations[$user->controller]->languagevariable);
- }
- else {
- return WCF::getLanguage()->get($this->locations[$user->controller]->languagevariable);
- }
- }
+ $oldLocation = $user->getLocation();
+ $user->setLocation();
+ $newLocation = $user->getLocation();
+ $user->setLocation($oldLocation);
- return '';
+ return $newLocation;
}
}
<item name="wcf.page.com.woltlab.wcf.TeamPage"><![CDATA[Team-Mitglieder]]></item>
<item name="wcf.page.com.woltlab.wcf.UserPage"><![CDATA[Benutzerprofil]]></item>
<item name="wcf.page.com.woltlab.wcf.UsersOnlineListPage"><![CDATA[Benutzer online]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.User"><![CDATA[Benutzerprofil von <a href="{link controller='User' object=$user}{/link}" class="userLink" data-user-id="{@$user->userID}">{$user->username}</a>]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.UsersOnlineList"><![CDATA[Benutzer-Online-Liste]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.MembersList"><![CDATA[Mitgliederliste]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.Team"><![CDATA[Liste der Team-Mitglieder]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.Dashboard"><![CDATA[Dashboard]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.Register"><![CDATA[Registrierung]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.LostPassword"><![CDATA[Kennwort vergessen]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.Login"><![CDATA[Anmeldung]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.AccountManagement"><![CDATA[Benutzerkonto-Verwaltung]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.AvatarEdit"><![CDATA[Avatar-Verwaltung]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.Settings"><![CDATA[Einstellungen]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.SignatureEdit"><![CDATA[Signatur-Verwaltung]]></item>
</category>
<category name="wcf.paidSubscription">
{/if}]]></item>
<item name="wcf.user.usersOnline.invisible"><![CDATA[ (unsichtbar)]]></item>
<item name="wcf.user.usersOnline.marking.legend"><![CDATA[Legende]]></item>
- <item name="wcf.user.usersOnline.location.UserPage"><![CDATA[Betrachtet das Benutzerprofil von <a href="{link controller='User' object=$user}{/link}" class="userLink" data-user-id="{@$user->userID}">{$user->username}</a>]]></item>
- <item name="wcf.user.usersOnline.location.UsersOnlineListPage"><![CDATA[Betrachtet die Benutzer-Online-Liste]]></item>
- <item name="wcf.user.usersOnline.location.MembersListPage"><![CDATA[Betrachtet die Mitgliederliste]]></item>
- <item name="wcf.user.usersOnline.location.TeamPage"><![CDATA[Betrachtet die Liste der Team-Mitglieder]]></item>
- <item name="wcf.user.usersOnline.location.DashboardPage"><![CDATA[Betrachtet das Dashboard]]></item>
- <item name="wcf.user.usersOnline.location.RegisterForm"><![CDATA[Führt die Registrierung durch]]></item>
- <item name="wcf.user.usersOnline.location.LostPasswordForm"><![CDATA[Fordert ein neues Kennwort an]]></item>
- <item name="wcf.user.usersOnline.location.LoginForm"><![CDATA[Führt die Anmeldung durch]]></item>
- <item name="wcf.user.usersOnline.location.AccountManagementForm"><![CDATA[Verwaltet das Benutzerkonto]]></item>
- <item name="wcf.user.usersOnline.location.AvatarEditForm"><![CDATA[Verwaltet den Avatar]]></item>
- <item name="wcf.user.usersOnline.location.SettingsForm"><![CDATA[Passt Einstellungen an]]></item>
- <item name="wcf.user.usersOnline.location.SignatureEditForm"><![CDATA[Bearbeitet die Signatur]]></item>
<item name="wcf.user.usersOnline.guests"><![CDATA[Gäste]]></item>
<item name="wcf.user.usersOnline.location"><![CDATA[Ort]]></item>
<item name="wcf.user.usersOnline.ipAddress"><![CDATA[IP-Adresse]]></item>
<item name="wcf.page.com.woltlab.wcf.TeamPage"><![CDATA[Staff Members]]></item>
<item name="wcf.page.com.woltlab.wcf.UserPage"><![CDATA[User Profile]]></item>
<item name="wcf.page.com.woltlab.wcf.UsersOnlineListPage"><![CDATA[Users Online]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.User"><![CDATA[User profile of <a href="{link controller='User' object=$user}{/link}" class="userLink" data-user-id="{@$user->userID}">{$user->username}</a>]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.UsersOnlineList"><![CDATA[List of Users Online]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.MembersList"><![CDATA[Members List]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.Team"><![CDATA[List of Staff Members]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.Dashboard"><![CDATA[Dashboard]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.Register"><![CDATA[Registration]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.LostPassword"><![CDATA[Lost Password]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.Login"><![CDATA[Login]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.AccountManagement"><![CDATA[Account Management]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.AvatarEdit"><![CDATA[Avatar Management]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.Settings"><![CDATA[Settings]]></item>
+ <item name="wcf.page.onlineLocation.com.woltlab.wcf.SignatureEdit"><![CDATA[Signature Management]]></item>
</category>
<category name="wcf.paidSubscription">
{/if}]]></item>
<item name="wcf.user.usersOnline.invisible"><![CDATA[ (invisible)]]></item>
<item name="wcf.user.usersOnline.marking.legend"><![CDATA[Legend]]></item>
- <item name="wcf.user.usersOnline.location.UserPage"><![CDATA[Viewing user profile <a href="{link controller='User' object=$user}{/link}" class="userLink" data-user-id="{@$user->userID}">{$user->username}</a>]]></item>
- <item name="wcf.user.usersOnline.location.UsersOnlineListPage"><![CDATA[Viewing users online]]></item>
- <item name="wcf.user.usersOnline.location.MembersListPage"><![CDATA[Viewing members list]]></item>
- <item name="wcf.user.usersOnline.location.TeamPage"><![CDATA[Viewing list of staff members]]></item>
- <item name="wcf.user.usersOnline.location.DashboardPage"><![CDATA[Viewing dashboard]]></item>
- <item name="wcf.user.usersOnline.location.RegisterForm"><![CDATA[Registering themself]]></item>
- <item name="wcf.user.usersOnline.location.LostPasswordForm"><![CDATA[Requesting a new password]]></item>
- <item name="wcf.user.usersOnline.location.LoginForm"><![CDATA[Logins themself]]></item>
- <item name="wcf.user.usersOnline.location.AccountManagementForm"><![CDATA[Managing their account]]></item>
- <item name="wcf.user.usersOnline.location.AvatarEditForm"><![CDATA[Editing their avatar]]></item>
- <item name="wcf.user.usersOnline.location.SettingsForm"><![CDATA[Editing their settings]]></item>
- <item name="wcf.user.usersOnline.location.SignatureEditForm"><![CDATA[Editing their signature]]></item>
<item name="wcf.user.usersOnline.guests"><![CDATA[Guests]]></item>
<item name="wcf.user.usersOnline.location"><![CDATA[Location]]></item>
<item name="wcf.user.usersOnline.ipAddress"><![CDATA[IP Address]]></item>