'wgStructuredChangeFiltersSavedQueriesPreferenceName',
'rcfilters-wl-saved-queries'
);
+ $output->addJsConfigVars(
+ 'wgStructuredChangeFiltersEditWatchlistUrl',
+ SpecialPage::getTitleFor( 'EditWatchlist' )->getLocalURL()
+ );
}
}
- protected function isStructuredFilterUiEnabled() {
- return parent::isStructuredFilterUiEnabled()
- && ( $this->getConfig()->get( 'StructuredChangeFiltersOnWatchlist' )
- || $this->getRequest()->getBool( 'rcfilters' ) );
+ public function isStructuredFilterUiEnabled() {
+ return $this->getRequest()->getBool( 'rcfilters' ) || (
+ $this->getConfig()->get( 'StructuredChangeFiltersOnWatchlist' ) &&
+ $this->getUser()->getOption( 'rcenhancedfilters' )
+ );
+ }
+
+ public function isStructuredFilterUiEnabledByDefault() {
+ return $this->getConfig()->get( 'StructuredChangeFiltersOnWatchlist' ) &&
+ $this->getUser()->getDefaultOption( 'rcenhancedfilters' );
}
/**
*/
public function getDefaultOptions() {
$opts = parent::getDefaultOptions();
- $user = $this->getUser();
- $opts->add( 'days', $user->getOption( 'watchlistdays' ), FormOptions::FLOAT );
- $opts->add( 'limit', $user->getIntOption( 'wllimit' ), FormOptions::INT );
+ $opts->add( 'days', $this->getDefaultDays(), FormOptions::FLOAT );
+ $opts->add( 'limit', $this->getDefaultLimit(), FormOptions::INT );
return $opts;
}
$showUpdatedMarker = $this->getConfig()->get( 'ShowUpdatedMarker' );
// Show watchlist header
- $form .= "<p>";
+ $watchlistHeader = '';
if ( $numItems == 0 ) {
- $form .= $this->msg( 'nowatchlist' )->parse() . "\n";
+ $watchlistHeader = $this->msg( 'nowatchlist' )->parse();
} else {
- $form .= $this->msg( 'watchlist-details' )->numParams( $numItems )->parse() . "\n";
+ $watchlistHeader .= $this->msg( 'watchlist-details' )->numParams( $numItems )->parse() . "\n";
if ( $this->getConfig()->get( 'EnotifWatchlist' )
&& $user->getOption( 'enotifwatchlistpages' )
) {
- $form .= $this->msg( 'wlheader-enotif' )->parse() . "\n";
+ $watchlistHeader .= $this->msg( 'wlheader-enotif' )->parse() . "\n";
}
if ( $showUpdatedMarker ) {
- $form .= $this->msg( 'wlheader-showupdated' )->parse() . "\n";
+ $watchlistHeader .= $this->msg(
+ $this->isStructuredFilterUiEnabled() ?
+ 'rcfilters-watchlist-showupdated' :
+ 'wlheader-showupdated'
+ )->parse() . "\n";
}
}
- $form .= "</p>";
+ $form .= Html::rawElement(
+ 'div',
+ [ 'class' => 'watchlistDetails' ],
+ $watchlistHeader
+ );
if ( $numItems > 0 && $showUpdatedMarker ) {
$form .= Xml::openElement( 'form', [ 'method' => 'post',
}
function getDefaultDays() {
- return $this->getUser()->getIntOption( 'watchlistdays' );
+ return floatval( $this->getUser()->getOption( 'watchlistdays' ) );
}
}