r101585 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101584‎ | r101585 | r101586 >
Date:06:21, 2 November 2011
Author:jeroendedauw
Status:deferred (Comments)
Tags:lamecommitsummary 
Comment:
Modified paths:
  • /trunk/extensions/Contest/Contest.i18n.php (modified) (history)
  • /trunk/extensions/Contest/Contest.php (modified) (history)
  • /trunk/extensions/Contest/resources/contest.contestant.pager.js (modified) (history)
  • /trunk/extensions/Contest/resources/contest.special.signup.js (modified) (history)
  • /trunk/extensions/Contest/resources/contest.special.submission.js (modified) (history)
  • /trunk/extensions/Contest/resources/jquery.contestEmail.js (added) (history)
  • /trunk/extensions/Contest/specials/SpecialContestSignup.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialMyContests.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/Contest.i18n.php
@@ -130,6 +130,7 @@
131131 'contest-signup-finished' => 'This contest has ended. Thank you for your participation!',
132132 'contest-signup-draft' => 'This contest has not yet started. Please be patient.',
133133 '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.',
134135
135136 'contest-signup-require-rules' => 'You must agree to the contest rules.',
136137 'contest-signup-require-country' => 'You must provide your country of residence.',
Index: trunk/extensions/Contest/specials/SpecialMyContests.php
@@ -337,7 +337,14 @@
338338 public function handleSubmission( array $data ) {
339339 $user = $this->getUser();
340340
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+
342349 $user->setRealName( $data['contestant-realname'] );
343350 $user->saveSettings();
344351
Index: trunk/extensions/Contest/specials/SpecialContestSignup.php
@@ -64,7 +64,14 @@
6565 public function handleSubmission( array $data ) {
6666 $user = $this->getUser();
6767
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+
6976 $user->setRealName( $data['contestant-realname'] );
7077 $user->saveSettings();
7178
Index: trunk/extensions/Contest/Contest.php
@@ -243,8 +243,8 @@
244244 'contest.special.signup.js',
245245 ),
246246 'dependencies' => array(
247 - 'jquery.ui.button', 'jquery.fancybox',
248 - )
 247+ 'jquery.ui.button', 'jquery.fancybox', 'jquery.contestEmail',
 248+ ),
249249 );
250250
251251 $wgResourceModules['contest.special.submission'] = $moduleTemplate + array(
@@ -252,10 +252,19 @@
253253 'contest.special.submission.js',
254254 ),
255255 'dependencies' => array(
256 - 'jquery.ui.button', 'jquery.contestSubmission',
 256+ 'jquery.ui.button', 'jquery.contestSubmission', 'jquery.contestEmail'
257257 ),
258258 );
259259
 260+$wgResourceModules['jquery.contestEmail'] = $moduleTemplate + array(
 261+ 'scripts' => array(
 262+ 'jquery.contestEmail.js',
 263+ ),
 264+ 'messages' => array(
 265+ 'contest-signup-emailwarn',
 266+ ),
 267+);
 268+
260269 $wgResourceModules['jquery.contestSubmission'] = $moduleTemplate + array(
261270 'scripts' => array(
262271 '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
130 + native
Index: trunk/extensions/Contest/resources/contest.special.submission.js
@@ -14,6 +14,8 @@
1515
1616 $( '.contest-submission' ).contestSubmission();
1717
 18+ $( '#mw-input-wpcontestant-email' ).contestEmail();
 19+
1820 } );
1921
2022 })( window.jQuery, window.mediaWiki );
Index: trunk/extensions/Contest/resources/contest.contestant.pager.js
@@ -19,4 +19,14 @@
2020 //
2121 // } );
2222
 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+
2333 })( window.jQuery, window.mediaWiki );
Index: trunk/extensions/Contest/resources/contest.special.signup.js
@@ -10,7 +10,9 @@
1111
1212 $( document ).ready( function() {
1313
14 - var contestConfig = mw.config.get( 'ContestConfig' );
 14+ var _this = this;
 15+
 16+ this.contestConfig = mw.config.get( 'ContestConfig' );
1517
1618 $( '.mw-htmlform-submit' ).button();
1719
@@ -18,7 +20,7 @@
1921
2022 $div = $( '<div />' ).attr( {
2123 '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'] ) );
2325
2426 $a = $( "label[for='contest-rules']" ).find( 'a' );
2527 $a.attr( { 'href': '#contest-rules-div' } );
@@ -33,7 +35,9 @@
3436 'type' : 'inline',
3537 'autoDimensions': false
3638 } );
37 -
 39+
 40+ $( '#mw-input-wpcontestant-email' ).contestEmail();
 41+
3842 } );
3943
4044 })( window.jQuery, window.mediaWiki );

Follow-up revisions

RevisionCommit summaryAuthorDate
r101586Follow up to r101585; message docjeroendedauw06:23, 2 November 2011

Comments

#Comment by Siebrand (talk | contribs)   07:51, 2 November 2011

Two style issues in newly added message: use capital after colon and e-mail instead of email.

Status & tagging log