* @ingroup SpecialPage
*/
+use MediaWiki\Widget\DateInputWidget;
+
/**
* Special:Contributions, show user contributions in a paged list
*
$out->addModuleStyles( [
'mediawiki.special',
'mediawiki.special.changeslist',
+ 'mediawiki.widgets.DateInputWidget.styles',
] );
+ $out->addModules( 'mediawiki.special.contributions' );
$this->addHelpLink( 'Help:User contributions' );
+ $out->enableOOUI();
$this->opts = [];
$request = $this->getRequest();
$this->opts['year'] = '';
$this->opts['month'] = '';
} else {
- $this->opts['year'] = $request->getIntOrNull( 'year' );
- $this->opts['month'] = $request->getIntOrNull( 'month' );
+ $this->opts['year'] = $request->getVal( 'year' );
+ $this->opts['month'] = $request->getVal( 'month' );
+
+ $this->opts['start'] = $request->getVal( 'start' );
+ $this->opts['end'] = $request->getVal( 'end' );
+ $this->opts = ContribsPager::processDateFilter( $this->opts );
}
$feedType = $request->getVal( 'feed' );
'contribs' => $this->opts['contribs'],
'namespace' => $this->opts['namespace'],
'tagfilter' => $this->opts['tagfilter'],
- 'year' => $this->opts['year'],
- 'month' => $this->opts['month'],
+ 'start' => $this->opts['start'],
+ 'end' => $this->opts['end'],
'deletedOnly' => $this->opts['deletedOnly'],
'topOnly' => $this->opts['topOnly'],
'newOnly' => $this->opts['newOnly'],
* @return array
*/
public static function getUserLinks( SpecialPage $sp, User $target ) {
-
$id = $target->getId();
$username = $target->getName();
$userpage = $target->getUserPage();
$this->opts['contribs'] = 'user';
}
- if ( !isset( $this->opts['year'] ) ) {
- $this->opts['year'] = '';
+ if ( !isset( $this->opts['start'] ) ) {
+ $this->opts['start'] = '';
}
- if ( !isset( $this->opts['month'] ) ) {
- $this->opts['month'] = '';
+ if ( !isset( $this->opts['end'] ) ) {
+ $this->opts['end'] = '';
}
if ( $this->opts['contribs'] == 'newbie' ) {
'contribs',
'year',
'month',
+ 'start',
+ 'end',
'topOnly',
'newOnly',
'hideMinor',
implode( '', $filters )
);
- $dateSelectionAndSubmit = Xml::tags( 'div', [],
- Xml::dateMenu(
- $this->opts['year'] === '' ? MWTimestamp::getInstance()->format( 'Y' ) : $this->opts['year'],
- $this->opts['month']
- ) . ' ' .
- Html::submitButton(
- $this->msg( 'sp-contributions-submit' )->text(),
- [ 'class' => 'mw-submit' ], [ 'mw-ui-progressive' ]
- )
+ $dateRangeSelection = Html::rawElement(
+ 'div',
+ [],
+ Xml::label( wfMessage( 'date-range-from' )->text(), 'mw-date-start' ) . ' ' .
+ new DateInputWidget( [
+ 'infusable' => true,
+ 'id' => 'mw-date-start',
+ 'name' => 'start',
+ 'value' => $this->opts['start'],
+ 'longDisplayFormat' => true,
+ ] ) . '<br>' .
+ Xml::label( wfMessage( 'date-range-to' )->text(), 'mw-date-end' ) . ' ' .
+ new DateInputWidget( [
+ 'infusable' => true,
+ 'id' => 'mw-date-end',
+ 'name' => 'end',
+ 'value' => $this->opts['end'],
+ 'longDisplayFormat' => true,
+ ] )
+ );
+
+ $submit = Xml::tags( 'div', [],
+ Html::submitButton(
+ $this->msg( 'sp-contributions-submit' )->text(),
+ [ 'class' => 'mw-submit' ], [ 'mw-ui-progressive' ]
+ )
);
$form .= Xml::fieldset(
$namespaceSelection .
$filterSelection .
$extraOptions .
- $dateSelectionAndSubmit,
+ $dateRangeSelection .
+ $submit,
[ 'class' => 'mw-contributions-table' ]
);