r80746 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80745‎ | r80746 | r80747 >
Date:14:36, 22 January 2011
Author:siebrand
Status:reverted (Comments)
Tags:
Comment:
* changed 'searchmenu-new-nocreate' to no longer be ignored and have content. Addresses bug 26747.
* remove trailing whitespace form SpecialSearch.php.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialSearch.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messageTypes.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messageTypes.inc
@@ -95,7 +95,6 @@
9696 'anonnotice',
9797 'autoblock_whitelist',
9898 'searchmenu-help',
99 - 'searchmenu-new-nocreate',
10099 'googlesearch',
101100 'opensearch-desc',
102101 'exif-make-value',
Index: trunk/phase3/includes/specials/SpecialSearch.php
@@ -103,12 +103,12 @@
104104 }
105105 # If there's an exact or very near match, jump right there.
106106 $t = SearchEngine::getNearMatch( $term );
107 -
 107+
108108 if ( !wfRunHooks( 'SpecialSearchGo', array( &$t, &$term ) ) ) {
109109 # Hook requested termination
110110 return;
111111 }
112 -
 112+
113113 if( !is_null( $t ) ) {
114114 $wgOut->redirect( $t->getFullURL() );
115115 return;
@@ -243,7 +243,7 @@
244244 $wgOut->addHTML( $this->formHeader($term, 0, 0));
245245 if( $this->searchAdvanced ) {
246246 $wgOut->addHTML( $this->powerSearchBox( $term ) );
247 - }
 247+ }
248248 $wgOut->addHTML( '</form>' );
249249 // Empty query -- straight view of search form
250250 wfProfileOut( __METHOD__ );
@@ -255,7 +255,7 @@
256256 $textMatchesNum = $textMatches ? $textMatches->numRows() : 0;
257257 // Total initial query matches (possible false positives)
258258 $num = $titleMatchesNum + $textMatchesNum;
259 -
 259+
260260 // Get total actual results (after second filtering, if any)
261261 $numTitleMatches = $titleMatches && !is_null( $titleMatches->getTotalHits() ) ?
262262 $titleMatches->getTotalHits() : $titleMatchesNum;
@@ -268,13 +268,13 @@
269269 $totalRes += $titleMatches->getTotalHits();
270270 if($textMatches && !is_null( $textMatches->getTotalHits() ))
271271 $totalRes += $textMatches->getTotalHits();
272 -
 272+
273273 // show number of results and current offset
274274 $wgOut->addHTML( $this->formHeader($term, $num, $totalRes));
275275 if( $this->searchAdvanced ) {
276276 $wgOut->addHTML( $this->powerSearchBox( $term ) );
277277 }
278 -
 278+
279279 $wgOut->addHtml( Xml::closeElement( 'form' ) );
280280 $wgOut->addHtml( "<div class='searchresults'>" );
281281
@@ -291,7 +291,7 @@
292292 wfRunHooks( 'SpecialSearchResults', array( $term, &$titleMatches, &$textMatches ) );
293293 } else {
294294 wfRunHooks( 'SpecialSearchNoResults', array( $term ) );
295 - }
 295+ }
296296
297297 $wgOut->parserOptions()->setEditSection( false );
298298 if( $titleMatches ) {
@@ -332,10 +332,10 @@
333333 }
334334 wfProfileOut( __METHOD__ );
335335 }
336 -
 336+
337337 protected function showCreateLink( $t ) {
338338 global $wgOut;
339 -
 339+
340340 // show direct page/create link if applicable
341341 $messageName = null;
342342 if( !is_null($t) ) {
@@ -346,7 +346,7 @@
347347 } else {
348348 $messageName = 'searchmenu-new-nocreate';
349349 }
350 - }
 350+ }
351351 if( $messageName ) {
352352 $wgOut->wrapWikiMsg( "<p class=\"mw-search-createlink\">\n$1</p>", array( $messageName, wfEscapeWikiText( $t->getPrefixedText() ) ) );
353353 } else {
@@ -365,12 +365,12 @@
366366 $this->active = 'advanced';
367367 } else {
368368 $profiles = $this->getSearchProfiles();
369 -
 369+
370370 foreach( $profiles as $key => $data ) {
371371 if ( $this->namespaces == $data['namespaces'] && $key != 'advanced')
372372 $this->active = $key;
373373 }
374 -
 374+
375375 }
376376 # Should advanced UI be used?
377377 $this->searchAdvanced = ($this->active === 'advanced');
@@ -467,9 +467,9 @@
468468
469469 if( $titleSnippet == '' )
470470 $titleSnippet = null;
471 -
 471+
472472 $link_t = clone $t;
473 -
 473+
474474 wfRunHooks( 'ShowSearchHitTitle',
475475 array( &$link_t, &$titleSnippet, $result, $terms, $this ) );
476476
@@ -777,7 +777,7 @@
778778 }
779779 $rows = array_values( $rows );
780780 $numRows = count( $rows );
781 -
 781+
782782 // Lays out namespaces in multiple floating two-column tables so they'll
783783 // be arranged nicely while still accommodating different screen widths
784784 $namespaceTables = '';
@@ -841,11 +841,11 @@
842842 Html::hidden( 'fulltext', 'Advanced search' ) .
843843 Xml::closeElement( 'fieldset' );
844844 }
845 -
 845+
