Convert Special:MIMESearch to use OOUI.
authorSethakill <sethakill@outlook.com>
Fri, 6 May 2016 19:06:57 +0000 (21:06 +0200)
committerSethakill <sethakill@outlook.com>
Sun, 8 May 2016 15:32:32 +0000 (17:32 +0200)
Bug: T117744
Change-Id: I6c8b0f3be92bc455fe62846508d0b21c778b993d

includes/specials/SpecialMIMEsearch.php

index defca7d..e3be225 100644 (file)
@@ -106,21 +106,26 @@ class MIMEsearchPage extends QueryPage {
        }
 
        /**
        }
 
        /**
-        * Return HTML to put just before the results.
+        * Generate and output the form
         */
        function getPageHeader() {
         */
        function getPageHeader() {
-               return Xml::openElement(
-                               'form',
-                               [ 'id' => 'specialmimesearch', 'method' => 'get', 'action' => wfScript() ]
-                       ) .
-                       Xml::openElement( 'fieldset' ) .
-                       Html::hidden( 'title', $this->getPageTitle()->getPrefixedText() ) .
-                       Xml::element( 'legend', null, $this->msg( 'mimesearch' )->text() ) .
-                       Xml::inputLabel( $this->msg( 'mimetype' )->text(), 'mime', 'mime', 20, $this->mime ) .
-                       ' ' .
-                       Xml::submitButton( $this->msg( 'ilsubmit' )->text() ) .
-                                       Xml::closeElement( 'fieldset' ) .
-                                       Xml::closeElement( 'form' );
+               $formDescriptor = [
+                       'mime' => [
+                               'type' => 'text',
+                               'name' => 'mime',
+                               'label-message' => 'mimetype',
+                               'required' => true,
+                               'default' => $this->mime,
+                       ],
+               ];
+
+               $form = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() )
+                       ->setWrapperLegendMsg( 'mimesearch' )
+                       ->setSubmitTextMsg( 'ilsubmit' )
+                       ->setAction( $this->getPageTitle()->getLocalURL() )
+                       ->setMethod( 'get' )
+                       ->prepareForm()
+                       ->displayForm( false );
        }
 
        public function execute( $par ) {
        }
 
        public function execute( $par ) {
@@ -133,7 +138,7 @@ class MIMEsearchPage extends QueryPage {
                ) {
                        $this->setHeaders();
                        $this->outputHeader();
                ) {
                        $this->setHeaders();
                        $this->outputHeader();
-                       $this->getOutput()->addHTML( $this->getPageHeader() );
+                       $this->getPageHeader();
                        return;
                }
 
                        return;
                }