* Add wfReadOnlyReason() to supply the reason for the wiki being read only. Use it...
[lhc/web/wiklou.git] / includes / SpecialPreferences.php
index 0bc362a..ca163a6 100644 (file)
@@ -24,7 +24,7 @@ class PreferencesForm {
        var $mRows, $mCols, $mSkin, $mMath, $mDate, $mUserEmail, $mEmailFlag, $mNick;
        var $mUserLanguage, $mUserVariant;
        var $mSearch, $mRecent, $mRecentDays, $mHourDiff, $mSearchLines, $mSearchChars, $mAction;
-       var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize;
+       var $mReset, $mPosted, $mToggles, $mUseAjaxSearch, $mSearchNs, $mRealName, $mImageSize;
        var $mUnderline, $mWatchlistEdits;
 
        /**
@@ -65,6 +65,7 @@ class PreferencesForm {
                $this->mSuccess = $request->getCheck( 'success' );
                $this->mWatchlistDays = $request->getVal( 'wpWatchlistDays' );
                $this->mWatchlistEdits = $request->getVal( 'wpWatchlistEdits' );
+               $this->mUseAjaxSearch = $request->getCheck( 'wpUseAjaxSearch' );
 
                $this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) &&
                        $this->mPosted &&
@@ -285,6 +286,7 @@ class PreferencesForm {
                $wgUser->setOption( 'thumbsize', $this->mThumbSize );
                $wgUser->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) );
                $wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0, 7 ) );
+               $wgUser->setOption( 'ajaxsearch', $this->mUseAjaxSearch );
 
                # Set search namespace options
                foreach( $this->mSearchNs as $i => $value ) {
@@ -395,6 +397,7 @@ class PreferencesForm {
                $this->mWatchlistEdits = $wgUser->getOption( 'wllimit' );
                $this->mUnderline = $wgUser->getOption( 'underline' );
                $this->mWatchlistDays = $wgUser->getOption( 'watchlistdays' );
+               $this->mUseAjaxSearch = $wgUser->getBoolOption( 'ajaxsearch' );
 
                $togs = User::getToggles();
                foreach ( $togs as $tname ) {
@@ -512,7 +515,7 @@ class PreferencesForm {
                global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
                global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
                global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
-               global $wgEmailConfirmToEdit;
+               global $wgEmailConfirmToEdit, $wgAjaxSearch;
 
                $wgOut->setPageTitle( wfMsg( 'preferences' ) );
                $wgOut->setArticleRelated( false );
@@ -521,11 +524,11 @@ class PreferencesForm {
                $wgOut->disallowUserJs();  # Prevent hijacked user scripts from sniffing passwords etc.
 
                if ( $this->mSuccess || 'success' == $status ) {
-                       $wgOut->addWikitext( '<div class="successbox"><strong>'. wfMsg( 'savedprefs' ) . '</strong></div>' );
+                       $wgOut->wrapWikiMsg( '<div class="successbox"><strong>$1</strong></div>', 'savedprefs' );
                } else  if ( 'error' == $status ) {
-                       $wgOut->addWikitext( '<div class="errorbox"><strong>' . $message  . '</strong></div>' );
+                       $wgOut->addWikiText( '<div class="errorbox"><strong>' . $message  . '</strong></div>' );
                } else if ( '' != $status ) {
-                       $wgOut->addWikitext( $message . "\n----" );
+                       $wgOut->addWikiText( $message . "\n----" );
                }
 
                $qbs = $wgLang->getQuickbarSettings();
@@ -970,7 +973,13 @@ class PreferencesForm {
                $wgOut->addHtml( '</fieldset>' );
 
                # Search
+               $ajaxsearch = $wgAjaxSearch ?
+                       $this->addRow(
+                               wfLabel( wfMsg( 'useajaxsearch' ), 'wpUseAjaxSearch' ),
+                               wfCheck( 'wpUseAjaxSearch', $this->mUseAjaxSearch, array( 'id' => 'wpUseAjaxSearch' ) )
+                       ) : '';
                $wgOut->addHTML( '<fieldset><legend>' . wfMsg( 'searchresultshead' ) . '</legend><table>' .
+                       $ajaxsearch .
                        $this->addRow(
                                wfLabel( wfMsg( 'resultsperpage' ), 'wpSearch' ),
                                wfInput( 'wpSearch', 4, $this->mSearch, array( 'id' => 'wpSearch' ) )