r100251 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100250‎ | r100251 | r100252 >
Date:18:38, 19 October 2011
Author:jeroendedauw
Status:resolved (Comments)
Tags:
Comment:
added days left field and initial work on reminder email UI
Modified paths:
  • /trunk/extensions/Contest/Contest.i18n.php (modified) (history)
  • /trunk/extensions/Contest/Contest.php (modified) (history)
  • /trunk/extensions/Contest/includes/Contest.class.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialContest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/Contest.i18n.php
@@ -145,8 +145,19 @@
146146 'contest-contest-name' => 'Name',
147147 'contest-contest-status' => 'Status',
148148 'contest-contest-submissioncount' => 'Amount of participants',
 149+ 'contest-contest-end' => 'Contest end',
 150+ 'contest-contest-days-ago' => '$1, $2 {{PLURAL:$2|day|days}} ago',
 151+ 'contest-contest-days-left' => '$1, in $2 {{PLURAL:$2|day|days}}',
149152 'contest-contest-contestants' => 'Contestants',
150153 'contest-contest-contestants-text' => 'To judge an individual entry, click on the entry ID in the left column.',
 154+ 'contest-contest-reminder-mail' => 'Reminder email',
 155+ 'contest-contest-reminder-page' => 'The content for the reminder email is pulled from [[$1|this page]].',
 156+ 'contest-contest-send-reminder' => 'Send reminder',
 157+
 158+ 'contest-contest-reminder-preview' => 'Preview of the reminder email:',
 159+ 'contest-contest-reminder-title' => 'Reminder email',
 160+ 'contest-contest-reminder-send' => 'Send reminder',
 161+ 'contest-contest-reminder-cancel' => 'Cancel',
151162
152163 // Contestant pager
153164 'contest-contestant-id' => 'ID',
Index: trunk/extensions/Contest/specials/SpecialContest.php
@@ -53,9 +53,13 @@
5454 }
5555 else {
5656 $out->setPageTitle( wfMsgExt( 'contest-contest-title', 'parseinline', $contest->getField( 'name' ) ) );
 57+
5758 $this->displayNavigation();
5859 $this->showGeneralInfo( $contest );
 60+ // TODO $this->showMailFunctionality( $contest );
5961 $this->showContestants( $contest, $challengeTitle );
 62+
 63+ $out->addModules( 'contest.special.contest' );
6064 }
6165 }
6266
@@ -107,11 +111,50 @@
108112 $stats['name'] = $contest->getField( 'name' );
109113 $stats['status'] = Contest::getStatusMessage( $contest->getStatus() );
110114 $stats['submissioncount'] = $this->getLang()->formatNum( $contest->getField( 'submission_count' ) );
111 -
 115+
 116+ $stats['end'] = wfMsgExt(
 117+ $contest->getDaysLeft() < 0 ? 'contest-contest-days-ago' : 'contest-contest-days-left',
 118+ 'parsemag',
 119+ $this->getLang()->timeanddate( $contest->getField( 'end' ), true ),
 120+ $this->getLang()->formatNum( abs( $contest->getDaysLeft() ) )
 121+ );
 122+
112123 return $stats;
113124 }
114125
115126 /**
 127+ *
 128+ *
 129+ * @since 0.1
 130+ *
 131+ * @param Contest $contest
 132+ */
 133+ protected function showMailFunctionality( Contest $contest ) {
 134+ $out = $this->getOutput();
 135+
 136+ $out->addHTML( Html::element( 'h3', array(), wfMsg( 'contest-contest-reminder-mail' ) ) );
 137+
 138+ $out->addWikiMsg( 'contest-contest-reminder-page', $contest->getField( 'reminder_email' ) );
 139+
 140+ $out->addHTML( Html::element(
 141+ 'button',
 142+ array(
 143+ 'id' => 'send-reminder',
 144+ ),
 145+ wfMsg( 'contest-contest-send-reminder' )
 146+ ) );
 147+
 148+ $out->addHTML( Html::rawElement(
 149+ 'div',
 150+ array(
 151+ 'id' => 'reminder-content',
 152+ 'style' => 'display:none'
 153+ ),
 154+ ContestUtils::getParsedArticleContent( $contest->getField( 'reminder_email' ) )
 155+ ) );
 156+ }
 157+
 158+ /**
116159 * Show a paged list of the contestants foe this contest.
117160 *
118161 * @since 0.1
Index: trunk/extensions/Contest/Contest.php
@@ -155,6 +155,21 @@
156156 )
157157 );
158158
 159+$wgResourceModules['contest.special.contest'] = $moduleTemplate + array(
 160+ 'scripts' => array(
 161+ 'contest.special.contest.js'
 162+ ),
 163+ 'messages' => array(
 164+ 'contest-contest-reminder-title',
 165+ 'contest-contest-reminder-cancel',
 166+ 'contest-contest-reminder-send',
 167+ 'contest-contest-reminder-preview'
 168+ ),
 169+ 'dependencies' => array(
 170+ 'jquery.ui.button', 'jquery.ui.dialog',
 171+ )
 172+);
 173+
159174 $wgResourceModules['jquery.ui.timepicker'] = $moduleTemplate + array(
160175 'scripts' => array(
161176 'jquery.ui.timepicker.js',
Index: trunk/extensions/Contest/includes/Contest.class.php
@@ -16,8 +16,8 @@
1717 // Constants representing the states a contest can have.
1818 const STATUS_DRAFT = 0;
1919 const STATUS_ACTIVE = 1;
20 - const STATUS_FINISHED = 2; // manually stopped by contest manager
21 - const STATUS_EXPIRED = 3; // past configured contest end date
 20+ const STATUS_FINISHED = 2; // Manually stopped by contest manager.
 21+ const STATUS_EXPIRED = 3; // Past configured contest end date.
2222
2323 /**
2424 * List of challenges for this contest.
@@ -138,6 +138,7 @@
139139 */
140140 public function getDefaults() {
141141 $defaultPage = 'MediaWiki:Contests/';
 142+
142143 return array(
143144 'name' => '',
144145 'status' => self::STATUS_DRAFT,
@@ -188,14 +189,18 @@
189190 wfMsg( 'contest-status-draft' ) => self::STATUS_DRAFT,
190191 wfMsg( 'contest-status-active' ) => self::STATUS_ACTIVE,
191192 wfMsg( 'contest-status-finished' ) => self::STATUS_FINISHED,
 193+ wfMsg( 'contest-status-expired' ) => self::STATUS_EXPIRED,
192194 );
193195 }
194196
195 - if ( !$onlySettable ) {
196 - $map[wfMsg( 'contest-status-expired')] = self::STATUS_EXPIRED;
 197+ if ( $onlySettable ) {
 198+ $messages = $map;
 199+ unset( $messages[wfMsg( 'contest-status-expired' )] );
 200+ return $messages;
197201 }
198 -
199 - return $map;
 202+ else {
 203+ return $map;
 204+ }
200205 }
201206
202207 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r100255Tweak messages.siebrand18:52, 19 October 2011
r100258follow up to r100251jeroendedauw19:07, 19 October 2011
r100259follow up to r100251; added missing filejeroendedauw19:09, 19 October 2011
r1002971.18wmf1 MFT r100251, r100255, r100258, r100259, r100274, r100276, r100278reedy23:52, 19 October 2011

Comments

#Comment by Siebrand (talk | contribs)   18:41, 19 October 2011

Please add message documentation for the newly added messages. Thanks.

Status & tagging log