Add $wgRCMaxAge to the message 'activeusers-count' because people are asking "how...
authorRaimond Spekking <raymond@users.mediawiki.org>
Fri, 18 Sep 2009 21:50:10 +0000 (21:50 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Fri, 18 Sep 2009 21:50:10 +0000 (21:50 +0000)
FormatNum/CommaList for some expressions
Simplify getPageHeader(), use more Xml/Html::functions.

includes/specials/SpecialActiveusers.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php

index 1a315e3..5960eed 100644 (file)
@@ -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 "<li>{$item} [{$count}]{$blocked}</li>";
+               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 ) ) .
-                       '<fieldset>' .
-                       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 .= '</fieldset>' . 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 .= '<ul>' . $usersbody . '</ul>';
+                       $s .= Html::rawElement( 'ul', array(), $usersbody );
                        $s .= $up->getNavigationBar();
                } else {
-                       $s .= '<p>' . wfMsgHtml( 'activeusers-noresult' ) . '</p>';
+                       $s .= Html::element( 'p', array(), wfMsg( 'activeusers-noresult' ) );
                }
 
                $wgOut->addHTML( $s );
index 91aa199..15d983e 100644 (file)
@@ -2516,7 +2516,7 @@ Supported protocols: <tt>$1</tt>',
 # 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.',
 
index fdb4375..8712f9a 100644 (file)
@@ -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}}',