Index: trunk/extensions/Contest/Contest.i18n.php |
— | — | @@ -130,6 +130,7 @@ |
131 | 131 | 'contest-signup-finished' => 'This contest has ended. Thank you for your participation!', |
132 | 132 | 'contest-signup-draft' => 'This contest has not yet started. Please be patient.', |
133 | 133 | 'contest-signup-country' => 'Your country', |
| 134 | + 'contest-signup-emailwarn' => 'Warning: you are changing your accounts email address, which will require your confirming the new address.', |
134 | 135 | |
135 | 136 | 'contest-signup-require-rules' => 'You must agree to the contest rules.', |
136 | 137 | 'contest-signup-require-country' => 'You must provide your country of residence.', |
Index: trunk/extensions/Contest/specials/SpecialMyContests.php |
— | — | @@ -337,7 +337,14 @@ |
338 | 338 | public function handleSubmission( array $data ) { |
339 | 339 | $user = $this->getUser(); |
340 | 340 | |
341 | | - $user->setEmail( $data['contestant-email'] ); |
| 341 | + $oldEmail = $user->getEmail(); |
| 342 | + |
| 343 | + if ( $oldEmail !== $data['contestant-email'] ) { |
| 344 | + $user->setEmail( $data['contestant-email'] ); |
| 345 | + $user->invalidateEmail(); |
| 346 | + $user->sendConfirmationMail( $oldEmail == '' ? 'set' : 'changed' ); |
| 347 | + } |
| 348 | + |
342 | 349 | $user->setRealName( $data['contestant-realname'] ); |
343 | 350 | $user->saveSettings(); |
344 | 351 | |
Index: trunk/extensions/Contest/specials/SpecialContestSignup.php |
— | — | @@ -64,7 +64,14 @@ |
65 | 65 | public function handleSubmission( array $data ) { |
66 | 66 | $user = $this->getUser(); |
67 | 67 | |
68 | | - $user->setEmail( $data['contestant-email'] ); |
| 68 | + $oldEmail = $user->getEmail(); |
| 69 | + |
| 70 | + if ( $oldEmail !== $data['contestant-email'] ) { |
| 71 | + $user->setEmail( $data['contestant-email'] ); |
| 72 | + $user->invalidateEmail(); |
| 73 | + $user->sendConfirmationMail( $oldEmail == '' ? 'set' : 'changed' ); |
| 74 | + } |
| 75 | + |
69 | 76 | $user->setRealName( $data['contestant-realname'] ); |
70 | 77 | $user->saveSettings(); |
71 | 78 | |
Index: trunk/extensions/Contest/Contest.php |
— | — | @@ -243,8 +243,8 @@ |
244 | 244 | 'contest.special.signup.js', |
245 | 245 | ), |
246 | 246 | 'dependencies' => array( |
247 | | - 'jquery.ui.button', 'jquery.fancybox', |
248 | | - ) |
| 247 | + 'jquery.ui.button', 'jquery.fancybox', 'jquery.contestEmail', |
| 248 | + ), |
249 | 249 | ); |
250 | 250 | |
251 | 251 | $wgResourceModules['contest.special.submission'] = $moduleTemplate + array( |
— | — | @@ -252,10 +252,19 @@ |
253 | 253 | 'contest.special.submission.js', |
254 | 254 | ), |
255 | 255 | 'dependencies' => array( |
256 | | - 'jquery.ui.button', 'jquery.contestSubmission', |
| 256 | + 'jquery.ui.button', 'jquery.contestSubmission', 'jquery.contestEmail' |
257 | 257 | ), |
258 | 258 | ); |
259 | 259 | |
| 260 | +$wgResourceModules['jquery.contestEmail'] = $moduleTemplate + array( |
| 261 | + 'scripts' => array( |
| 262 | + 'jquery.contestEmail.js', |
| 263 | + ), |
| 264 | + 'messages' => array( |
| 265 | + 'contest-signup-emailwarn', |
| 266 | + ), |
| 267 | +); |
| 268 | + |
260 | 269 | $wgResourceModules['jquery.contestSubmission'] = $moduleTemplate + array( |
261 | 270 | 'scripts' => array( |
262 | 271 | 'jquery.contestSubmission.js', |
Index: trunk/extensions/Contest/resources/jquery.contestEmail.js |
— | — | @@ -0,0 +1,28 @@ |
| 2 | +/** |
| 3 | + * JavasSript for the Contest MediaWiki extension. |
| 4 | + * @see https://www.mediawiki.org/wiki/Extension:Contest |
| 5 | + * |
| 6 | + * @licence GNU GPL v3 or later |
| 7 | + * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
| 8 | + */ |
| 9 | + |
| 10 | +(function( $, mw ) { |
| 11 | + |
| 12 | + $.fn.contestEmail = function() { |
| 13 | + var _this = this; |
| 14 | + var $this = $( this ); |
| 15 | + |
| 16 | + this.originalEmail = $this.val(); |
| 17 | + this.$emailWarn = $( '<p />' ).text( mw.msg( 'contest-signup-emailwarn' ) ).css( 'display', 'none' ); |
| 18 | + $this.before( this.$emailWarn ); |
| 19 | + |
| 20 | + if ( this.originalEmail !== '' ) { |
| 21 | + $this.keyup( function() { |
| 22 | + _this.$emailWarn.css( 'display', _this.originalEmail === $( this ).val() ? 'none' : 'block' ); |
| 23 | + } ); |
| 24 | + } |
| 25 | + |
| 26 | + return this; |
| 27 | + }; |
| 28 | + |
| 29 | +})( window.jQuery, window.mediaWiki ); |
Property changes on: trunk/extensions/Contest/resources/jquery.contestEmail.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 30 | + native |
Index: trunk/extensions/Contest/resources/contest.special.submission.js |
— | — | @@ -14,6 +14,8 @@ |
15 | 15 | |
16 | 16 | $( '.contest-submission' ).contestSubmission(); |
17 | 17 | |
| 18 | + $( '#mw-input-wpcontestant-email' ).contestEmail(); |
| 19 | + |
18 | 20 | } ); |
19 | 21 | |
20 | 22 | })( window.jQuery, window.mediaWiki ); |
Index: trunk/extensions/Contest/resources/contest.contestant.pager.js |
— | — | @@ -19,4 +19,14 @@ |
20 | 20 | // |
21 | 21 | // } ); |
22 | 22 | |
| 23 | + $( '.contestant-row' ).click( function() { |
| 24 | + debugger; |
| 25 | + $this = $( this ); |
| 26 | + $a = $this.children( 'td:first' ); |
| 27 | + $a = $a.children( 'a' ); |
| 28 | + $a.trigger( 'click' ); |
| 29 | + } ); |
| 30 | + |
| 31 | + } ); |
| 32 | + |
23 | 33 | })( window.jQuery, window.mediaWiki ); |
Index: trunk/extensions/Contest/resources/contest.special.signup.js |
— | — | @@ -10,7 +10,9 @@ |
11 | 11 | |
12 | 12 | $( document ).ready( function() { |
13 | 13 | |
14 | | - var contestConfig = mw.config.get( 'ContestConfig' ); |
| 14 | + var _this = this; |
| 15 | + |
| 16 | + this.contestConfig = mw.config.get( 'ContestConfig' ); |
15 | 17 | |
16 | 18 | $( '.mw-htmlform-submit' ).button(); |
17 | 19 | |
— | — | @@ -18,7 +20,7 @@ |
19 | 21 | |
20 | 22 | $div = $( '<div />' ).attr( { |
21 | 23 | 'style': 'display:none' |
22 | | - } ).html( $( '<div />' ).attr( { 'id': 'contest-rules-div' } ).html( contestConfig['rules_page'] ) ); |
| 24 | + } ).html( $( '<div />' ).attr( { 'id': 'contest-rules-div' } ).html( this.contestConfig['rules_page'] ) ); |
23 | 25 | |
24 | 26 | $a = $( "label[for='contest-rules']" ).find( 'a' ); |
25 | 27 | $a.attr( { 'href': '#contest-rules-div' } ); |
— | — | @@ -33,7 +35,9 @@ |
34 | 36 | 'type' : 'inline', |
35 | 37 | 'autoDimensions': false |
36 | 38 | } ); |
37 | | - |
| 39 | + |
| 40 | + $( '#mw-input-wpcontestant-email' ).contestEmail(); |
| 41 | + |
38 | 42 | } ); |
39 | 43 | |
40 | 44 | })( window.jQuery, window.mediaWiki ); |