Revert "Convert SpecialPrefixIndex to class HTMLForm"
authorFomafix <fomafix@googlemail.com>
Tue, 10 Apr 2018 07:24:38 +0000 (09:24 +0200)
committerFomafix <fomafix@googlemail.com>
Tue, 10 Apr 2018 07:28:48 +0000 (09:28 +0200)
This reverts commit ebf4bb56b7b430ce9580332722176996c343e223.

ebf4bb56b7b430ce9580332722176996c343e223 changed the URL parameters
from

 prefix=Foo&namespace=0&stripprefix=1

to

 wpprefix=Foo&namespace=0&wpstripprefix=1

and breaks Special:PrefixIndex.

Change-Id: I99f75b5cb12913236a43b17970ea1752261ace9b

includes/specials/SpecialPrefixindex.php

index afd626b..34ffa07 100644 (file)
@@ -98,36 +98,56 @@ class SpecialPrefixindex extends SpecialAllPages {
         * @return string
         */
        protected function namespacePrefixForm( $namespace = NS_MAIN, $from = '' ) {
         * @return string
         */
        protected function namespacePrefixForm( $namespace = NS_MAIN, $from = '' ) {
-               $fields = [
-                       'prefix' => [
-                               'label-message' => 'allpagesprefix',
-                               'type' => 'text',
-                               'size' => '30',
-                       ],
-                       'namespace' => [
-                               'type' => 'namespaceselect',
+               $out = Xml::openElement( 'div', [ 'class' => 'namespaceoptions' ] );
+               $out .= Xml::openElement(
+                       'form',
+                       [ 'method' => 'get', 'action' => $this->getConfig()->get( 'Script' ) ]
+               );
+               $out .= Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() );
+               $out .= Xml::openElement( 'fieldset' );
+               $out .= Xml::element( 'legend', null, $this->msg( 'allpages' )->text() );
+               $out .= Xml::openElement( 'table', [ 'id' => 'nsselect', 'class' => 'allpages' ] );
+               $out .= "<tr>
+                               <td class='mw-label'>" .
+                       Xml::label( $this->msg( 'allpagesprefix' )->text(), 'nsfrom' ) .
+                       "</td>
+                               <td class='mw-input'>" .
+                       Xml::input( 'prefix', 30, str_replace( '_', ' ', $from ), [ 'id' => 'nsfrom' ] ) .
+                       "</td>
+                       </tr>
+                       <tr>
+                       <td class='mw-label'>" .
+                       Xml::label( $this->msg( 'namespace' )->text(), 'namespace' ) .
+                       "</td>
+                               <td class='mw-input'>" .
+                       Html::namespaceSelector( [
+                               'selected' => $namespace,
+                       ], [
                                'name' => 'namespace',
                                'id' => 'namespace',
                                'name' => 'namespace',
                                'id' => 'namespace',
-                               'label-message' => 'namespace',
-                               'all' => null,
-                               'value' => $namespace,
-                       ],
-                       'hidedirects' => [
-                               'class' => 'HTMLCheckField',
-                               'label-message' => 'allpages-hide-redirects',
-                       ],
-                       'stripprefix' => [
-                               'class' => 'HTMLCheckField',
-                               'label-message' => 'prefixindex-strip',
-                       ],
-               ];
-               $form = new HTMLForm( $fields, $this->getContext() );
-               $form
-                       ->setMethod( 'get' )
-                       ->setWrapperLegendMsg( 'allpages' )
-                       ->setSubmitTextMsg( 'prefixindex-submit' )
-                       ->prepareForm()
-                       ->displayForm( false );
+                               'class' => 'namespaceselector',
+                       ] ) .
+                       Xml::checkLabel(
+                               $this->msg( 'allpages-hide-redirects' )->text(),
+                               'hideredirects',
+                               'hideredirects',
+                               $this->hideRedirects
+                       ) . ' ' .
+                       Xml::checkLabel(
+                               $this->msg( 'prefixindex-strip' )->text(),
+                               'stripprefix',
+                               'stripprefix',
+                               $this->stripPrefix
+                       ) . ' ' .
+                       Xml::submitButton( $this->msg( 'prefixindex-submit' )->text() ) .
+                       "</td>
+                       </tr>";
+               $out .= Xml::closeElement( 'table' );
+               $out .= Xml::closeElement( 'fieldset' );
+               $out .= Xml::closeElement( 'form' );
+               $out .= Xml::closeElement( 'div' );
+
+               return $out;
        }
 
        /**
        }
 
        /**