<?php
-/**
- * Contain class to show various lists of change:
- * - what's link here
- * - related changes
- * - recent changes
- */
/**
* @todo document
class RCCacheEntry extends RecentChange
{
var $secureName, $link;
- var $curlinks, $difflink, $lastlink , $usertalklink , $versionlink ;
+ var $curlink , $difflink, $lastlink , $usertalklink , $versionlink ;
var $userlink, $timestamp, $watched;
- function newFromParent( $rc )
- {
+ static function newFromParent( $rc ) {
$rc2 = new RCCacheEntry;
$rc2->mAttribs = $rc->mAttribs;
$rc2->mExtra = $rc->mExtra;
} ;
/**
- * @package MediaWiki
+ * Class to show various lists of changes:
+ * - what links here
+ * - related changes
+ * - recent changes
*/
class ChangesList {
# Called by history lists and recent changes
// Precache various messages
if( !isset( $this->message ) ) {
foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last '.
- 'blocklink history boteditletter' ) as $msg ) {
+ 'blocklink history boteditletter semicolon-separator' ) as $msg ) {
$this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
}
}
# Diff link
if( !$this->userCan($rc,Revision::DELETED_TEXT) ) {
$diffLink = $this->message['diff'];
- } else if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG) {
+ } else if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
$diffLink = $this->message['diff'];
} else {
$rcidparam = $unpatrolled
} else {
$articlelink = ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
}
- if($watched) $articlelink = '<strong>'.$articlelink.'</strong>';
+ if( $watched )
+ $articlelink = "<strong class=\"mw-watched\">{$articlelink}</strong>";
global $wgContLang;
$articlelink .= $wgContLang->getDirMark();
+ wfRunHooks('ChangesListInsertArticleLink',
+ array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched));
+
$s .= ' '.$articlelink;
}
function insertTimestamp(&$s, $rc) {
global $wgLang;
# Timestamp
- $s .= '; ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
+ $s .= $this->message['semicolon-separator'] . ' ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
}
/** Insert links to user page, user talk page and eventually a blocking link */
/** insert a formatted action */
function insertAction(&$s, &$rc) {
- # Add comment
+ # Add action
if( $rc->mAttribs['rc_type'] == RC_LOG ) {
// log action
- if ( $this->isDeleted($rc,LogViewer::DELETED_ACTION) ) {
+ if ( $this->isDeleted($rc,LogPage::DELETED_ACTION) ) {
$s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
- $s .= ' ' . LogPage::actionText( $rc->mAttribs['rc_log_type'], $rc->mAttribs['rc_log_action'], $rc->getTitle(), $this->skin, LogPage::extractParams($rc->mAttribs['rc_params']), true, true );
+ $s .= ' ' . LogPage::actionText( $rc->mAttribs['rc_log_type'], $rc->mAttribs['rc_log_action'],
+ $rc->getTitle(), $this->skin, LogPage::extractParams($rc->mAttribs['rc_params']), true, true );
}
}
}
*/
function usePatrol() {
global $wgUseRCPatrol, $wgUser;
- return( $wgUseRCPatrol && $wgUser->isAllowed( 'patrol' ) );
+ return( $wgUseRCPatrol && ($wgUser->isAllowed('patrol') || $wgUser->isAllowed('patrolmarks')) );
}
/**
// Moved pages
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$this->insertMove( $s, $rc );
+ // Log entries
+ } elseif( $rc_log_type !='' ) {
+ $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
+ $this->insertLog( $s, $logtitle, $rc_log_type );
// Log entries (old format) or log targets, and special pages
} elseif( $rc_namespace == NS_SPECIAL ) {
list( $specialName, $specialSubpage ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
wfDebug( "Unexpected special page in recentchanges\n" );
}
// Log entries
- } elseif( $rc_log_type !='' ) {
- $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
- $this->insertLog( $s, $logtitle, $rc_log_type );
- // All other stuff
- } else {
+ } else {
wfProfileIn($fname.'-page');
$this->insertDiffHist($s, $rc, $unpatrolled);
$rc->unpatrolled = false;
}
- $showrev=true;
+ $showdifflinks = true;
# Make article link
+ // Page moves
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
$clink = wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
$this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
- } else if( $rc_namespace == NS_SPECIAL ) {
// Log entries (old format) and special pages
+ } elseif( $rc_namespace == NS_SPECIAL ) {
list( $specialName, $logtype ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
if ( $specialName == 'Log' ) {
# Log updates, etc
wfDebug( "Unexpected special page in recentchanges\n" );
$clink = '';
}
- } elseif ( $rc_log_type !='' ) {
- // Log entries
- $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
- $logname = LogPage::logName( $rc_log_type );
- $clink = '(' . $this->skin->makeKnownLinkObj($logtitle, $logname ) . ')';
- } if ( $this->isDeleted($rc,Revision::DELETED_TEXT) ) {
+ // Page edits or log entries (group these page)
+ } else if( $this->isDeleted($rc,Revision::DELETED_TEXT) ) {
$clink = '<span class="history-deleted">' . $this->skin->makeKnownLinkObj( $rc->getTitle(), '' ) . '</span>';
if ( !ChangesList::userCan($rc,Revision::DELETED_TEXT) )
- $showrev=false;
+ $showdifflinks = false;
} else if( $rc->unpatrolled && $rc_type == RC_NEW ) {
# Unpatrolled new page, give rc_id in query
$clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
$querydiff = $curIdEq."&diff=$rc_this_oldid&oldid=$rc_last_oldid$rcIdQuery";
$aprops = ' tabindex="'.$baseRC->counter.'"';
$curLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['cur'], $querycur, '' ,'', $aprops );
- if ( !$showrev ) {
+
+ # Make "diff" an "cur" links
+ if ( !$showdifflinks ) {
$curLink = $this->message['cur'];
$diffLink = $this->message['diff'];
} else if( $rc_type == RC_NEW || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
} else {
$diffLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['diff'], $querydiff, '' ,'', $aprops );
}
-
+
# Make "last" link
- if ( !$showrev ) {
+ if( !$showdifflinks ) {
$lastLink = $this->message['last'];
} else if( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$lastLink = $this->message['last'];
if( $rcObj->mAttribs['rc_new'] ) {
$isnew = true;
}
- // if all log actions to this page were hidden, then don't
- // give the name of the affected page for this block
- if( !($rcObj->mAttribs['rc_deleted'] & LogViewer::DELETED_ACTION) ) {
+ // If all log actions to this page were hidden, then don't
+ // give the name of the affected page for this block!
+ if( !($rcObj->mAttribs['rc_deleted'] & LogPage::DELETED_ACTION) ) {
$namehidden = false;
}
$u = $rcObj->userlink;
array_push( $users, $text );
}
- $users = ' <span class="changedby">['.implode('; ',$users).']</span>';
+ $users = ' <span class="changedby">[' . implode( $this->message['semicolon-separator'] . ' ', $users ) . ']</span>';
# Arrow
$rci = 'RCI'.$this->rcCacheIndex;
$r .= ' '.$this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot );
# Timestamp
- $r .= ' '.$block[0]->timestamp.' </td><td>';
+ $r .= ' <tt>'.$block[0]->timestamp.' </tt></td><td>';
# Article link
if ( $namehidden )
$nchanges[$n], $curIdEq."&diff=$currentRevision&oldid=$oldid" );
}
- # Character difference
- $chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'],
- $block[0]->mAttribs['rc_new_len'] );
- if( $chardiff == '' ) {
- $r .= '; ';
- } else {
- $r .= '; ' . $chardiff . ' ';
+ if( $wgRCShowChangedSize ) {
+ # Character difference
+ $chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'],
+ $block[0]->mAttribs['rc_new_len'] );
+ if( $chardiff == '' ) {
+ $r .= ') ';
+ } else {
+ $r .= ' ' . $chardiff. ' . . ';
+ }
}
# History
- $r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(), $this->message['history'], $curIdEq.'&action=history' );
-
+ $r .= '(' . $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
+ $this->message['history'], $curIdEq.'&action=history' );
$r .= ')';
}
}
# Revision link
if( $rc_type == RC_LOG ) {
- $link = $rcObj->timestamp.' ';
+ $link = '<tt>'.$rcObj->timestamp.'</tt> ';
} else if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) {
- $link = '<span class="history-deleted">'.$rcObj->timestamp.'</span> ';
+ $link = '<span class="history-deleted"><tt>'.$rcObj->timestamp.'</tt></span> ';
} else {
- $link = $this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o );
+ $link = '<tt>'.$this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o ).'</tt>';
if( $this->isDeleted($rcObj,Revision::DELETED_TEXT) )
$link = '<span class="history-deleted">'.$link.'</span> ';
}
if ( !$rc_log_type ) {
$r .= ' (';
$r .= $rcObj->curlink;
- $r .= '; ';
+ $r .= $this->message['semicolon-separator'] . ' ';
$r .= $rcObj->lastlink;
$r .= ')';
} else {
parent::insertComment($r, $rcObj);
# Mark revision as deleted
if ( !$rc_log_type && $this->isDeleted($rcObj,Revision::DELETED_TEXT) )
- $s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
+ $r .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
$r .= "</td></tr>\n";
}
function maybeWatchedLink( $link, $watched=false ) {
if( $watched ) {
// FIXME: css style might be more appropriate
- return '<strong>' . $link . '</strong>';
+ return '<strong class="mw-watched">' . $link . '</strong>';
} else {
return $link;
}
* @access private
*/
function spacerArrow() {
- //FIXME: problems with FF 1.5x
return $this->arrow( '', ' ' );
}
/**
- * Generate HTML for the equivilant of a spacer image for tables
+ * Generate HTML for the equivalent of a spacer image for tables
* @return string HTML <td> tag
* @access private
*/
function spacerColumn() {
return '<td width="12"></td>';
- }
+ }
// Adds a few spaces
function spacerIndent() {
return ' ';
- }
+ }
/**
* Enhanced RC ungrouped line.
extract( $rcObj->mAttribs );
$curIdEq = 'curid='.$rc_cur_id;
- $r = '<table cellspacing="0" cellpadding="0"><tr><td>';
+ $r = '<table cellspacing="0" cellpadding="0"><tr>';
# spacerArrow() causes issues in FF
$r .= $this->spacerColumn();
} else {
$r .= ' '.$this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot );
}
- $r .= ' '.$rcObj->timestamp.' </td><td>';
+ $r .= ' <tt>'.$rcObj->timestamp.'</tt> </td><td>';
# Article link
if ( $rc_log_type !='' ) {
}
if ( $rc_type != RC_LOG ) {
# Diff
- $r .= ' ('. $rcObj->difflink .'; ';
+ $r .= ' ('. $rcObj->difflink . $this->message['semicolon-separator'] . ' ';
# Hist
$r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ')';
}
# Comment
if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
// log action
- if ( $this->isDeleted($rcObj,LogViewer::DELETED_ACTION) ) {
+ if ( $this->isDeleted($rcObj,LogPage::DELETED_ACTION) ) {
$r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
} else {
$r .= ' ' . LogPage::actionText( $rc_log_type, $rc_log_action, $rcObj->getTitle(), $this->skin, LogPage::extractParams($rc_params), true, true );
}
// log comment
- if ( $this->isDeleted($rcObj,LogViewer::DELETED_COMMENT) ) {
+ if ( $this->isDeleted($rcObj,LogPage::DELETED_COMMENT) ) {
$r .= ' <span class="history-deleted">' . wfMsg('rev-deleted-comment') . '</span>';
} else {
$r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
}
}
-?>