From ebf4bb56b7b430ce9580332722176996c343e223 Mon Sep 17 00:00:00 2001 From: gopavasanth Date: Sun, 25 Mar 2018 15:51:18 +0530 Subject: [PATCH] Convert SpecialPrefixIndex to class HTMLForm The XML part of namespacePrefixForm() is changed to use class HTMLForm. Bug: T117726 Change-Id: I98cdfb69d11dee0dd1ac2d0d862235f2e53d85d9 --- includes/specials/SpecialPrefixindex.php | 76 +++++++++--------------- 1 file changed, 28 insertions(+), 48 deletions(-) diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index 34ffa07363..afd626b0a4 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -98,56 +98,36 @@ class SpecialPrefixindex extends SpecialAllPages { * @return string */ protected function namespacePrefixForm( $namespace = NS_MAIN, $from = '' ) { - $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 .= " - " . - Xml::label( $this->msg( 'allpagesprefix' )->text(), 'nsfrom' ) . - " - " . - Xml::input( 'prefix', 30, str_replace( '_', ' ', $from ), [ 'id' => 'nsfrom' ] ) . - " - - - " . - Xml::label( $this->msg( 'namespace' )->text(), 'namespace' ) . - " - " . - Html::namespaceSelector( [ - 'selected' => $namespace, - ], [ + $fields = [ + 'prefix' => [ + 'label-message' => 'allpagesprefix', + 'type' => 'text', + 'size' => '30', + ], + 'namespace' => [ + 'type' => 'namespaceselect', 'name' => 'namespace', 'id' => 'namespace', - '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() ) . - " - "; - $out .= Xml::closeElement( 'table' ); - $out .= Xml::closeElement( 'fieldset' ); - $out .= Xml::closeElement( 'form' ); - $out .= Xml::closeElement( 'div' ); - - return $out; + '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 ); } /** -- 2.20.1