From d941458287d50048091966c61e1176da588693bc Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Fri, 18 Sep 2009 21:50:10 +0000 Subject: [PATCH] Add $wgRCMaxAge to the message 'activeusers-count' because people are asking "how long is 'recent'?" FormatNum/CommaList for some expressions Simplify getPageHeader(), use more Xml/Html::functions. --- includes/specials/SpecialActiveusers.php | 49 ++++++++++++------------ languages/messages/MessagesEn.php | 2 +- languages/messages/MessagesQqq.php | 3 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/includes/specials/SpecialActiveusers.php b/includes/specials/SpecialActiveusers.php index 1a315e3aeb..5960eed012 100644 --- a/includes/specials/SpecialActiveusers.php +++ b/includes/specials/SpecialActiveusers.php @@ -29,7 +29,9 @@ class ActiveUsersPager extends UsersPager { function __construct( $group = null ) { - global $wgRequest; + global $wgRequest, $wgRCMaxAge; + $this->RCMaxAge = ceil( $wgRCMaxAge / ( 3600 * 24 ) ); // Constant + $un = $wgRequest->getText( 'username' ); $this->requestedUser = ''; if ( $un != '' ) { @@ -76,6 +78,7 @@ class ActiveUsersPager extends UsersPager { } function formatRow( $row ) { + global $wgLang; $userName = $row->user_name; $userPage = Title::makeTitle( NS_USER, $userName ); $name = $this->getSkin()->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) ); @@ -83,37 +86,33 @@ class ActiveUsersPager extends UsersPager { $list = array(); foreach( self::getGroups( $row->user_id ) as $group ) $list[] = self::buildGroupLink( $group ); - $groups = implode( ', ', $list ); + $groups = $wgLang->commaList( $list ); $item = wfSpecialList( $name, $groups ); - $count = wfMsgExt( 'activeusers-count', array( 'parsemag' ), $row->recentedits, $userName ); + $count = wfMsgExt( 'activeusers-count', + array( 'parsemag' ), + $wgLang->formatNum( $row->recentedits ), + $userName, + $wgLang->formatNum ( $this->RCMaxAge ) + ); $blocked = $row->blocked ? ' ' . wfMsgExt( 'listusers-blocked', array( 'parsemag' ), $userName ) : ''; - return "
  • {$item} [{$count}]{$blocked}
  • "; + return Html::rawElement( 'li', array(), "{$item} [{$count}]{$blocked}" ); } function getPageHeader() { global $wgScript, $wgRequest; $self = $this->getTitle(); - - # Form tag - $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) . - '
    ' . - Xml::element( 'legend', array(), wfMsg( 'activeusers' ) ); - $out .= Xml::hidden( 'title', $self->getPrefixedDBkey() ); - - # Username field - $out .= Xml::label( wfMsg( 'activeusers-from' ), 'offset' ) . ' ' . - Xml::input( 'username', 20, $this->requestedUser, array( 'id' => 'offset' ) ) . ' '; - - # Submit button and form bottom - if( $this->mLimit ) - $out .= Xml::hidden( 'limit', $this->mLimit ); - $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ); - - $out .= '
    ' . Xml::closeElement( 'form' ); - - return $out; + $limit = $this->mLimit ? Xml::hidden( 'limit', $this->mLimit ) : ''; + + return Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ) . # Form tag + Xml::fieldset( wfMsg( 'activeusers' ) ) . "\n" . + Xml::hidden( 'title', $self->getPrefixedDBkey() ) . + $limit . "\n" . + Xml::inputLabel( wfMsg( 'activeusers-from' ), 'username', 'offset', 20, $this->requestedUser ) . ' ' . # Username field + Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .# Submit button and form bottom + Xml::closeElement( 'fieldset' ) . + Xml::closeElement( 'form' ); } } @@ -146,10 +145,10 @@ class SpecialActiveUsers extends SpecialPage { $s = $up->getPageHeader(); if( $usersbody ) { $s .= $up->getNavigationBar(); - $s .= ''; + $s .= Html::rawElement( 'ul', array(), $usersbody ); $s .= $up->getNavigationBar(); } else { - $s .= '

    ' . wfMsgHtml( 'activeusers-noresult' ) . '

    '; + $s .= Html::element( 'p', array(), wfMsg( 'activeusers-noresult' ) ); } $wgOut->addHTML( $s ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 91aa19940f..15d983e254 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2516,7 +2516,7 @@ Supported protocols: $1', # Special:ActiveUsers 'activeusers' => 'Active users list', 'activeusers-summary' => '', # do not translate or duplicate this message to other languages -'activeusers-count' => '$1 recent {{PLURAL:$1|edit|edits}}', +'activeusers-count' => '$1 {{PLURAL:$1|edit|edits}} in the last {{PLURAL:$3|day|$3 days}}', 'activeusers-from' => 'Display users starting at:', 'activeusers-noresult' => 'No users found.', diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index fdb4375184..8712f9a8e4 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -1911,7 +1911,8 @@ $1 is a page title", 'activeusers' => 'Title of [[Special:ActiveUsers]]', 'activeusers-count' => "Used in [[Special:ActiveUsers]] to show the active user's recent edit count in brackets ([]). * $1 is the number of recent edits -* $2 is the user's name for use with GENDER (optional)", +* $2 is the user's name for use with GENDER (optional) +* $3 is the maximum number of days of the RecentChangesList", 'activeusers-from' => 'identical with {{msg-mw|listusersfrom}}', 'activeusers-noresult' => 'identical with {{msg-mw|listusers-noresult}}', -- 2.20.1