Index: trunk/extensions/Contest/specials/SpecialContestWelcome.php |
— | — | @@ -54,8 +54,35 @@ |
55 | 55 | $out->addHTML( '<br /><br /><br /><br />' ); |
56 | 56 | $out->returnToMain(); |
57 | 57 | } |
| 58 | + else if ( $contest->getField( 'status' ) !== Contest::STATUS_ACTIVE ) { |
| 59 | + // TODO: show message |
| 60 | + } |
58 | 61 | else { |
59 | | - // TODO: we might want to have a title field here |
| 62 | + $this->showEnabledPage( $contest ); |
| 63 | + } |
| 64 | + } |
| 65 | + |
| 66 | + protected function showEnabledPage( Contest $contest ) { |
| 67 | + $out = $this->getOutput(); |
| 68 | + |
| 69 | + $alreadySignedup = $this->getUser()->isLoggedIn(); |
| 70 | + |
| 71 | + if ( $alreadySignedup ) { |
| 72 | + // Check if the user is already a contestant in this contest. |
| 73 | + // If he is, reirect to submission page, else show signup form. |
| 74 | + $alreadySignedup = ContestContestant::s()->selectRow( |
| 75 | + 'id', |
| 76 | + array( |
| 77 | + 'contest_id' => $contest->getId(), |
| 78 | + 'user_id' => $this->getUser()->getId() |
| 79 | + ) |
| 80 | + ) !== false; |
| 81 | + } |
| 82 | + |
| 83 | + if ( $alreadySignedup ) { |
| 84 | + $out->redirect( SpecialPage::getTitleFor( 'ContestSubmission', $contest->getField( 'name' ) )->getLocalURL() ); |
| 85 | + } |
| 86 | + else { |
60 | 87 | $out->setPageTitle( $contest->getField( 'name' ) ); |
61 | 88 | |
62 | 89 | $this->showIntro( $contest ); |
Index: trunk/extensions/Contest/specials/SpecialContestSignup.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | * @since 0.1 |
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | | - parent::__construct( 'ContestSignup', 'contestparticipant' ); |
| 23 | + parent::__construct( 'ContestSignup' ); |
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
Index: trunk/extensions/Contest/resources/jquery.contestChallanges.js |
— | — | @@ -17,8 +17,8 @@ |
18 | 18 | this.challangesList = null; |
19 | 19 | |
20 | 20 | this.showChallange = function( challange ) { |
21 | | - // TODO |
22 | | - console.log( challange ); |
| 21 | + // TODO: show challange pop-up with text and participate button |
| 22 | + window.location = challange.target; |
23 | 23 | }; |
24 | 24 | |
25 | 25 | this.addChallange = function( challange ) { |