Index: trunk/phase3/includes/ChangesList.php |
— | — | @@ -139,8 +139,8 @@ |
140 | 140 | # Diff |
141 | 141 | $s .= '(' . $this->message['diff'] . ') ('; |
142 | 142 | # Hist |
143 | | - $s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'], 'action=history' ) . |
144 | | - ') . . '; |
| 143 | + $s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'], |
| 144 | + 'action=history' ) . ') . . '; |
145 | 145 | # "[[x]] moved to [[y]]" |
146 | 146 | $msg = ( $rc->mAttribs['rc_type'] == RC_MOVE ) ? '1movedto2' : '1movedto2_redir'; |
147 | 147 | $s .= wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ), |
— | — | @@ -168,13 +168,12 @@ |
169 | 169 | |
170 | 170 | protected function insertDiffHist( &$s, &$rc, $unpatrolled ) { |
171 | 171 | # Diff link |
172 | | - if( !$this->userCan($rc,Revision::DELETED_TEXT) ) { |
| 172 | + if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) { |
173 | 173 | $diffLink = $this->message['diff']; |
174 | | - } else if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) { |
| 174 | + } else if( !$this->userCan($rc,Revision::DELETED_TEXT) ) { |
175 | 175 | $diffLink = $this->message['diff']; |
176 | 176 | } else { |
177 | | - $rcidparam = $unpatrolled ? |
178 | | - array( 'rcid' => $rc->mAttribs['rc_id'] ) : array(); |
| 177 | + $rcidparam = $unpatrolled ? array( 'rcid' => $rc->mAttribs['rc_id'] ) : array(); |
179 | 178 | $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'], |
180 | 179 | wfArrayToCGI( array( |
181 | 180 | 'curid' => $rc->mAttribs['rc_cur_id'], |
— | — | @@ -224,7 +223,7 @@ |
225 | 224 | |
226 | 225 | /** Insert links to user page, user talk page and eventually a blocking link */ |
227 | 226 | public function insertUserRelatedLinks(&$s, &$rc) { |
228 | | - if ( $this->isDeleted($rc,Revision::DELETED_USER) ) { |
| 227 | + if( $this->isDeleted($rc,Revision::DELETED_USER) ) { |
229 | 228 | $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>'; |
230 | 229 | } else { |
231 | 230 | $s .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] ); |
— | — | @@ -234,13 +233,11 @@ |
235 | 234 | |
236 | 235 | /** insert a formatted action */ |
237 | 236 | protected function insertAction(&$s, &$rc) { |
238 | | - # Add action |
239 | 237 | if( $rc->mAttribs['rc_type'] == RC_LOG ) { |
240 | | - // log action |
241 | | - if ( $this->isDeleted($rc,LogPage::DELETED_ACTION) ) { |
| 238 | + if( $this->isDeleted($rc,LogPage::DELETED_ACTION) ) { |
242 | 239 | $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>'; |
243 | 240 | } else { |
244 | | - $s .= ' ' . LogPage::actionText( $rc->mAttribs['rc_log_type'], $rc->mAttribs['rc_log_action'], |
| 241 | + $s .= ' '.LogPage::actionText( $rc->mAttribs['rc_log_type'], $rc->mAttribs['rc_log_action'], |
245 | 242 | $rc->getTitle(), $this->skin, LogPage::extractParams($rc->mAttribs['rc_params']), true, true ); |
246 | 243 | } |
247 | 244 | } |
— | — | @@ -248,10 +245,8 @@ |
249 | 246 | |
250 | 247 | /** insert a formatted comment */ |
251 | 248 | protected function insertComment(&$s, &$rc) { |
252 | | - # Add comment |
253 | 249 | if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) { |
254 | | - // log comment |
255 | | - if ( $this->isDeleted($rc,Revision::DELETED_COMMENT) ) { |
| 250 | + if( $this->isDeleted($rc,Revision::DELETED_COMMENT) ) { |
256 | 251 | $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span>'; |
257 | 252 | } else { |
258 | 253 | $s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() ); |
— | — | @@ -274,8 +269,8 @@ |
275 | 270 | protected function numberofWatchingusers( $count ) { |
276 | 271 | global $wgLang; |
277 | 272 | static $cache = array(); |
278 | | - if ( $count > 0 ) { |
279 | | - if ( !isset( $cache[$count] ) ) { |
| 273 | + if( $count > 0 ) { |
| 274 | + if( !isset( $cache[$count] ) ) { |
280 | 275 | $cache[$count] = wfMsgExt('number_of_watching_users_RCview', |
281 | 276 | array('parsemag', 'escape'), $wgLang->formatNum($count)); |
282 | 277 | } |
— | — | @@ -317,7 +312,6 @@ |
318 | 313 | |
319 | 314 | protected function maybeWatchedLink( $link, $watched=false ) { |
320 | 315 | if( $watched ) { |
321 | | - // FIXME: css style might be more appropriate |
322 | 316 | return '<strong class="mw-watched">' . $link . '</strong>'; |
323 | 317 | } else { |
324 | 318 | return '<span class="mw-rc-unwatched">' . $link . '</span>'; |
— | — | @@ -335,48 +329,40 @@ |
336 | 330 | */ |
337 | 331 | public function recentChangesLine( &$rc, $watched = false ) { |
338 | 332 | global $wgContLang, $wgRCShowChangedSize, $wgUser; |
339 | | - |
340 | 333 | wfProfileIn( __METHOD__ ); |
341 | | - |
342 | | - # Extract DB fields into local scope |
343 | | - // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables. |
344 | | - extract( $rc->mAttribs ); |
345 | | - |
346 | 334 | # Should patrol-related stuff be shown? |
347 | | - $unpatrolled = $wgUser->useRCPatrol() && $rc_patrolled == 0; |
| 335 | + $unpatrolled = $wgUser->useRCPatrol() && !$rc->mAttribs['rc_patrolled']; |
348 | 336 | |
349 | | - $dateheader = ""; // $s now contains only <li>...</li>, for hooks' convenience. |
350 | | - $this->insertDateHeader($dateheader,$rc_timestamp); |
| 337 | + $dateheader = ''; // $s now contains only <li>...</li>, for hooks' convenience. |
| 338 | + $this->insertDateHeader( $dateheader, $rc->mAttribs['rc_timestamp'] ); |
351 | 339 | |
352 | 340 | $s = ''; |
353 | | - |
354 | 341 | // Moved pages |
355 | | - if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) { |
| 342 | + if( $rc->mAttribs['rc_type'] == RC_MOVE || $rc->mAttribs['rc_type'] == RC_MOVE_OVER_REDIRECT ) { |
356 | 343 | $this->insertMove( $s, $rc ); |
357 | 344 | // Log entries |
358 | | - } elseif( $rc_log_type ) { |
359 | | - $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL ); |
360 | | - $this->insertLog( $s, $logtitle, $rc_log_type ); |
| 345 | + } elseif( $rc->mAttribs['rc_log_type'] ) { |
| 346 | + $logtitle = Title::newFromText( 'Log/'.$rc->mAttribs['rc_log_type'], NS_SPECIAL ); |
| 347 | + $this->insertLog( $s, $logtitle, $rc->mAttribs['rc_log_type'] ); |
361 | 348 | // Log entries (old format) or log targets, and special pages |
362 | | - } elseif( $rc_namespace == NS_SPECIAL ) { |
363 | | - list( $specialName, $specialSubpage ) = SpecialPage::resolveAliasWithSubpage( $rc_title ); |
364 | | - if ( $specialName == 'Log' ) { |
365 | | - $this->insertLog( $s, $rc->getTitle(), $specialSubpage ); |
366 | | - } else { |
367 | | - wfDebug( "Unexpected special page in recentchanges\n" ); |
| 349 | + } elseif( $rc->mAttribs['rc_namespace'] == NS_SPECIAL ) { |
| 350 | + list( $name, $subpage ) = SpecialPage::resolveAliasWithSubpage( $rc->mAttribs['rc_title'] ); |
| 351 | + if( $name == 'Log' ) { |
| 352 | + $this->insertLog( $s, $rc->getTitle(), $subpage ); |
368 | 353 | } |
369 | 354 | // Regular entries |
370 | 355 | } else { |
371 | | - $this->insertDiffHist($s, $rc, $unpatrolled); |
| 356 | + $this->insertDiffHist( $s, $rc, $unpatrolled ); |
372 | 357 | # M, N, b and ! (minor, new, bot and unpatrolled) |
373 | | - $s .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '', $rc_bot ); |
374 | | - $this->insertArticleLink($s, $rc, $unpatrolled, $watched); |
| 358 | + $s .= $this->recentChangesFlags( $rc->mAttribs['rc_new'], $rc->mAttribs['rc_minor'], |
| 359 | + $unpatrolled, '', $rc->mAttribs['rc_bot'] ); |
| 360 | + $this->insertArticleLink( $s, $rc, $unpatrolled, $watched ); |
375 | 361 | } |
376 | | - |
377 | | - $this->insertTimestamp($s,$rc); |
378 | | - |
379 | | - if( $wgRCShowChangedSize ) { |
380 | | - $s .= ( $rc->getCharacterDifference() == '' ? '' : $rc->getCharacterDifference() . ' . . ' ); |
| 362 | + # Edit/log timestamp |
| 363 | + $this->insertTimestamp( $s, $rc ); |
| 364 | + # Bytes added or removed |
| 365 | + if( $wgRCShowChangedSize && ($cd = $rc->getCharacterDifference()) ) { |
| 366 | + $s .= "$cd . . "; |
381 | 367 | } |
382 | 368 | # User tool links |
383 | 369 | $this->insertUserRelatedLinks($s,$rc); |
— | — | @@ -384,29 +370,28 @@ |
385 | 371 | $this->insertAction($s, $rc); |
386 | 372 | # Edit or log comment |
387 | 373 | $this->insertComment($s, $rc); |
388 | | - |
389 | 374 | # Mark revision as deleted if so |
390 | | - if ( !$rc_log_type && $this->isDeleted($rc,Revision::DELETED_TEXT) ) |
| 375 | + if( !$rc->mAttribs['rc_log_type'] && $this->isDeleted($rc,Revision::DELETED_TEXT) ) { |
391 | 376 | $s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>'; |
392 | | - if($rc->numberofWatchingusers > 0) { |
393 | | - $s .= ' ' . wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rc->numberofWatchingusers)); |
394 | 377 | } |
| 378 | + # How many users watch this page |
| 379 | + if( $rc->numberofWatchingusers > 0 ) { |
| 380 | + $s .= ' ' . wfMsg( 'number_of_watching_users_RCview', |
| 381 | + $wgContLang->formatNum($rc->numberofWatchingusers) ); |
| 382 | + } |
395 | 383 | |
396 | 384 | wfRunHooks( 'OldChangesListRecentChangesLine', array(&$this, &$s, $rc) ); |
397 | | - |
398 | | - $s = "<li>$s</li>\n"; |
399 | 385 | |
400 | 386 | wfProfileOut( __METHOD__ ); |
401 | | - return $dateheader . $s; |
| 387 | + return "$dateheader<li>$s</li>\n"; |
402 | 388 | } |
403 | 389 | } |
404 | 390 | |
405 | 391 | |
406 | 392 | /** |
407 | | - * Generate a list of changes using an Enhanced system (use javascript). |
| 393 | + * Generate a list of changes using an Enhanced system (uses javascript). |
408 | 394 | */ |
409 | 395 | class EnhancedChangesList extends ChangesList { |
410 | | - |
411 | 396 | /** |
412 | 397 | * Add the JavaScript file for enhanced changeslist |
413 | 398 | * @ return string |