Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -757,6 +757,11 @@ |
758 | 758 | 'search' => array( |
759 | 759 | 'searchresults', |
760 | 760 | 'searchresults-title', |
| 761 | + 'searchresulttext', |
| 762 | + 'searchsubtitle', |
| 763 | + 'searchsubtitleinvalid', |
| 764 | + 'noexactmatch', |
| 765 | + 'noexactmatch-nocreate', |
761 | 766 | 'toomanymatches', |
762 | 767 | 'titlematches', |
763 | 768 | 'notitlematches', |
— | — | @@ -768,7 +773,6 @@ |
769 | 774 | 'searchmenu-exists', |
770 | 775 | 'searchmenu-new', |
771 | 776 | 'searchhelp-url', |
772 | | - 'searchmenu-badtitle', |
773 | 777 | 'searchmenu', |
774 | 778 | 'searchprofile-articles', |
775 | 779 | 'searchprofile-project', |
— | — | @@ -800,7 +804,7 @@ |
801 | 805 | 'showingresults', |
802 | 806 | 'showingresultsnum', |
803 | 807 | 'showingresultstotal', |
804 | | - 'search-nonefound', |
| 808 | + 'nonefound', |
805 | 809 | 'powersearch', |
806 | 810 | 'powersearch-legend', |
807 | 811 | 'powersearch-ns', |
— | — | @@ -874,6 +878,7 @@ |
875 | 879 | 'allowemail', |
876 | 880 | 'prefs-searchoptions', |
877 | 881 | 'prefs-namespaces', |
| 882 | + 'defaultns', |
878 | 883 | 'default', |
879 | 884 | 'files', |
880 | 885 | ), |
Index: trunk/phase3/skins/monobook/main.css |
— | — | @@ -1409,10 +1409,6 @@ |
1410 | 1410 | padding:2px; |
1411 | 1411 | } |
1412 | 1412 | |
1413 | | -#powersearch p { |
1414 | | - margin-top:0px; |
1415 | | -} |
1416 | | - |
1417 | 1413 | div.multipageimagenavbox { |
1418 | 1414 | border: solid 1px silver; |
1419 | 1415 | padding: 4px; |
Index: trunk/phase3/skins/common/shared.css |
— | — | @@ -112,11 +112,6 @@ |
113 | 113 | font-size: 97%; |
114 | 114 | } |
115 | 115 | |
116 | | -td#mw-search-menu { |
117 | | - padding-left:6em; |
118 | | - font-size:85%; |
119 | | -} |
120 | | - |
121 | 116 | div#mw-search-interwiki { |
122 | 117 | float: right; |
123 | 118 | width: 18em; |
Index: trunk/phase3/includes/SearchEngine.php |
— | — | @@ -43,11 +43,6 @@ |
44 | 44 | return null; |
45 | 45 | } |
46 | 46 | |
47 | | - /** If this search backend can list/unlist redirects */ |
48 | | - function acceptListRedirects() { |
49 | | - return true; |
50 | | - } |
51 | | - |
52 | 47 | /** |
53 | 48 | * If an exact title match can be find, or a very slightly close match, |
54 | 49 | * return the title. If no match, returns NULL. |
— | — | @@ -233,10 +228,6 @@ |
234 | 229 | */ |
235 | 230 | public static function userNamespaces( &$user ) { |
236 | 231 | $arr = array(); |
237 | | - // for logged-in users use predefined defaults |
238 | | - if( $user->isLoggedIn() && $user->getOption( 'defaultusersearch', true ) ) |
239 | | - return SearchEngine::projectNamespaces(); |
240 | | - |
241 | 232 | foreach( SearchEngine::searchableNamespaces() as $ns => $name ) { |
242 | 233 | if( $user->getOption( 'searchNs' . $ns ) ) { |
243 | 234 | $arr[] = $ns; |
— | — | @@ -271,39 +262,8 @@ |
272 | 263 | |
273 | 264 | return array_keys($wgNamespacesToBeSearchedDefault, true); |
274 | 265 | } |
275 | | - |
| 266 | + |
276 | 267 | /** |
277 | | - * Get a list of namespace names useful for showing in tooltips |
278 | | - * and preferences |
279 | | - * |
280 | | - * @param unknown_type $namespaces |
281 | | - */ |
282 | | - public static function namespacesAsText( $namespaces ){ |
283 | | - global $wgContLang; |
284 | | - |
285 | | - $formatted = array_map( array($wgContLang,'getFormattedNsText'), $namespaces ); |
286 | | - foreach( $formatted as $key => $ns ){ |
287 | | - if ( empty($ns) ) |
288 | | - $formatted[$key] = wfMsg( 'blanknamespace' ); |
289 | | - } |
290 | | - return $formatted; |
291 | | - } |
292 | | - |
293 | | - /** |
294 | | - * An array of "project" namespaces indexes typically searched |
295 | | - * by logged-in users |
296 | | - * |
297 | | - * @return array |
298 | | - * @static |
299 | | - */ |
300 | | - public static function projectNamespaces(){ |
301 | | - global $wgNamespacesToBeSearchedDefault, $wgNamespacesToBeSearchedProject; |
302 | | - |
303 | | - return array_keys( $wgNamespacesToBeSearchedDefault + |
304 | | - $wgNamespacesToBeSearchedProject, true); |
305 | | - } |
306 | | - |
307 | | - /** |
308 | 268 | * Return a 'cleaned up' search string |
309 | 269 | * |
310 | 270 | * @return string |
— | — | @@ -387,7 +347,6 @@ |
388 | 348 | else |
389 | 349 | return $wgServer . $wgScriptPath . '/api.php?action=opensearch&search={searchTerms}&namespace={namespaces}'; |
390 | 350 | } |
391 | | - |
392 | 351 | } |
393 | 352 | |
394 | 353 | /** |
— | — | @@ -524,17 +483,11 @@ |
525 | 484 | */ |
526 | 485 | class SearchResult { |
527 | 486 | var $mRevision = null; |
528 | | - var $mImage = null; |
529 | 487 | |
530 | 488 | function SearchResult( $row ) { |
531 | 489 | $this->mTitle = Title::makeTitle( $row->page_namespace, $row->page_title ); |
532 | | - if( !is_null($this->mTitle) ){ |
| 490 | + if( !is_null($this->mTitle) ) |
533 | 491 | $this->mRevision = Revision::newFromTitle( $this->mTitle ); |
534 | | - if($this->mTitle->getNamespace() == NS_IMAGE) |
535 | | - $this->mImage = wfFindFile( $this->mTitle ); |
536 | | - } |
537 | | - |
538 | | - |
539 | 492 | } |
540 | 493 | |
541 | 494 | /** |
— | — | @@ -556,7 +509,7 @@ |
557 | 510 | * @access public |
558 | 511 | */ |
559 | 512 | function isMissingRevision(){ |
560 | | - if( !$this->mRevision && !$this->mImage ) |
| 513 | + if( !$this->mRevision ) |
561 | 514 | return true; |
562 | 515 | return false; |
563 | 516 | } |
— | — | @@ -581,10 +534,7 @@ |
582 | 535 | */ |
583 | 536 | protected function initText(){ |
584 | 537 | if( !isset($this->mText) ){ |
585 | | - if($this->mRevision != null) |
586 | | - $this->mText = $this->mRevision->getText(); |
587 | | - else |
588 | | - $this->mText = ''; |
| 538 | + $this->mText = $this->mRevision->getText(); |
589 | 539 | } |
590 | 540 | } |
591 | 541 | |
— | — | @@ -644,10 +594,7 @@ |
645 | 595 | * @return string timestamp |
646 | 596 | */ |
647 | 597 | function getTimestamp(){ |
648 | | - if($this->mRevision != null) |
649 | | - return $this->mRevision->getTimestamp(); |
650 | | - else |
651 | | - return ''; |
| 598 | + return $this->mRevision->getTimestamp(); |
652 | 599 | } |
653 | 600 | |
654 | 601 | /** |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1865,26 +1865,11 @@ |
1866 | 1866 | NS_CATEGORY_TALK => true |
1867 | 1867 | ); |
1868 | 1868 | |
1869 | | -/** Default search for anonymous users */ |
1870 | 1869 | $wgNamespacesToBeSearchedDefault = array( |
1871 | 1870 | NS_MAIN => true, |
1872 | 1871 | ); |
1873 | 1872 | |
1874 | 1873 | /** |
1875 | | - * Additional namespaces to those in $wgNamespacesToBeSearchedDefault that |
1876 | | - * will be added to default search for logged-in users. |
1877 | | - * |
1878 | | - * Same format as $wgNamespacesToBeSearchedDefault |
1879 | | - */ |
1880 | | -$wgNamespacesToBeSearchedProject = array( |
1881 | | - NS_USER => true, |
1882 | | - NS_PROJECT => true, |
1883 | | - NS_HELP => true, |
1884 | | - NS_CATEGORY => true, |
1885 | | -); |
1886 | | - |
1887 | | - |
1888 | | -/** |
1889 | 1874 | * Site notice shown at the top of each page |
1890 | 1875 | * |
1891 | 1876 | * This message can contain wiki text, and can also be set through the |
Index: trunk/phase3/includes/specials/SpecialPreferences.php |
— | — | @@ -67,7 +67,6 @@ |
68 | 68 | $this->mWatchlistDays = $request->getVal( 'wpWatchlistDays' ); |
69 | 69 | $this->mWatchlistEdits = $request->getVal( 'wpWatchlistEdits' ); |
70 | 70 | $this->mDisableMWSuggest = $request->getCheck( 'wpDisableMWSuggest' ); |
71 | | - $this->mDefaultUserSearch = $request->getVal( 'wpUserSearch' ) != 'wpCustomUserSearch'; |
72 | 71 | |
73 | 72 | $this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) && |
74 | 73 | $this->mPosted && |
— | — | @@ -290,7 +289,6 @@ |
291 | 290 | $wgUser->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) ); |
292 | 291 | $wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0, 7 ) ); |
293 | 292 | $wgUser->setOption( 'disablesuggest', $this->mDisableMWSuggest ); |
294 | | - $wgUser->setOption( 'defaultusersearch', $this->mDefaultUserSearch ); |
295 | 293 | |
296 | 294 | # Set search namespace options |
297 | 295 | foreach( $this->mSearchNs as $i => $value ) { |
— | — | @@ -505,7 +503,7 @@ |
506 | 504 | return Xml::tags( 'tr', null, $td1 . $td2 ). $td3 . "\n"; |
507 | 505 | |
508 | 506 | } |
509 | | - |
| 507 | + |
510 | 508 | /** |
511 | 509 | * @access private |
512 | 510 | */ |
— | — | @@ -1050,16 +1048,11 @@ |
1051 | 1049 | $wgOut->addHtml( '</fieldset>' ); |
1052 | 1050 | |
1053 | 1051 | # Search |
1054 | | - $defaultNs = SearchEngine::namespacesAsText( SearchEngine::projectNamespaces() ); |
1055 | 1052 | $mwsuggest = $wgEnableMWSuggest ? |
1056 | 1053 | $this->addRow( |
1057 | 1054 | Xml::label( wfMsg( 'mwsuggest-disable' ), 'wpDisableMWSuggest' ), |
1058 | 1055 | Xml::check( 'wpDisableMWSuggest', $this->mDisableMWSuggest, array( 'id' => 'wpDisableMWSuggest' ) ) |
1059 | 1056 | ) : ''; |
1060 | | - $userDefaultSearch = '<p>'.Xml::radioLabel(wfMsg('prefs-search-nsdefault'),'wpUserSearch','wpDefaultUserSearch','wpDefaultUserSearch',$this->mDefaultUserSearch). |
1061 | | - '</p>'.implode(', ', $defaultNs).'<br/><br/><p>'. |
1062 | | - Xml::radioLabel(wfMsg('prefs-search-nscustom'),'wpUserSearch','wpCustomUserSearch','wpCustomUserSearch',!$this->mDefaultUserSearch). |
1063 | | - '</p>'; |
1064 | 1057 | $wgOut->addHTML( |
1065 | 1058 | // Elements for the search tab itself |
1066 | 1059 | Xml::openElement( 'fieldset' ) . |
— | — | @@ -1086,7 +1079,7 @@ |
1087 | 1080 | // Elements for the namespace options in the search tab |
1088 | 1081 | Xml::openElement( 'fieldset' ) . |
1089 | 1082 | Xml::element( 'legend', null, wfMsg( 'prefs-namespaces' ) ) . |
1090 | | - $userDefaultSearch. |
| 1083 | + wfMsgExt( 'defaultns', array( 'parse' ) ) . |
1091 | 1084 | $ps . |
1092 | 1085 | Xml::closeElement( 'fieldset' ) . |
1093 | 1086 | // End of the search tab |
Index: trunk/phase3/includes/specials/SpecialSearch.php |
— | — | @@ -69,7 +69,6 @@ |
70 | 70 | } |
71 | 71 | |
72 | 72 | $this->searchRedirects = $request->getcheck( 'redirs' ) ? true : false; |
73 | | - $this->searchAdvanced = $request->getVal('advanced'); |
74 | 73 | } |
75 | 74 | |
76 | 75 | /** |
— | — | @@ -109,6 +108,13 @@ |
110 | 109 | } |
111 | 110 | } |
112 | 111 | |
| 112 | + $wgOut->wrapWikiMsg( "==$1==\n", 'notitlematches' ); |
| 113 | + if( $t->quickUserCan( 'create' ) && $t->quickUserCan( 'edit' ) ) { |
| 114 | + $wgOut->addWikiMsg( 'noexactmatch', wfEscapeWikiText( $term ) ); |
| 115 | + } else { |
| 116 | + $wgOut->addWikiMsg( 'noexactmatch-nocreate', wfEscapeWikiText( $term ) ); |
| 117 | + } |
| 118 | + |
113 | 119 | return $this->showResults( $term ); |
114 | 120 | } |
115 | 121 | |
— | — | @@ -123,56 +129,14 @@ |
124 | 130 | $sk = $wgUser->getSkin(); |
125 | 131 | |
126 | 132 | $this->setupPage( $term ); |
127 | | - $this->searchEngine = SearchEngine::create(); |
128 | | - |
129 | | - $t = Title::newFromText( $term ); |
130 | | - |
131 | | - // add a table since it's difficult to stack divs horizontally nicely |
132 | | - // left - search box, right - search menu |
133 | 133 | |
134 | | - $wgOut->addHtml( |
135 | | - Xml::openElement( 'table', array( 'border'=>'0' ) ). |
136 | | - Xml::openElement( 'tr' ) . |
137 | | - Xml::openElement( 'td' ) . "\n" |
138 | | - ); |
139 | | - |
140 | | - |
141 | | - if( $this->searchAdvanced ){ |
142 | | - $wgOut->addHTML( $this->powerSearchBox( $term ) ); |
143 | | - $showMenu = false; |
144 | | - } else { |
145 | | - $wgOut->addHTML( $this->shortDialog( $term ) ); |
146 | | - $showMenu = true; |
147 | | - } |
148 | | - |
149 | | - $wgOut->addHtml( Xml::closeElement( 'td' ) ); |
150 | | - |
151 | | - |
152 | | - $wgOut->addHtml( Xml::openElement('td', array( 'id' => 'mw-search-menu' )) ); |
153 | | - |
154 | | - if( $showMenu ){ |
155 | | - if( $t!=null && $t->quickUserCan( 'create' ) && $t->quickUserCan( 'edit' ) ) { |
156 | | - if( $t->exists() ){ |
157 | | - $wgOut->addWikiMsg( 'searchmenu-exists', wfEscapeWikiText( $term ) ); |
158 | | - } else { |
159 | | - $wgOut->addWikiMsg( 'searchmenu-new', wfEscapeWikiText( $term ) ); |
160 | | - } |
161 | | - } |
162 | | - } |
163 | | - if ( is_null($t) ) |
164 | | - $wgOut->addWikiMsg( 'searchmenu-badtitle', wfEscapeWikiText( $term ) ); |
165 | | - else |
166 | | - $wgOut->addWikiMsg( 'searchmenu', wfEscapeWikiText( $term ) ); |
167 | | - |
168 | | - $wgOut->addHtml( |
169 | | - Xml::closeElement('td'). |
170 | | - Xml::closeElement('tr'). |
171 | | - Xml::closeElement('table') |
172 | | - ); |
173 | | - |
| 134 | + $wgOut->addWikiMsg( 'searchresulttext' ); |
174 | 135 | |
175 | 136 | if( '' === trim( $term ) ) { |
176 | 137 | // Empty query -- straight view of search form |
| 138 | + $wgOut->setSubtitle( '' ); |
| 139 | + $wgOut->addHTML( $this->powerSearchBox( $term ) ); |
| 140 | + $wgOut->addHTML( $this->powerSearchFocus() ); |
177 | 141 | wfProfileOut( $fname ); |
178 | 142 | return; |
179 | 143 | } |
— | — | @@ -201,7 +165,9 @@ |
202 | 166 | return; |
203 | 167 | } |
204 | 168 | |
205 | | - $search = $this->searchEngine; |
| 169 | + $wgOut->addHTML( $this->shortDialog( $term ) ); |
| 170 | + |
| 171 | + $search = SearchEngine::create(); |
206 | 172 | $search->setLimitOffset( $this->limit, $this->offset ); |
207 | 173 | $search->setNamespaces( $this->namespaces ); |
208 | 174 | $search->showRedirects = $this->searchRedirects; |
— | — | @@ -212,13 +178,14 @@ |
213 | 179 | // Sometimes the search engine knows there are too many hits |
214 | 180 | if ($titleMatches instanceof SearchResultTooMany) { |
215 | 181 | $wgOut->addWikiText( '==' . wfMsg( 'toomanymatches' ) . "==\n" ); |
| 182 | + $wgOut->addHTML( $this->powerSearchBox( $term ) ); |
| 183 | + $wgOut->addHTML( $this->powerSearchFocus() ); |
216 | 184 | wfProfileOut( $fname ); |
217 | 185 | return; |
218 | 186 | } |
219 | 187 | |
220 | 188 | $textMatches = $search->searchText( $rewritten ); |
221 | | - |
222 | | - |
| 189 | + |
223 | 190 | // did you mean... suggestions |
224 | 191 | if($textMatches && $textMatches->hasSuggestion()){ |
225 | 192 | $st = SpecialPage::getTitleFor( 'Search' ); |
— | — | @@ -231,8 +198,8 @@ |
232 | 199 | $textMatches->getSuggestionSnippet().'</a>'; |
233 | 200 | |
234 | 201 | $wgOut->addHTML('<div class="searchdidyoumean">'.wfMsg('search-suggest',$suggestLink).'</div>'); |
235 | | - } |
236 | | - |
| 202 | + } |
| 203 | + |
237 | 204 | // show number of results |
238 | 205 | $num = ( $titleMatches ? $titleMatches->numRows() : 0 ) |
239 | 206 | + ( $textMatches ? $textMatches->numRows() : 0); |
— | — | @@ -297,11 +264,12 @@ |
298 | 265 | } |
299 | 266 | |
300 | 267 | if ( $num == 0 ) { |
301 | | - $wgOut->addWikiMsg( 'search-nonefound' ); |
| 268 | + $wgOut->addWikiMsg( 'nonefound' ); |
302 | 269 | } |
303 | 270 | if( $num || $this->offset ) { |
304 | 271 | $wgOut->addHTML( "<p class='mw-search-pager-bottom'>{$prevnext}</p>\n" ); |
305 | 272 | } |
| 273 | + $wgOut->addHTML( $this->powerSearchBox( $term ) ); |
306 | 274 | wfProfileOut( $fname ); |
307 | 275 | } |
308 | 276 | |
— | — | @@ -317,6 +285,8 @@ |
318 | 286 | $wgOut->setPageTitle( wfMsg( 'searchresults') ); |
319 | 287 | $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsg( 'searchresults-title', $term) ) ); |
320 | 288 | } |
| 289 | + $subtitlemsg = ( Title::newFromText( $term ) ? 'searchsubtitle' : 'searchsubtitleinvalid' ); |
| 290 | + $wgOut->setSubtitle( $wgOut->parse( wfMsg( $subtitlemsg, wfEscapeWikiText($term) ) ) ); |
321 | 291 | $wgOut->setArticleRelated( false ); |
322 | 292 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
323 | 293 | } |
— | — | @@ -350,8 +320,6 @@ |
351 | 321 | $opt['ns' . $n] = 1; |
352 | 322 | } |
353 | 323 | $opt['redirs'] = $this->searchRedirects ? 1 : 0; |
354 | | - if( $this->searchAdvanced ) |
355 | | - $opt['advanced'] = $this->searchAdvanced; |
356 | 324 | return $opt; |
357 | 325 | } |
358 | 326 | |
— | — | @@ -631,18 +599,14 @@ |
632 | 600 | Xml::closeElement( 'span' ) . "\n"; |
633 | 601 | } |
634 | 602 | |
635 | | - if( $this->searchEngine->acceptListRedirects() ){ |
636 | | - $redirect = Xml::check( 'redirs', $this->searchRedirects, array( 'value' => '1', 'id' => 'redirs' ) ); |
637 | | - $redirectLabel = Xml::label( wfMsg( 'powersearch-redir' ), 'redirs' ); |
638 | | - } else{ |
639 | | - $redirect = ''; |
640 | | - $redirectLabel = ''; |
641 | | - } |
| 603 | + $redirect = Xml::check( 'redirs', $this->searchRedirects, array( 'value' => '1', 'id' => 'redirs' ) ); |
| 604 | + $redirectLabel = Xml::label( wfMsg( 'powersearch-redir' ), 'redirs' ); |
642 | 605 | $searchField = Xml::input( 'search', 50, $term, array( 'type' => 'text', 'id' => 'powerSearchText' ) ); |
643 | 606 | $searchButton = Xml::submitButton( wfMsg( 'powersearch' ), array( 'name' => 'fulltext' ) ) . "\n"; |
644 | 607 | $searchTitle = SpecialPage::getTitleFor( 'Search' ); |
645 | 608 | |
646 | 609 | $out = Xml::openElement( 'form', array( 'id' => 'powersearch', 'method' => 'get', 'action' => $wgScript ) ) . |
| 610 | + Xml::fieldset( wfMsg( 'powersearch-legend' ), |
647 | 611 | Xml::hidden( 'title', $searchTitle->getPrefixedText() ) . |
648 | 612 | "<p>" . |
649 | 613 | wfMsgExt( 'powersearch-ns', array( 'parseinline' ) ) . |
— | — | @@ -656,11 +620,10 @@ |
657 | 621 | " " . |
658 | 622 | $searchField . |
659 | 623 | " " . |
660 | | - $searchButton. |
| 624 | + $searchButton ) . |
661 | 625 | "</form>"; |
662 | 626 | |
663 | | - return Xml::openElement( 'fieldset', array( 'id' => 'mw-searchoptions' ) ) . $this->formHeader($term) . |
664 | | - $out . Xml::closeElement( 'fieldset' ); |
| 627 | + return $out; |
665 | 628 | } |
666 | 629 | |
667 | 630 | function powerSearchFocus() { |
— | — | @@ -671,134 +634,18 @@ |
672 | 635 | "});" . |
673 | 636 | "</script>"; |
674 | 637 | } |
675 | | - |
676 | | - /** Make a search link with some target namespaces */ |
677 | | - function makeSearchLink($term, $namespaces, $label, $tooltip, $params=array()){ |
678 | | - $opt = $params; |
679 | | - foreach( $namespaces as $n ) { |
680 | | - $opt['ns' . $n] = 1; |
681 | | - } |
682 | | - $opt['redirs'] = $this->searchRedirects ? 1 : 0; |
683 | | - |
684 | | - $st = SpecialPage::getTitleFor( 'Search' ); |
685 | | - $stParams = wfArrayToCGI( array( |
686 | | - 'search' => $term, |
687 | | - 'fulltext' => wfMsg( 'search' ) ), |
688 | | - $opt); |
689 | | - |
690 | | - return Xml::element( 'a', |
691 | | - array( 'href'=> $st->getLocalURL( $stParams ), 'title' => $tooltip ), |
692 | | - $label ); |
693 | | - |
694 | | - } |
695 | | - |
696 | | - /** Check if query starts with image: prefix */ |
697 | | - function startsWithImage( $term ){ |
698 | | - global $wgContLang; |
699 | | - |
700 | | - $p = explode( ':', $term ); |
701 | | - if( count( $p ) > 1 ){ |
702 | | - return $wgContLang->getNsIndex( $p[0] ) == NS_IMAGE; |
703 | | - } |
704 | | - return false; |
705 | | - } |
706 | | - |
707 | | - /** Check if query begins with all: magic prefix */ |
708 | | - function startsWithAll($term){ |
709 | | - global $wgContLang; |
710 | | - |
711 | | - $p = explode( ':', $term ); |
712 | | - return count( $p ) > 1 && $p[0] == wfMsg( 'searchall' ); |
713 | | - } |
714 | 638 | |
715 | | - function formHeader( $term ) { |
716 | | - global $wgContLang; |
717 | | - |
718 | | - $sep = ' '; |
719 | | - $out = Xml::openElement('div', array( 'style' => 'padding-bottom:0.5em;' ) ); |
720 | | - |
721 | | - $bareterm = $term; |
722 | | - if( $this->startsWithAll( $term ) || $this->startsWithImage( $term ) ) |
723 | | - $bareterm = substr( $term, strpos( $term, ':' ) + 1 ); // delete all/image prefix |
724 | | - |
725 | | - // figure out the active search profile header |
726 | | - if( $this->searchAdvanced ) |
727 | | - $active = 'advanced'; |
728 | | - else if( $this->namespaces == NS_IMAGE || $this->startsWithImage( $term ) ) |
729 | | - $active = 'images'; |
730 | | - elseif( $this->startsWithAll( $term ) ) |
731 | | - $active = 'all'; |
732 | | - elseif( $this->namespaces == SearchEngine::defaultNamespaces() ) |
733 | | - $active = 'default'; |
734 | | - elseif( $this->namespaces == SearchEngine::projectNamespaces() ) |
735 | | - $active = 'project'; |
736 | | - else |
737 | | - $active = 'advanced'; |
738 | | - |
739 | | - |
740 | | - // search profiles headers |
741 | | - $m = wfMsg( 'searchprofile-articles' ); |
742 | | - $tt = wfMsg( 'searchprofile-articles-tooltip', |
743 | | - implode( ', ', SearchEngine::namespacesAsText( SearchEngine::defaultNamespaces() ) ) ); |
744 | | - if( $active == 'default' ){ |
745 | | - $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m ); |
746 | | - } else |
747 | | - $out .= $this->makeSearchLink( $bareterm, SearchEngine::defaultNamespaces(), $m, $tt ); |
748 | | - |
749 | | - $out .= $sep; |
750 | | - |
751 | | - $m = wfMsg( 'searchprofile-project' ); |
752 | | - $tt = wfMsg( 'searchprofile-project-tooltip', |
753 | | - implode( ', ', SearchEngine::namespacesAsText( SearchEngine::projectNamespaces() ) ) ); |
754 | | - if( $active == 'project' ){ |
755 | | - $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m ); |
756 | | - } else |
757 | | - $out .= $this->makeSearchLink( $bareterm, SearchEngine::projectNamespaces(), $m, $tt ); |
758 | | - |
759 | | - $out .= $sep; |
760 | | - |
761 | | - $m = wfMsg( 'searchprofile-images' ); |
762 | | - $tt = wfMsg( 'searchprofile-images-tooltip' ); |
763 | | - if( $active == 'images' ){ |
764 | | - $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m ); |
765 | | - } else |
766 | | - $out .= $this->makeSearchLink( $wgContLang->getFormattedNsText(NS_IMAGE).':'.$bareterm, array() , $m, $tt ); |
767 | | - |
768 | | - $out .= $sep; |
769 | | - |
770 | | - $m = wfMsg( 'searchprofile-everything' ); |
771 | | - $tt = wfMsg( 'searchprofile-everything-tooltip' ); |
772 | | - if( $active == 'all' ){ |
773 | | - $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m ); |
774 | | - } else |
775 | | - $out .= $this->makeSearchLink( wfMsg( 'searchall' ).':'.$bareterm, array() , $m, $tt ); |
776 | | - |
777 | | - $out .= $sep; |
778 | | - |
779 | | - $m = wfMsg( 'searchprofile-advanced' ); |
780 | | - $tt = wfMsg( 'searchprofile-advanced-tooltip' ); |
781 | | - if( $active == 'advanced' ){ |
782 | | - $out .= Xml::element( 'strong', array( 'title'=>$tt ), $m ); |
783 | | - } else |
784 | | - $out .= $this->makeSearchLink( $bareterm, array() , $m, $tt, array( 'advanced' => '1' ) ); |
785 | | - |
786 | | - $out .= Xml::closeElement('div') ; |
787 | | - |
788 | | - return $out; |
789 | | - } |
790 | | - |
791 | | - function shortDialog( $term ) { |
| 639 | + function shortDialog($term) { |
792 | 640 | global $wgScript; |
793 | | - |
794 | | - $out = Xml::openElement( 'form', array( |
| 641 | + |
| 642 | + $out = Xml::openElement( 'form', array( |
795 | 643 | 'id' => 'search', |
796 | 644 | 'method' => 'get', |
797 | 645 | 'action' => $wgScript |
798 | 646 | )); |
799 | 647 | $searchTitle = SpecialPage::getTitleFor( 'Search' ); |
800 | | - $out .= Xml::hidden( 'title', $searchTitle->getPrefixedText() ) . "\n"; |
801 | | - $out .= Xml::input( 'search', 50, $term, array( 'type' => 'text', 'id' => 'searchText' ) ) . "\n"; |
802 | | - |
| 648 | + $out .= Xml::hidden( 'title', $searchTitle->getPrefixedText() ); |
| 649 | + $out .= Xml::input( 'search', 50, $term, array( 'type' => 'text', 'id' => 'searchText' ) ) . ' '; |
803 | 650 | foreach( SearchEngine::searchableNamespaces() as $ns => $name ) { |
804 | 651 | if( in_array( $ns, $this->namespaces ) ) { |
805 | 652 | $out .= Xml::hidden( "ns{$ns}", '1' ); |
— | — | @@ -806,7 +653,7 @@ |
807 | 654 | } |
808 | 655 | $out .= Xml::submitButton( wfMsg( 'searchbutton' ), array( 'name' => 'fulltext' ) ); |
809 | 656 | $out .= Xml::closeElement( 'form' ); |
810 | | - return Xml::openElement( 'fieldset', array( 'id' => 'mw-searchoptions' ) ) . $this->formHeader($term) . |
811 | | - $out . Xml::closeElement( 'fieldset' ); |
| 657 | + |
| 658 | + return $out; |
812 | 659 | } |
813 | 660 | } |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1415,61 +1415,49 @@ |
1416 | 1416 | 'diff-strike' => "'''strikethrough'''", |
1417 | 1417 | |
1418 | 1418 | # Search results |
1419 | | -'searchresults' => 'Search results', |
1420 | | -'searchresults-title' => 'Search results for $1', |
1421 | | -'toomanymatches' => 'Too many matches were returned, please try a different query', |
1422 | | -'titlematches' => 'Page title matches', |
1423 | | -'notitlematches' => 'No page title matches', |
1424 | | -'textmatches' => 'Page text matches', |
1425 | | -'notextmatches' => 'No page text matches', |
1426 | | -'prevn' => 'previous $1', |
1427 | | -'nextn' => 'next $1', |
1428 | | -'viewprevnext' => 'View ($1) ($2) ($3)', |
1429 | | -'searchmenu-exists' => "* Page '''[[$1]]'''", |
1430 | | -'searchmenu-new' => "* Create page '''[[$1]]'''", |
1431 | | -'searchhelp-url' => 'Project:Searching', |
1432 | | -'searchmenu-badtitle' => '* "$1" is not a valid title. |
1433 | | -* [[{{MediaWiki:Searchhelp-url}}|{{int:help}}]]', |
1434 | | -'searchmenu' => '* [[Special:AllPages/$1|Index]] |
1435 | | -* [[{{MediaWiki:Searchhelp-url}}|{{int:help}}]]', |
1436 | | -'searchprofile-articles' => 'Pages', |
1437 | | -'searchprofile-project' => 'Pages/Project', |
1438 | | -'searchprofile-images' => 'Files', |
1439 | | -'searchprofile-everything' => 'Everything', |
1440 | | -'searchprofile-advanced' => 'Advanced', |
1441 | | -'searchprofile-articles-tooltip' => 'Search in $1', |
1442 | | -'searchprofile-project-tooltip' => 'Search in $1', |
1443 | | -'searchprofile-images-tooltip' => 'Search for files', |
1444 | | -'searchprofile-everything-tooltip' => 'Search all of content (including talk pages)', |
1445 | | -'searchprofile-advanced-tooltip' => 'Search in custom namespaces', |
1446 | | -'prefs-search-nsdefault' => 'Search using defaults:', |
1447 | | -'prefs-search-nscustom' => 'Search custom namespaces:', |
1448 | | -'search-result-size' => '$1 ({{PLURAL:$2|1 word|$2 words}})', |
1449 | | -'search-result-score' => 'Relevance: $1%', |
1450 | | -'search-redirect' => '(redirect $1)', |
1451 | | -'search-section' => '(section $1)', |
1452 | | -'search-suggest' => 'Did you mean: $1', |
1453 | | -'search-interwiki-caption' => 'Sister projects', |
1454 | | -'search-interwiki-default' => '$1 results:', |
1455 | | -'search-interwiki-custom' => '', # do not translate or duplicate this message to other languages |
1456 | | -'search-interwiki-more' => '(more)', |
1457 | | -'search-mwsuggest-enabled' => 'with suggestions', |
1458 | | -'search-mwsuggest-disabled' => 'no suggestions', |
1459 | | -'search-relatedarticle' => 'Related', |
1460 | | -'mwsuggest-disable' => 'Disable AJAX suggestions', |
1461 | | -'searchrelated' => 'related', |
1462 | | -'searchall' => 'all', |
1463 | | -'showingresults' => "Showing below up to {{PLURAL:$1|'''1''' result|'''$1''' results}} starting with #'''$2'''.", |
1464 | | -'showingresultsnum' => "Showing below {{PLURAL:$3|'''1''' result|'''$3''' results}} starting with #'''$2'''.", |
1465 | | -'showingresultstotal' => "Showing below {{PLURAL:$4|result '''$1''' of '''$3'''|results '''$1 - $2''' of '''$3'''}}", |
1466 | | -'search-nonefound' => 'There were no results matching the query.', |
1467 | | -'powersearch' => 'Advanced search', |
1468 | | -'powersearch-legend' => 'Advanced search', |
1469 | | -'powersearch-ns' => 'Search in namespaces:', |
1470 | | -'powersearch-redir' => 'List redirects', |
1471 | | -'powersearch-field' => 'Search for', |
1472 | | -'search-external' => 'External search', |
1473 | | -'searchdisabled' => '{{SITENAME}} search is disabled. |
| 1419 | +'searchresults' => 'Search results', |
| 1420 | +'searchresults-title' => 'Search results for $1', |
| 1421 | +'searchresulttext' => 'For more information about searching {{SITENAME}}, see [[{{MediaWiki:Helppage}}|{{int:help}}]].', |
| 1422 | +'searchsubtitle' => 'You searched for \'\'\'[[:$1]]\'\'\' ([[Special:Prefixindex/$1|all pages starting with "$1"]] | [[Special:WhatLinksHere/$1|all pages that link to "$1"]])', |
| 1423 | +'searchsubtitleinvalid' => "You searched for '''$1'''", |
| 1424 | +'noexactmatch' => "'''There is no page titled \"\$1\".''' |
| 1425 | +You can [[:\$1|create this page]].", |
| 1426 | +'noexactmatch-nocreate' => "'''There is no page titled \"\$1\".'''", |
| 1427 | +'toomanymatches' => 'Too many matches were returned, please try a different query', |
| 1428 | +'titlematches' => 'Page title matches', |
| 1429 | +'notitlematches' => 'No page title matches', |
| 1430 | +'textmatches' => 'Page text matches', |
| 1431 | +'notextmatches' => 'No page text matches', |
| 1432 | +'prevn' => 'previous $1', |
| 1433 | +'nextn' => 'next $1', |
| 1434 | +'viewprevnext' => 'View ($1) ($2) ($3)', |
| 1435 | +'search-result-size' => '$1 ({{PLURAL:$2|1 word|$2 words}})', |
| 1436 | +'search-result-score' => 'Relevance: $1%', |
| 1437 | +'search-redirect' => '(redirect $1)', |
| 1438 | +'search-section' => '(section $1)', |
| 1439 | +'search-suggest' => 'Did you mean: $1', |
| 1440 | +'search-interwiki-caption' => 'Sister projects', |
| 1441 | +'search-interwiki-default' => '$1 results:', |
| 1442 | +'search-interwiki-custom' => '', # do not translate or duplicate this message to other languages |
| 1443 | +'search-interwiki-more' => '(more)', |
| 1444 | +'search-mwsuggest-enabled' => 'with suggestions', |
| 1445 | +'search-mwsuggest-disabled' => 'no suggestions', |
| 1446 | +'search-relatedarticle' => 'Related', |
| 1447 | +'mwsuggest-disable' => 'Disable AJAX suggestions', |
| 1448 | +'searchrelated' => 'related', |
| 1449 | +'searchall' => 'all', |
| 1450 | +'showingresults' => "Showing below up to {{PLURAL:$1|'''1''' result|'''$1''' results}} starting with #'''$2'''.", |
| 1451 | +'showingresultsnum' => "Showing below {{PLURAL:$3|'''1''' result|'''$3''' results}} starting with #'''$2'''.", |
| 1452 | +'showingresultstotal' => "Showing below {{PLURAL:$4|result '''$1''' of '''$3'''|results '''$1 - $2''' of '''$3'''}}", |
| 1453 | +'nonefound' => "'''Note''': Only some namespaces are searched by default. |
| 1454 | +Try prefixing your query with ''all:'' to search all content (including talk pages, templates, etc), or use the desired namespace as prefix.", |
| 1455 | +'powersearch' => 'Advanced search', |
| 1456 | +'powersearch-legend' => 'Advanced search', |
| 1457 | +'powersearch-ns' => 'Search in namespaces:', |
| 1458 | +'powersearch-redir' => 'List redirects', |
| 1459 | +'powersearch-field' => 'Search for', |
| 1460 | +'search-external' => 'External search', |
| 1461 | +'searchdisabled' => '{{SITENAME}} search is disabled. |
1474 | 1462 | You can search via Google in the meantime. |
1475 | 1463 | Note that their indexes of {{SITENAME}} content may be out of date.', |
1476 | 1464 | 'googlesearch' => '<form method="get" action="http://www.google.com/search" id="googlesearch"> |
— | — | @@ -1552,6 +1540,7 @@ |
1553 | 1541 | 'allowemail' => 'Enable e-mail from other users', |
1554 | 1542 | 'prefs-searchoptions' => 'Search options', |
1555 | 1543 | 'prefs-namespaces' => 'Namespaces', |
| 1544 | +'defaultns' => 'Search in these namespaces by default:', |
1556 | 1545 | 'default' => 'default', |
1557 | 1546 | 'files' => 'Files', |
1558 | 1547 | |