Index: trunk/extensions/Contest/Contest.i18n.php |
— | — | @@ -109,6 +109,7 @@ |
110 | 110 | 'contest-submission-submit' => 'Submit', |
111 | 111 | 'contest-submission-unknown' => 'There is no contest with the provided name.', |
112 | 112 | 'contest-submission-header' => 'On this page you can modify your submission untill the deadline.', |
| 113 | + 'contest-signup-finished' => 'This contest has ended.', |
113 | 114 | |
114 | 115 | // Special:Contest |
115 | 116 | 'contest-contest-title' => 'Contest: $1', |
Index: trunk/extensions/Contest/specials/SpecialContestSignup.php |
— | — | @@ -87,29 +87,47 @@ |
88 | 88 | $out->returnToMain(); |
89 | 89 | } |
90 | 90 | else { |
91 | | - // Check if the user is already a contestant in this contest. |
92 | | - // If he is, reirect to submission page, else show signup form. |
93 | | - $contestant = ContestContestant::s()->selectRow( |
94 | | - 'id', |
95 | | - array( |
96 | | - 'contest_id' => $contest->getId(), |
97 | | - 'user_id' => $this->getUser()->getId() |
98 | | - ) |
99 | | - ); |
100 | | - |
101 | | - if ( $contestant === false ) { |
102 | | - // TODO: we might want to have a title field here |
103 | | - $out->setPageTitle( $contest->getField( 'name' ) ); |
104 | | - $out->addWikiMsg( 'contest-signup-header', $contest->getField( 'name' ) ); |
105 | | - |
106 | | - $this->showSignupForm( $contest ); |
| 91 | + switch ( $contest->getField( 'status' ) ) { |
| 92 | + case Contest::STATUS_ACTIVE: |
| 93 | + $this->showEnabledPage( $contest ); |
| 94 | + break; |
| 95 | + case Contest::STATUS_DRAFT: |
| 96 | + // TODO |
| 97 | + break; |
| 98 | + case Contest::STATUS_FINISHED: |
| 99 | + $this->showWarning( 'contest-signup-finished' ); |
| 100 | + $out->addHTML( '<br /><br /><br /><br />' ); |
| 101 | + $out->returnToMain(); |
| 102 | + break; |
107 | 103 | } |
108 | | - else { |
109 | | - $out->redirect( SpecialPage::getTitleFor( 'ContestSubmission', $contestName )->getLocalURL() ); |
110 | | - } |
111 | 104 | } |
112 | 105 | } |
113 | 106 | |
| 107 | + protected function showEnabledPage( Contest $contest ) { |
| 108 | + $out = $this->getOutput(); |
| 109 | + |
| 110 | + // Check if the user is already a contestant in this contest. |
| 111 | + // If he is, reirect to submission page, else show signup form. |
| 112 | + $contestant = ContestContestant::s()->selectRow( |
| 113 | + 'id', |
| 114 | + array( |
| 115 | + 'contest_id' => $contest->getId(), |
| 116 | + 'user_id' => $this->getUser()->getId() |
| 117 | + ) |
| 118 | + ); |
| 119 | + |
| 120 | + if ( $contestant === false ) { |
| 121 | + // TODO: we might want to have a title field here |
| 122 | + $out->setPageTitle( $contest->getField( 'name' ) ); |
| 123 | + $out->addWikiMsg( 'contest-signup-header', $contest->getField( 'name' ) ); |
| 124 | + |
| 125 | + $this->showSignupForm( $contest ); |
| 126 | + } |
| 127 | + else { |
| 128 | + $out->redirect( SpecialPage::getTitleFor( 'ContestSubmission', $contestName )->getLocalURL() ); |
| 129 | + } |
| 130 | + } |
| 131 | + |
114 | 132 | /** |
115 | 133 | * Display the signup form for this contest. |
116 | 134 | * |