846846 protected function getSearchProfiles() {
847847 // Builds list of Search Types (profiles)
848848 $nsAllSet = array_keys( SearchEngine::searchableNamespaces() );
849 -
 849+
850850 $profiles = array(
851851 'default' => array(
852852 'message' => 'searchprofile-articles',
@@ -880,21 +880,21 @@
881881 'parameters' => array( 'advanced' => 1 ),
882882 )
883883 );
884 -
 884+
885885 wfRunHooks( 'SpecialSearchProfiles', array( &$profiles ) );
886886
887887 foreach( $profiles as &$data ) {
888888 sort($data['namespaces']);
889889 }
890 -
 890+
891891 return $profiles;
892892 }
893893
894894 protected function formHeader( $term, $resultsShown, $totalNum ) {
895895 global $wgLang;
896 -
 896+
897897 $out = Xml::openElement('div', array( 'class' => 'mw-search-formheader' ) );
898 -
 898+
899899 $bareterm = $term;
900900 if( $this->startsWithImage( $term ) ) {
901901 // Deletes prefixes
@@ -902,7 +902,7 @@
903903 }
904904
905905 $profiles = $this->getSearchProfiles();
906 -
 906+
907907 // Outputs XML for Search Types
908908 $out .= Xml::openElement( 'div', array( 'class' => 'search-types' ) );
909909 $out .= Xml::openElement( 'ul' );
@@ -919,7 +919,7 @@
920920 $profile['namespaces'],
921921 wfMsg( $profile['message'] ),
922922 wfMsg( $profile['tooltip'], $tooltipParam ),
923 - isset( $profile['parameters'] ) ? $profile['parameters'] : array()
 923+ isset( $profile['parameters'] ) ? $profile['parameters'] : array()
924924 )
925925 );
926926 }
@@ -945,17 +945,17 @@
946946 Xml::tags( 'ul', null, Xml::tags( 'li', null, $top ) )
947947 );
948948 }
949 -
 949+
950950 $out .= Xml::element( 'div', array( 'style' => 'clear:both' ), '', false );
951951 $out .= Xml::closeElement('div');
952 -
 952+
953953 // Adds hidden namespace fields
954954 if ( !$this->searchAdvanced ) {
955955 foreach( $this->namespaces as $ns ) {
956956 $out .= Html::hidden( "ns{$ns}", '1' );
957957 }
958958 }
959 -
 959+
960960 return $out;
961961 }
962962
@@ -972,7 +972,7 @@
973973 ) ) . "\n";
974974 $out .= Html::hidden( 'fulltext', 'Search' ) . "\n";
975975 $out .= Xml::submitButton( wfMsg( 'searchbutton' ) ) . "\n";
976 - return $out . $this->didYouMeanHtml;
 976+ return $out . $this->didYouMeanHtml;
977977 }
978978
979979 /**
@@ -1005,7 +1005,7 @@
10061006 'a',
10071007 array(
10081008 'href' => $st->getLocalURL( $stParams ),
1009 - 'title' => $tooltip,
 1009+ 'title' => $tooltip,
10101010 'onmousedown' => 'mwSearchHeaderClick(this);',
10111011 'onkeydown' => 'mwSearchHeaderClick(this);'),
10121012 $label
@@ -1027,7 +1027,7 @@
10281028 }
10291029 return false;
10301030 }
1031 -
 1031+
10321032 /**
10331033 * Check if query starts with all: prefix
10341034 *
@@ -1037,7 +1037,7 @@
10381038 protected function startsWithAll( $term ) {
10391039
10401040 $allkeyword = wfMsgForContent('searchall');
1041 -
 1041+
10421042 $p = explode( ':', $term );
10431043 if( count( $p ) > 1 ) {
10441044 return $p[0] == $allkeyword;
@@ -1045,4 +1045,3 @@
10461046 return false;
10471047 }
10481048 }
1049 -
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1664,7 +1664,7 @@
16651665 'searchmenu-legend' => 'Search options',
16661666 'searchmenu-exists' => "'''There is a page named \"[[:\$1]]\" on this wiki.'''",
16671667 'searchmenu-new' => "'''Create the page \"[[:\$1]]\" on this wiki!'''",
1668 -'searchmenu-new-nocreate' => '', # do not translate or duplicate this message to other languages
 1668+'searchmenu-new-nocreate' => '"$1" is an invalid page name or cannot be created by you.',
16691669 'searchhelp-url' => 'Help:Contents',
16701670 'searchmenu-prefix' => '[[Special:PrefixIndex/$1|Browse pages with this prefix]]',
16711671 'searchmenu-help' => '[[{{MediaWiki:Searchhelp-url}}|{{int:help}}]]?', # do not translate or duplicate this message to other languages

Follow-up revisions

RevisionCommit summaryAuthorDate
r97098* (bug 30900) Remove confusing default value added for the default-don't-say-...brion20:42, 14 September 2011
r97099MFT r97098: revert of r80746 to fix bug 30900brion20:46, 14 September 2011
r97173Merged revisions 97087,97091-97092,97094,97096-97098,97100-97101,97103,97136,...dantman16:19, 15 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r65902Add a new searchmenu-new-nocreate message...hartman15:36, 4 May 2010

Comments

#Comment by Brion VIBBER (talk | contribs)   19:39, 14 September 2011

This message is supposed to be empty, and possibly should never actually be used as it's usually going to be misleading or incorrect: see bug 30900.

Recommend revert.

#Comment by Brion VIBBER (talk | contribs)   20:43, 14 September 2011

Reverted from trunk in r97098.

Status & tagging log