Merge "Preserve 'srbackend' query parameter"
authorChad <chadh@wikimedia.org>
Wed, 30 Jul 2014 18:03:58 +0000 (18:03 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 30 Jul 2014 18:03:58 +0000 (18:03 +0000)
1  2 
includes/specials/SpecialSearch.php

@@@ -82,8 -82,7 +82,8 @@@ class SpecialSearch extends SpecialPag
                $out = $this->getOutput();
                $out->allowClickjacking();
                $out->addModuleStyles( array(
 -                      'mediawiki.special', 'mediawiki.special.search', 'mediawiki.ui', 'mediawiki.ui.button'
 +                      'mediawiki.special', 'mediawiki.special.search', 'mediawiki.ui', 'mediawiki.ui.button',
 +                      'mediawiki.ui.input',
                ) );
  
                // Strip underscores from title parameter; most of the time we'll want
                        // Show the create link ahead
                        $this->showCreateLink( $title, $num, $titleMatches, $textMatches );
                        if ( $totalRes > $this->limit || $this->offset ) {
+                               if ( $this->searchEngineType !== null ) {
+                                       $this->setExtraParam( 'srbackend', $this->searchEngineType );
+                               }
                                $prevnext = $this->getLanguage()->viewPrevNext(
                                        $this->getPageTitle(),
                                        $this->offset,
         * @param Title $title
         * @param int $num The number of search results found
         * @param null|SearchResultSet $titleMatches Results from title search
 -       * @param null|SearchResultSet $textMatches  Results from text search
 +       * @param null|SearchResultSet $textMatches Results from text search
         */
        protected function showCreateLink( $title, $num, $titleMatches, $textMatches ) {
                // show direct page/create link if applicable
                        return;
                }
  
 +              $linkClass = 'mw-search-createlink';
                if ( $title->isKnown() ) {
                        $messageName = 'searchmenu-exists';
 +                      $linkClass = 'mw-search-exists';
                } elseif ( $title->quickUserCan( 'create', $this->getUser() ) ) {
                        $messageName = 'searchmenu-new';
                } else {
  
                // Extensions using the hook might still return an empty $messageName
                if ( $messageName ) {
 -                      $this->getOutput()->wrapWikiMsg( "<p class=\"mw-search-createlink\">\n$1</p>", $params );
 +                      $this->getOutput()->wrapWikiMsg( "<p class=\"$linkClass\">\n$1</p>", $params );
                } else {
                        // preserve the paragraph for margins etc...
                        $this->getOutput()->addHtml( '<p></p>' );
         * @param SearchResult $result
         * @param string $lastInterwiki
         * @param string $query
 -       * @param array $customCaptions iw prefix -> caption
 +       * @param array $customCaptions Interwiki prefix -> caption
         *
         * @return string
         */
                        'id' => $this->profile === 'advanced' ? 'powerSearchText' : 'searchText',
                        'size' => '50',
                        'autofocus',
 -                      'class' => 'mw-ui-input',
 +                      'class' => 'mw-ui-input mw-ui-input-inline',
                ) ) . "\n";
                $out .= Html::hidden( 'fulltext', 'Search' ) . "\n";
                $out .= Xml::submitButton(
                ) . "\n";
  
                // Results-info
 -              if ( $totalNum > 0 ) {
 +              if ( $totalNum > 0 && $this->offset < $totalNum ) {
                        $top = $this->msg( 'showingresultsheader' )
                                ->numParams( $this->offset + 1, $this->offset + $resultsShown, $totalNum )
                                ->params( wfEscapeWikiText( $term ) )