r28543 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r28542‎ | r28543 | r28544 >
Date:15:46, 16 December 2007
Author:vasilievvv
Status:old
Tags:
Comment:
* Introduce new user preference: ajaxsearch
* Drop strange status bar message
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/SpecialPreferences.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesRu.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)
  • /trunk/phase3/skins/common/ajaxsearch.js (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -2198,6 +2198,7 @@
21992199 'searchnamed',
22002200 'articletitles',
22012201 'hideresults',
 2202+ 'useajaxsearch',
22022203 ),
22032204 'separators' => array(
22042205 'catseparator',
Index: trunk/phase3/skins/common/ajaxsearch.js
@@ -23,7 +23,6 @@
2424 function Search_Typing() {
2525 started=true;
2626 typing=true;
27 - window.status = "Waiting until you're done typing...";
2827 setTimeout("Search_doneTyping()", 500);
2928
3029 // I believe these are needed by IE for when the users press return?
Index: trunk/phase3/includes/OutputPage.php
@@ -599,7 +599,7 @@
600600
601601 wfRunHooks( 'AjaxAddScript', array( &$this ) );
602602
603 - if( $wgAjaxSearch ) {
 603+ if( $wgAjaxSearch && $wgUser->getBoolOption( 'ajaxsearch' ) ) {
604604 $this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajaxsearch.js?$wgStyleVersion\"></script>\n" );
605605 $this->addScript( "<script type=\"{$wgJsMimeType}\">hookEvent(\"load\", sajax_onload);</script>\n" );
606606 }
Index: trunk/phase3/includes/SpecialPreferences.php
@@ -24,7 +24,7 @@
2525 var $mRows, $mCols, $mSkin, $mMath, $mDate, $mUserEmail, $mEmailFlag, $mNick;
2626 var $mUserLanguage, $mUserVariant;
2727 var $mSearch, $mRecent, $mRecentDays, $mHourDiff, $mSearchLines, $mSearchChars, $mAction;
28 - var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize;
 28+ var $mReset, $mPosted, $mToggles, $mUseAjaxSearch, $mSearchNs, $mRealName, $mImageSize;
2929 var $mUnderline, $mWatchlistEdits;
3030
3131 /**
@@ -65,6 +65,7 @@
6666 $this->mSuccess = $request->getCheck( 'success' );
6767 $this->mWatchlistDays = $request->getVal( 'wpWatchlistDays' );
6868 $this->mWatchlistEdits = $request->getVal( 'wpWatchlistEdits' );
 69+ $this->mUseAjaxSearch = $request->getCheck( 'wpUseAjaxSearch' );
6970
7071 $this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) &&
7172 $this->mPosted &&
@@ -285,6 +286,7 @@
286287 $wgUser->setOption( 'thumbsize', $this->mThumbSize );
287288 $wgUser->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) );
288289 $wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0, 7 ) );
 290+ $wgUser->setOption( 'ajaxsearch', $this->mUseAjaxSearch );
289291
290292 # Set search namespace options
291293 foreach( $this->mSearchNs as $i => $value ) {
@@ -395,6 +397,7 @@
396398 $this->mWatchlistEdits = $wgUser->getOption( 'wllimit' );
397399 $this->mUnderline = $wgUser->getOption( 'underline' );
398400 $this->mWatchlistDays = $wgUser->getOption( 'watchlistdays' );
 401+ $this->mUseAjaxSearch = $wgUser->getBoolOption( 'ajaxsearch' );
399402
400403 $togs = User::getToggles();
401404 foreach ( $togs as $tname ) {
@@ -512,7 +515,7 @@
513516 global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
514517 global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
515518 global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
516 - global $wgEmailConfirmToEdit;
 519+ global $wgEmailConfirmToEdit, $wgAjaxSearch;
517520
518521 $wgOut->setPageTitle( wfMsg( 'preferences' ) );
519522 $wgOut->setArticleRelated( false );
@@ -970,7 +973,13 @@
971974 $wgOut->addHtml( '</fieldset>' );
972975
973976 # Search
 977+ $ajaxsearch = $wgAjaxSearch ?
 978+ $this->addRow(
 979+ wfLabel( wfMsg( 'useajaxsearch' ), 'wpUseAjaxSearch' ),
 980+ wfCheck( 'wpUseAjaxSearch', $this->mUseAjaxSearch, array( 'id' => 'wpUseAjaxSearch' ) )
 981+ ) : '';
974982 $wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'searchresultshead' ) . '</legend><table>' .
 983+ $ajaxsearch .
975984 $this->addRow(
976985 wfLabel( wfMsg( 'resultsperpage' ), 'wpSearch' ),
977986 wfInput( 'wpSearch', 4, $this->mSearch, array( 'id' => 'wpSearch' ) )
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2965,6 +2965,7 @@
29662966 'searchnamed' => "Search for pages named ''$1''.",
29672967 'articletitles' => "Pages starting with ''$1''",
29682968 'hideresults' => 'Hide results',
 2969+'useajaxsearch' => 'Use AJAX search',
29692970
29702971 # Separators for various lists
29712972 'catseparator' => '|', # don't translate or duplicate this message to other languages
Index: trunk/phase3/languages/messages/MessagesRu.php
@@ -2358,6 +2358,7 @@
23592359 'searchnamed' => 'Поиск статей с названием $1.',
23602360 'articletitles' => 'Статьи, начинающиеся с «$1»',
23612361 'hideresults' => 'Скрыть результаты',
 2362+'useajaxsearch' => 'Использовать AJAX-поиск',
23622363
23632364 # Multipage image navigation
23642365 'imgmultipageprev' => '← предыдущая страница',

Status & tagging log