* @file
* @ingroup SpecialPage
*/
-
+
class SpecialContributions extends SpecialPage {
public function __construct() {
$this->opts['limit'] = $wgRequest->getInt( 'limit', $wgUser->getOption('rclimit') );
$this->opts['target'] = $target;
+ $this->opts['topOnly'] = $wgRequest->getCheck( 'topOnly' );
$nt = Title::makeTitleSafe( NS_USER, $target );
if( !$nt ) {
}
$this->opts['tagfilter'] = (string) $wgRequest->getVal( 'tagfilter' );
-
+
// Allows reverts to have the bot flag in recent changes. It is just here to
- // be passed in the form at the top of the page
+ // be passed in the form at the top of the page
if( $wgUser->isAllowed( 'markbotedits' ) && $wgRequest->getBool( 'bot' ) ) {
$this->opts['bot'] = '1';
}
$this->opts['year'] = $wgRequest->getIntOrNull( 'year' );
$this->opts['month'] = $wgRequest->getIntOrNull( 'month' );
}
-
+
// Add RSS/atom links
$this->setSyndicated();
$feedType = $wgRequest->getVal( 'feed' );
$wgOut->addHTML( $this->getForm() );
- $pager = new ContribsPager( $target, $this->opts['namespace'], $this->opts['year'],
- $this->opts['month'], false, $this->opts['deletedOnly'] );
+ $pager = new ContribsPager( $target, $this->opts['namespace'], $this->opts['year'],
+ $this->opts['month'], false, $this->opts['deletedOnly'], $this->opts['topOnly'] );
if( !$pager->getNumRows() ) {
$wgOut->addWikiMsg( 'nocontribs', $target );
} else {
}
}
}
-
+
protected function setSyndicated() {
global $wgOut;
$wgOut->setSyndicated( true );
array(),
array(
'action' => 'unblock',
- 'ip' => $nt->getDBkey()
+ 'ip' => $nt->getDBkey()
)
);
}
*/
protected function getForm() {
global $wgScript;
-
+
$this->opts['title'] = $this->getTitle()->getPrefixedText();
if( !isset( $this->opts['target'] ) ) {
$this->opts['target'] = '';
} else {
$this->opts['target'] = str_replace( '_' , ' ' , $this->opts['target'] );
}
-
+
if( !isset( $this->opts['namespace'] ) ) {
$this->opts['namespace'] = '';
}
-
+
if( !isset( $this->opts['contribs'] ) ) {
$this->opts['contribs'] = 'user';
}
-
+
if( !isset( $this->opts['year'] ) ) {
$this->opts['year'] = '';
}
-
+
if( !isset( $this->opts['month'] ) ) {
$this->opts['month'] = '';
}
-
+
if( $this->opts['contribs'] == 'newbie' ) {
$this->opts['target'] = '';
}
if( !isset( $this->opts['tagfilter'] ) ) {
$this->opts['tagfilter'] = '';
}
-
+
+ if( !isset( $this->opts['topOnly'] ) ) {
+ $this->opts['topOnly'] = false;
+ }
+
$f = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
# Add hidden params for tracking except for parameters in $skipParameters
- $skipParameters = array( 'namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month' );
+ $skipParameters = array( 'namespace', 'deletedOnly', 'target', 'contribs', 'year', 'month', 'topOnly' );
foreach ( $this->opts as $name => $value ) {
if( in_array( $name, $skipParameters ) ) {
continue;
}
$tagFilter = ChangeTags::buildTagFilterSelector( $this->opts['tagfilter'] );
-
+
$f .= '<fieldset>' .
Xml::element( 'legend', array(), wfMsg( 'sp-contributions-search' ) ) .
- Xml::radioLabel( wfMsgExt( 'sp-contributions-newbies', array( 'parsemag' ) ),
+ Xml::radioLabel( wfMsgExt( 'sp-contributions-newbies', array( 'parsemag' ) ),
'contribs', 'newbie' , 'newbie', $this->opts['contribs'] == 'newbie' ? true : false ) . '<br />' .
- Xml::radioLabel( wfMsgExt( 'sp-contributions-username', array( 'parsemag' ) ),
+ Xml::radioLabel( wfMsgExt( 'sp-contributions-username', array( 'parsemag' ) ),
'contribs' , 'user', 'user', $this->opts['contribs'] == 'user' ? true : false ) . ' ' .
Html::input( 'target', $this->opts['target'], 'text', array(
'size' => '20',
Xml::namespaceSelector( $this->opts['namespace'], '' ) .
'</span>' .
Xml::checkLabel( wfMsg( 'history-show-deleted' ),
- 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'] ) .
+ 'deletedOnly', 'mw-show-deleted-only', $this->opts['deletedOnly'] ) . '<br />' .
+ Xml::tags( 'p', null, Xml::checkLabel( wfMsg( 'sp-contributions-toponly' ),
+ 'topOnly', 'mw-show-top-only', $this->opts['topOnly'] ) ) .
( $tagFilter ? Xml::tags( 'p', null, implode( ' ', $tagFilter ) ) : '' ) .
Xml::openElement( 'p' ) .
'<span style="white-space: nowrap">' .
'</span>' . ' ' .
Xml::submitButton( wfMsg( 'sp-contributions-submit' ) ) .
Xml::closeElement( 'p' );
-
+
$explain = wfMsgExt( 'sp-contributions-explain', 'parseinline' );
if( !wfEmptyMsg( 'sp-contributions-explain', $explain ) )
$f .= "<p id='mw-sp-contributions-explain'>{$explain}</p>";
-
+
$f .= '</fieldset>' .
Xml::closeElement( 'form' );
return $f;
}
-
+
/**
* Output a subscription feed listing recent edits to this page.
* @param $type String
wfMsgExt( 'tagline', 'parsemag' ),
$this->getTitle()->getFullUrl() . "/" . urlencode($this->opts['target'])
);
-
+
// Already valid title
$nt = Title::makeTitleSafe( NS_USER, $this->opts['target'] );
$target = $this->opts['target'] == 'newbies' ? 'newbies' : $nt->getText();
-
- $pager = new ContribsPager( $target, $this->opts['namespace'],
- $this->opts['year'], $this->opts['month'], $this->opts['tagfilter'], $this->opts['deletedOnly'] );
+
+ $pager = new ContribsPager( $target, $this->opts['namespace'], $this->opts['year'],
+ $this->opts['month'], $this->opts['tagfilter'], $this->opts['deletedOnly'], $this->opts['topOnly'] );
$pager->mLimit = min( $this->opts['limit'], $wgFeedLimit );
protected function feedItemDesc( $revision ) {
if( $revision ) {
return '<p>' . htmlspecialchars( $revision->getUserText() ) . wfMsgForContent( 'colon-separator' ) .
- htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) .
+ htmlspecialchars( FeedItem::stripComment( $revision->getComment() ) ) .
"</p>\n<hr />\n<div>" .
nl2br( htmlspecialchars( $revision->getText() ) ) . "</div>";
}
var $messages, $target;
var $namespace = '', $mDb;
- function __construct( $target, $namespace = false, $year = false, $month = false, $tagFilter = false, $deletedOnly = false ) {
+ function __construct( $target, $namespace = false, $year = false, $month = false, $tagFilter = false, $deletedOnly = false, $topOnly = false ) {
parent::__construct();
$msgs = array( 'uctop', 'diff', 'newarticle', 'rollbacklink', 'diff', 'hist', 'rev-delundel', 'pipe-separator' );
$this->namespace = $namespace;
$this->tagFilter = $tagFilter;
$this->deletedOnly = $deletedOnly;
+ $this->topOnly = $topOnly;
$this->getDateCond( $year, $month );
function getQueryInfo() {
global $wgUser;
list( $tables, $index, $userCond, $join_cond ) = $this->getUserCond();
-
+
$conds = array_merge( $userCond, $this->getNamespaceCond() );
// Paranoia: avoid brute force searches (bug 17342)
if( !$wgUser->isAllowed( 'deletedhistory' ) ) {
' != ' . Revision::SUPPRESSED_USER;
}
$join_cond['page'] = array( 'INNER JOIN', 'page_id=rev_page' );
-
+
$queryInfo = array(
'tables' => $tables,
'fields' => array(
'page_namespace', 'page_title', 'page_is_new', 'page_latest', 'page_is_redirect',
- 'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment',
+ 'page_len','rev_id', 'rev_page', 'rev_text_id', 'rev_timestamp', 'rev_comment',
'rev_minor_edit', 'rev_user', 'rev_user_text', 'rev_parent_id', 'rev_deleted'
),
'conds' => $conds,
$condition['rev_user_text'] = $this->target;
$index = 'usertext_timestamp';
}
- if ( $this->deletedOnly ) {
+ if( $this->deletedOnly ) {
$condition[] = "rev_deleted != '0'";
}
+ if( $this->topOnly ) {
+ $condition[] = "rev_id = page_latest";
+ }
return array( $tables, $index, $condition, $join_conds );
}
$diffHistLinks = '(' . $difftext . $this->messages['pipe-separator'] . $histlink . ')';
$ret = "{$del}{$d} {$diffHistLinks} {$nflag}{$mflag} {$link}{$userlink} {$comment} {$topmarktext}";
-
+
# Denote if username is redacted for this edit
if( $rev->isDeleted( Revision::DELETED_USER ) ) {
$ret .= " <strong>" . wfMsgHtml('rev-deleted-user-contribs') . "</strong>";