r98590 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98589‎ | r98590 | r98591 >
Date:00:25, 1 October 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
show message when contest hs ended
Modified paths:
  • /trunk/extensions/Contest/Contest.i18n.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialContestSignup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/Contest.i18n.php
@@ -109,6 +109,7 @@
110110 'contest-submission-submit' => 'Submit',
111111 'contest-submission-unknown' => 'There is no contest with the provided name.',
112112 'contest-submission-header' => 'On this page you can modify your submission untill the deadline.',
 113+ 'contest-signup-finished' => 'This contest has ended.',
113114
114115 // Special:Contest
115116 'contest-contest-title' => 'Contest: $1',
Index: trunk/extensions/Contest/specials/SpecialContestSignup.php
@@ -87,29 +87,47 @@
8888 $out->returnToMain();
8989 }
9090 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;
107103 }
108 - else {
109 - $out->redirect( SpecialPage::getTitleFor( 'ContestSubmission', $contestName )->getLocalURL() );
110 - }
111104 }
112105 }
113106
 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+
114132 /**
115133 * Display the signup form for this contest.
116134 *

Follow-up revisions

RevisionCommit summaryAuthorDate
r98591Follow up to r98590;jeroendedauw00:33, 1 October 2011

Status & tagging log