/**
* Run text & title search and display the output
- * @addtogroup SpecialPage
+ * @file
+ * @ingroup SpecialPage
*/
/**
/**
* implements Special:Search - Run text & title search and display the output
- * @addtogroup SpecialPage
+ * @ingroup SpecialPage
*/
class SpecialSearch {
return;
}
}
+
+ $wgOut->wrapWikiMsg( "==$1==\n", 'notitlematches' );
if( $t->quickUserCan( 'create' ) && $t->quickUserCan( 'edit' ) ) {
$wgOut->addWikiMsg( 'noexactmatch', wfEscapeWikiText( $term ) );
} else {
} else {
$top = wfShowingResultsNum( $this->offset, $this->limit, $num );
}
- $wgOut->addHTML( "<p>{$top}</p>\n" );
+ $wgOut->addHTML( "<p class='mw-search-numberresults'>{$top}</p>\n" );
}
// prev/next links
$this->powerSearchOptions(),
array( 'search' => $term ) ),
($num < $this->limit) );
- $wgOut->addHTML( "<p>{$prevnext}</p>\n" );
+ $wgOut->addHTML( "<p class='mw-search-pager-top'>{$prevnext}</p>\n" );
wfRunHooks( 'SpecialSearchResults', array( $term, $titleMatches, $textMatches ) );
} else {
wfRunHooks( 'SpecialSearchNoResults', array( $term ) );
if( $titleMatches->numRows() ) {
$wgOut->wrapWikiMsg( "==$1==\n", 'titlematches' );
$wgOut->addHTML( $this->showMatches( $titleMatches ) );
- } else {
- $wgOut->wrapWikiMsg( "==$1==\n", 'notitlematches' );
}
$titleMatches->free();
}
// show results
if( $textMatches->numRows() )
$wgOut->addHTML( $this->showMatches( $textMatches ) );
-
+
$textMatches->free();
}
$wgOut->addWikiMsg( 'nonefound' );
}
if( $num || $this->offset ) {
- $wgOut->addHTML( "<p>{$prevnext}</p>\n" );
+ $wgOut->addHTML( "<p class='mw-search-pager-bottom'>{$prevnext}</p>\n" );
}
$wgOut->addHTML( $this->powerSearchBox( $term ) );
wfProfileOut( $fname );
$off = $this->offset + 1;
- $out .= "<ul start='{$off}' class='mw-search-results'>\n";
+ $out .= "<ul class='mw-search-results'>\n";
while( $result = $matches->next() ) {
$out .= $this->showHit( $result, $terms );
//This is not quite safe, but better than showing excerpts from non-readable pages
//Note that hiding the entry entirely would screw up paging.
if (!$t->userCanRead()) {
+ wfProfileOut( $fname );
return "<li>{$link}</li>\n";
}
// The least confusing at this point is to drop the result.
// You may get less results, but... oh well. :P
if( $result->isMissingRevision() ) {
+ wfProfileOut( $fname );
return "<!-- missing page " .
htmlspecialchars( $t->getPrefixedText() ) . "-->\n";
}
Xml::closeElement( 'span' ) . "\n";
}
- $redirect = Xml::check( 'redirs', $this->searchRedirects, array( 'value' => '1' ) );
+ $redirect = Xml::check( 'redirs', $this->searchRedirects, array( 'value' => '1', 'id' => 'redirs' ) );
+ $redirectLabel = Xml::label( wfMsg( 'powersearch-redir' ), 'redirs' );
$searchField = Xml::input( 'search', 50, $term, array( 'type' => 'text', 'id' => 'powerSearchText' ) );
$searchButton = Xml::submitButton( wfMsg( 'powersearch' ), array( 'name' => 'fulltext' ) ) . "\n";
$out = Xml::openElement( 'form', array( 'id' => 'powersearch', 'method' => 'get', 'action' => $wgScript ) ) .
- Xml::openElement( 'fieldset' ) .
- Xml::element( 'legend', array( ), wfMsg( 'powersearch-legend' ) ) .
- Xml::hidden( 'title', 'Special:Search' ) .
- wfMsgExt( 'powersearchtext', array( 'parse', 'replaceafter' ),
- $namespaces, $redirect, $searchField,
- '', '', '', '', '', # Dummy placeholders
+ Xml::fieldset( wfMsg( 'powersearch-legend' ),
+ Xml::hidden( 'title', 'Special:Search' ) .
+ "<p>" .
+ wfMsgExt( 'powersearch-ns', array( 'parseinline' ) ) .
+ "<br />" .
+ $namespaces .
+ "</p>" .
+ "<p>" .
+ $redirect . " " . $redirectLabel .
+ "</p>" .
+ wfMsgExt( 'powersearch-field', array( 'parseinline' ) ) .
+ " " .
+ $searchField .
+ " " .
$searchButton ) .
- Xml::closeElement( 'fieldset' ) .
- Xml::closeElement( 'form' );
+ "</form>";
return $out;
}
function powerSearchFocus() {
- return "<script type='text/javascript'>" .
- "document.getElementById('powerSearchText').focus();" .
+ global $wgJsMimeType;
+ return "<script type=\"$wgJsMimeType\">" .
+ "hookEvent(\"load\", function(){" .
+ "document.getElementById('powerSearchText').focus();" .
+ "});" .
"</script>";
}