: $nothing;
$f .= $bot ? '<span class="bot">' . $this->message['boteditletter'] . '</span>' : $nothing;
$f .= $patrolled ? '<span class="unpatrolled">!</span>' : $nothing;
- return "<tt>$f</tt>";
+ return $f;
}
/**
}
}
- /**
- * int $field one of DELETED_* bitfield constants
- * @return bool
- */
- function isDeleted( $rc, $field ) {
- return ($rc->mAttribs['rc_deleted'] & $field) == $field;
- }
-
- /**
- * Determine if the current user is allowed to view a particular
- * field of this revision, if it's marked as deleted.
- * @param int $field
- * @return bool
- */
- function userCan( $rc, $field ) {
- if( ( $rc->mAttribs['rc_deleted'] & $field ) == $field ) {
- global $wgUser;
- $permission = ( $rc->mAttribs['rc_deleted'] & Revision::DELETED_RESTRICTED ) == Revision::DELETED_RESTRICTED
- ? 'hiderevision'
- : 'deleterevision';
- wfDebug( "Checking for $permission due to $field match on $rc->mAttribs['rc_deleted']\n" );
- return $wgUser->isAllowed( $permission );
- } else {
- return true;
- }
- }
function insertMove( &$s, $rc ) {
# Diff
$s .= '(' . $this->skin->makeKnownLinkObj($title, $logname ) . ')';
}
+
function insertDiffHist(&$s, &$rc, $unpatrolled) {
# 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 ) {
+ if( $rc->mAttribs['rc_type'] == RC_NEW || $rc->mAttribs['rc_type'] == RC_LOG ) {
$diffLink = $this->message['diff'];
} else {
$rcidparam = $unpatrolled
$params = ( $unpatrolled && $rc->mAttribs['rc_type'] == RC_NEW )
? 'rcid='.$rc->mAttribs['rc_id']
: '';
- if( $this->isDeleted($rc,Revision::DELETED_TEXT) ) {
- $articlelink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
- $articlelink = '<span class="history-deleted">'.$articlelink.'</span>';
- } else {
- $articlelink = ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
- }
+ $articlelink = ' '. $this->skin->makeKnownLinkObj( $rc->getTitle(), '', $params );
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;
}
/** Insert links to user page, user talk page and eventually a blocking link */
function insertUserRelatedLinks(&$s, &$rc) {
- if ( $this->isDeleted($rc,Revision::DELETED_USER) ) {
- $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>';
- } else {
- $s .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
- $s .= $this->skin->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
- }
- }
-
- /** insert a formatted action */
- function insertAction(&$s, &$rc) {
- # Add comment
- if( $rc->mAttribs['rc_type'] == RC_LOG ) {
- // log action
- if ( $this->isDeleted($rc,LogViewer::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 .= $this->skin->userLink( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
+ $s .= $this->skin->userToolLinks( $rc->mAttribs['rc_user'], $rc->mAttribs['rc_user_text'] );
}
/** insert a formatted comment */
function insertComment(&$s, &$rc) {
# Add comment
if( $rc->mAttribs['rc_type'] != RC_MOVE && $rc->mAttribs['rc_type'] != RC_MOVE_OVER_REDIRECT ) {
- // log comment
- if ( $this->isDeleted($rc,Revision::DELETED_COMMENT) ) {
- $s .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span>';
- } else {
- $s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
- }
+ $s .= $this->skin->commentBlock( $rc->mAttribs['rc_comment'], $rc->getTitle() );
}
}
$s .= '<li>';
- // Moved pages
+ // 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 ) {
+ // log entries
+ } elseif ( $rc_namespace == NS_SPECIAL ) {
list( $specialName, $specialSubpage ) = SpecialPage::resolveAliasWithSubpage( $rc_title );
if ( $specialName == 'Log' ) {
$this->insertLog( $s, $rc->getTitle(), $specialSubpage );
} else {
wfDebug( "Unexpected special page in recentchanges\n" );
}
- // Log entries
+ // all other stuff
} else {
wfProfileIn($fname.'-page');
}
$this->insertUserRelatedLinks($s,$rc);
- $this->insertAction($s, $rc);
$this->insertComment($s, $rc);
-
- # Mark revision as deleted
- if ( !$rc_log_type && $this->isDeleted($rc,Revision::DELETED_TEXT) )
- $s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
- if($rc->numberofWatchingusers > 0) {
- $s .= ' ' . wfMsg('number_of_watching_users_RCview', $wgContLang->formatNum($rc->numberofWatchingusers));
- }
+
+ $s .= rtrim(' ' . $this->numberofWatchingusers($rc->numberofWatchingusers));
$s .= "</li>\n";
$rc->unpatrolled = false;
}
- $showrev=true;
# Make article link
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) ) {
- $clink = '<span class="history-deleted">' . $this->skin->makeKnownLinkObj( $rc->getTitle(), '' ) . '</span>';
- if ( !ChangesList::userCan($rc,Revision::DELETED_TEXT) )
- $showrev=false;
- } else if( $rc->unpatrolled && $rc_type == RC_NEW ) {
+ } elseif( $rc->unpatrolled && $rc_type == RC_NEW ) {
# Unpatrolled new page, give rc_id in query
$clink = $this->skin->makeKnownLinkObj( $rc->getTitle(), '', "rcid={$rc_id}" );
} else {
$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 ) {
- $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 ) {
+ if( $rc_type == RC_NEW || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
if( $rc_type != RC_NEW ) {
$curLink = $this->message['cur'];
}
}
# Make "last" link
- if ( !$showrev ) {
- $lastLink = $this->message['last'];
- } else if( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
+ if( $rc_last_oldid == 0 || $rc_type == RC_LOG || $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
$lastLink = $this->message['last'];
} else {
$lastLink = $this->skin->makeKnownLinkObj( $rc->getTitle(), $this->message['last'],
- $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
- }
-
- # Make user links
- if ( $this->isDeleted($rc,Revision::DELETED_USER) ) {
- $rc->userlink = ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-user') . '</span>';
- } else {
- $rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
- $rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
+ $curIdEq.'&diff='.$rc_this_oldid.'&oldid='.$rc_last_oldid . $rcIdQuery );
}
+ $rc->userlink = $this->skin->userLink( $rc_user, $rc_user_text );
+
$rc->lastlink = $lastLink;
$rc->curlink = $curLink;
$rc->difflink = $diffLink;
+ $rc->usertalklink = $this->skin->userToolLinks( $rc_user, $rc_user_text );
+
# Put accumulated information into the cache, for later display
# Page moves go on their own line
$title = $rc->getTitle();
*/
function recentChangesBlockGroup( $block ) {
global $wgLang, $wgContLang, $wgRCShowChangedSize;
- $r = '<table cellpadding="0" cellspacing="0"><tr>';
+ $r = '';
# Collate list of users
$isnew = false;
- $namehidden = true;
$unpatrolled = false;
$userlinks = array();
foreach( $block as $rcObj ) {
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) ) {
- $namehidden = false;
- }
$u = $rcObj->userlink;
if( !isset( $userlinks[$u] ) ) {
$userlinks[$u] = 0;
$toggleLink = "javascript:toggleVisibility('$rci','$rcm','$rcl')";
$tl = '<span id="'.$rcm.'"><a href="'.$toggleLink.'">' . $this->sideArrow() . '</a></span>';
$tl .= '<span id="'.$rcl.'" style="display:none"><a href="'.$toggleLink.'">' . $this->downArrow() . '</a></span>';
- $r .= '<td valign="top">'.$tl;
+ $r .= $tl;
# Main line
- $r .= ' '.$this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot );
+ $r .= '<tt>';
+ $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, ' ', $bot );
# Timestamp
- $r .= ' '.$block[0]->timestamp.' </td><td>';
+ $r .= ' '.$block[0]->timestamp.' </tt>';
# Article link
- if ( $namehidden )
- $r .= ' <span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
- else
- $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
+ $r .= $this->maybeWatchedLink( $block[0]->link, $block[0]->watched );
$r .= $wgContLang->getDirMark();
$curIdEq = 'curid=' . $block[0]->mAttribs['rc_cur_id'];
$currentRevision = $block[0]->mAttribs['rc_this_oldid'];
if( $block[0]->mAttribs['rc_type'] != RC_LOG ) {
# Changes
+
$n = count($block);
static $nchanges = array();
if ( !isset( $nchanges[$n] ) ) {
$r .= ' (';
- if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) {
- $r .= $nchanges[$n];
- } else if( $isnew ) {
+ if( $isnew ) {
$r .= $nchanges[$n];
} else {
$r .= $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
$nchanges[$n], $curIdEq."&diff=$currentRevision&oldid=$oldid" );
}
+ $r .= ') . . ';
+
if( $wgRCShowChangedSize ) {
# Character difference
$chardiff = $rcObj->getCharacterDifference( $block[ count( $block ) - 1 ]->mAttribs['rc_old_len'],
$block[0]->mAttribs['rc_new_len'] );
if( $chardiff == '' ) {
- $r .= ') ';
+ $r .= ' (';
} else {
$r .= ' ' . $chardiff. ' . . ';
}
- }
+ }
# History
$r .= '(' . $this->skin->makeKnownLinkObj( $block[0]->getTitle(),
}
$r .= $users;
- $r .=$this->numberofWatchingusers($block[0]->numberofWatchingusers);
-
- $r .= "</td></tr></table>\n";
+
+ $r .= $this->numberofWatchingusers($block[0]->numberofWatchingusers);
+ $r .= "<br />\n";
# Sub-entries
- $r .= '<div id="'.$rci.'" style="display:none; font-size:95%;"><table cellpadding="0" cellspacing="0">';
+ $r .= '<div id="'.$rci.'" style="display:none">';
foreach( $block as $rcObj ) {
# Get rc_xxxx variables
// FIXME: Would be good to replace this extract() call with something that explicitly initializes local variables.
extract( $rcObj->mAttribs );
- #$r .= '<tr><td valign="top">'.$this->spacerArrow();
- $r .= '<tr><td valign="top">'.$this->spacerIndent();
- $r .= ' ';
+ $r .= $this->spacerArrow();
+ $r .= '<tt> ';
$r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot );
- $r .= ' </td><td valign="top">';
+ $r .= ' </tt>';
$o = '';
if( $rc_this_oldid != 0 ) {
$o = 'oldid='.$rc_this_oldid;
}
- # Revision link
if( $rc_type == RC_LOG ) {
- $link = $rcObj->timestamp.' ';
- } else if( !ChangesList::userCan($rcObj,Revision::DELETED_TEXT) ) {
- $link = '<span class="history-deleted">'.$rcObj->timestamp.'</span> ';
+ $link = $rcObj->timestamp;
} else {
$link = $this->skin->makeKnownLinkObj( $rcObj->getTitle(), $rcObj->timestamp, $curIdEq.'&'.$o );
- if( $this->isDeleted($rcObj,Revision::DELETED_TEXT) )
- $link = '<span class="history-deleted">'.$link.'</span> ';
}
+ $link = '<tt>'.$link.'</tt>';
+
$r .= $link;
-
- if ( !$rc_log_type ) {
- $r .= ' (';
- $r .= $rcObj->curlink;
- $r .= '; ';
- $r .= $rcObj->lastlink;
- $r .= ')';
- } else {
- $logname = LogPage::logName( $rc_log_type );
- $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
- $r .= '(' . $this->skin->makeKnownLinkObj($logtitle, $logname ) . ')';
- }
- $r .= ' . . ';
+ $r .= ' (';
+ $r .= $rcObj->curlink;
+ $r .= '; ';
+ $r .= $rcObj->lastlink;
+ $r .= ') . . ';
# Character diff
if( $wgRCShowChangedSize ) {
$r .= ( $rcObj->getCharacterDifference() == '' ? '' : $rcObj->getCharacterDifference() . ' . . ' ) ;
}
- # User links
+
$r .= $rcObj->userlink;
$r .= $rcObj->usertalklink;
- // log action
- parent::insertAction($r, $rcObj);
- // log comment
- parent::insertComment($r, $rcObj);
- # Mark revision as deleted
- if ( !$rc_log_type && $this->isDeleted($rcObj,Revision::DELETED_TEXT) )
- $s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
-
- $r .= "</td></tr>\n";
+ $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
+ $r .= "<br />\n";
}
- $r .= "</table></div>\n";
+ $r .= "</div>\n";
$this->rcCacheIndex++;
return $r;
* @access private
*/
function spacerArrow() {
- //FIXME: problems with FF 1.5x
return $this->arrow( '', ' ' );
}
-
- /**
- * Generate HTML for the equivilant 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 = '';
+
+ # Spacer image
+ $r .= $this->spacerArrow();
- # spacerArrow() causes issues in FF
- $r .= $this->spacerColumn();
- $r .= '<td valign="top">';
-
# Flag and Timestamp
+ $r .= '<tt>';
+
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
- $r .= ' ';
+ $r .= ' ';
} else {
- $r .= ' '.$this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot );
+ $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, ' ', $rc_bot );
}
- $r .= ' '.$rcObj->timestamp.' </td><td>';
-
+ $r .= ' '.$rcObj->timestamp.' </tt>';
+
# Article link
- if ( $rc_log_type !='' ) {
- $logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
- $logname = LogPage::logName( $rc_log_type );
- $r .= '(' . $this->skin->makeKnownLinkObj($logtitle, $logname ) . ')';
- // All other stuff
- } else {
- $r .= $this->maybeWatchedLink( $rcObj->link, $rcObj->watched );
- }
- if ( $rc_type != RC_LOG ) {
- # Diff
- $r .= ' ('. $rcObj->difflink .'; ';
- # Hist
- $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ')';
- }
- $r .= ' . . ';
-
+ $r .= $this->maybeWatchedLink( $rcObj->link, $rcObj->watched );
+
+ # Diff
+ $r .= ' ('. $rcObj->difflink .'; ';
+
+ # Hist
+ $r .= $this->skin->makeKnownLinkObj( $rcObj->getTitle(), wfMsg( 'hist' ), $curIdEq.'&action=history' ) . ') . . ';
+
# Character diff
if( $wgRCShowChangedSize ) {
$r .= ( $rcObj->getCharacterDifference() == '' ? '' : ' ' . $rcObj->getCharacterDifference() . ' . . ' ) ;
}
# User/talk
- $r .= ' '.$rcObj->userlink . $rcObj->usertalklink;
+ $r .= $rcObj->userlink . $rcObj->usertalklink;
# Comment
if( $rc_type != RC_MOVE && $rc_type != RC_MOVE_OVER_REDIRECT ) {
- // log action
- if ( $this->isDeleted($rcObj,LogViewer::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) ) {
- $r .= ' <span class="history-deleted">' . wfMsg('rev-deleted-comment') . '</span>';
- } else {
- $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
- }
+ $r .= $this->skin->commentBlock( $rc_comment, $rcObj->getTitle() );
}
$r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
- $r .= "</td></tr></table>\n";
+ $r .= "<br />\n";
return $r;
}