Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -585,7 +585,6 @@ |
586 | 586 | |
587 | 587 | # includes/specials |
588 | 588 | 'SpecialAllmessages' => 'includes/specials/SpecialAllmessages.php', |
589 | | - 'ActiveUsersPager' => 'includes/specials/SpecialActiveusers.php', |
590 | 589 | 'AllmessagesTablePager' => 'includes/specials/SpecialAllmessages.php', |
591 | 590 | 'AncientPagesPage' => 'includes/specials/SpecialAncientpages.php', |
592 | 591 | '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 | | - * |
| 263 | + * Also called by SpecialActiveUsers |
264 | 264 | * @param $group String: group name |
265 | 265 | * @return string |
266 | 266 | */ |
267 | | - protected static function buildGroupLink( $group ) { |
| 267 | + public 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 ActiveUsersPager extends UsersPager { |
| 34 | +class SpecialActiveUsers extends QueryPage { |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * @var FormOptions |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | |
58 | 58 | $this->setupOptions(); |
59 | 59 | |
60 | | - parent::__construct(); |
| 60 | + parent::__construct( 'Activeusers' ); |
61 | 61 | } |
62 | 62 | |
63 | 63 | public function setupOptions() { |
— | — | @@ -66,6 +66,8 @@ |
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 ); |
70 | 72 | |
71 | 73 | $this->opts->fetchValuesFromRequest( $wgRequest ); |
72 | 74 | |
— | — | @@ -78,8 +80,8 @@ |
79 | 81 | } |
80 | 82 | } |
81 | 83 | |
82 | | - function getIndexField() { |
83 | | - return 'rc_user_text'; |
| 84 | + function getOrderFields() { |
| 85 | + return array( 'rc_user_text', 'user_id' ); |
84 | 86 | } |
85 | 87 | |
86 | 88 | function getQueryInfo() { |
— | — | @@ -114,19 +116,23 @@ |
115 | 117 | return $query; |
116 | 118 | } |
117 | 119 | |
118 | | - function formatRow( $row ) { |
| 120 | + function formatResult( $skin, $row ) { |
119 | 121 | global $wgLang; |
120 | 122 | $userName = $row->user_name; |
121 | 123 | |
122 | | - $ulinks = $this->getSkin()->userLink( $row->user_id, $userName ); |
123 | | - $ulinks .= $this->getSkin()->userToolLinks( $row->user_id, $userName ); |
| 124 | + $ulinks = $skin->userLink( $row->user_id, $userName ); |
| 125 | + $ulinks .= $skin->userToolLinks( $row->user_id, $userName ); |
124 | 126 | |
125 | 127 | $list = array(); |
126 | | - foreach( self::getGroups( $row->user_id ) as $group ) { |
| 128 | + $user = User::newFromId( $row->user_id ); |
| 129 | + foreach( $user->getEffectiveGroups() as $group ) { |
127 | 130 | if ( isset( $this->groups[$group] ) ) { |
128 | | - return; |
| 131 | + return false; |
129 | 132 | } |
130 | | - $list[] = self::buildGroupLink( $group ); |
| 133 | + if( in_array( $group, array( '*', 'user' ) ) ){ |
| 134 | + continue; |
| 135 | + } |
| 136 | + $list[] = SpecialListUsers::buildGroupLink( $group ); |
131 | 137 | } |
132 | 138 | $groups = $wgLang->commaList( $list ); |
133 | 139 | |
— | — | @@ -139,18 +145,35 @@ |
140 | 146 | ); |
141 | 147 | $blocked = $row->blocked ? ' ' . wfMsgExt( 'listusers-blocked', array( 'parsemag' ), $userName ) : ''; |
142 | 148 | |
143 | | - return Html::rawElement( 'li', array(), "{$item} [{$count}]{$blocked}" ); |
| 149 | + return "{$item} [{$count}]{$blocked}"; |
144 | 150 | } |
145 | 151 | |
| 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 | + |
146 | 160 | function getPageHeader() { |
147 | | - global $wgScript; |
| 161 | + global $wgScript, $wgActiveUserDays, $wgLang; |
148 | 162 | |
149 | 163 | $self = $this->getTitle(); |
150 | | - $limit = $this->mLimit ? Html::hidden( 'limit', $this->mLimit ) : ''; |
| 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 | + : ''; |
151 | 170 | |
152 | | - $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); # Form tag |
| 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 |
153 | 176 | $out .= Xml::fieldset( wfMsg( 'activeusers' ) ) . "\n"; |
154 | | - $out .= Html::hidden( 'title', $self->getPrefixedDBkey() ) . $limit . "\n"; |
| 177 | + $out .= Html::hidden( 'title', $self->getPrefixedDBkey() ) . $limit . $offset . "\n"; |
155 | 178 | |
156 | 179 | $out .= Xml::inputLabel( wfMsg( 'activeusers-from' ), 'username', 'offset', 20, $this->requestedUser ) . '<br />';# Username field |
157 | 180 | |
— | — | @@ -164,50 +187,4 @@ |
165 | 188 | |
166 | 189 | return $out; |
167 | 190 | } |
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 | | -} |
| 191 | +} |
\ No newline at end of file |