$contribs = wfMsg( 'contribslink' );
if ( $this->mNewRev->isCurrent() && $wgUser->isAllowed('rollback') ) {
- $username = $this->mNewRev->getUserText();
- $rollback = ' <strong>[' . $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'rollbacklink' ),
- 'action=rollback&from=' . urlencode( $username ) .
- '&token=' . urlencode( $wgUser->editToken( array( $this->mTitle->getPrefixedText(), $username ) ) ) ) .
- ']</strong>';
+ $rollback = ' ' . $sk->generateRollback( $this->mNewRev );
} else {
$rollback = '';
}
return array( $inside, $trail );
}
+ /**
+ * Generate a rollback link for a given revision. Currently it's the
+ * caller's responsibility to ensure that the revision is the top one. If
+ * it's not, of course, the user will get an error message.
+ *
+ * If the calling page is called with the parameter &bot=1, all rollback
+ * links also get that parameter. It causes the edit itself and the rollback
+ * to be marked as "bot" edits. Bot edits are hidden by default from recent
+ * changes, so this allows sysops to combat a busy vandal without bothering
+ * other users.
+ *
+ * @param Revision $rev
+ */
+ function generateRollback( $rev ) {
+ global $wgUser, $wgRequest;
+ $title = $rev->getTitle();
+
+ $extraRollback = $wgRequest->getBool( 'bot' ) ? '&bot=1' : '';
+ $extraRollback .= '&token=' . urlencode(
+ $wgUser->editToken( array( $title->getPrefixedText(), $rev->getUserText() ) ) );
+ return '<span class="mw-rollback-link">['. $this->makeKnownLinkObj( $title,
+ wfMsg('rollbacklink'),
+ 'action=rollback&from=' . urlencode( $rev->getUserText() ) . $extraRollback ) .']</span>';
+ }
}
?>
/** @todo document */
function historyLine( $row, $next, $counter = '', $notificationtimestamp = false, $latest = false, $firstInList = false ) {
- global $wgUser, $wgRequest, $wgTitle;
+ global $wgUser;
$rev = new Revision( $row );
$rev->setTitle( $this->mTitle );
$s .= ' ' . wfMsgHtml( 'deletedrev' );
}
if( $wgUser->isAllowed( 'rollback' ) && $firstInList ) {
- $extraRollback = $wgRequest->getBool( 'bot' ) ? '&bot=1' : '';
- $extraRollback .= '&token=' . urlencode(
- $wgUser->editToken( array( $wgTitle->getPrefixedText(), $rev->getUserText() ) ) );
- $s .= ' ['. $this->mSkin->makeKnownLinkObj( $wgTitle,
- wfMsg('rollbacklink'),
- 'action=rollback&from=' . $rev->getUserText() . $extraRollback ) .']';
+ $s .= ' '.$this->mSkin->generateRollback( $rev );
}
$s .= "</li>\n";
* privileges. The rollback link restores the most recent version that was not
* written by the target user.
*
- * If the contributions page is called with the parameter &bot=1, all rollback
- * links also get that parameter. It causes the edit itself and the rollback
- * to be marked as "bot" edits. Bot edits are hidden by default from recent
- * changes, so this allows sysops to combat a busy vandal without bothering
- * other users.
- *
* @todo This would probably look a lot nicer in a table.
*/
function ucListEdit( $sk, $row ) {
}
$rev = new Revision( $row );
-
+
$page = Title::makeTitle( $row->page_namespace, $row->page_title );
$link = $sk->makeKnownLinkObj( $page );
$difftext = $topmarktext = '';
}
if( $wgUser->isAllowed( 'rollback' ) ) {
- $extraRollback = $wgRequest->getBool( 'bot' ) ? '&bot=1' : '';
- $extraRollback .= '&token=' . urlencode(
- $wgUser->editToken( array( $page->getPrefixedText(), $row->rev_user_text ) ) );
- $topmarktext .= ' ['. $sk->makeKnownLinkObj( $page,
- $messages['rollbacklink'],
- 'action=rollback&from=' . urlencode( $row->rev_user_text ) . $extraRollback ) .']';
+ $topmarktext .= ' '.$sk->generateRollback( $rev );
}
}