Index: trunk/extensions/Contest/Contest.i18n.php |
— | — | @@ -124,7 +124,8 @@ |
125 | 125 | 'contest-signup-invalid-name' => 'The name you provided is to short.', |
126 | 126 | 'contest-signup-require-challenge' => 'You must select a challenge.', |
127 | 127 | 'contest-signup-invalid-cv' => 'You entered an invalid URL.', |
128 | | - |
| 128 | + |
| 129 | + 'contest-submission-submission' => 'Url to your submission', |
129 | 130 | 'contest-submission-invalid-url' => 'This URL does not match one of the allowed formats.', |
130 | 131 | |
131 | 132 | // Special:ContestSubmission |
Index: trunk/extensions/Contest/specials/SpecialContestSubmission.php |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | |
118 | 118 | $form = new HTMLForm( $this->getFormFields( $contestant ), $this->getContext() ); |
119 | 119 | |
120 | | - $form->setSubmitCallback( array( __CLASS__, 'handleSubmission' ) ); |
| 120 | + $form->setSubmitCallback( array( $this, 'handleSubmission' ) ); |
121 | 121 | $form->setSubmitText( wfMsg( 'contest-submission-submit' ) ); |
122 | 122 | |
123 | 123 | if( $form->show() ){ |
— | — | @@ -134,8 +134,8 @@ |
135 | 135 | * |
136 | 136 | * @return true|array |
137 | 137 | */ |
138 | | - public static function handleSubmission( array $data ) { |
139 | | - $user = $GLOBALS['wgUser']; //$this->getUser(); |
| 138 | + public function handleSubmission( array $data ) { |
| 139 | + $user = $this->getUser(); |
140 | 140 | |
141 | 141 | $user->setEmail( $data['contestant-email'] ); |
142 | 142 | $user->setRealName( $data['contestant-realname'] ); |
— | — | @@ -149,6 +149,8 @@ |
150 | 150 | 'volunteer' => $data['contestant-volunteer'], |
151 | 151 | 'wmf' => $data['contestant-wmf'], |
152 | 152 | 'cv' => $data['contestant-cv'], |
| 153 | + |
| 154 | + 'submission' => $data['contestant-submission'], |
153 | 155 | ) ); |
154 | 156 | |
155 | 157 | return $contestant->writeToDB(); |
— | — | @@ -217,6 +219,16 @@ |
218 | 220 | 'validation-callback' => array( __CLASS__, 'validateCVField' ) |
219 | 221 | ); |
220 | 222 | |
| 223 | + // TODO: this needs UI work to explain to the user what they can enter here, |
| 224 | + // and possibly some pop-up thing where they can just enter their |
| 225 | + // user and project, after which we just find the latest rev and store that url. |
| 226 | + $fields['contestant-submission'] = array( |
| 227 | + 'type' => 'text', |
| 228 | + 'default' => $contestant->getField( 'submission' ), |
| 229 | + 'label-message' => 'contest-submission-submission', |
| 230 | + 'validation-callback' => array( __CLASS__, 'validateSubmissionField' ) |
| 231 | + ); |
| 232 | + |
221 | 233 | return $fields; |
222 | 234 | } |
223 | 235 | |
— | — | @@ -278,6 +290,8 @@ |
279 | 291 | * HTMLForm field validation-callback for the submissiom field. |
280 | 292 | * Warning: regexes used! o_O |
281 | 293 | * |
| 294 | + * TODO: add support for other services such as Gitorious? |
| 295 | + * |
282 | 296 | * @since 0.1 |
283 | 297 | * |
284 | 298 | * @param $value String |