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