Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -605,6 +605,7 @@ |
606 | 606 | |
607 | 607 | # includes/specials |
608 | 608 | 'SpecialAllmessages' => 'includes/specials/SpecialAllmessages.php', |
| 609 | + 'ActiveUsersPager' => 'includes/specials/SpecialActiveusers.php', |
609 | 610 | 'AllmessagesTablePager' => 'includes/specials/SpecialAllmessages.php', |
610 | 611 | 'AncientPagesPage' => 'includes/specials/SpecialAncientpages.php', |
611 | 612 | 'BrokenRedirectsPage' => 'includes/specials/SpecialBrokenRedirects.php', |
Index: trunk/phase3/includes/specials/SpecialListusers.php |
— | — | @@ -259,11 +259,11 @@ |
260 | 260 | |
261 | 261 | /** |
262 | 262 | * Format a link to a group description page |
263 | | - * Also called by SpecialActiveUsers |
| 263 | + * |
264 | 264 | * @param $group String: group name |
265 | 265 | * @return string |
266 | 266 | */ |
267 | | - public static function buildGroupLink( $group ) { |
| 267 | + protected static function buildGroupLink( $group ) { |
268 | 268 | static $cache = array(); |
269 | 269 | if( !isset( $cache[$group] ) ) |
270 | 270 | $cache[$group] = User::makeGroupLinkHtml( $group, htmlspecialchars( User::getGroupMember( $group ) ) ); |
Index: trunk/phase3/includes/specials/SpecialActiveusers.php |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | * |
32 | 32 | * @ingroup SpecialPage |
33 | 33 | */ |
34 | | -class SpecialActiveUsers extends QueryPage { |
| 34 | +class ActiveUsersPager extends UsersPager { |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @var FormOptions |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | |
58 | 58 | $this->setupOptions(); |
59 | 59 | |
60 | | - parent::__construct( 'Activeusers' ); |
| 60 | + parent::__construct(); |
61 | 61 | } |
62 | 62 | |
63 | 63 | public function setupOptions() { |
— | — | @@ -66,8 +66,6 @@ |
67 | 67 | |
68 | 68 | $this->opts->add( 'hidebots', false, FormOptions::BOOL ); |
69 | 69 | $this->opts->add( 'hidesysops', false, FormOptions::BOOL ); |
70 | | - $this->opts->add( 'limit', 0, FormOptions::INT ); |
71 | | - $this->opts->add( 'offset', 0, FormOptions::INT ); |
72 | 70 | |
73 | 71 | $this->opts->fetchValuesFromRequest( $wgRequest ); |
74 | 72 | |
— | — | @@ -80,8 +78,8 @@ |
81 | 79 | } |
82 | 80 | } |
83 | 81 | |
84 | | - function getOrderFields() { |
85 | | - return array( 'rc_user_text', 'user_id' ); |
| 82 | + function getIndexField() { |
| 83 | + return 'rc_user_text'; |
86 | 84 | } |
87 | 85 | |
88 | 86 | function getQueryInfo() { |
— | — | @@ -116,23 +114,19 @@ |
117 | 115 | return $query; |
118 | 116 | } |
119 | 117 | |
120 | | - function formatResult( $skin, $row ) { |
| 118 | + function formatRow( $row ) { |
121 | 119 | global $wgLang; |
122 | 120 | $userName = $row->user_name; |
123 | 121 | |
124 | | - $ulinks = $skin->userLink( $row->user_id, $userName ); |
125 | | - $ulinks .= $skin->userToolLinks( $row->user_id, $userName ); |
| 122 | + $ulinks = $this->getSkin()->userLink( $row->user_id, $userName ); |
| 123 | + $ulinks .= $this->getSkin()->userToolLinks( $row->user_id, $userName ); |
126 | 124 | |
127 | 125 | $list = array(); |
128 | | - $user = User::newFromId( $row->user_id ); |
129 | | - foreach( $user->getEffectiveGroups() as $group ) { |
| 126 | + foreach( self::getGroups( $row->user_id ) as $group ) { |
130 | 127 | if ( isset( $this->groups[$group] ) ) { |
131 | | - return false; |
| 128 | + return; |
132 | 129 | } |
133 | | - if( in_array( $group, array( '*', 'user' ) ) ){ |
134 | | - continue; |
135 | | - } |
136 | | - $list[] = SpecialListUsers::buildGroupLink( $group ); |
| 130 | + $list[] = self::buildGroupLink( $group ); |
137 | 131 | } |
138 | 132 | $groups = $wgLang->commaList( $list ); |
139 | 133 | |
— | — | @@ -145,35 +139,18 @@ |
146 | 140 | ); |
147 | 141 | $blocked = $row->blocked ? ' ' . wfMsgExt( 'listusers-blocked', array( 'parsemag' ), $userName ) : ''; |
148 | 142 | |
149 | | - return "{$item} [{$count}]{$blocked}"; |
| 143 | + return Html::rawElement( 'li', array(), "{$item} [{$count}]{$blocked}" ); |
150 | 144 | } |
151 | 145 | |
152 | | - function linkParameters() { |
153 | | - return array( |
154 | | - 'hidebots' => isset( $this->groups['bot'] ), |
155 | | - 'hidesysops' => isset( $this->groups['sysop'] ), |
156 | | - 'username' => $this->requestedUser, |
157 | | - ); |
158 | | - } |
159 | | - |
160 | 146 | function getPageHeader() { |
161 | | - global $wgScript, $wgActiveUserDays, $wgLang; |
| 147 | + global $wgScript; |
162 | 148 | |
163 | 149 | $self = $this->getTitle(); |
164 | | - $limit = $this->opts->getValue( 'limit' ) |
165 | | - ? Html::hidden( 'limit', $this->opts->getValue( 'limit' ) ) |
166 | | - : ''; |
167 | | - $offset = $this->opts->getValue( 'offset' ) |
168 | | - ? Html::hidden( 'offset', $this->opts->getValue( 'offset' ) ) |
169 | | - : ''; |
| 150 | + $limit = $this->mLimit ? Html::hidden( 'limit', $this->mLimit ) : ''; |
170 | 151 | |
171 | | - $out = Html::rawElement( 'div', array( 'class' => 'mw-activeusers-intro' ), |
172 | | - wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $wgLang->formatNum( $wgActiveUserDays ) ) |
173 | | - ); |
174 | | - |
175 | | - $out .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); # Form tag |
| 152 | + $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); # Form tag |
176 | 153 | $out .= Xml::fieldset( wfMsg( 'activeusers' ) ) . "\n"; |
177 | | - $out .= Html::hidden( 'title', $self->getPrefixedDBkey() ) . $limit . $offset . "\n"; |
| 154 | + $out .= Html::hidden( 'title', $self->getPrefixedDBkey() ) . $limit . "\n"; |
178 | 155 | |
179 | 156 | $out .= Xml::inputLabel( wfMsg( 'activeusers-from' ), 'username', 'offset', 20, $this->requestedUser ) . '<br />';# Username field |
180 | 157 | |
— | — | @@ -188,3 +165,49 @@ |
189 | 166 | return $out; |
190 | 167 | } |
191 | 168 | } |
| 169 | + |
| 170 | +/** |
| 171 | + * @ingroup SpecialPage |
| 172 | + */ |
| 173 | +class SpecialActiveUsers extends SpecialPage { |
| 174 | + |
| 175 | + /** |
| 176 | + * Constructor |
| 177 | + */ |
| 178 | + public function __construct() { |
| 179 | + parent::__construct( 'Activeusers' ); |
| 180 | + } |
| 181 | + |
| 182 | + /** |
| 183 | + * Show the special page |
| 184 | + * |
| 185 | + * @param $par Mixed: parameter passed to the page or null |
| 186 | + */ |
| 187 | + public function execute( $par ) { |
| 188 | + global $wgOut, $wgLang, $wgActiveUserDays; |
| 189 | + |
| 190 | + $this->setHeaders(); |
| 191 | + $this->outputHeader(); |
| 192 | + |
| 193 | + $up = new ActiveUsersPager(); |
| 194 | + |
| 195 | + # getBody() first to check, if empty |
| 196 | + $usersbody = $up->getBody(); |
| 197 | + |
| 198 | + $s = Html::rawElement( 'div', array( 'class' => 'mw-activeusers-intro' ), |
| 199 | + wfMsgExt( 'activeusers-intro', array( 'parsemag', 'escape' ), $wgLang->formatNum( $wgActiveUserDays ) ) |
| 200 | + ); |
| 201 | + |
| 202 | + $s .= $up->getPageHeader(); |
| 203 | + if( $usersbody ) { |
| 204 | + $s .= $up->getNavigationBar(); |
| 205 | + $s .= Html::rawElement( 'ul', array(), $usersbody ); |
| 206 | + $s .= $up->getNavigationBar(); |
| 207 | + } else { |
| 208 | + $s .= Html::element( 'p', array(), wfMsg( 'activeusers-noresult' ) ); |
| 209 | + } |
| 210 | + |
| 211 | + $wgOut->addHTML( $s ); |
| 212 | + } |
| 213 | + |
| 214 | +} |