r44492 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44491‎ | r44492 | r44493 >
Date:04:23, 12 December 2008
Author:aaron
Status:ok
Tags:
Comment:
Tweak JS focusing
Modified paths:
  • /trunk/phase3/includes/specials/SpecialSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialSearch.php
@@ -131,6 +131,7 @@
132132
133133 $filePrefix = $wgContLang->getFormattedNsText(NS_FILE).':';
134134 if( '' === trim( $term ) || $filePrefix === trim( $term ) ) {
 135+ $wgOut->addHTML( $this->searchAdvanced ? $this->powerSearchFocus() : $this->searchFocus() );
135136 // Empty query -- straight view of search form
136137 wfProfileOut( __METHOD__ );
137138 return;
@@ -269,6 +270,9 @@
270271 $wgOut->addWikiMsg( 'search-nonefound' );
271272 }
272273 $wgOut->addHtml( "</div>" );
 274+ if( $totalRes === 0 ) {
 275+ $wgOut->addHTML( $this->searchAdvanced ? $this->powerSearchFocus() : $this->searchFocus() );
 276+ }
273277
274278 if( $numSQL || $this->offset ) {
275279 $wgOut->addHTML( "<p class='mw-search-pager-bottom'>{$prevnext}</p>\n" );
@@ -619,8 +623,7 @@
620624 if( $t != null && count($this->namespaces) === 1 ) {
621625 $out .= wfMsgExt( 'searchmenu-prefix', array('parseinline'), $term );
622626 }
623 - return $this->powerSearchFocus() .
624 - Xml::openElement( 'fieldset', array('id' => 'mw-searchoptions','style' => 'margin:0em;') ) .
 627+ return Xml::openElement( 'fieldset', array('id' => 'mw-searchoptions','style' => 'margin:0em;') ) .
625628 Xml::element( 'legend', null, wfMsg('powersearch-legend') ) .
626629 $this->formHeader($term) . $out .
627630 Xml::closeElement( 'fieldset' );
@@ -724,8 +727,7 @@
725728 global $wgScript;
726729 $searchTitle = SpecialPage::getTitleFor( 'Search' );
727730 $searchable = SearchEngine::searchableNamespaces();
728 - $out = $this->searchFocus();
729 - $out .= Xml::openElement( 'form', array( 'id' => 'search', 'method' => 'get', 'action' => $wgScript ) );
 731+ $out = Xml::openElement( 'form', array( 'id' => 'search', 'method' => 'get', 'action' => $wgScript ) );
730732 $out .= Xml::hidden( 'title', $searchTitle->getPrefixedText() ) . "\n";
731733 // If searching several, but not all namespaces, show what we are searching.
732734 if( count($this->namespaces) > 1 && $this->namespaces !== array_keys($searchable) ) {

Status & tagging log