Pass all non-default values as hidden field in namespace form on Special:Watchlist
authorAlexandre Emsenhuber <ialex.wiki@gmail.com>
Mon, 18 Feb 2013 09:45:49 +0000 (10:45 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 19 Feb 2013 23:20:58 +0000 (23:20 +0000)
Except 'namespace', 'invert' and 'associated' which are displayed in the form.
This allows to forward all parameters that were modified using query string, e.g.
the new 'extended' parameter added in I115544005a621ee01a0ed0970a13099af92f42e7
that would be lost otherwise when using the form.

Change-Id: Idb0d3b1d6b4827d35ac9b09eb4d8a5ae630a0e3a

includes/specials/SpecialWatchlist.php

index 7033de6..2132b65 100644 (file)
@@ -333,6 +333,11 @@ class SpecialWatchlist extends SpecialPage {
                        $links[] = $this->showHideLink( $nondefaults, $msg, $name, $values[$name] );
                }
 
+               $hiddenFields = $nondefaults;
+               unset( $hiddenFields['namespace'] );
+               unset( $hiddenFields['invert'] );
+               unset( $hiddenFields['associated'] );
+
                # Namespace filter and put the whole form together.
                $form .= $wlInfo;
                $form .= $cutofflinks;
@@ -365,11 +370,8 @@ class SpecialWatchlist extends SpecialPage {
                        array( 'title' => $this->msg( 'tooltip-namespace_association' )->text() )
                ) . '&#160;';
                $form .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text() ) . '</p>';
-               $form .= Html::hidden( 'days', $values['days'] );
-               foreach ( $filters as $key => $msg ) {
-                       if ( $values[$key] ) {
-                               $form .= Html::hidden( $key, 1 );
-                       }
+               foreach ( $hiddenFields as $key => $value ) {
+                       $form .= Html::hidden( $key, $value );
                }
                $form .= Xml::closeElement( 'form' );
                $form .= Xml::closeElement( 'fieldset' );