Per code review. Only set focus if we have a search term.
authorChad Horohoe <demon@users.mediawiki.org>
Thu, 11 Dec 2008 23:49:35 +0000 (23:49 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Thu, 11 Dec 2008 23:49:35 +0000 (23:49 +0000)
includes/specials/SpecialSearch.php

index 5d0f1a7..bb493cc 100644 (file)
@@ -619,7 +619,7 @@ class SpecialSearch {
                if( $t != null && count($this->namespaces) === 1 ) {
                        $out .= wfMsgExt( 'searchmenu-prefix', array('parseinline'), $term );
                }
-               return $this->powerSearchFocus() .
+               return $term != '' ? $this->powerSearchFocus() : '' .
                        Xml::openElement( 'fieldset', array('id' => 'mw-searchoptions','style' => 'margin:0em;') ) .
                        Xml::element( 'legend', null, wfMsg('powersearch-legend') ) .
                        $this->formHeader($term) . $out . 
@@ -633,7 +633,7 @@ class SpecialSearch {
                                "document.getElementById('searchText').focus();" .
                        "});" .
                        "</script>";
-       }       
+       }
 
        protected function powerSearchFocus() {
                global $wgJsMimeType;
@@ -724,7 +724,7 @@ class SpecialSearch {
                global $wgScript;
                $searchTitle = SpecialPage::getTitleFor( 'Search' );
                $searchable = SearchEngine::searchableNamespaces();
-               $out = $this->searchFocus();
+               $out = $term != '' ? $this->searchFocus() : '';
                $out .= Xml::openElement( 'form', array( 'id' => 'search', 'method' => 'get', 'action' => $wgScript ) );
                $out .= Xml::hidden( 'title', $searchTitle->getPrefixedText() ) . "\n";
                // If searching several, but not all namespaces, show what we are searching.