r100313 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100312‎ | r100313 | r100314 >
Date:01:03, 20 October 2011
Author:reedy
Status:old
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/Contest (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Contest/Contest.i18n.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Contest/Contest.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Contest/RELEASE-NOTES (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Contest/api/ApiMailContestants.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Contest/includes/ContestReminderJob.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Contest/resources/contest.special.contest.js (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Contest/specials/SpecialContest.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/Contest/Contest.i18n.php
@@ -161,10 +161,11 @@
162162 'contest-contest-reminder-cancel' => 'Cancel',
163163 'contest-contest-reminder-sending' => 'Sending...',
164164 // We really want // {{PLURAL:$1|contestant|contestants}} here, but the JS i18n shizzle does not support it yet :/
165 - 'contest-contest-reminder-success' => 'Successfully send the reminder email to $1 contestants',
 165+ 'contest-contest-reminder-success' => 'Successfully sent the reminder email to $1 contestants',
166166 'contest-contest-reminder-close' => 'Close',
167167 'contest-contest-reminder-retry' => 'Retry sending',
168 - 'contest-contest-reminder-failed' => 'Could not send the reminder emails.',
 168+ 'contest-contest-reminder-failed' => 'Could not sent the reminder emails.',
 169+ 'contest-contest-reminder-subject' => 'Subject:',
169170
170171 // Contestant pager
171172 'contest-contestant-id' => 'ID',
@@ -310,6 +311,7 @@
311312 'contest-contest-reminder-close' => 'Close button text',
312313 'contest-contest-reminder-retry' => 'Retry button text',
313314 'contest-contest-reminder-failed' => 'Failiure message, displayed in an alert box',
 315+ 'contest-contest-reminder-subject' => 'Email subject indicator',
314316
315317 // Special:MyContests
316318 'contest-mycontests-toplink' => 'Text for link in the user menu (i.e. where watchlist and preferences are linked)',
Index: branches/wmf/1.18wmf1/extensions/Contest/specials/SpecialContest.php
@@ -141,7 +141,11 @@
142142 array(
143143 'id' => 'send-reminder',
144144 'data-token' => $this->getUser()->editToken(),
145 - 'data-contest-id' => $contest->getId()
 145+ 'data-contest-id' => $contest->getId(),
 146+
 147+ // Note: this is a copy of the message in ContestContestant::sendReminderEmail.
 148+ // If it's changed or modified by a hook, this message might not be accurate.
 149+ 'data-reminder-subject' => wfMsgExt( 'contest-email-reminder-title', 'parsemag', $contest->getDaysLeft() )
146150 ),
147151 wfMsg( 'contest-contest-send-reminder' )
148152 ) );
Index: branches/wmf/1.18wmf1/extensions/Contest/Contest.php
@@ -170,6 +170,7 @@
171171 'contest-contest-reminder-close',
172172 'contest-contest-reminder-retry',
173173 'contest-contest-reminder-failed',
 174+ 'contest-contest-reminder-subject',
174175 ),
175176 'dependencies' => array(
176177 'jquery.ui.button', 'jquery.ui.dialog',
Index: branches/wmf/1.18wmf1/extensions/Contest/RELEASE-NOTES
@@ -5,7 +5,7 @@
66
77
88 === Version 0.1 ===
9 -2011-10-xx
 9+2011-10-20
1010
1111 Initial release with these features:
1212
Index: branches/wmf/1.18wmf1/extensions/Contest/includes/ContestReminderJob.php
@@ -33,6 +33,9 @@
3434 * @return bool
3535 */
3636 public function run() {
 37+ /**
 38+ * @var $contestant ContestContestant
 39+ */
3740 foreach ( $this->params['contestants'] as /* ContestContestant */ $contestant ) {
3841 $contestant->sendReminderEmail( $this->params['emailText'], array(
3942 'daysLeft' => $this->params['daysLeft'],
Index: branches/wmf/1.18wmf1/extensions/Contest/api/ApiMailContestants.php
@@ -70,9 +70,10 @@
7171 $conditions['id'] = $params['ids'];
7272 }
7373
74 - $contestants = ContestContestant::s()->select( array( 'contest_id', 'email' ), $conditions );
 74+ $contestants = ContestContestant::s()->select( array( 'id', 'user_id', 'contest_id', 'email' ), $conditions );
7575
76 - if ( $contestants !== false && count( $contestants ) > 0 ) {
 76+ $contestantCount = count( $contestants );
 77+ if ( $contestants !== false && $contestantCount > 0 ) {
7778 $setSize = ContestSettings::get( 'reminderJobSize' );
7879 $limit = count( $contestants );
7980
@@ -94,7 +95,7 @@
9596 $this->getResult()->addValue(
9697 null,
9798 'contestantcount',
98 - count( $contestants )
 99+ $contestantCount
99100 );
100101 }
101102 }
@@ -169,7 +170,7 @@
170171 public function getDescription() {
171172 return array(
172173 'API module for mailing contestants. Selection criteria will be joined with AND,
173 - except for the challange ids/titles and contest ids/names pairs, which will be joined wit OR.'
 174+ except for the challange ids/titles and contest ids/names pairs, which will be joined with OR.'
174175 );
175176 }
176177
@@ -184,7 +185,7 @@
185186 'api.php?action=mailcontestants&ids=42',
186187 'api.php?action=mailcontestants&ids=4|2',
187188 'api.php?action=mailcontestants&contestids=42',
188 - 'api.php?action=mailcontestants&contestnames=Weekend of Code',
 189+ 'api.php?action=mailcontestants&contestnames=Weekend_of_Code',
189190 'api.php?action=mailcontestants&challengetitles=foo|bar|baz',
190191 );
191192 }
Index: branches/wmf/1.18wmf1/extensions/Contest/resources/contest.special.contest.js
@@ -1,15 +1,15 @@
22 /**
33 * JavasSript for the Contest MediaWiki extension.
44 * @see https://www.mediawiki.org/wiki/Extension:Contest
5 - *
 5+ *
66 * @licence GNU GPL v3 or later
77 * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
88 */
99
1010 (function( $, mw ) { $( document ).ready( function() {
11 -
 11+
1212 var _this = this;
13 -
 13+
1414 this.sendReminder = function( callback ) {
1515 var requestArgs = {
1616 'action': 'mailcontestants',
@@ -17,7 +17,7 @@
1818 'token': $( '#send-reminder' ).attr( 'data-token' ),
1919 'contestids': $( '#send-reminder' ).attr( 'data-contest-id' )
2020 };
21 -
 21+
2222 $.post(
2323 wgScriptPath + '/api.php',
2424 requestArgs,
@@ -26,12 +26,13 @@
2727 }
2828 );
2929 };
30 -
 30+
3131 this.showReminderDialog = function() {
3232 var $dialog = null;
33 -
 33+
3434 $dialog = $( '<div />' ).html( '' ).dialog( {
3535 'title': mw.msg( 'contest-contest-reminder-title' ),
 36+ 'minWidth': 550,
3637 'buttons': [
3738 {
3839 'text': mw.msg( 'contest-contest-reminder-send' ),
@@ -39,10 +40,10 @@
4041 'click': function() {
4142 var $send = $( '#reminder-send-button' );
4243 var $cancel = $( '#reminder-cancel-button' );
43 -
 44+
4445 $send.button( 'option', 'disabled', true );
4546 $send.button( 'option', 'label', mw.msg( 'contest-contest-reminder-sending' ) );
46 -
 47+
4748 _this.sendReminder( function( data ) {
4849 if ( data.success ) {
4950 $dialog.text( mw.msg( 'contest-contest-reminder-success', data.contestantcount ) );
@@ -52,7 +53,7 @@
5354 else {
5455 $send.button( 'option', 'label', mw.msg( 'contest-contest-reminder-retry' ) );
5556 $send.button( 'option', 'disabled', false );
56 -
 57+
5758 alert( mw.msg( 'contest-contest-reminder-failed' ) );
5859 }
5960 } );
@@ -67,12 +68,18 @@
6869 }
6970 ]
7071 } );
71 -
 72+
7273 $dialog.append( $( '<p />' ).text( mw.msg( 'contest-contest-reminder-preview' ) ) ).append( '<hr />' );
73 -
74 - $dialog.append( $( '#reminder-content' ).html() );
 74+
 75+ $dialog.append( $( '<p />' )
 76+ .html( $( '<b />' )
 77+ .text( mw.msg( 'contest-contest-reminder-subject' ) ) )
 78+ .append( ' ' + $( '#send-reminder' ).attr( 'data-reminder-subject' ) ) )
 79+ .append( '<hr />' );
 80+
 81+ $dialog.append( $( '#reminder-content' ).html() );
7582 };
76 -
 83+
7784 $( '#send-reminder' ).button().click( this.showReminderDialog );
78 -
79 -} ); })( window.jQuery, window.mediaWiki );
\ No newline at end of file
 85+
 86+} ); })( window.jQuery, window.mediaWiki );
Property changes on: branches/wmf/1.18wmf1/extensions/Contest
___________________________________________________________________
Modified: svn:mergeinfo
8087 Merged /trunk/extensions/Contest:r100302,100307-100309,100311

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r100295fix bug 31833jeroendedauw23:39, 19 October 2011
r100302send -> sentjeroendedauw00:31, 20 October 2011
r100307added subject to reminder email previewjeroendedauw00:47, 20 October 2011
r100308Grab id and user_id of a user (prevents fatal on job execution)...reedy00:50, 20 October 2011
r100309array_splice first parameter is passed by reference...reedy00:57, 20 October 2011
r100311Trim trailing whitespacereedy00:59, 20 October 2011

Status & tagging log