Convert Special:MIMESearch to use OOUI.
[lhc/web/wiklou.git] / 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() {
-               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 ) {
@@ -133,7 +138,7 @@ class MIMEsearchPage extends QueryPage {
                ) {
                        $this->setHeaders();
                        $this->outputHeader();
-                       $this->getOutput()->addHTML( $this->getPageHeader() );
+                       $this->getPageHeader();
                        return;
                }