Merge "TitleInputWidget: Correct links when 'relative' option used"
[lhc/web/wiklou.git] / includes / specials / SpecialFileDuplicateSearch.php
index 607b4f6..da79bb8 100644 (file)
@@ -110,25 +110,31 @@ class FileDuplicateSearchPage extends QueryPage {
                $out = $this->getOutput();
 
                # Create the input form
-               $out->addHTML(
-                       Html::openElement(
-                               'form',
-                               array( 'id' => 'fileduplicatesearch', 'method' => 'get', 'action' => wfScript() )
-                       ) . "\n" .
-                               Html::hidden( 'title', $this->getPageTitle()->getPrefixedDBkey() ) . "\n" .
-                               Html::openElement( 'fieldset' ) . "\n" .
-                               Html::element( 'legend', null, $this->msg( 'fileduplicatesearch-legend' )->text() ) . "\n" .
-                               Xml::inputLabel(
-                                       $this->msg( 'fileduplicatesearch-filename' )->text(),
-                                       'filename',
-                                       'filename',
-                                       50,
-                                       $this->filename
-                               ) . "\n" .
-                               Xml::submitButton( $this->msg( 'fileduplicatesearch-submit' )->text() ) . "\n" .
-                               Html::closeElement( 'fieldset' ) . "\n" .
-                               Html::closeElement( 'form' )
+               $formFields = array(
+                       'filename' => array(
+                               'type' => 'text',
+                               'name' => 'filename',
+                               'label-message' => 'fileduplicatesearch-filename',
+                               'id' => 'filename',
+                               'size' => 50,
+                               'value' => $this->filename,
+                               'cssclass' => 'mw-ui-input-inline'
+                       ),
+               );
+               $hiddenFields = array(
+                       'title' => $this->getPageTitle()->getPrefixedDBKey(),
                );
+               $htmlForm = HTMLForm::factory( 'inline', $formFields, $this->getContext() );
+               $htmlForm->addHiddenFields( $hiddenFields );
+               $htmlForm->setAction( wfScript() );
+               $htmlForm->setMethod( 'get' );
+               $htmlForm->setSubmitProgressive();
+               $htmlForm->setSubmitTextMsg( $this->msg( 'fileduplicatesearch-submit' ) );
+               $htmlForm->setWrapperLegendMsg( 'fileduplicatesearch-legend' );
+
+               // The form should be visible always, even if it was submitted (e.g. to perform another action).
+               // To bypass the callback validation of HTMLForm, use prepareForm() and displayForm().
+               $htmlForm->prepareForm()->displayForm( false );
 
                if ( $this->file ) {
                        $this->hash = $this->file->getSha1();
@@ -212,7 +218,6 @@ class FileDuplicateSearchPage extends QueryPage {
                if ( $result->isLocal() ) {
                        $userId = $result->getUser( 'id' );
                        $user = Linker::userLink( $userId, $userText );
-                       $user .= $this->getContext()->msg( 'word-separator' )->escaped();
                        $user .= '<span style="white-space: nowrap;">';
                        $user .= Linker::userToolLinks( $userId, $userText );
                        $user .= '</span>';