Index: trunk/extensions/Contest/Contest.i18n.php |
— | — | @@ -145,8 +145,19 @@ |
146 | 146 | 'contest-contest-name' => 'Name', |
147 | 147 | 'contest-contest-status' => 'Status', |
148 | 148 | '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}}', |
149 | 152 | 'contest-contest-contestants' => 'Contestants', |
150 | 153 | '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', |
151 | 162 | |
152 | 163 | // Contestant pager |
153 | 164 | 'contest-contestant-id' => 'ID', |
Index: trunk/extensions/Contest/specials/SpecialContest.php |
— | — | @@ -53,9 +53,13 @@ |
54 | 54 | } |
55 | 55 | else { |
56 | 56 | $out->setPageTitle( wfMsgExt( 'contest-contest-title', 'parseinline', $contest->getField( 'name' ) ) ); |
| 57 | + |
57 | 58 | $this->displayNavigation(); |
58 | 59 | $this->showGeneralInfo( $contest ); |
| 60 | + // TODO $this->showMailFunctionality( $contest ); |
59 | 61 | $this->showContestants( $contest, $challengeTitle ); |
| 62 | + |
| 63 | + $out->addModules( 'contest.special.contest' ); |
60 | 64 | } |
61 | 65 | } |
62 | 66 | |
— | — | @@ -107,11 +111,50 @@ |
108 | 112 | $stats['name'] = $contest->getField( 'name' ); |
109 | 113 | $stats['status'] = Contest::getStatusMessage( $contest->getStatus() ); |
110 | 114 | $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 | + |
112 | 123 | return $stats; |
113 | 124 | } |
114 | 125 | |
115 | 126 | /** |
| 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 | + /** |
116 | 159 | * Show a paged list of the contestants foe this contest. |
117 | 160 | * |
118 | 161 | * @since 0.1 |
Index: trunk/extensions/Contest/Contest.php |
— | — | @@ -155,6 +155,21 @@ |
156 | 156 | ) |
157 | 157 | ); |
158 | 158 | |
| 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 | + |
159 | 174 | $wgResourceModules['jquery.ui.timepicker'] = $moduleTemplate + array( |
160 | 175 | 'scripts' => array( |
161 | 176 | 'jquery.ui.timepicker.js', |
Index: trunk/extensions/Contest/includes/Contest.class.php |
— | — | @@ -16,8 +16,8 @@ |
17 | 17 | // Constants representing the states a contest can have. |
18 | 18 | const STATUS_DRAFT = 0; |
19 | 19 | 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. |
22 | 22 | |
23 | 23 | /** |
24 | 24 | * List of challenges for this contest. |
— | — | @@ -138,6 +138,7 @@ |
139 | 139 | */ |
140 | 140 | public function getDefaults() { |
141 | 141 | $defaultPage = 'MediaWiki:Contests/'; |
| 142 | + |
142 | 143 | return array( |
143 | 144 | 'name' => '', |
144 | 145 | 'status' => self::STATUS_DRAFT, |
— | — | @@ -188,14 +189,18 @@ |
189 | 190 | wfMsg( 'contest-status-draft' ) => self::STATUS_DRAFT, |
190 | 191 | wfMsg( 'contest-status-active' ) => self::STATUS_ACTIVE, |
191 | 192 | wfMsg( 'contest-status-finished' ) => self::STATUS_FINISHED, |
| 193 | + wfMsg( 'contest-status-expired' ) => self::STATUS_EXPIRED, |
192 | 194 | ); |
193 | 195 | } |
194 | 196 | |
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; |
197 | 201 | } |
198 | | - |
199 | | - return $map; |
| 202 | + else { |
| 203 | + return $map; |
| 204 | + } |
200 | 205 | } |
201 | 206 | |
202 | 207 | /** |