Florianschmidtwelzow has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/200827

Change subject: Use HTMLForm for Special:Search
......................................................................

Use HTMLForm for Special:Search

Allows us to change the output of forms through HtmlForm on as much special
pages as possible.

Change-Id: Iba29770c53d8fd0425875f56c2e02691892e1715
---
M includes/specials/SpecialSearch.php
M resources/src/mediawiki.special/mediawiki.special.search.css
2 files changed, 32 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/27/200827/1

diff --git a/includes/specials/SpecialSearch.php 
b/includes/specials/SpecialSearch.php
index 55be2c2..c3d61e9 100644
--- a/includes/specials/SpecialSearch.php
+++ b/includes/specials/SpecialSearch.php
@@ -1072,21 +1072,31 @@
         * @return string
         */
        protected function shortDialog( $term, $resultsShown, $totalNum ) {
-               $out = Html::hidden( 'title', 
$this->getPageTitle()->getPrefixedText() );
-               $out .= Html::hidden( 'profile', $this->profile ) . "\n";
-               // Term box
-               $out .= Html::input( 'search', $term, 'search', array(
-                       'id' => $this->isPowerSearch() ? 'powerSearchText' : 
'searchText',
-                       'size' => '50',
-                       'autofocus' => trim( $term ) === '',
-                       'class' => 'mw-ui-input mw-ui-input-inline',
-               ) ) . "\n";
-               $out .= Html::hidden( 'fulltext', 'Search' ) . "\n";
-               $out .= Html::submitButton(
-                       $this->msg( 'searchbutton' )->text(),
-                       array( 'class' => 'mw-ui-button mw-ui-progressive' ),
-                       array( 'mw-ui-progressive' )
-               ) . "\n";
+               $formFields = array(
+                       'search' => array(
+                               'type' => 'text',
+                               'name' => 'search',
+                               'value' => $term,
+                               'hidelabel' => true,
+                               'id' => $this->isPowerSearch() ? 
'powerSearchText' : 'searchText',
+                               'size' => '50',
+                               'autofocus' => trim( $term ) === '',
+                               'cssclass' => 'mw-ui-input mw-ui-input-inline',
+                       ),
+               );
+               $hiddenFields = array(
+                       'title' => $this->getPageTitle()->getPrefixedText(),
+                       'profile' => $this->profile,
+                       'fulltext' => 'Search',
+               );
+
+               $form = HTMLForm::factory( 'inline', $formFields, 
$this->getContext() );
+               $form->addHiddeNFields( $hiddenFields );
+               $form->setAction( wfScript() );
+               $form->setMethod( 'get' );
+               $form->setSubmitProgressive();
+               $form->setSubmitTextMsg( $this->msg( 'searchbutton' ) );
+               $out = $form->prepareForm()->getHTML( false );
 
                // Results-info
                if ( $totalNum > 0 && $this->offset < $totalNum ) {
diff --git a/resources/src/mediawiki.special/mediawiki.special.search.css 
b/resources/src/mediawiki.special/mediawiki.special.search.css
index 8f845df..c79ec9c 100644
--- a/resources/src/mediawiki.special/mediawiki.special.search.css
+++ b/resources/src/mediawiki.special/mediawiki.special.search.css
@@ -172,3 +172,10 @@
 form#powersearch {
        clear: both;
 }
+/* HTMLForm adjustments */
+.mw-htmlform-nolabel {
+       float: left;
+}
+#searchText {
+       float: inherit;
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/200827
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba29770c53d8fd0425875f56c2e02691892e1715
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <florian.schmidt.wel...@t-online.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to