<?php
+/**
+ * @package MediaWiki
+ */
+/**
+ * @package MediaWiki
+ */
class ChangesList {
# Called by history lists and recent changes
#
+ /** @todo document */
function ChangesList( &$skin ) {
$this->skin =& $skin;
}
- # Returns text for the start of the tabular part of RC
+ /**
+ * Returns the appropiate flags for new page, minor change and patrolling
+ */
+ function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ' ) {
+ $f = $new ? '<span class="newpage">' . htmlspecialchars( wfMsg( 'newpageletter' ) ) . '</span>'
+ : $nothing;
+ $f .= $minor ? '<span class="minor">' . htmlspecialchars( wfMsg( 'minoreditletter' ) ) . '</span>'
+ : $nothing;
+ $f .= $patrolled ? '<span class="unpatrolled">!</span>' : $nothing;
+ return $f;
+
+ }
+
+ /**
+ * Returns text for the start of the tabular part of RC
+ */
function beginRecentChangesList() {
$this->rc_cache = array() ;
$this->rcMoveIndex = 0;
$r .= '<tt>' ;
if ( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
- $r .= ' ';
+ $r .= ' ';
} else {
- # M, N and !
- $M = wfMsg( 'minoreditletter' );
- $N = wfMsg( 'newpageletter' );
-
- if ( $rc_type == RC_NEW ) {
- $r .= $N ;
- } else {
- $r .= ' ' ;
- }
- if ( $rc_minor ) {
- $r .= $M ;
- } else {
- $r .= ' ' ;
- }
- if ( $rcObj->unpatrolled ) {
- $r .= '!';
- } else {
- $r .= ' ';
- }
+ $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled );
}
# Timestamp
$r .= $rcObj->usertalklink ;
# Comment
- if ( $rc_comment != '' && $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
- $rc_comment=$this->skin->formatComment($rc_comment, $rcObj->getTitle());
- $r .= $wgContLang->emphasize( ' ('.$rc_comment.')' );
+ if ( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
+ $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
+ }
+
+ if ($rcObj->numberofWatchingusers > 0) {
+ $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rcObj->numberofWatchingusers));
}
$r .= "<br />\n" ;
function recentChangesBlockGroup ( $block ) {
global $wgStylePath, $wgContLang ;
- $r = '' ;
- $M = wfMsg( 'minoreditletter' );
- $N = wfMsg( 'newpageletter' );
+ $r = '';
# Collate list of users
$isnew = false ;
if ( $count > 1 ) $text .= " ({$count}×)" ;
array_push ( $users , $text ) ;
}
- $users = ' <font size="-1">['.implode('; ',$users).']</font>' ;
+ $users = ' <span class="changedby">['.implode('; ',$users).']</span>';
# Arrow
$rci = 'RCI'.$this->rcCacheIndex ;
$r .= $tl ;
# Main line
- # M/N
+
$r .= '<tt>' ;
- if ( $isnew ) $r .= $N ;
- else $r .= ' ' ;
- $r .= ' ' ; # Minor
- if ( $unpatrolled ) {
- $r .= "!";
- } else {
- $r .= " ";
- }
+ $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled );
# Timestamp
$r .= ' '.$block[0]->timestamp.' ' ;
}
$r .= $users ;
+
+ if ($block[0]->numberofWatchingusers > 0) {
+ $r .= wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($block[0]->numberofWatchingusers));
+ }
$r .= "<br />\n" ;
# Sub-entries
$r .= '<img src="'.$wgStylePath.'/common/images/Arr_.png" width="12" height="12" />';
$r .= '<tt> ' ;
- if ( $rc_new ) {
- $r .= $N ;
- } else {
- $r .= ' ' ;
- }
-
- if ( $rc_minor ) {
- $r .= $M ;
- } else {
- $r .= ' ' ;
- }
-
- if ( $rcObj->unpatrolled ) {
- $r .= "!";
- } else {
- $r .= " ";
- }
-
+ $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled );
$r .= ' </tt>' ;
$o = '' ;
$r .= $rcObj->lastlink ;
$r .= ') . . '.$rcObj->userlink ;
$r .= $rcObj->usertalklink ;
- if ( $rc_comment != '' ) {
- $rc_comment=$this->skin->formatComment($rc_comment, $rcObj->getTitle());
- $r .= $wgContLang->emphasize( ' ('.$rc_comment.')' ) ;
- }
+ $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
$r .= "<br />\n" ;
}
$r .= "</div>\n" ;
* Either returns the line, or caches it for later use
*/
function recentChangesLine( &$rc, $watched = false ) {
- global $wgUser ;
+ global $wgUser;
$usenew = $wgUser->getOption( 'usenewrc' );
if ( $usenew )
$line = $this->recentChangesLineNew ( $rc, $watched ) ;
return $line ;
}
+
function recentChangesLineOld( &$rc, $watched = false ) {
+ global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgUseRCPatrol,
+ $wgOnlySysopsCanPatrol, $wgSysopUserBans;
+
$fname = 'Skin::recentChangesLineOld';
wfProfileIn( $fname );
-
- global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgRCSeconds, $wgUseRCPatrol, $wgOnlySysopsCanPatrol;
static $message;
if( !isset( $message ) ) {
$curIdEq = 'curid=' . $rc_cur_id;
# Should patrol-related stuff be shown?
- $unpatrolled = $wgUseRCPatrol && $wgUser->getID() != 0 &&
+ $unpatrolled = $wgUseRCPatrol && $wgUser->isLoggedIn() &&
( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') ) && $rc_patrolled == 0;
# Make date header if necessary
- $date = $wgLang->date( $rc_timestamp, true);
+ $date = $wgLang->date( $rc_timestamp, true, true );
$s = '';
if ( $date != $this->lastdate ) {
if ( '' != $this->lastdate ) { $s .= "</ul>\n"; }
$s .= ') . . ';
# M, N and ! (minor, new and unpatrolled)
- if ( $rc_minor ) { $s .= ' <span class="minor">'.$message["minoreditletter"].'</span>'; }
- if ( $rc_type == RC_NEW ) { $s .= '<span class="newpage">'.$message["newpageletter"].'</span>'; }
- if ( !$rc_patrolled ) { $s .= ' <span class="unpatrolled">!</span>'; }
+ $s .= ' ' . $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $unpatrolled, '' );
# Article link
# If it's a new article, there is no diff link, but if it hasn't been
if ( $watched ) {
$articleLink = '<strong>'.$articleLink.'</strong>';
}
+
$s .= ' '.$articleLink;
wfProfileOut("$fname-page");
}
wfProfileIn( "$fname-rest" );
# Timestamp
- $s .= '; ' . $wgLang->time( $rc_timestamp, true, $wgRCSeconds ) . ' . . ';
+ $s .= '; ' . $wgLang->time( $rc_timestamp, true, true ) . ' . . ';
# User link (or contributions for unregistered users)
if ( 0 == $rc_user ) {
}
# Block link
$blockLink='';
- if ( ( 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
+ if ( ( $wgSysopUserBans || 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
$blockLinkPage = Title::makeTitle( NS_SPECIAL, 'Blockip' );
$blockLink = $this->skin->makeKnownLinkObj( $blockLinkPage,
$message['blocklink'], 'ip='.$rc_user_text );
if($userTalkLink) $s.=' ('.$userTalkLink.')';
# Add comment
- if ( '' != $rc_comment && '*' != $rc_comment && $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
- $rc_comment = $this->skin->formatComment($rc_comment,$rc->getTitle());
- $s .= $wgContLang->emphasize(' (' . $rc_comment . ')');
+ if ( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
+ $s .= $this->skin->commentBlock( $rc_comment, $rc->getTitle() );
}
+
+ if ($rc->numberofWatchingusers > 0) {
+ $s .= ' ' . wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rc->numberofWatchingusers));
+ }
+
$s .= "</li>\n";
wfProfileOut( "$fname-rest" );
}
function recentChangesLineNew( &$baseRC, $watched = false ) {
- global $wgTitle, $wgLang, $wgContLang, $wgUser, $wgRCSeconds;
- global $wgUseRCPatrol, $wgOnlySysopsCanPatrol;
+ global $wgTitle, $wgLang, $wgContLang, $wgUser,
+ $wgUseRCPatrol, $wgOnlySysopsCanPatrol, $wgSysopUserBans;
static $message;
if( !isset( $message ) ) {
}
# Should patrol-related stuff be shown?
- if ( $wgUseRCPatrol && $wgUser->getID() != 0 &&
+ if ( $wgUseRCPatrol && $wgUser->isLoggedIn() &&
( !$wgOnlySysopsCanPatrol || $wgUser->isAllowed('patrol') )) {
$rc->unpatrolled = !$rc_patrolled;
} else {
$clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '' ) ;
}
- $time = $wgContLang->time( $rc_timestamp, true, $wgRCSeconds );
+ $time = $wgContLang->time( $rc_timestamp, true, true );
$rc->watched = $watched ;
$rc->link = $clink ;
$rc->timestamp = $time;
+ $rc->numberofWatchingusers = $baseRC->numberofWatchingusers;
# Make "cur" and "diff" links
$titleObj = $rc->getTitle();
$userTalkLink = $this->skin->makeLinkObj( $userTalkPage, $talkname );
global $wgDisableAnonTalk;
- if ( ( 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
+ if ( ( $wgSysopUserBans || 0 == $rc_user ) && $wgUser->isAllowed('block') ) {
$blockPage =& Title::makeTitle( NS_SPECIAL, 'Blockip' );
$blockLink = $this->skin->makeKnownLinkObj( $blockPage,
$message['blocklink'], 'ip='.$rc_user_text );
}
}
-
-
?>