Slight improvement of enhanced recent changes lines. There were complaints about
[lhc/web/wiklou.git] / includes / ChangesList.php
1 <?php
2 /**
3 * @package MediaWiki
4 * Contain class to show various lists of change:
5 * - what's link here
6 * - related changes
7 * - recent changes
8 */
9
10 /**
11 * @todo document
12 * @package MediaWiki
13 */
14 class RCCacheEntry extends RecentChange
15 {
16 var $secureName, $link;
17 var $curlink , $difflink, $lastlink , $usertalklink , $versionlink ;
18 var $userlink, $timestamp, $watched;
19
20 function newFromParent( $rc )
21 {
22 $rc2 = new RCCacheEntry;
23 $rc2->mAttribs = $rc->mAttribs;
24 $rc2->mExtra = $rc->mExtra;
25 return $rc2;
26 }
27 } ;
28
29 /**
30 * @package MediaWiki
31 */
32 class ChangesList {
33 # Called by history lists and recent changes
34 #
35
36 /** @todo document */
37 function ChangesList( &$skin ) {
38 $this->skin =& $skin;
39 $this->preCacheMessages();
40 }
41
42 /**
43 * Fetch an appropriate changes list class for the specified user
44 * Some users might want to use an enhanced list format, for instance
45 *
46 * @param $user User to fetch the list class for
47 * @return ChangesList derivative
48 */
49 public static function newFromUser( &$user ) {
50 $sk =& $user->getSkin();
51 $list = NULL;
52 if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) {
53 return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
54 } else {
55 return $list;
56 }
57 }
58
59 /**
60 * As we use the same small set of messages in various methods and that
61 * they are called often, we call them once and save them in $this->message
62 */
63 function preCacheMessages() {
64 // Precache various messages
65 if( !isset( $this->message ) ) {
66 foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last '.
67 'blocklink changes history boteditletter' ) as $msg ) {
68 $this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
69 }
70 }
71 }
72
73
74 /**
75 * Returns the appropriate flags for new page, minor change and patrolling
76 */
77 function recentChangesFlags( $new, $minor, $patrolled, $nothing = '&nbsp;', $bot = false ) {
78 $f = $new ? '<span class="newpage">' . $this->message['newpageletter'] . '</span>'
79 : $nothing;
80 $f .= $minor ? '<span class="minor">' . $this->message['minoreditletter'] . '</span>'
81 : $nothing;
82 $f .= $bot ? '<span class="bot">' . $this->message['boteditletter'] . '</span>' : $nothing;
83 $f .= $patrolled ? '<span class="unpatrolled">!</span>' : $nothing;
84 return $f;
85 }
86
87 /**
88 * Returns text for the start of the tabular part of RC
89 */
90 function beginRecentChangesList() {
91 $this->rc_cache = array();
92 $this->rcMoveIndex = 0;
93 $this->rcCacheIndex = 0;
94 $this->lastdate = '';
95 $this->rclistOpen = false;
96 return '';
97 }
98
99 /**
100 * Returns text for the end of RC
101 */
102 function endRecentChangesList() {
103 if( $this->rclistOpen ) {
104 return "</ul>\n";
105 } else {
106 return '';
107 }
108 }
109
110
111 function insertMove( &$s, $rc ) {
112 # Diff
113 $s .= '(' . $this->message['diff'] . ') (';
114 # Hist
115 $s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'], 'action=history' ) .
116 ') . . ';
117
118 # "[[x]] moved to [[y]]"
119 $msg = ( $rc->mAttribs['rc_type'] == RC_MOVE ) ? '1movedto2' : '1movedto2_redir';
120 $s .= wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
121 $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
122 }
123
124 function insertDateHeader(&$s, $rc_timestamp) {
125 global $wgLang;
126
127 # Make date header if necessary
128 $date = $wgLang->date( $rc_timestamp, true, true );
129 $s = '';
130 if( $date != $this->lastdate ) {
131 if( '' != $this->lastdate ) {
132 $s .= "</ul>\n";
133 }
134 $s .= '<h4>'.$date."</h4>\n<ul class=\"special\">";
135 $this->lastdate = $date;
136 $this->rclistOpen = true;
137 }
138 }
139
140 function insertLog(&$s, $title, $logtype) {
141 $logname = LogPage::logName( $logtype );
142 $s .= '(' . $this->skin->makeKnownLinkObj($title, $logname ) . ')';
143 }
144
145
146 function insertDiffHist(&$s, &$rc, $unpatrolled) {
147 # Diff link
148 if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
149 $diffLink = $this->message['diff'];
150 } else {
151 $rcidparam = $unpatrolled
152 ? array( 'rcid' => $rc->mAttribs['rc_id'] )
153 : array();
154 $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'],
155 wfArrayToCGI( array(
156 'curid' => $rc->mAttribs['rc_cur_id'],
157 'diff' => $rc->mAttribs['rc_this_oldid'],
158 'oldid' => $rc->mAttribs['rc_last_oldid'] ),
159 $rcidparam ),
160 '', '', ' tabindex="'.$rc->counter.'"');
161 }
162 $s .= '('.$diffLink.') (';
163
164 # History link
165 $s .= $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['hist'],
166 wfArrayToCGI( array(
167 'curid' => $rc->mAttribs['rc_cur_id'],
168 'action' => 'history' ) ) );
169 $s .= ') . . ';
170 }
171
172 function insertArticleLink(&$s, &$rc, $unpatrolled, $watched) {
173 # Article link
174 # If it's a new article, there is no diff link, but if it hasn't been
175 # patrolled yet, we need to give users a way to do so
176 $params = ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW )
177 ? 'rcid='.$rc->mAttribs['rc_id']
178 : '';
179 $articlelink = ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
180 if($watched) $articlelink = '<strong>'.$articlelink.'</strong>';
181 global $wgContLang;
182 $articlelink .= $wgContLang->getDirMark();
183
184 $s .= ' '.$articlelink;
185 }
186
187 function insertTimestamp(&$s, $rc) {
188 global $wgLang;
189 # Timestamp
190 $s .= '; ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
191 }
192
193 /** Insert links to user page, user talk page and eventually a blocking link */
194 function insertUserRelatedLinks(&$s, &$rc) {
195 $s .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
196 $s .= $this->skin->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
197 }
198
199 /** insert a formatted comment */
200 function insertComment(&$s, &$rc) {
201 # Add comment
202 if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
203 $s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
204 }
205 }
206
207 /**
208 * Check whether to enable recent changes patrol features
209 * @return bool
210 */
211 function usePatrol() {
212 global $wgUseRCPatrol, $wgUser;
213 return( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) );
214 }
215 }
216
217
218 /**
219 * Generate a list of changes using the good old system (no javascript)
220 */
221 class OldChangesList extends ChangesList {
222 /**
223 * Format a line using the old system (aka without any javascript).
224 */
225 function recentChangesLine( &$rc, $watched = false ) {
226 global $wgContLang, $wgRCShowChangedSize;
227
228 $fname = 'ChangesList::recentChangesLineOld';
229 wfProfileIn( $fname );
230
231 # Extract DB fields into local scope
232 extract( $rc->mAttribs );
233
234 # Should patrol-related stuff be shown?
235 $unpatrolled = $this->usePatrol() && $rc_patrolled == 0;
236
237 $this->insertDateHeader($s,$rc_timestamp);
238
239 $s .= '<li>';
240
241 // moved pages
242 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
243 $this->insertMove( $s, $rc );
244 // log entries
245 } elseif ( $rc_namespace == NS_SPECIAL ) {
246 list( $specialName, $specialSubpage ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
247 if ( $specialName == 'Log' ) {
248 $this->insertLog( $s, $rc->getTitle(), $specialSubpage );
249 } else {
250 wfDebug( "Unexpected special page in recentchanges\n" );
251 }
252 // all other stuff
253 } else {
254 wfProfileIn($fname.'-page');
255
256 $this->insertDiffHist($s, $rc, $unpatrolled);
257
258 # M, N, b and ! (minor, new, bot and unpatrolled)
259 $s .= ' ' . $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '', $rc_bot );
260 $this->insertArticleLink($s, $rc, $unpatrolled, $watched);
261
262 wfProfileOut($fname.'-page');
263 }
264
265 wfProfileIn( $fname.'-rest' );
266
267 $this->insertTimestamp($s,$rc);
268
269 if( $wgRCShowChangedSize ) {
270 $s .= ( $rc->getCharacterDifference() == '' ? '' : $rc->getCharacterDifference() . ' . . ' );
271 }
272
273 $this->insertUserRelatedLinks($s,$rc);
274 $this->insertComment($s, $rc);
275
276 if($rc->numberofWatchingusers > 0) {
277 $s .= ' ' . wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rc->numberofWatchingusers));
278 }
279
280 $s .= "</li>\n";
281
282 wfProfileOut( $fname.'-rest' );
283
284 wfProfileOut( $fname );
285 return $s;
286 }
287 }
288
289
290 /**
291 * Generate a list of changes using an Enhanced system (use javascript).
292 */
293 class EnhancedChangesList extends ChangesList {
294 /**
295 * Format a line for enhanced recentchange (aka with javascript and block of lines).
296 */
297 function recentChangesLine( &$baseRC, $watched = false ) {
298 global $wgLang, $wgContLang;
299
300 # Create a specialised object
301 $rc = RCCacheEntry::newFromParent( $baseRC );
302
303 # Extract fields from DB into the function scope (rc_xxxx variables)
304 extract( $rc->mAttribs );
305 $curIdEq = 'curid=' . $rc_cur_id;
306
307 # If it's a new day, add the headline and flush the cache
308 $date = $wgLang->date( $rc_timestamp, true);
309 $ret = '';
310 if( $date != $this->lastdate ) {
311 # Process current cache
312 $ret = $this->recentChangesBlock();
313 $this->rc_cache = array();
314 $ret .= "<h4>{$date}</h4>\n";
315 $this->lastdate = $date;
316 }
317
318 # Should patrol-related stuff be shown?
319 if( $this->usePatrol() ) {
320 $rc->unpatrolled = !$rc_patrolled;
321 } else {
322 $rc->unpatrolled = false;
323 }
324
325 # Make article link
326 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
327 $msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
328 $clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
329 $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
330 } elseif( $rc_namespace == NS_SPECIAL ) {
331 list( $specialName, $logtype ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
332 if ( $specialName == 'Log' ) {
333 # Log updates, etc
334 $logname = LogPage::logName( $logtype );
335 $clink = '(' . $this->skin->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
336 } else {
337 wfDebug( "Unexpected special page in recentchanges\n" );
338 $clink = '';
339 }
340 } elseif( $rc->unpatrolled && $rc_type == RC_NEW ) {
341 # Unpatrolled new page, give rc_id in query
342 $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
343 } else {
344 $clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' );
345 }
346
347 $time = $wgContLang->time( $rc_timestamp, true, true );
348 $rc->watched = $watched;
349 $rc->link = $clink;
350 $rc->timestamp = $time;
351 $rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
352
353 # Make "cur" and "diff" links
354 if( $rc->unpatrolled ) {
355 $rcIdQuery = "&rcid={$rc_id}";
356 } else {
357 $rcIdQuery = '';
358 }
359 $querycur = $curIdEq."&diff=0&oldid=$rc_this_oldid";
360 $querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery";
361 $aprops = ' tabindex="'.$baseRC->counter.'"';
362 $curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['cur'], $querycur, '' ,'', $aprops );
363 if( $rc_type == RC_NEW || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
364 if( $rc_type != RC_NEW ) {
365 $curLink = $this->message['cur'];
366 }
367 $diffLink = $this->message['diff'];
368 } else {
369 $diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'], $querydiff, '' ,'', $aprops );
370 }
371
372 # Make "last" link
373 if( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
374 $lastLink = $this->message['last'];
375 } else {
376 $lastLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
377 $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
378 }
379
380 $rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
381
382 $rc->lastlink = $lastLink;
383 $rc->curlink = $curLink;
384 $rc->difflink = $diffLink;
385
386 $rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
387
388 # Put accumulated information into the cache, for later display
389 # Page moves go on their own line
390 $title = $rc->getTitle();
391 $secureName = $title->getPrefixedDBkey();
392 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
393 # Use an @ character to prevent collision with page names
394 $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array($rc);
395 } else {
396 if( !isset ( $this->rc_cache[$secureName] ) ) {
397 $this->rc_cache[$secureName] = array();
398 }
399 array_push( $this->rc_cache[$secureName], $rc );
400 }
401 return $ret;
402 }
403
404 /**
405 * Enhanced RC group
406 */
407 function recentChangesBlockGroup( $block ) {
408 global $wgContLang, $wgRCShowChangedSize;
409 $r = '';
410
411 # Collate list of users
412 $isnew = false;
413 $unpatrolled = false;
414 $userlinks = array();
415 foreach( $block as $rcObj ) {
416 $oldid = $rcObj->mAttribs['rc_last_oldid'];
417 if( $rcObj->mAttribs['rc_new'] ) {
418 $isnew = true;
419 }
420 $u = $rcObj->userlink;
421 if( !isset( $userlinks[$u] ) ) {
422 $userlinks[$u] = 0;
423 }
424 if( $rcObj->unpatrolled ) {
425 $unpatrolled = true;
426 }
427 $bot = $rcObj->mAttribs['rc_bot'];
428 $userlinks[$u]++;
429 }
430
431 # Sort the list and convert to text
432 krsort( $userlinks );
433 asort( $userlinks );
434 $users = array();
435 foreach( $userlinks as $userlink => $count) {
436 $text = $userlink;
437 $text .= $wgContLang->getDirMark();
438 if( $count > 1 ) {
439 $text .= ' ('.$count.'&times;)';
440 }
441 array_push( $users, $text );
442 }
443
444 $users = ' <span class="changedby">['.implode('; ',$users).']</span>';
445
446 # Arrow
447 $rci = 'RCI'.$this->rcCacheIndex;
448 $rcl = 'RCL'.$this->rcCacheIndex;
449 $rcm = 'RCM'.$this->rcCacheIndex;
450 $toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')";
451 $tl = '<span id="'.$rcm.'"><a href="'.$toggleLink.'">' . $this->sideArrow() . '</a></span>';
452 $tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'">' . $this->downArrow() . '</a></span>';
453 $r .= $tl;
454
455 # Main line
456 $r .= '<tt>';
457 $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, '&nbsp;', $bot );
458
459 # Timestamp
460 $r .= ' '.$block[0]->timestamp.' </tt>';
461
462 # Article link
463 $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
464 $r .= $wgContLang->getDirMark();
465
466 $curIdEq = 'curid=' . $block[0]->mAttribs['rc_cur_id'];
467 $currentRevision = $block[0]->mAttribs['rc_this_oldid'];
468 if( $block[0]->mAttribs['rc_type'] != RC_LOG ) {
469 # Changes
470 $r .= ' ('.count($block).' ';
471
472 if( $isnew ) {
473 $r .= $this->message['changes'];
474 } else {
475 $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
476 $this->message['changes'], $curIdEq."&diff=$currentRevision&oldid=$oldid" );
477 }
478
479 $r .= ') . . ';
480
481 # Character difference
482 $chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'],
483 $block[0]->mAttribs['rc_new_len'] );
484 if( $chardiff == '' ) {
485 $r .= ' (';
486 } else {
487 $r .= ' ' . $chardiff. ' . . (';
488 }
489
490
491 # History
492 $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
493 $this->message['history'], $curIdEq.'&action=history' );
494 $r .= ')';
495 }
496
497 $r .= $users;
498
499 if($block[0]->numberofWatchingusers > 0) {
500 global $wgContLang;
501 $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($block[0]->numberofWatchingusers));
502 }
503 $r .= "<br />\n";
504
505 # Sub-entries
506 $r .= '<div id="'.$rci.'" style="display:none">';
507 foreach( $block as $rcObj ) {
508 # Get rc_xxxx variables
509 extract( $rcObj->mAttribs );
510
511 $r .= $this->spacerArrow();
512 $r .= '<tt>&nbsp; &nbsp; &nbsp; &nbsp;';
513 $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
514 $r .= '&nbsp;</tt>';
515
516 $o = '';
517 if( $rc_this_oldid != 0 ) {
518 $o = 'oldid='.$rc_this_oldid;
519 }
520 if( $rc_type == RC_LOG ) {
521 $link = $rcObj->timestamp;
522 } else {
523 $link = $this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o );
524 }
525 $link = '<tt>'.$link.'</tt>';
526
527 $r .= $link;
528 $r .= ' (';
529 $r .= $rcObj->curlink;
530 $r .= '; ';
531 $r .= $rcObj->lastlink;
532 $r .= ') . . ';
533
534 # Character diff
535 if( $wgRCShowChangedSize ) {
536 $r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ;
537 }
538
539 $r .= $rcObj->userlink;
540 $r .= $rcObj->usertalklink;
541 $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
542 $r .= "<br />\n";
543 }
544 $r .= "</div>\n";
545
546 $this->rcCacheIndex++;
547 return $r;
548 }
549
550 function maybeWatchedLink( $link, $watched=false ) {
551 if( $watched ) {
552 // FIXME: css style might be more appropriate
553 return '<strong>' . $link . '</strong>';
554 } else {
555 return $link;
556 }
557 }
558
559 /**
560 * Generate HTML for an arrow or placeholder graphic
561 * @param string $dir one of '', 'd', 'l', 'r'
562 * @param string $alt text
563 * @return string HTML <img> tag
564 * @access private
565 */
566 function arrow( $dir, $alt='' ) {
567 global $wgStylePath;
568 $encUrl = htmlspecialchars( $wgStylePath . '/common/images/Arr_' . $dir . '.png' );
569 $encAlt = htmlspecialchars( $alt );
570 return "<img src=\"$encUrl\" width=\"12\" height=\"12\" alt=\"$encAlt\" />";
571 }
572
573 /**
574 * Generate HTML for a right- or left-facing arrow,
575 * depending on language direction.
576 * @return string HTML <img> tag
577 * @access private
578 */
579 function sideArrow() {
580 global $wgContLang;
581 $dir = $wgContLang->isRTL() ? 'l' : 'r';
582 return $this->arrow( $dir, '+' );
583 }
584
585 /**
586 * Generate HTML for a down-facing arrow
587 * depending on language direction.
588 * @return string HTML <img> tag
589 * @access private
590 */
591 function downArrow() {
592 return $this->arrow( 'd', '-' );
593 }
594
595 /**
596 * Generate HTML for a spacer image
597 * @return string HTML <img> tag
598 * @access private
599 */
600 function spacerArrow() {
601 return $this->arrow( '', ' ' );
602 }
603
604 /**
605 * Enhanced RC ungrouped line.
606 * @return string a HTML formated line (generated using $r)
607 */
608 function recentChangesBlockLine( $rcObj ) {
609 global $wgContLang, $wgRCShowChangedSize;
610
611 # Get rc_xxxx variables
612 extract( $rcObj->mAttribs );
613 $curIdEq = 'curid='.$rc_cur_id;
614
615 $r = '';
616
617 # Spacer image
618 $r .= $this->spacerArrow();
619
620 # Flag and Timestamp
621 $r .= '<tt>';
622
623 if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
624 $r .= '&nbsp;&nbsp;&nbsp;';
625 } else {
626 $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
627 }
628 $r .= ' '.$rcObj->timestamp.' </tt>';
629
630 # Article link
631 $r .= $this->maybeWatchedLink( $rcObj->link, $rcObj->watched );
632
633 # Diff
634 $r .= ' ('. $rcObj->difflink .'; ';
635
636 # Hist
637 $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ') . . ';
638
639 # Character diff
640 if( $wgRCShowChangedSize ) {
641 $r .= ( $rcObj->getCharacterDifference() == '' ? '' : '&nbsp;' . $rcObj->getCharacterDifference() . ' . . ' ) ;
642 }
643
644 # User/talk
645 $r .= $rcObj->userlink . $rcObj->usertalklink;
646
647 # Comment
648 if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
649 $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
650 }
651
652 if( $rcObj->numberofWatchingusers > 0 ) {
653 $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rcObj->numberofWatchingusers));
654 }
655
656 $r .= "<br />\n";
657 return $r;
658 }
659
660 /**
661 * If enhanced RC is in use, this function takes the previously cached
662 * RC lines, arranges them, and outputs the HTML
663 */
664 function recentChangesBlock() {
665 if( count ( $this->rc_cache ) == 0 ) {
666 return '';
667 }
668 $blockOut = '';
669 foreach( $this->rc_cache as $block ) {
670 if( count( $block ) < 2 ) {
671 $blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
672 } else {
673 $blockOut .= $this->recentChangesBlockGroup( $block );
674 }
675 }
676
677 return '<div>'.$blockOut.'</div>';
678 }
679
680 /**
681 * Returns text for the end of RC
682 * If enhanced RC is in use, returns pretty much all the text
683 */
684 function endRecentChangesList() {
685 return $this->recentChangesBlock() . parent::endRecentChangesList();
686 }
687
688 }
689 ?>