http://www.mediawiki.org/wiki/Special:Code/MediaWiki/99150
Revision: 99150 Author: jeroendedauw Date: 2011-10-06 21:53:22 +0000 (Thu, 06 Oct 2011) Log Message: ----------- some work on signup flow Modified Paths: -------------- trunk/extensions/Contest/resources/jquery.contestChallanges.js trunk/extensions/Contest/specials/SpecialContestSignup.php trunk/extensions/Contest/specials/SpecialContestWelcome.php Modified: trunk/extensions/Contest/resources/jquery.contestChallanges.js =================================================================== --- trunk/extensions/Contest/resources/jquery.contestChallanges.js 2011-10-06 21:49:08 UTC (rev 99149) +++ trunk/extensions/Contest/resources/jquery.contestChallanges.js 2011-10-06 21:53:22 UTC (rev 99150) @@ -17,8 +17,8 @@ this.challangesList = null; this.showChallange = function( challange ) { - // TODO - console.log( challange ); + // TODO: show challange pop-up with text and participate button + window.location = challange.target; }; this.addChallange = function( challange ) { Modified: trunk/extensions/Contest/specials/SpecialContestSignup.php =================================================================== --- trunk/extensions/Contest/specials/SpecialContestSignup.php 2011-10-06 21:49:08 UTC (rev 99149) +++ trunk/extensions/Contest/specials/SpecialContestSignup.php 2011-10-06 21:53:22 UTC (rev 99150) @@ -19,7 +19,7 @@ * @since 0.1 */ public function __construct() { - parent::__construct( 'ContestSignup', 'contestparticipant' ); + parent::__construct( 'ContestSignup' ); } /** Modified: trunk/extensions/Contest/specials/SpecialContestWelcome.php =================================================================== --- trunk/extensions/Contest/specials/SpecialContestWelcome.php 2011-10-06 21:49:08 UTC (rev 99149) +++ trunk/extensions/Contest/specials/SpecialContestWelcome.php 2011-10-06 21:53:22 UTC (rev 99150) @@ -54,8 +54,35 @@ $out->addHTML( '<br /><br /><br /><br />' ); $out->returnToMain(); } + else if ( $contest->getField( 'status' ) !== Contest::STATUS_ACTIVE ) { + // TODO: show message + } else { - // TODO: we might want to have a title field here + $this->showEnabledPage( $contest ); + } + } + + protected function showEnabledPage( Contest $contest ) { + $out = $this->getOutput(); + + $alreadySignedup = $this->getUser()->isLoggedIn(); + + if ( $alreadySignedup ) { + // Check if the user is already a contestant in this contest. + // If he is, reirect to submission page, else show signup form. + $alreadySignedup = ContestContestant::s()->selectRow( + 'id', + array( + 'contest_id' => $contest->getId(), + 'user_id' => $this->getUser()->getId() + ) + ) !== false; + } + + if ( $alreadySignedup ) { + $out->redirect( SpecialPage::getTitleFor( 'ContestSubmission', $contest->getField( 'name' ) )->getLocalURL() ); + } + else { $out->setPageTitle( $contest->getField( 'name' ) ); $this->showIntro( $contest ); _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs