*/
private function preCacheMessages() {
if ( !isset( $this->message ) ) {
- foreach ( explode( ' ', 'cur diff hist last blocklink history ' .
- 'semicolon-separator pipe-separator' ) as $msg ) {
+ foreach ( array(
+ 'cur', 'diff', 'hist', 'last', 'blocklink', 'history',
+ 'semicolon-separator', 'pipe-separator' ) as $msg
+ ) {
$this->message[$msg] = $this->msg( $msg )->escaped();
}
}
* @param string $nothing to use for empty space
* @return String
*/
- protected function recentChangesFlags( $flags, $nothing = ' ' ) {
+ public function recentChangesFlags( $flags, $nothing = ' ' ) {
+ global $wgRecentChangesFlags;
$f = '';
- foreach ( array( 'newpage', 'minor', 'bot', 'unpatrolled' ) as $flag ) {
+ foreach ( array_keys( $wgRecentChangesFlags ) as $flag ) {
$f .= isset( $flags[$flag] ) && $flags[$flag]
? self::flag( $flag )
: $nothing;
* unpatrolled edit. By default in English it will contain "N", "m", "b",
* "!" respectively, plus it will have an appropriate title and class.
*
- * @param string $flag 'newpage', 'unpatrolled', 'minor', or 'bot'
+ * @param string $flag One key of $wgRecentChangesFlags
* @return String: Raw HTML
*/
public static function flag( $flag ) {
- static $messages = null;
- if ( is_null( $messages ) ) {
- $messages = array(
- 'newpage' => array( 'newpageletter', 'recentchanges-label-newpage' ),
- 'minoredit' => array( 'minoreditletter', 'recentchanges-label-minor' ),
- 'botedit' => array( 'boteditletter', 'recentchanges-label-bot' ),
- 'unpatrolled' => array( 'unpatrolledletter', 'recentchanges-label-unpatrolled' ),
- );
- foreach ( $messages as &$value ) {
- $value[0] = wfMessage( $value[0] )->escaped();
- $value[1] = wfMessage( $value[1] )->escaped();
+ static $flagInfos = null;
+ if ( is_null( $flagInfos ) ) {
+ global $wgRecentChangesFlags;
+ $flagInfos = array();
+ foreach ( $wgRecentChangesFlags as $key => $value ) {
+ $flagInfos[$key]['letter'] = wfMessage( $value['letter'] )->escaped();
+ $flagInfos[$key]['title'] = wfMessage( $value['title'] )->escaped();
+ // Allow customized class name, fall back to flag name
+ $flagInfos[$key]['class'] = Sanitizer::escapeClass(
+ isset( $value['class'] ) ? $value['class'] : $key );
}
}
- # Inconsistent naming, bleh
+ // Inconsistent naming, bleh, kepted for b/c
$map = array(
- 'newpage' => 'newpage',
- 'minor' => 'minoredit',
- 'bot' => 'botedit',
- 'unpatrolled' => 'unpatrolled',
- 'minoredit' => 'minoredit',
- 'botedit' => 'botedit',
+ 'minoredit' => 'minor',
+ 'botedit' => 'bot',
);
- $flag = $map[$flag];
+ if ( isset( $map[$flag] ) ) {
+ $flag = $map[$flag];
+ }
- return "<abbr class='$flag' title='" . $messages[$flag][1] . "'>" . $messages[$flag][0] . '</abbr>';
+ return "<abbr class='" . $flagInfos[$flag]['class'] . "' title='" . $flagInfos[$flag]['title'] . "'>" .
+ $flagInfos[$flag]['letter'] .
+ '</abbr>';
}
/**
'oldid' => $rc->mAttribs['rc_last_oldid']
);
- if ( $unpatrolled ) {
- $query['rcid'] = $rc->mAttribs['rc_id'];
- };
-
$diffLink = Linker::linkKnown(
$rc->getTitle(),
$this->message['diff'],
* @param $watched
*/
public function insertArticleLink( &$s, &$rc, $unpatrolled, $watched ) {
- # If it's a new article, there is no diff link, but if it hasn't been
- # patrolled yet, we need to give users a way to do so
$params = array();
- if ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW ) {
- $params['rcid'] = $rc->mAttribs['rc_id'];
- }
-
$articlelink = Linker::linkKnown(
$rc->getTitle(),
null,
/**
* Check whether to enable recent changes patrol features
+ *
+ * @deprecated since 1.22
* @return Boolean
*/
public static function usePatrol() {
global $wgUser;
+
+ wfDeprecated( __METHOD__, '1.22' );
+
return $wgUser->useRCPatrol();
}
* @param $rc RecentChange
*/
public function insertRollback( &$s, &$rc ) {
- if ( $rc->mAttribs['rc_type'] != RC_NEW && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] ) {
+ if ( $rc->mAttribs['rc_type'] == RC_EDIT && $rc->mAttribs['rc_this_oldid'] && $rc->mAttribs['rc_cur_id'] ) {
$page = $rc->getTitle();
/** Check for rollback and edit permissions, disallow special pages, and only
* show a link on the top-most revision */
// Indicate watched status on the line to allow for more
// comprehensive styling.
- $classes[] = $watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
+ $classes[] = $watched && $rc->mAttribs['rc_timestamp'] >= $watched
+ ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
// Moved pages (very very old, not supported anymore)
if ( $rc->mAttribs['rc_type'] == RC_MOVE || $rc->mAttribs['rc_type'] == RC_MOVE_OVER_REDIRECT ) {
$this->rcCacheIndex = 0;
$this->lastdate = '';
$this->rclistOpen = false;
- $this->getOutput()->addModuleStyles( 'mediawiki.special.changeslist' );
+ $this->getOutput()->addModuleStyles( array(
+ 'mediawiki.special.changeslist',
+ 'mediawiki.special.changeslist.enhanced',
+ ) );
+ $this->getOutput()->addModules( array(
+ 'jquery.makeCollapsible',
+ 'mediawiki.icon',
+ ) );
return '';
}
/**
if ( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
// New unpatrolled pages
} elseif ( $rc->unpatrolled && $type == RC_NEW ) {
- $clink = Linker::linkKnown( $rc->getTitle(), null, array(),
- array( 'rcid' => $rc->mAttribs['rc_id'] ) );
+ $clink = Linker::linkKnown( $rc->getTitle() );
// Log entries
} elseif ( $type == RC_LOG ) {
if ( $logType ) {
# called too many times (50% of CPU time on RecentChanges!).
$thisOldid = $rc->mAttribs['rc_this_oldid'];
$lastOldid = $rc->mAttribs['rc_last_oldid'];
- if ( $rc->unpatrolled ) {
- $rcIdQuery = array( 'rcid' => $rc->mAttribs['rc_id'] );
- } else {
- $rcIdQuery = array();
- }
+
$querycur = $curIdEq + array( 'diff' => '0', 'oldid' => $thisOldid );
- $querydiff = $curIdEq + array( 'diff' => $thisOldid, 'oldid' =>
- $lastOldid ) + $rcIdQuery;
+ $querydiff = $curIdEq + array( 'diff' => $thisOldid, 'oldid' => $lastOldid );
if ( !$showdifflinks ) {
$curLink = $this->message['cur'];
$lastLink = $this->message['last'];
} else {
$lastLink = Linker::linkKnown( $rc->getTitle(), $this->message['last'],
- array(), $curIdEq + array( 'diff' => $thisOldid, 'oldid' => $lastOldid ) + $rcIdQuery );
+ array(), $curIdEq + array( 'diff' => $thisOldid, 'oldid' => $lastOldid ) );
}
# Make user links
$secureName = $title->getPrefixedDBkey();
if ( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
# Use an @ character to prevent collision with page names
- $this->rc_cache['@@' . ($this->rcMoveIndex++)] = array( $rc );
+ $this->rc_cache['@@' . ( $this->rcMoveIndex++ )] = array( $rc );
} else {
# Logs are grouped by type
if ( $type == RC_LOG ) {
$classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns'
. $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
}
- $classes[] = $block[0]->watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
+ $classes[] = $block[0]->watched && $block[0]->mAttribs['rc_timestamp'] >= $block[0]->watched
+ ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
$r = Html::openElement( 'table', array( 'class' => $classes ) ) .
Html::openElement( 'tr' );
implode( $this->message['semicolon-separator'], $users )
)->escaped() . '</span>';
- $tl = '<span class="mw-collapsible-toggle mw-enhancedchanges-arrow mw-enhancedchanges-arrow-space"></span>';
+ $tl = '<span class="mw-collapsible-toggle mw-collapsible-arrow mw-enhancedchanges-arrow mw-enhancedchanges-arrow-space"></span>';
$r .= "<td>$tl</td>";
# Main line
$classes = array();
$type = $rcObj->mAttribs['rc_type'];
- $r .= '<tr><td></td><td class="mw-enhanced-rc">';
+ $trClass = $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
+ ? ' class="mw-enhanced-watched"' : '';
+
+ $r .= '<tr' . $trClass . '><td></td><td class="mw-enhanced-rc">';
$r .= $this->recentChangesFlags( array(
'newpage' => $type == RC_NEW,
'minor' => $rcObj->mAttribs['rc_minor'],
} elseif ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
$link = '<span class="history-deleted">' . $rcObj->timestamp . '</span> ';
} else {
- if ( $rcObj->unpatrolled && $type == RC_NEW) {
- $params['rcid'] = $rcObj->mAttribs['rc_id'];
- }
$link = Linker::linkKnown(
$rcObj->getTitle(),
$classes[] = Sanitizer::escapeClass( 'mw-changeslist-ns' .
$rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title'] );
}
- $classes[] = $rcObj->watched ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
+ $classes[] = $rcObj->watched && $rcObj->mAttribs['rc_timestamp'] >= $rcObj->watched
+ ? 'mw-changeslist-line-watched' : 'mw-changeslist-line-not-watched';
$r = Html::openElement( 'table', array( 'class' => $classes ) ) .
Html::openElement( 'tr' );
$r .= '<td class="mw-enhanced-rc"><span class="mw-enhancedchanges-arrow-space"></span>';
# Flag and Timestamp
if ( $type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT ) {
- $r .= '    '; // 4 flags -> 4 spaces
+ $r .= $this->recentChangesFlags( array() ); // no flags, but need the placeholders
} else {
$r .= $this->recentChangesFlags( array(
'newpage' => $type == RC_NEW,