23eeb7b5931136502b951fd897ed88917ab4e457
6 class RCCacheEntry
extends RecentChange
8 var $secureName, $link;
9 var $curlink , $difflink, $lastlink , $usertalklink , $versionlink ;
10 var $userlink, $timestamp, $watched;
12 static function newFromParent( $rc ) {
13 $rc2 = new RCCacheEntry
;
14 $rc2->mAttribs
= $rc->mAttribs
;
15 $rc2->mExtra
= $rc->mExtra
;
21 * Class to show various lists of changes:
27 # Called by history lists and recent changes
31 function __construct( &$skin ) {
33 $this->preCacheMessages();
37 * Fetch an appropriate changes list class for the specified user
38 * Some users might want to use an enhanced list format, for instance
40 * @param $user User to fetch the list class for
41 * @return ChangesList derivative
43 public static function newFromUser( &$user ) {
44 $sk = $user->getSkin();
46 if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) {
47 return $user->getOption( 'usenewrc' ) ?
new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
54 * As we use the same small set of messages in various methods and that
55 * they are called often, we call them once and save them in $this->message
57 function preCacheMessages() {
58 // Precache various messages
59 if( !isset( $this->message
) ) {
60 foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last '.
61 'blocklink history boteditletter semicolon-separator' ) as $msg ) {
62 $this->message
[$msg] = wfMsgExt( $msg, array( 'escape') );
69 * Returns the appropriate flags for new page, minor change and patrolling
71 function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ', $bot = false ) {
72 $f = $new ?
'<span class="newpage">' . $this->message
['newpageletter'] . '</span>'
74 $f .= $minor ?
'<span class="minor">' . $this->message
['minoreditletter'] . '</span>'
76 $f .= $bot ?
'<span class="bot">' . $this->message
['boteditletter'] . '</span>' : $nothing;
77 $f .= $patrolled ?
'<span class="unpatrolled">!</span>' : $nothing;
82 * Returns text for the start of the tabular part of RC
84 function beginRecentChangesList() {
85 $this->rc_cache
= array();
86 $this->rcMoveIndex
= 0;
87 $this->rcCacheIndex
= 0;
89 $this->rclistOpen
= false;
94 * Returns text for the end of RC
96 function endRecentChangesList() {
97 if( $this->rclistOpen
) {
105 * int $field one of DELETED_* bitfield constants
108 function isDeleted( $rc, $field ) {
109 return ($rc->mAttribs
['rc_deleted'] & $field) == $field;
113 * Determine if the current user is allowed to view a particular
114 * field of this revision, if it's marked as deleted.
118 function userCan( $rc, $field ) {
119 if( ( $rc->mAttribs
['rc_deleted'] & $field ) == $field ) {
121 $permission = ( $rc->mAttribs
['rc_deleted'] & Revision
::DELETED_RESTRICTED
) == Revision
::DELETED_RESTRICTED
124 wfDebug( "Checking for $permission due to $field match on $rc->mAttribs['rc_deleted']\n" );
125 return $wgUser->isAllowed( $permission );
131 function insertMove( &$s, $rc ) {
133 $s .= '(' . $this->message
['diff'] . ') (';
135 $s .= $this->skin
->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message
['hist'], 'action=history' ) .
138 # "[[x]] moved to [[y]]"
139 $msg = ( $rc->mAttribs
['rc_type'] == RC_MOVE
) ?
'1movedto2' : '1movedto2_redir';
140 $s .= wfMsg( $msg, $this->skin
->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
141 $this->skin
->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
144 function insertDateHeader(&$s, $rc_timestamp) {
147 # Make date header if necessary
148 $date = $wgLang->date( $rc_timestamp, true, true );
150 if( $date != $this->lastdate
) {
151 if( '' != $this->lastdate
) {
154 $s .= '<h4>'.$date."</h4>\n<ul class=\"special\">";
155 $this->lastdate
= $date;
156 $this->rclistOpen
= true;
160 function insertLog(&$s, $title, $logtype) {
161 $logname = LogPage
::logName( $logtype );
162 $s .= '(' . $this->skin
->makeKnownLinkObj($title, $logname ) . ')';
165 function insertDiffHist(&$s, &$rc, $unpatrolled) {
167 if( !$this->userCan($rc,Revision
::DELETED_TEXT
) ) {
168 $diffLink = $this->message
['diff'];
169 } else if( $rc->mAttribs
['rc_type'] == RC_NEW ||
$rc->mAttribs
['rc_type'] == RC_LOG
) {
170 $diffLink = $this->message
['diff'];
172 $rcidparam = $unpatrolled
173 ?
array( 'rcid' => $rc->mAttribs
['rc_id'] )
175 $diffLink = $this->skin
->makeKnownLinkObj( $rc->getTitle(), $this->message
['diff'],
177 'curid' => $rc->mAttribs
['rc_cur_id'],
178 'diff' => $rc->mAttribs
['rc_this_oldid'],
179 'oldid' => $rc->mAttribs
['rc_last_oldid'] ),
181 '', '', ' tabindex="'.$rc->counter
.'"');
183 $s .= '('.$diffLink.') (';
186 $s .= $this->skin
->makeKnownLinkObj( $rc->getTitle(), $this->message
['hist'],
188 'curid' => $rc->mAttribs
['rc_cur_id'],
189 'action' => 'history' ) ) );
193 function insertArticleLink(&$s, &$rc, $unpatrolled, $watched) {
195 # If it's a new article, there is no diff link, but if it hasn't been
196 # patrolled yet, we need to give users a way to do so
197 $params = ( $unpatrolled && $rc->mAttribs
['rc_type'] == RC_NEW
)
198 ?
'rcid='.$rc->mAttribs
['rc_id']
200 if( $this->isDeleted($rc,Revision
::DELETED_TEXT
) ) {
201 $articlelink = $this->skin
->makeKnownLinkObj( $rc->getTitle(), '', $params );
202 $articlelink = '<span class="history-deleted">'.$articlelink.'</span>';
204 $articlelink = ' '. $this->skin
->makeKnownLinkObj( $rc->getTitle(), '', $params );
207 $articlelink = "<strong class=\"mw-watched\">{$articlelink}</strong>";
209 $articlelink .= $wgContLang->getDirMark();
211 wfRunHooks('ChangesListInsertArticleLink',
212 array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched));
214 $s .= ' '.$articlelink;
217 function insertTimestamp(&$s, $rc) {
220 $s .= $this->message
['semicolon-separator'] . ' ' . $wgLang->time( $rc->mAttribs
['rc_timestamp'], true, true ) . ' . . ';
223 /** Insert links to user page, user talk page and eventually a blocking link */
224 function insertUserRelatedLinks(&$s, &$rc) {
225 if ( $this->isDeleted($rc,Revision
::DELETED_USER
) ) {
226 $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>';
228 $s .= $this->skin
->userLink( $rc->mAttribs
['rc_user'], $rc->mAttribs
['rc_user_text'] );
229 $s .= $this->skin
->userToolLinks( $rc->mAttribs
['rc_user'], $rc->mAttribs
['rc_user_text'] );
233 /** insert a formatted action */
234 function insertAction(&$s, &$rc) {
236 if( $rc->mAttribs
['rc_type'] == RC_LOG
) {
238 if ( $this->isDeleted($rc,LogPage
::DELETED_ACTION
) ) {
239 $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
241 $s .= ' ' . LogPage
::actionText( $rc->mAttribs
['rc_log_type'], $rc->mAttribs
['rc_log_action'],
242 $rc->getTitle(), $this->skin
, LogPage
::extractParams($rc->mAttribs
['rc_params']), true, true );
247 /** insert a formatted comment */
248 function insertComment(&$s, &$rc) {
250 if( $rc->mAttribs
['rc_type'] != RC_MOVE
&& $rc->mAttribs
['rc_type'] != RC_MOVE_OVER_REDIRECT
) {
252 if ( $this->isDeleted($rc,Revision
::DELETED_COMMENT
) ) {
253 $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span>';
255 $s .= $this->skin
->commentBlock( $rc->mAttribs
['rc_comment'], $rc->getTitle() );
261 * Check whether to enable recent changes patrol features
264 public static function usePatrol() {
265 global $wgUseRCPatrol, $wgUser;
266 return( $wgUseRCPatrol && ($wgUser->isAllowed('patrol') ||
$wgUser->isAllowed('patrolmarks')) );
270 * Returns the string which indicates the number of watching users
272 function numberofWatchingusers( $count ) {
274 static $cache = array();
276 if ( !isset( $cache[$count] ) ) {
277 $cache[$count] = wfMsgExt('number_of_watching_users_RCview',
278 array('parsemag', 'escape'), $wgLang->formatNum($count));
280 return $cache[$count];
289 * Generate a list of changes using the good old system (no javascript)
291 class OldChangesList
extends ChangesList
{
293 * Format a line using the old system (aka without any javascript).
295 function recentChangesLine( &$rc, $watched = false ) {
296 global $wgContLang, $wgRCShowChangedSize;
298 $fname = 'ChangesList::recentChangesLineOld';
299 wfProfileIn( $fname );
301 # Extract DB fields into local scope
302 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
303 extract( $rc->mAttribs
);
305 # Should patrol-related stuff be shown?
306 $unpatrolled = $this->usePatrol() && $rc_patrolled == 0;
308 $this->insertDateHeader($s,$rc_timestamp);
313 if( $rc_type == RC_MOVE ||
$rc_type == RC_MOVE_OVER_REDIRECT
) {
314 $this->insertMove( $s, $rc );
316 } elseif( $rc_log_type !='' ) {
317 $logtitle = Title
::newFromText( "Log/$rc_log_type", NS_SPECIAL
);
318 $this->insertLog( $s, $logtitle, $rc_log_type );
319 // Log entries (old format) or log targets, and special pages
320 } elseif( $rc_namespace == NS_SPECIAL
) {
321 list( $specialName, $specialSubpage ) = SpecialPage
::resolveAliasWithSubpage( $rc_title );
322 if ( $specialName == 'Log' ) {
323 $this->insertLog( $s, $rc->getTitle(), $specialSubpage );
325 wfDebug( "Unexpected special page in recentchanges\n" );
329 wfProfileIn($fname.'-page');
331 $this->insertDiffHist($s, $rc, $unpatrolled);
333 # M, N, b and ! (minor, new, bot and unpatrolled)
334 $s .= $this->recentChangesFlags( $rc_type == RC_NEW
, $rc_minor, $unpatrolled, '', $rc_bot );
335 $this->insertArticleLink($s, $rc, $unpatrolled, $watched);
337 wfProfileOut($fname.'-page');
340 wfProfileIn( $fname.'-rest' );
342 $this->insertTimestamp($s,$rc);
344 if( $wgRCShowChangedSize ) {
345 $s .= ( $rc->getCharacterDifference() == '' ?
'' : $rc->getCharacterDifference() . ' . . ' );
348 $this->insertUserRelatedLinks($s,$rc);
349 $this->insertAction($s, $rc);
350 $this->insertComment($s, $rc);
352 # Mark revision as deleted
353 if ( !$rc_log_type && $this->isDeleted($rc,Revision
::DELETED_TEXT
) )
354 $s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
355 if($rc->numberofWatchingusers
> 0) {
356 $s .= ' ' . wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rc->numberofWatchingusers
));
361 wfProfileOut( $fname.'-rest' );
363 wfProfileOut( $fname );
370 * Generate a list of changes using an Enhanced system (use javascript).
372 class EnhancedChangesList
extends ChangesList
{
374 * Format a line for enhanced recentchange (aka with javascript and block of lines).
376 function recentChangesLine( &$baseRC, $watched = false ) {
377 global $wgLang, $wgContLang;
379 # Create a specialised object
380 $rc = RCCacheEntry
::newFromParent( $baseRC );
382 # Extract fields from DB into the function scope (rc_xxxx variables)
383 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
384 extract( $rc->mAttribs
);
385 $curIdEq = 'curid=' . $rc_cur_id;
387 # If it's a new day, add the headline and flush the cache
388 $date = $wgLang->date( $rc_timestamp, true);
390 if( $date != $this->lastdate
) {
391 # Process current cache
392 $ret = $this->recentChangesBlock();
393 $this->rc_cache
= array();
394 $ret .= "<h4>{$date}</h4>\n";
395 $this->lastdate
= $date;
398 # Should patrol-related stuff be shown?
399 if( $this->usePatrol() ) {
400 $rc->unpatrolled
= !$rc_patrolled;
402 $rc->unpatrolled
= false;
405 $showdifflinks = true;
408 if( $rc_type == RC_MOVE ||
$rc_type == RC_MOVE_OVER_REDIRECT
) {
409 $msg = ( $rc_type == RC_MOVE
) ?
"1movedto2" : "1movedto2_redir";
410 $clink = wfMsg( $msg, $this->skin
->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
411 $this->skin
->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
412 // Log entries (old format) and special pages
413 } elseif( $rc_namespace == NS_SPECIAL
) {
414 list( $specialName, $logtype ) = SpecialPage
::resolveAliasWithSubpage( $rc_title );
415 if ( $specialName == 'Log' ) {
417 $logname = LogPage
::logName( $logtype );
418 $clink = '(' . $this->skin
->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
420 wfDebug( "Unexpected special page in recentchanges\n" );
423 // Page edits or log entries (group these page)
424 } else if( $this->isDeleted($rc,Revision
::DELETED_TEXT
) ) {
425 $clink = '<span class="history-deleted">' . $this->skin
->makeKnownLinkObj( $rc->getTitle(), '' ) . '</span>';
426 if ( !ChangesList
::userCan($rc,Revision
::DELETED_TEXT
) )
427 $showdifflinks = false;
428 } else if( $rc->unpatrolled
&& $rc_type == RC_NEW
) {
429 # Unpatrolled new page, give rc_id in query
430 $clink = $this->skin
->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
432 $clink = $this->skin
->makeKnownLinkObj( $rc->getTitle(), '' );
435 $time = $wgContLang->time( $rc_timestamp, true, true );
436 $rc->watched
= $watched;
438 $rc->timestamp
= $time;
439 $rc->numberofWatchingusers
= $baseRC->numberofWatchingusers
;
441 # Make "cur" and "diff" links
442 if( $rc->unpatrolled
) {
443 $rcIdQuery = "&rcid={$rc_id}";
447 $querycur = $curIdEq."&diff=0&oldid=$rc_this_oldid";
448 $querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery";
449 $aprops = ' tabindex="'.$baseRC->counter
.'"';
450 $curLink = $this->skin
->makeKnownLinkObj( $rc->getTitle(), $this->message
['cur'], $querycur, '' ,'', $aprops );
452 # Make "diff" an "cur" links
453 if ( !$showdifflinks ) {
454 $curLink = $this->message
['cur'];
455 $diffLink = $this->message
['diff'];
456 } else if( $rc_type == RC_NEW ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE ||
$rc_type == RC_MOVE_OVER_REDIRECT
) {
457 if( $rc_type != RC_NEW
) {
458 $curLink = $this->message
['cur'];
460 $diffLink = $this->message
['diff'];
462 $diffLink = $this->skin
->makeKnownLinkObj( $rc->getTitle(), $this->message
['diff'], $querydiff, '' ,'', $aprops );
466 if( !$showdifflinks ) {
467 $lastLink = $this->message
['last'];
468 } else if( $rc_last_oldid == 0 ||
$rc_type == RC_LOG ||
$rc_type == RC_MOVE ||
$rc_type == RC_MOVE_OVER_REDIRECT
) {
469 $lastLink = $this->message
['last'];
471 $lastLink = $this->skin
->makeKnownLinkObj( $rc->getTitle(), $this->message
['last'],
472 $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
476 if ( $this->isDeleted($rc,Revision
::DELETED_USER
) ) {
477 $rc->userlink
= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>';
479 $rc->userlink
= $this->skin
->userLink( $rc_user, $rc_user_text );
480 $rc->usertalklink
= $this->skin
->userToolLinks( $rc_user, $rc_user_text );
483 $rc->lastlink
= $lastLink;
484 $rc->curlink
= $curLink;
485 $rc->difflink
= $diffLink;
487 # Put accumulated information into the cache, for later display
488 # Page moves go on their own line
489 $title = $rc->getTitle();
490 $secureName = $title->getPrefixedDBkey();
491 if( $rc_type == RC_MOVE ||
$rc_type == RC_MOVE_OVER_REDIRECT
) {
492 # Use an @ character to prevent collision with page names
493 $this->rc_cache
['@@' . ($this->rcMoveIndex++
)] = array($rc);
495 if( !isset ( $this->rc_cache
[$secureName] ) ) {
496 $this->rc_cache
[$secureName] = array();
498 array_push( $this->rc_cache
[$secureName], $rc );
506 function recentChangesBlockGroup( $block ) {
507 global $wgLang, $wgContLang, $wgRCShowChangedSize;
508 $r = '<table cellpadding="0" cellspacing="0" border="0" style="background: none"><tr>';
510 # Collate list of users
511 $userlinks = array();
513 $unpatrolled = false;
515 $curId = $currentRevision = 0;
516 # Some catalyst variables...
519 foreach( $block as $rcObj ) {
520 $oldid = $rcObj->mAttribs
['rc_last_oldid'];
521 if( $rcObj->mAttribs
['rc_new'] ) {
524 // If all log actions to this page were hidden, then don't
525 // give the name of the affected page for this block!
526 if( !($rcObj->mAttribs
['rc_deleted'] & LogPage
::DELETED_ACTION
) ) {
529 $u = $rcObj->userlink
;
530 if( !isset( $userlinks[$u] ) ) {
533 if( $rcObj->unpatrolled
) {
536 if( $rcObj->mAttribs
['rc_type'] != RC_LOG
) {
539 # Get the latest entry with a page_id and oldid
540 # since logs may not have these.
541 if( !$curId && $rcObj->mAttribs
['rc_cur_id'] ) {
542 $curId = $rcObj->mAttribs
['rc_cur_id'];
544 if( !$currentRevision && $rcObj->mAttribs
['rc_this_oldid'] ) {
545 $currentRevision = $rcObj->mAttribs
['rc_this_oldid'];
548 $bot = $rcObj->mAttribs
['rc_bot'];
552 # Sort the list and convert to text
553 krsort( $userlinks );
556 foreach( $userlinks as $userlink => $count) {
558 $text .= $wgContLang->getDirMark();
560 $text .= ' ('.$count.'×)';
562 array_push( $users, $text );
565 $users = ' <span class="changedby">[' . implode( $this->message
['semicolon-separator'] . ' ', $users ) . ']</span>';
568 $rci = 'RCI'.$this->rcCacheIndex
;
569 $rcl = 'RCL'.$this->rcCacheIndex
;
570 $rcm = 'RCM'.$this->rcCacheIndex
;
571 $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')";
572 $tl = '<span id="'.$rcm.'"><a href="'.$toggleLink.'">' . $this->sideArrow() . '</a></span>';
573 $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'">' . $this->downArrow() . '</a></span>';
574 $r .= '<td valign="top" style="white-space: nowrap"><tt>'.$tl.' ';
577 $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot );
580 $r .= ' '.$block[0]->timestamp
.' </tt></td><td>';
584 $r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
586 $r .= $this->maybeWatchedLink( $block[0]->link
, $block[0]->watched
);
589 $r .= $wgContLang->getDirMark();
591 $curIdEq = 'curid=' . $curId;
594 static $nchanges = array();
595 if ( !isset( $nchanges[$n] ) ) {
596 $nchanges[$n] = wfMsgExt( 'nchanges', array( 'parsemag', 'escape'), $wgLang->formatNum( $n ) );
602 if( !ChangesList
::userCan($rcObj,Revision
::DELETED_TEXT
) ) {
604 } else if( $isnew ) {
607 $r .= $this->skin
->makeKnownLinkObj( $block[0]->getTitle(),
608 $nchanges[$n], $curIdEq."&diff=$currentRevision&oldid=$oldid" );
613 # Character difference (does not apply if only log items)
614 if( $wgRCShowChangedSize && !$alllogs ) {
616 $first = count($block) - 1;
617 # Some events (like logs) have an "empty" size, so we need to skip those...
618 while( $last < $first && $block[$last]->mAttribs
['rc_new_len'] === NULL ) {
621 while( $first > $last && $block[$first]->mAttribs
['rc_old_len'] === NULL ) {
625 $chardiff = $rcObj->getCharacterDifference( $block[$first]->mAttribs
['rc_old_len'],
626 $block[$last]->mAttribs
['rc_new_len'] );
628 if( $chardiff == '' ) {
631 $r .= ' ' . $chardiff. ' . . ';
636 $r .= '(' . $this->skin
->makeKnownLinkObj( $block[0]->getTitle(),
637 $this->message
['history'], $curIdEq.'&action=history' );
641 $r .=$this->numberofWatchingusers($block[0]->numberofWatchingusers
);
643 $r .= "</td></tr></table>\n";
646 $r .= '<div id="'.$rci.'" style="display:none;"><table cellpadding="0" cellspacing="0" border="0" style="background: none">';
647 foreach( $block as $rcObj ) {
648 # Get rc_xxxx variables
649 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
650 extract( $rcObj->mAttribs
);
652 #$r .= '<tr><td valign="top">'.$this->spacerArrow();
653 $r .= '<tr><td valign="top">';
654 $r .= '<tt>'.$this->spacerIndent() . $this->spacerIndent();
655 $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled
, ' ', $rc_bot );
656 $r .= ' </tt></td><td valign="top">';
659 if( $rc_this_oldid != 0 ) {
660 $o = 'oldid='.$rc_this_oldid;
663 if( $rc_type == RC_LOG
) {
664 $link = '<tt>'.$rcObj->timestamp
.'</tt> ';
665 } else if( !ChangesList
::userCan($rcObj,Revision
::DELETED_TEXT
) ) {
666 $link = '<span class="history-deleted"><tt>'.$rcObj->timestamp
.'</tt></span> ';
668 $link = '<tt>'.$this->skin
->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp
, $curIdEq.'&'.$o ).'</tt>';
669 if( $this->isDeleted($rcObj,Revision
::DELETED_TEXT
) )
670 $link = '<span class="history-deleted">'.$link.'</span> ';
674 if ( !$rc_log_type ) {
676 $r .= $rcObj->curlink
;
677 $r .= $this->message
['semicolon-separator'] . ' ';
678 $r .= $rcObj->lastlink
;
681 $logname = LogPage
::logName( $rc_log_type );
682 $logtitle = Title
::newFromText( "Log/$rc_log_type", NS_SPECIAL
);
683 $r .= '(' . $this->skin
->makeKnownLinkObj($logtitle, $logname ) . ')';
688 if( $wgRCShowChangedSize ) {
689 $r .= ( $rcObj->getCharacterDifference() == '' ?
'' : $rcObj->getCharacterDifference() . ' . . ' ) ;
692 $r .= $rcObj->userlink
;
693 $r .= $rcObj->usertalklink
;
695 parent
::insertAction($r, $rcObj);
697 parent
::insertComment($r, $rcObj);
698 # Mark revision as deleted
699 if ( !$rc_log_type && $this->isDeleted($rcObj,Revision
::DELETED_TEXT
) )
700 $r .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
702 $r .= "</td></tr>\n";
704 $r .= "</table></div>\n";
706 $this->rcCacheIndex++
;
710 function maybeWatchedLink( $link, $watched=false ) {
712 // FIXME: css style might be more appropriate
713 return '<strong class="mw-watched">' . $link . '</strong>';
720 * Generate HTML for an arrow or placeholder graphic
721 * @param string $dir one of '', 'd', 'l', 'r'
722 * @param string $alt text
723 * @return string HTML <img> tag
726 function arrow( $dir, $alt='' ) {
728 $encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' );
729 $encAlt = htmlspecialchars( $alt );
730 return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" />";
734 * Generate HTML for a right- or left-facing arrow,
735 * depending on language direction.
736 * @return string HTML <img> tag
739 function sideArrow() {
741 $dir = $wgContLang->isRTL() ?
'l' : 'r';
742 return $this->arrow( $dir, '+' );
746 * Generate HTML for a down-facing arrow
747 * depending on language direction.
748 * @return string HTML <img> tag
751 function downArrow() {
752 return $this->arrow( 'd', '-' );
756 * Generate HTML for a spacer image
757 * @return string HTML <img> tag
760 function spacerArrow() {
761 return $this->arrow( '', ' ' );
765 * Add a set of spaces
766 * @return string HTML <td> tag
769 function spacerIndent() {
770 return ' ';
774 * Enhanced RC ungrouped line.
775 * @return string a HTML formated line (generated using $r)
777 function recentChangesBlockLine( $rcObj ) {
778 global $wgContLang, $wgRCShowChangedSize;
780 # Get rc_xxxx variables
781 // FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
782 extract( $rcObj->mAttribs
);
783 $curIdEq = 'curid='.$rc_cur_id;
785 $r = '<table cellspacing="0" cellpadding="0" border="0" style="background: none"><tr>';
787 $r .= '<td valign="top" style="white-space: nowrap"><tt>' . $this->spacerArrow() . ' ';
790 if( $rc_type == RC_MOVE ||
$rc_type == RC_MOVE_OVER_REDIRECT
) {
791 $r .= ' '; // 4 flags -> 4 spaces
793 $r .= $this->recentChangesFlags( $rc_type == RC_NEW
, $rc_minor, $rcObj->unpatrolled
, ' ', $rc_bot );
795 $r .= ' '.$rcObj->timestamp
.' </tt></td><td>';
798 if ( $rc_log_type !='' ) {
799 $logtitle = Title
::newFromText( "Log/$rc_log_type", NS_SPECIAL
);
800 $logname = LogPage
::logName( $rc_log_type );
801 $r .= '(' . $this->skin
->makeKnownLinkObj($logtitle, $logname ) . ')';
804 $r .= $this->maybeWatchedLink( $rcObj->link
, $rcObj->watched
);
806 if ( $rc_type != RC_LOG
) {
808 $r .= ' ('. $rcObj->difflink
. $this->message
['semicolon-separator'] . ' ';
810 $r .= $this->skin
->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ')';
815 if( $wgRCShowChangedSize ) {
816 $r .= ( $rcObj->getCharacterDifference() == '' ?
'' : ' ' . $rcObj->getCharacterDifference() . ' . . ' ) ;
820 $r .= ' '.$rcObj->userlink
. $rcObj->usertalklink
;
823 if( $rc_type != RC_MOVE
&& $rc_type != RC_MOVE_OVER_REDIRECT
) {
825 if ( $this->isDeleted($rcObj,LogPage
::DELETED_ACTION
) ) {
826 $r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
828 $r .= ' ' . LogPage
::actionText( $rc_log_type, $rc_log_action, $rcObj->getTitle(), $this->skin
, LogPage
::extractParams($rc_params), true, true );
831 if ( $this->isDeleted($rcObj,LogPage
::DELETED_COMMENT
) ) {
832 $r .= ' <span class="history-deleted">' . wfMsg('rev-deleted-comment') . '</span>';
834 $r .= $this->skin
->commentBlock( $rc_comment, $rcObj->getTitle() );
838 $r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers
);
840 $r .= "</td></tr></table>\n";
845 * If enhanced RC is in use, this function takes the previously cached
846 * RC lines, arranges them, and outputs the HTML
848 function recentChangesBlock() {
849 if( count ( $this->rc_cache
) == 0 ) {
853 foreach( $this->rc_cache
as $block ) {
854 if( count( $block ) < 2 ) {
855 $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
857 $blockOut .= $this->recentChangesBlockGroup( $block );
861 return '<div>'.$blockOut.'</div>';
865 * Returns text for the end of RC
866 * If enhanced RC is in use, returns pretty much all the text
868 function endRecentChangesList() {
869 return $this->recentChangesBlock() . parent
::endRecentChangesList();