Index: branches/wmf/1.18wmf1/extensions/Contest/Contest.i18n.php |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | 'specialpages-group-contest' => 'Contests', |
63 | 63 | |
64 | 64 | // Navigation links |
65 | | - 'contest-nav-contests' => 'Contests list', |
| 65 | + 'contest-nav-contests' => 'Contest list', |
66 | 66 | 'contest-nav-editcontest' => 'Edit contest', |
67 | 67 | 'contest-nav-contest' => 'Summary and participants', |
68 | 68 | 'contest-nav-contestwelcome' => 'Landing page', |
— | — | @@ -122,7 +122,7 @@ |
123 | 123 | 'contest-signup-header' => 'Please fill out the form to complete your registration for $1.', |
124 | 124 | 'contest-signup-email' => 'Your e-mail address', |
125 | 125 | 'contest-signup-realname' => 'Your real name', |
126 | | - 'contest-signup-volunteer' => 'I am interested in receiving email about volunteer opportunities', |
| 126 | + 'contest-signup-volunteer' => 'I am interested in receiving e-mail about volunteer opportunities', |
127 | 127 | 'contest-signup-wmf' => 'I am interested in being contacted about working for the Wikimedia Foundation', |
128 | 128 | 'contest-signup-cv' => 'Link to your CV', |
129 | 129 | 'contest-signup-readrules' => 'I confirm that I have read [[$1|the contest rules]] and agree to them', |
— | — | @@ -160,10 +160,10 @@ |
161 | 161 | 'contest-contest-reminder-cancel' => 'Cancel', |
162 | 162 | 'contest-contest-reminder-sending' => 'Sending...', |
163 | 163 | // We really want // {{PLURAL:$1|contestant|contestants}} here, but the JS i18n shizzle does not support it yet :/ |
164 | | - 'contest-contest-reminder-success' => 'Successfully sent the reminder email to $1 contestants', |
| 164 | + 'contest-contest-reminder-success' => 'Successfully sent the reminder e-mail to $1 contestants', |
165 | 165 | 'contest-contest-reminder-close' => 'Close', |
166 | 166 | 'contest-contest-reminder-retry' => 'Retry sending', |
167 | | - 'contest-contest-reminder-failed' => 'Could not sent the reminder emails.', |
| 167 | + 'contest-contest-reminder-failed' => 'Could not send the reminder e-mails.', |
168 | 168 | 'contest-contest-reminder-subject' => 'Subject:', |
169 | 169 | |
170 | 170 | // Contestant pager |
— | — | @@ -209,7 +209,7 @@ |
210 | 210 | 'contest-mycontests-active-header' => 'Running contests', |
211 | 211 | 'contest-mycontests-finished-header' => 'Passed contests', |
212 | 212 | 'contest-mycontests-active-text' => 'You are currently participating in these contests:', |
213 | | - 'contest-mycontests-finished-text' => 'You have have participated in these contests:', |
| 213 | + 'contest-mycontests-finished-text' => 'You have participated in these contests:', |
214 | 214 | 'contest-mycontests-header-contest' => 'Contest', |
215 | 215 | 'contest-mycontests-header-challenge' => 'Challenge', |
216 | 216 | 'contest-mycontests-signup-success' => 'You have successfully signed up for the "$1" contest.', |
— | — | @@ -270,6 +270,20 @@ |
271 | 271 | 'contest-contest-contestants' => 'Page section header', |
272 | 272 | 'contest-contest-days-ago' => '$1 is a date, $2 is an integer, the amount of days', |
273 | 273 | 'contest-contest-days-left' => '$1 is a date, $2 is an integer, the amount of days', |
| 274 | + 'contest-contest-contestants' => 'Page section header', |
| 275 | + 'contest-contest-reminder-mail' => 'Reminder e-mail', |
| 276 | + 'contest-contest-reminder-page' => 'Text explaining the e-mail content is pulled from a page, $1 is the page name.', |
| 277 | + 'contest-contest-send-reminder' => 'Send reminder button text', |
| 278 | + 'contest-contest-reminder-preview' => 'Text indicating that the following content is the preview for the reminder email.', |
| 279 | + 'contest-contest-reminder-title' => 'Dialog title', |
| 280 | + 'contest-contest-reminder-send' => 'Send button text', |
| 281 | + 'contest-contest-reminder-cancel' => 'Cancel button text', |
| 282 | + 'contest-contest-reminder-sending' => 'Send button text after clicking it', |
| 283 | + 'contest-contest-reminder-success' => 'Success message, $1 is the amount of contesnats. No PLURAL for now, just assume there are multiple untill MWs JS supports plural.', |
| 284 | + 'contest-contest-reminder-close' => 'Close button text', |
| 285 | + 'contest-contest-reminder-retry' => 'Retry button text', |
| 286 | + 'contest-contest-reminder-failed' => 'Failiure message, displayed in an alert box', |
| 287 | + 'contest-contest-reminder-subject' => 'E-mail subject indicator', |
274 | 288 | 'contest-contestant-id' => 'Table column header', |
275 | 289 | 'contest-contestant-volunteer' => 'Table column header', |
276 | 290 | 'contest-contestant-wmf' => 'Table column header', |
Index: branches/wmf/1.18wmf1/extensions/Contest/specials/SpecialContestWelcome.php |
— | — | @@ -142,11 +142,11 @@ |
143 | 143 | $challenges[] = $data; |
144 | 144 | } |
145 | 145 | |
146 | | - $this->getOutput()->addScript( |
| 146 | + $output->addScript( |
147 | 147 | Skin::makeVariablesScript( |
148 | 148 | array( |
149 | 149 | 'ContestChallenges' => $challenges, |
150 | | - 'ContestConfig' => array() |
| 150 | + 'ContestConfig' => array(), |
151 | 151 | ) |
152 | 152 | ) |
153 | 153 | ); |
— | — | @@ -188,7 +188,7 @@ |
189 | 189 | */ |
190 | 190 | protected function showRules( Contest $contest ) { |
191 | 191 | // TODO: we might want to have a pop-up with the content here, instead of a link to the page. |
192 | | - $this->getOutput()->addWikiMsgArray( 'contest-welcome-rules', $contest->getField( 'rules_page' ) ); |
| 192 | + $this->getOutput()->addWikiMsgArray( 'contest-welcome-rules', $contest->getField( 'rules_page' ) ); |
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
Index: branches/wmf/1.18wmf1/extensions/Contest/specials/SpecialContest.php |
— | — | @@ -56,7 +56,11 @@ |
57 | 57 | |
58 | 58 | $this->displayNavigation(); |
59 | 59 | $this->showGeneralInfo( $contest ); |
60 | | - $this->showMailFunctionality( $contest ); |
| 60 | + |
| 61 | + if ( $this->getUser()->isAllowed( 'contestadmin' ) ) { |
| 62 | + $this->showMailFunctionality( $contest ); |
| 63 | + } |
| 64 | + |
61 | 65 | $this->showContestants( $contest, $challengeTitle ); |
62 | 66 | |
63 | 67 | $out->addModules( 'contest.special.contest' ); |
Index: branches/wmf/1.18wmf1/extensions/Contest/specials/SpecialContestant.php |
— | — | @@ -27,13 +27,16 @@ |
28 | 28 | * |
29 | 29 | * @since 0.1 |
30 | 30 | * |
31 | | - * @param string $arg |
| 31 | + * @param string $subPage |
32 | 32 | */ |
33 | 33 | public function execute( $subPage ) { |
34 | 34 | if ( !parent::execute( $subPage ) ) { |
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
| 38 | + /** |
| 39 | + * @var $contestant ContestContestant |
| 40 | + */ |
38 | 41 | $contestant = ContestContestant::s()->selectRow( 'id', array( 'id' => (int)$subPage ) ); |
39 | 42 | |
40 | 43 | if ( $contestant === false ) { |
— | — | @@ -47,10 +50,12 @@ |
48 | 51 | } |
49 | 52 | |
50 | 53 | if ( $this->getRequest()->wasPosted() ) { |
51 | | - $contestant->setReadDb( DB_MASTER ); |
| 54 | + ContestContestant::s()->setReadDb( DB_MASTER ); |
52 | 55 | } |
53 | 56 | |
54 | 57 | $contestant->loadFields(); |
| 58 | + ContestContestant::s()->setReadDb( DB_SLAVE ); |
| 59 | + |
55 | 60 | $this->showPage( $contestant ); |
56 | 61 | } |
57 | 62 | } |
— | — | @@ -293,7 +298,14 @@ |
294 | 299 | |
295 | 300 | $out->addHTML( '<div class="contestant-comments">' ); |
296 | 301 | |
297 | | - foreach ( $contestant->getComments() as /* ContestComment */ $comment ) { |
| 302 | + if ( $this->getRequest()->wasPosted() ) { |
| 303 | + ContestComment::s()->setReadDb( DB_MASTER ); |
| 304 | + } |
| 305 | + |
| 306 | + $comments = $contestant->getComments(); |
| 307 | + ContestComment::s()->setReadDb( DB_SLAVE ); |
| 308 | + |
| 309 | + foreach ( $comments as /* ContestComment */ $comment ) { |
298 | 310 | $out->addHTML( $this->getCommentHTML( $comment ) ); |
299 | 311 | } |
300 | 312 | |
Index: branches/wmf/1.18wmf1/extensions/Contest/specials/SpecialContests.php |
— | — | @@ -216,17 +216,19 @@ |
217 | 217 | ), |
218 | 218 | wfMsg( 'contest-special-edit' ) |
219 | 219 | ); |
220 | | - |
221 | | - $links[] = Html::element( |
222 | | - 'a', |
223 | | - array( |
224 | | - 'href' => '#', |
225 | | - 'class' => 'contest-delete', |
226 | | - 'data-contest-id' => $contest->getId(), |
227 | | - 'data-contest-token' => $this->getUser()->editToken( 'deletecontest' . $contest->getId() ) |
228 | | - ), |
229 | | - wfMsg( 'contest-special-delete' ) |
230 | | - ); |
| 220 | + |
| 221 | + if ( ContestSettings::get( 'contestDeletionEnabled' ) ) { |
| 222 | + $links[] = Html::element( |
| 223 | + 'a', |
| 224 | + array( |
| 225 | + 'href' => '#', |
| 226 | + 'class' => 'contest-delete', |
| 227 | + 'data-contest-id' => $contest->getId(), |
| 228 | + 'data-contest-token' => $this->getUser()->editToken( 'deletecontest' . $contest->getId() ) |
| 229 | + ), |
| 230 | + wfMsg( 'contest-special-delete' ) |
| 231 | + ); |
| 232 | + } |
231 | 233 | } |
232 | 234 | |
233 | 235 | $links[] = Html::element( |
Index: branches/wmf/1.18wmf1/extensions/Contest/specials/SpecialEditContest.php |
— | — | @@ -95,6 +95,13 @@ |
96 | 96 | protected function showContent( $subPage ) { |
97 | 97 | $isNew = $this->getRequest()->wasPosted() && $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'newEditToken' ) ); |
98 | 98 | |
| 99 | + $this->getOutput()->addScript( |
| 100 | + Skin::makeVariablesScript( |
| 101 | + array( |
| 102 | + 'ContestDeletionEnabled' => ContestSettings::get( 'contestDeletionEnabled' ), |
| 103 | + ) |
| 104 | + ) |
| 105 | + ); |
99 | 106 | if ( $isNew ) { |
100 | 107 | $data = array( 'name' => $this->getRequest()->getVal( 'newcontest' ) ); |
101 | 108 | |
— | — | @@ -312,7 +319,12 @@ |
313 | 320 | if ( $idString == '' ) { |
314 | 321 | return true; |
315 | 322 | } |
316 | | - |
| 323 | + |
| 324 | + if ( !ContestSettings::get( 'contestDeletionEnabled' ) ) { |
| 325 | + // Shouldn't get here (UI should prevent it) |
| 326 | + throw new MWException( 'Contest deletion is disabled', 'contestdeletiondisabled' ); |
| 327 | + } |
| 328 | + |
317 | 329 | return ContestChallenge::s()->delete( array( 'id' => explode( '|', $idString ) ) ); |
318 | 330 | } |
319 | 331 | |
Index: branches/wmf/1.18wmf1/extensions/Contest/Contest.settings.php |
— | — | @@ -31,7 +31,10 @@ |
32 | 32 | 'voteValues' => range( 0, 5 ), |
33 | 33 | 'enableTopLink' => true, |
34 | 34 | 'submissionDomains' => array( 'github.com', 'gitorious.org', 'mediawiki.org' ), |
35 | | - 'reminderJobSize' => 50 |
| 35 | + 'reminderJobSize' => 50, |
| 36 | + 'mailSender' => $GLOBALS['wgPasswordSender'], |
| 37 | + 'mailSenderName' => $GLOBALS['wgPasswordSenderName'], |
| 38 | + 'contestDeletionEnabled' => true |
36 | 39 | ); |
37 | 40 | } |
38 | 41 | |
Index: branches/wmf/1.18wmf1/extensions/Contest/Contest.php |
— | — | @@ -296,6 +296,3 @@ |
297 | 297 | $egContestSettings = array(); |
298 | 298 | |
299 | 299 | $wgContestEmailParse = false; |
300 | | - |
301 | | -$wgContestMailSender = $wgPasswordSender; |
302 | | -$wgContestMailSenderName = $wgPasswordSenderName; |
Index: branches/wmf/1.18wmf1/extensions/Contest/includes/ContestDBObject.php |
— | — | @@ -23,14 +23,14 @@ |
24 | 24 | * @var array |
25 | 25 | */ |
26 | 26 | protected $fields = array( 'id' => null ); |
27 | | - |
| 27 | + |
28 | 28 | /** |
29 | 29 | * The database connection to use for read operations. |
30 | | - * |
| 30 | + * |
31 | 31 | * @since 0.2 |
32 | 32 | * @var integer DB_ enum |
33 | 33 | */ |
34 | | - protected $readDb = DB_SLAVE; |
| 34 | + protected static $readDb = DB_SLAVE; |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Constructor. |
— | — | @@ -281,29 +281,8 @@ |
282 | 282 | return $this->insertIntoDB(); |
283 | 283 | } |
284 | 284 | } |
285 | | - |
| 285 | + |
286 | 286 | /** |
287 | | - * Get the database type used for read operations. |
288 | | - * |
289 | | - * @since 0.2 |
290 | | - * @return integer DB_ enum |
291 | | - */ |
292 | | - public function getReadDb() { |
293 | | - return $this->readDb; |
294 | | - } |
295 | | - |
296 | | - /** |
297 | | - * Set the database type to use for read operations. |
298 | | - * |
299 | | - * @param integer $db |
300 | | - * |
301 | | - * @since 0.2 |
302 | | - */ |
303 | | - public function setReadDb( $db ) { |
304 | | - $this->readDb = $db; |
305 | | - } |
306 | | - |
307 | | - /** |
308 | 287 | * Updates the object in the database. |
309 | 288 | * |
310 | 289 | * @since 0.1 |
— | — | @@ -351,13 +330,13 @@ |
352 | 331 | * @return boolean Success indicator |
353 | 332 | */ |
354 | 333 | public function removeFromDB() { |
355 | | - $sucecss = $this->delete( array( 'id' => $this->getId() ) ); |
| 334 | + $success = $this->delete( array( 'id' => $this->getId() ) ); |
356 | 335 | |
357 | | - if ( $sucecss ) { |
| 336 | + if ( $success ) { |
358 | 337 | $this->setField( 'id', null ); |
359 | 338 | } |
360 | 339 | |
361 | | - return $sucecss; |
| 340 | + return $success; |
362 | 341 | } |
363 | 342 | |
364 | 343 | /** |
— | — | @@ -481,6 +460,27 @@ |
482 | 461 | // |
483 | 462 | |
484 | 463 | /** |
| 464 | + * Get the database type used for read operations. |
| 465 | + * |
| 466 | + * @since 0.2 |
| 467 | + * @return integer DB_ enum |
| 468 | + */ |
| 469 | + public function getReadDb() { |
| 470 | + return self::$readDb; |
| 471 | + } |
| 472 | + |
| 473 | + /** |
| 474 | + * Set the database type to use for read operations. |
| 475 | + * |
| 476 | + * @param integer $db |
| 477 | + * |
| 478 | + * @since 0.2 |
| 479 | + */ |
| 480 | + public function setReadDb( $db ) { |
| 481 | + self::$readDb = $db; |
| 482 | + } |
| 483 | + |
| 484 | + /** |
485 | 485 | * Gets if the object can take a certain field. |
486 | 486 | * |
487 | 487 | * @since 0.1 |
Index: branches/wmf/1.18wmf1/extensions/Contest/includes/ContestContestant.php |
— | — | @@ -489,13 +489,11 @@ |
490 | 490 | * @return Status |
491 | 491 | */ |
492 | 492 | public function sendSignupEmail() { |
493 | | - global $wgContestMailSender, $wgContestMailSenderName; |
494 | | - |
495 | 493 | $title = wfMsg( 'contest-email-signup-title' ); |
496 | 494 | $emailText = ContestUtils::getParsedArticleContent( $this->getContest()->getField( 'signup_email' ) ); |
497 | 495 | $user = $this->getUser(); |
498 | | - $sender = $wgContestMailSender; |
499 | | - $senderName = $wgContestMailSenderName; |
| 496 | + $sender = ContestSettings::get( 'wgPasswordSender' ); |
| 497 | + $senderName = ContestSettings::get( 'wgPasswordSenderName' ); |
500 | 498 | |
501 | 499 | wfRunHooks( 'ContestBeforeSignupEmail', array( &$this, &$title, &$emailText, &$user, &$sender, &$senderName ) ); |
502 | 500 | |
— | — | @@ -517,16 +515,14 @@ |
518 | 516 | * @return Status |
519 | 517 | */ |
520 | 518 | public function sendReminderEmail( $emailText, array $params = array() ) { |
521 | | - global $wgContestMailSender, $wgContestMailSenderName; |
522 | | - |
523 | 519 | if ( !array_key_exists( 'daysLeft', $params ) ) { |
524 | 520 | $params['daysLeft'] = $this->getContest()->getDaysLeft(); |
525 | 521 | } |
526 | 522 | |
527 | 523 | $title = wfMsgExt( 'contest-email-reminder-title', 'parsemag', $params['daysLeft'] ); |
528 | 524 | $user = $this->getUser(); |
529 | | - $sender = $wgContestMailSender; |
530 | | - $senderName = $wgContestMailSenderName; |
| 525 | + $sender = ContestSettings::get( 'wgPasswordSender' ); |
| 526 | + $senderName = ContestSettings::get( 'wgPasswordSenderName' ); |
531 | 527 | |
532 | 528 | wfRunHooks( 'ContestBeforeReminderEmail', array( &$this, &$title, &$emailText, &$user, &$sender, &$senderName ) ); |
533 | 529 | |
Index: branches/wmf/1.18wmf1/extensions/Contest/includes/Contest.class.php |
— | — | @@ -412,6 +412,10 @@ |
413 | 413 | * @return boolean Success indicator |
414 | 414 | */ |
415 | 415 | public function removeAllFromDB() { |
| 416 | + if ( !ContestSettings::get( 'contestDeletionEnabled' ) ) { |
| 417 | + // Shouldn't get here (UI should prevent it) |
| 418 | + throw new MWException( 'Contest deletion is disabled', 'contestdeletiondisabled' ); |
| 419 | + } |
416 | 420 | $condition = array( 'contest_id' => $this->getId() ); |
417 | 421 | |
418 | 422 | $success = ContestChallenge::s()->delete( $condition ); |
Index: branches/wmf/1.18wmf1/extensions/Contest/api/ApiDeleteContest.php |
— | — | @@ -19,6 +19,9 @@ |
20 | 20 | } |
21 | 21 | |
22 | 22 | public function execute() { |
| 23 | + if ( !ContestSettings::get( 'contestDeletionEnabled' ) ) { |
| 24 | + $this->dieUsage( 'Contest deletion is disabled', 'contestdeletiondisabled' ); |
| 25 | + } |
23 | 26 | global $wgUser; |
24 | 27 | |
25 | 28 | if ( !$wgUser->isAllowed( 'contestadmin' ) || $wgUser->isBlocked() ) { |
— | — | @@ -80,7 +83,7 @@ |
81 | 84 | |
82 | 85 | public function getPossibleErrors() { |
83 | 86 | return array_merge( parent::getPossibleErrors(), array( |
84 | | - array( 'missingparam', 'ids' ), |
| 87 | + array( 'code' => 'contestdeletiondisabled', 'info' => 'Contest deletion is disabled' ), |
85 | 88 | ) ); |
86 | 89 | } |
87 | 90 | |
Index: branches/wmf/1.18wmf1/extensions/Contest/resources/contest.contestant.pager.css |
— | — | @@ -6,6 +6,6 @@ |
7 | 7 | * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
8 | 8 | */ |
9 | 9 | |
10 | | -.contestant-row td:hover { |
| 10 | +/*.contestant-row td:hover { |
11 | 11 | cursor: pointer; |
12 | | -} |
\ No newline at end of file |
| 12 | +}*/ |
\ No newline at end of file |
Index: branches/wmf/1.18wmf1/extensions/Contest/resources/contest.special.editcontest.js |
— | — | @@ -80,16 +80,17 @@ |
81 | 81 | ).append( '<br />' ).append( this.textInput ) |
82 | 82 | ); |
83 | 83 | |
84 | | - this.deleteButton = $( '<button />' ) |
85 | | - .button( { 'label': mw.msg( 'contest-edit-delete' ) } ) |
86 | | - .click( function() { |
87 | | - if ( confirm( mw.msg( 'contest-edit-confirm-delete' ) ) ) { |
88 | | - _this.remove(); |
89 | | - return false; |
90 | | - } |
91 | | - } ); |
92 | | - |
93 | | - $this.append( this.deleteButton ); |
| 84 | + if ( mw.config.get( 'ContestDeletionEnabled' ) ) { |
| 85 | + this.deleteButton = $( '<button />' ) |
| 86 | + .button( { 'label': mw.msg( 'contest-edit-delete' ) } ) |
| 87 | + .click( function() { |
| 88 | + if ( confirm( mw.msg( 'contest-edit-confirm-delete' ) ) ) { |
| 89 | + _this.remove(); |
| 90 | + return false; |
| 91 | + } |
| 92 | + } ); |
| 93 | + $this.append( this.deleteButton ); |
| 94 | + } |
94 | 95 | }; |
95 | 96 | |
96 | 97 | this.init(); |
Index: branches/wmf/1.18wmf1/extensions/Contest/resources/contest.contestant.pager.js |
— | — | @@ -8,12 +8,15 @@ |
9 | 9 | |
10 | 10 | (function( $, mw ) { |
11 | 11 | |
12 | | - $( document ).ready( function() { |
| 12 | +// $( document ).ready( function() { |
| 13 | +// |
| 14 | +// $( '.contestant-row' ).click( function( e ) { |
| 15 | +// window.open( |
| 16 | +// $( this ).attr( 'data-contestant-target' ), |
| 17 | +// e.metaKey ? '_blank' : '_self' |
| 18 | +// ); |
| 19 | +// } ); |
| 20 | +// |
| 21 | +// } ); |
13 | 22 | |
14 | | - $( '.contestant-row' ).click( function() { |
15 | | - window.location = $( this ).attr( 'data-contestant-target' ); |
16 | | - } ); |
17 | | - |
18 | | - } ); |
19 | | - |
20 | 23 | })( window.jQuery, window.mediaWiki ); |
Property changes on: branches/wmf/1.18wmf1/extensions/Contest |
___________________________________________________________________ |
Modified: svn:mergeinfo |
21 | 24 | Merged /trunk/extensions/Contest:r100405,100419,100427,100432-100433,100435-100439 |