Index: trunk/phase3/includes/User.php |
— | — | @@ -1909,6 +1909,13 @@ |
1910 | 1910 | } |
1911 | 1911 | $this->mOptions[$oname] = $val; |
1912 | 1912 | } |
| 1913 | + |
| 1914 | + /** |
| 1915 | + * Reset all options to the site defaults |
| 1916 | + */ |
| 1917 | + function restoreOptions() { |
| 1918 | + $this->mOptions = User::getDefaultOptions(); |
| 1919 | + } |
1913 | 1920 | |
1914 | 1921 | /** |
1915 | 1922 | * Get the user's preferred date format. |
Index: trunk/phase3/includes/specials/SpecialPreferences.php |
— | — | @@ -32,7 +32,7 @@ |
33 | 33 | * Constructor |
34 | 34 | * Load some values |
35 | 35 | */ |
36 | | - function PreferencesForm( &$request ) { |
| 36 | + function __construct( &$request ) { |
37 | 37 | global $wgContLang, $wgUser, $wgAllowRealName; |
38 | 38 | |
39 | 39 | $this->mQuickbar = $request->getVal( 'wpQuickbar' ); |
— | — | @@ -60,6 +60,7 @@ |
61 | 61 | $this->mUnderline = $request->getInt( 'wpOpunderline' ); |
62 | 62 | $this->mAction = $request->getVal( 'action' ); |
63 | 63 | $this->mReset = $request->getCheck( 'wpReset' ); |
| 64 | + $this->mRestoreprefs = $request->getCheck( 'wpRestore' ); |
64 | 65 | $this->mPosted = $request->wasPosted(); |
65 | 66 | $this->mSuccess = $request->getCheck( 'success' ); |
66 | 67 | $this->mWatchlistDays = $request->getVal( 'wpWatchlistDays' ); |
— | — | @@ -117,6 +118,8 @@ |
118 | 119 | $this->mainPrefsForm( 'reset', wfMsg( 'prefsreset' ) ); |
119 | 120 | } else if ( $this->mSaveprefs ) { |
120 | 121 | $this->savePreferences(); |
| 122 | + } else if ( $this->mRestoreprefs ) { |
| 123 | + $this->restorePreferences(); |
121 | 124 | } else { |
122 | 125 | $this->resetPrefs(); |
123 | 126 | $this->mainPrefsForm( '' ); |
— | — | @@ -435,6 +438,17 @@ |
436 | 439 | |
437 | 440 | wfRunHooks( 'ResetPreferences', array( $this, $wgUser ) ); |
438 | 441 | } |
| 442 | + |
| 443 | + /** |
| 444 | + * @access private |
| 445 | + */ |
| 446 | + function restorePreferences() { |
| 447 | + global $wgUser; |
| 448 | + $wgUser->restoreOptions(); |
| 449 | + $wgUser->setCookies(); |
| 450 | + $wgUser->saveSettings(); |
| 451 | + $this->mainPrefsForm( 'success' ); |
| 452 | + } |
439 | 453 | |
440 | 454 | /** |
441 | 455 | * @access private |
— | — | @@ -1192,13 +1206,13 @@ |
1193 | 1207 | $skin = $wgUser->getSkin(); |
1194 | 1208 | $wgOut->addHTML( " |
1195 | 1209 | <div id='prefsubmit'> |
1196 | | - <div> |
1197 | | - <input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml( 'saveprefs' ) . '"'.$skin->tooltipAndAccesskey('save')." /> |
| 1210 | + <input type='submit' name='wpSaveprefs' class='btnSavePrefs' value=\"" . wfMsgHtml( 'saveprefs' ) . |
| 1211 | + '"'.$skin->tooltipAndAccesskey('save')." /> |
1198 | 1212 | <input type='submit' name='wpReset' value=\"" . wfMsgHtml( 'resetprefs' ) . "\" /> |
| 1213 | + <input type='submit' name='wpRestore' class='btnSavePrefs' style='float:right;' value=\"" . |
| 1214 | + wfMsgHtml( 'restoreprefs' ) . "\" /> |
1199 | 1215 | </div> |
1200 | 1216 | |
1201 | | - </div> |
1202 | | - |
1203 | 1217 | <input type='hidden' name='wpEditToken' value=\"{$token}\" /> |
1204 | 1218 | </div></form>\n" ); |
1205 | 1219 | |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1535,6 +1535,7 @@ |
1536 | 1536 | 'prefs-resetpass' => 'Change password', |
1537 | 1537 | 'saveprefs' => 'Save', |
1538 | 1538 | 'resetprefs' => 'Clear unsaved changes', |
| 1539 | +'restoreprefs' => 'Restore all default settings', |
1539 | 1540 | 'textboxsize' => 'Editing', |
1540 | 1541 | 'prefs-edit-boxsize' => 'Size of the edit window.', |
1541 | 1542 | 'rows' => 'Rows:', |