Index: trunk/phase3/includes/specials/SpecialPreferences.php |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | var $mUserLanguage, $mUserVariant; |
28 | 28 | var $mSearch, $mRecent, $mRecentDays, $mTimeZone, $mHourDiff, $mSearchLines, $mSearchChars, $mAction; |
29 | 29 | var $mReset, $mPosted, $mToggles, $mSearchNs, $mRealName, $mImageSize; |
30 | | - var $mUnderline, $mWatchlistEdits; |
| 30 | + var $mUnderline, $mWatchlistEdits, $mGender; |
31 | 31 | |
32 | 32 | /** |
33 | 33 | * Constructor |
— | — | @@ -66,6 +66,7 @@ |
67 | 67 | $this->mWatchlistDays = $request->getVal( 'wpWatchlistDays' ); |
68 | 68 | $this->mWatchlistEdits = $request->getVal( 'wpWatchlistEdits' ); |
69 | 69 | $this->mDisableMWSuggest = $request->getCheck( 'wpDisableMWSuggest' ); |
| 70 | + $this->mGender = $request->getVal( 'wpGender' ); |
70 | 71 | |
71 | 72 | $this->mSaveprefs = $request->getCheck( 'wpSaveprefs' ) && |
72 | 73 | $this->mPosted && |
— | — | @@ -207,6 +208,15 @@ |
208 | 209 | } |
209 | 210 | } |
210 | 211 | |
| 212 | + function validateGender( $val ) { |
| 213 | + $valid = array( 'male', 'female', 'unknown' ); |
| 214 | + if ( in_array($val, $valid) ) { |
| 215 | + return $val; |
| 216 | + } else { |
| 217 | + return User::getDefaultOption( 'gender' ); |
| 218 | + } |
| 219 | + } |
| 220 | + |
211 | 221 | /** |
212 | 222 | * @access private |
213 | 223 | */ |
— | — | @@ -272,6 +282,7 @@ |
273 | 283 | $wgUser->setOption( 'underline', $this->validateInt($this->mUnderline, 0, 2) ); |
274 | 284 | $wgUser->setOption( 'watchlistdays', $this->validateFloat( $this->mWatchlistDays, 0, 7 ) ); |
275 | 285 | $wgUser->setOption( 'disablesuggest', $this->mDisableMWSuggest ); |
| 286 | + $wgUser->setOption( 'gender', $this->validateGender( $this->mGender ) ); |
276 | 287 | |
277 | 288 | # Set search namespace options |
278 | 289 | foreach( $this->mSearchNs as $i => $value ) { |
— | — | @@ -423,6 +434,7 @@ |
424 | 435 | $this->mUnderline = $wgUser->getOption( 'underline' ); |
425 | 436 | $this->mWatchlistDays = $wgUser->getOption( 'watchlistdays' ); |
426 | 437 | $this->mDisableMWSuggest = $wgUser->getBoolOption( 'disablesuggest' ); |
| 438 | + $this->mGender = $wgUser->getOption( 'gender' ); |
427 | 439 | |
428 | 440 | $togs = User::getToggles(); |
429 | 441 | foreach ( $togs as $tname ) { |
— | — | @@ -735,8 +747,20 @@ |
736 | 748 | $this->tableRow( ' ', $this->getToggle( 'fancysig' ) ) |
737 | 749 | ); |
738 | 750 | |
739 | | - list( $lsLabel, $lsSelect) = Xml::languageSelector( $this->mUserLanguage ); |
| 751 | + $gender = new XMLSelect( 'wpGender', 'wpGender', $this->mGender ); |
| 752 | + $gender->addOption( wfMsg( 'gender-unknown' ), 'unknown' ); |
| 753 | + $gender->addOption( wfMsg( 'gender-male' ), 'male' ); |
| 754 | + $gender->addOption( wfMsg( 'gender-female' ), 'female' ); |
| 755 | + |
740 | 756 | $wgOut->addHTML( |
| 757 | + $this->tableRow( |
| 758 | + Xml::label( wfMsg( 'yourgender' ), 'wpGender' ), |
| 759 | + $gender->getHTML() |
| 760 | + ) |
| 761 | + ); |
| 762 | + |
| 763 | + list( $lsLabel, $lsSelect) = Xml::languageSelector( $this->mUserLanguage, false ); |
| 764 | + $wgOut->addHTML( |
741 | 765 | $this->tableRow( $lsLabel, $lsSelect ) |
742 | 766 | ); |
743 | 767 | |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -286,6 +286,7 @@ |
287 | 287 | 'servername' => array( 0, 'SERVERNAME' ), |
288 | 288 | 'scriptpath' => array( 0, 'SCRIPTPATH' ), |
289 | 289 | 'grammar' => array( 0, 'GRAMMAR:' ), |
| 290 | + 'gender' => array( 0, 'GENDER:' ), |
290 | 291 | 'notitleconvert' => array( 0, '__NOTITLECONVERT__', '__NOTC__'), |
291 | 292 | 'nocontentconvert' => array( 0, '__NOCONTENTCONVERT__', '__NOCC__'), |
292 | 293 | 'currentweek' => array( 1, 'CURRENTWEEK' ), |
— | — | @@ -908,6 +909,10 @@ |
909 | 910 | Check HTML tags.', |
910 | 911 | 'badsiglength' => 'The signature is too long. |
911 | 912 | It must be under $1 {{PLURAL:$1|character|characters}}.', |
| 913 | +'yourgender' => 'Gender:', |
| 914 | +'gender-unknown' => 'Unspecified', |
| 915 | +'gender-male' => 'Male', |
| 916 | +'gender-female' => 'Female', |
912 | 917 | 'email' => 'E-mail', |
913 | 918 | 'prefs-help-realname' => 'Real name is optional. |
914 | 919 | If you choose to provide it, this will be used for giving you attribution for your work.', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -62,6 +62,7 @@ |
63 | 63 | * More helpful error message on raw page access if PHP_SELF isn't set |
64 | 64 | * (bug 17145) Specific categories can be excluded from Special:UnusedCategories |
65 | 65 | with __IGNOREUNUSED__ |
| 66 | +* (bug 13040) Gender switch in user preferences |
66 | 67 | |
67 | 68 | === Bug fixes in 1.15 === |
68 | 69 | * (bug 16968) Special:Upload no longer throws useless warnings. |