http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100296
Revision: 100296
Author: reedy
Date: 2011-10-19 23:40:31 +0000 (Wed, 19 Oct 2011)
Log Message:
-----------
1.18wmf1 MFT r100292, r100287
Modified Paths:
--------------
branches/wmf/1.18wmf1/extensions/Contest/Contest.php
branches/wmf/1.18wmf1/extensions/Contest/includes/ContestContestant.php
branches/wmf/1.18wmf1/extensions/Contest/specials/SpecialMyContests.php
Property Changed:
----------------
branches/wmf/1.18wmf1/extensions/Contest/
Property changes on: branches/wmf/1.18wmf1/extensions/Contest
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/REL1_15/phase3/extensions/Contest:51646
/branches/REL1_17/phase3/extensions/Contest:81445,81448
/branches/new-installer/phase3/extensions/Contest:43664-66004
/branches/sqlite/extensions/Contest:58211-58321
/trunk/extensions/Contest:99592,99653,100190-100191,100193,100198,100200,100240,100245,100252,100255,100261
/trunk/phase3/extensions/Contest:92580,92634,92713,92762,92765,92791,92854,92884,92886-92887,92894,92898,92907,92932,92958,93141,93149,93151,93233-93234,93258,93266,93303,93516-93518,93520,93818-93822,93847,93858,93891,93935-93936,94058,94062,94068,94107,94155,94235,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94995-94997,95023,95042,95072-95073,95155,95327,95332,95410,95422,95426,95442,95468,95601,95812,98578,98598,98656
+ /branches/REL1_15/phase3/extensions/Contest:51646
/branches/REL1_17/phase3/extensions/Contest:81445,81448
/branches/new-installer/phase3/extensions/Contest:43664-66004
/branches/sqlite/extensions/Contest:58211-58321
/trunk/extensions/Contest:99592,99653,100190-100191,100193,100198,100200,100240,100245,100252,100255,100261,100287,100292
/trunk/phase3/extensions/Contest:92580,92634,92713,92762,92765,92791,92854,92884,92886-92887,92894,92898,92907,92932,92958,93141,93149,93151,93233-93234,93258,93266,93303,93516-93518,93520,93818-93822,93847,93858,93891,93935-93936,94058,94062,94068,94107,94155,94235,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94995-94997,95023,95042,95072-95073,95155,95327,95332,95410,95422,95426,95442,95468,95601,95812,98578,98598,98656
Modified: branches/wmf/1.18wmf1/extensions/Contest/Contest.php
===================================================================
--- branches/wmf/1.18wmf1/extensions/Contest/Contest.php 2011-10-19
23:39:10 UTC (rev 100295)
+++ branches/wmf/1.18wmf1/extensions/Contest/Contest.php 2011-10-19
23:40:31 UTC (rev 100296)
@@ -275,3 +275,6 @@
$egContestSettings = array();
$wgContestEmailParse = false;
+
+$wgContestMailSender = $wgPasswordSender;
+$wgContestMailSenderName = $wgPasswordSenderName;
Modified:
branches/wmf/1.18wmf1/extensions/Contest/includes/ContestContestant.php
===================================================================
--- branches/wmf/1.18wmf1/extensions/Contest/includes/ContestContestant.php
2011-10-19 23:39:10 UTC (rev 100295)
+++ branches/wmf/1.18wmf1/extensions/Contest/includes/ContestContestant.php
2011-10-19 23:40:31 UTC (rev 100296)
@@ -489,13 +489,13 @@
* @return Status
*/
public function sendSignupEmail() {
- global $wgPasswordSender, $wgPasswordSenderName;
+ global $wgContestMailSender, $wgContestMailSenderName;
$title = wfMsg( 'contest-email-signup-title' );
$emailText = ContestUtils::getParsedArticleContent(
$this->getContest()->getField( 'signup_email' ) );
$user = $this->getUser();
- $sender = $wgPasswordSender;
- $senderName = $wgPasswordSenderName;
+ $sender = $wgContestMailSender;
+ $senderName = $wgContestMailSenderName;
wfRunHooks( 'ContestBeforeSignupEmail', array( &$this, &$title,
&$emailText, &$user, &$sender, &$senderName ) );
@@ -517,7 +517,7 @@
* @return Status
*/
public function sendReminderEmail( $emailText, array $params = array()
) {
- global $wgPasswordSender, $wgPasswordSenderName;
+ global $wgContestMailSender, $wgContestMailSenderName;
if ( !array_key_exists( 'daysLeft', $params ) ) {
$params['daysLeft'] =
$this->getContest()->getDaysLeft();
@@ -525,8 +525,8 @@
$title = wfMsgExt( 'contest-email-reminder-title', 'parsemag',
$params['daysLeft'] );
$user = $this->getUser();
- $sender = $wgPasswordSender;
- $senderName = $wgPasswordSenderName;
+ $sender = $wgContestMailSender;
+ $senderName = $wgContestMailSenderName;
wfRunHooks( 'ContestBeforeReminderEmail', array( &$this,
&$title, &$emailText, &$user, &$sender, &$senderName ) );
Modified:
branches/wmf/1.18wmf1/extensions/Contest/specials/SpecialMyContests.php
===================================================================
--- branches/wmf/1.18wmf1/extensions/Contest/specials/SpecialMyContests.php
2011-10-19 23:39:10 UTC (rev 100295)
+++ branches/wmf/1.18wmf1/extensions/Contest/specials/SpecialMyContests.php
2011-10-19 23:40:31 UTC (rev 100296)
@@ -348,6 +348,7 @@
$contestant = new ContestContestant( array(
'id' => $data['contestant-id'],
+ 'challenge_id' => $data['contestant-challengeid'],
'full_name' => $data['contestant-realname'],
'email' => $data['contestant-email'],
@@ -431,6 +432,15 @@
'options' => ContestContestant::getCountriesForInput()
);
+ $fields['contestant-challengeid'] = array(
+ 'type' => 'radio',
+ 'label-message' => 'contest-signup-challenge',
+ 'options' => $this->getChallengesList( $contestant ),
+ 'default' => $contestant->getField( 'challenge_id' ),
+ 'required' => true,
+ 'validation-callback' => array( __CLASS__,
'validateChallengeField' )
+ );
+
$fields['contestant-volunteer'] = array(
'type' => 'check',
'default' => $contestant->getField( 'volunteer' ),
@@ -454,7 +464,33 @@
return $fields;
}
+
+ /**
+ * Gets a list of contests that can be fed directly to the options
field of
+ * an HTMLForm radio input.
+ * challenge title => challenge id
+ *
+ * @since 0.1
+ *
+ * @param ContestContestant $contestant
+ *
+ * @return array
+ */
+ protected function getChallengesList( ContestContestant $contestant ) {
+ $list = array();
+ $challenges = ContestChallenge::s()->select(
+ array( 'id', 'title' ),
+ array( 'contest_id' => $contestant->getField(
'contest_id' ) )
+ );
+
+ foreach ( $challenges as /* ContestChallenge */ $challenge ) {
+ $list[$challenge->getField( 'title' )] =
$challenge->getId();
+ }
+
+ return $list;
+ }
+
/**
* HTMLForm field validation-callback for name field.
*
@@ -544,7 +580,25 @@
return wfMsg( 'contest-submission-invalid-url' );
}
+
+ /**
+ * HTMLForm field validation-callback for challenge field.
+ *
+ * @since 0.1
+ *
+ * @param $value String
+ * @param $alldata Array
+ *
+ * @return true|string
+ */
+ public static function validateChallengeField( $value, $alldata = null
) {
+ if ( is_null( $value ) ) {
+ return wfMsg( 'contest-signup-require-challenge' );
+ }
+ return true;
+ }
+
}
class ContestSubmissionField extends HTMLFormField {
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs