X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialRecentchanges.php;h=37fa32c4fd09726c5f8d611cd6e344ba930618bf;hb=eabfeda3bec5d8108bddf143cf677aa301d8073b;hp=90abe1ca3fbc06358972531ac546dc5b784345d2;hpb=9ea31e542ed3ac4b0f7292d18fde6818395e0968;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 90abe1ca3f..37fa32c4fd 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -26,10 +26,7 @@ * * @ingroup SpecialPage */ -class SpecialRecentChanges extends SpecialPage { - var $rcOptions, $rcSubpage; - protected $customFilters; - +class SpecialRecentChanges extends ChangesListSpecialPage { /** * The feed format to output as (either 'rss' or 'atom'), or null if no * feed output was requested @@ -52,7 +49,7 @@ class SpecialRecentChanges extends SpecialPage { * @return FormOptions */ public function getDefaultOptions() { - $opts = new FormOptions(); + $opts = parent::getDefaultOptions(); $user = $this->getUser(); $opts->add( 'days', $user->getIntOption( 'rcdays' ) ); @@ -66,10 +63,6 @@ class SpecialRecentChanges extends SpecialPage { $opts->add( 'hidepatrolled', $user->getBoolOption( 'hidepatrolled' ) ); $opts->add( 'hidemyself', false ); - $opts->add( 'namespace', '', FormOptions::INTNULL ); - $opts->add( 'invert', false ); - $opts->add( 'associated', false ); - $opts->add( 'categories', '' ); $opts->add( 'categories_any', false ); $opts->add( 'tagfilter', '' ); @@ -77,43 +70,9 @@ class SpecialRecentChanges extends SpecialPage { return $opts; } - /** - * Create a FormOptions object with options as specified by the user - * - * @param array $parameters - * @return FormOptions - */ - public function setup( $parameters ) { + public function validateOptions( FormOptions $opts ) { global $wgFeedLimit; - - $opts = $this->getDefaultOptions(); - foreach ( $this->getCustomFilters() as $key => $params ) { - $opts->add( $key, $params['default'] ); - } - - $opts = $this->fetchOptionsFromRequest( $opts ); - - // Give precedence to subpage syntax - if ( $parameters !== null ) { - $this->parseParameters( $parameters, $opts ); - } - $opts->validateIntBounds( 'limit', 0, $this->feedFormat ? $wgFeedLimit : 5000 ); - - return $opts; - } - - /** - * Fetch values for a FormOptions object from the WebRequest associated with this instance. - * - * Intended for subclassing, e.g. to add a backwards-compatibility layer. - * - * @param FormOptions $parameters - * @return FormOptions - */ - protected function fetchOptionsFromRequest( $opts ) { - $opts->fetchValuesFromRequest( $this->getRequest() ); - return $opts; } /** @@ -130,17 +89,6 @@ class SpecialRecentChanges extends SpecialPage { return $this->customFilters; } - /** - * Get the current FormOptions for this request - */ - public function getOptions() { - if ( $this->rcOptions === null ) { - $this->rcOptions = $this->setup( $this->rcSubpage ); - } - - return $this->rcOptions; - } - /** * Main execution point * @@ -212,8 +160,7 @@ class SpecialRecentChanges extends SpecialPage { } /** - * Process $par and put options found if $opts - * Mainly used when including the page + * Process $par and put options found in $opts. Used when including the page. * * @param string $par * @param FormOptions $opts @@ -658,65 +605,6 @@ class SpecialRecentChanges extends SpecialPage { return $extraOpts; } - /** - * Return the legend displayed within the fieldset. - * - * This method is also called from SpecialWatchlist. - * - * @param $context the object available as $this in non-static functions - * @return string - */ - public static function makeLegend( IContextSource $context ) { - global $wgRecentChangesFlags; - $user = $context->getUser(); - # The legend showing what the letters and stuff mean - $legend = Xml::openElement( 'dl' ) . "\n"; - # Iterates through them and gets the messages for both letter and tooltip - $legendItems = $wgRecentChangesFlags; - if ( !$user->useRCPatrol() ) { - unset( $legendItems['unpatrolled'] ); - } - foreach ( $legendItems as $key => $legendInfo ) { # generate items of the legend - $label = $legendInfo['title']; - $letter = $legendInfo['letter']; - $cssClass = isset( $legendInfo['class'] ) ? $legendInfo['class'] : $key; - - $legend .= Xml::element( 'dt', - array( 'class' => $cssClass ), $context->msg( $letter )->text() - ) . "\n"; - if ( $key === 'newpage' ) { - $legend .= Xml::openElement( 'dd' ); - $legend .= $context->msg( $label )->escaped(); - $legend .= ' ' . $context->msg( 'recentchanges-legend-newpage' )->parse(); - $legend .= Xml::closeElement( 'dd' ) . "\n"; - } else { - $legend .= Xml::element( 'dd', array(), - $context->msg( $label )->text() - ) . "\n"; - } - } - # (+-123) - $legend .= Xml::tags( 'dt', - array( 'class' => 'mw-plusminus-pos' ), - $context->msg( 'recentchanges-legend-plusminus' )->parse() - ) . "\n"; - $legend .= Xml::element( - 'dd', - array( 'class' => 'mw-changeslist-legend-plusminus' ), - $context->msg( 'recentchanges-label-plusminus' )->text() - ) . "\n"; - $legend .= Xml::closeElement( 'dl' ) . "\n"; - - # Collapsibility - $legend = - '
' . - $context->msg( 'recentchanges-legend-heading' )->parse() . - '
' . $legend . '
' . - '
'; - - return $legend; - } - /** * Send the text to be displayed above the options * @@ -738,14 +626,6 @@ class SpecialRecentChanges extends SpecialPage { } } - /** - * Send the text to be displayed after the options, for use in subclasses. - * - * @param FormOptions $opts - */ - function setBottomText( FormOptions $opts ) { - } - /** * Creates the choose namespace selection * @@ -978,14 +858,8 @@ class SpecialRecentChanges extends SpecialPage { * Add page-specific modules. */ protected function addModules() { + parent::addModules(); $out = $this->getOutput(); $out->addModules( 'mediawiki.special.recentchanges' ); - // This modules include styles and behavior for the legend box, load it unconditionally - $out->addModuleStyles( 'mediawiki.special.changeslist' ); - $out->addModules( 'mediawiki.special.changeslist.js' ); - } - - protected function getGroupName() { - return 'changes'; } }