r98331 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98330‎ | r98331 | r98332 >
Date:16:46, 28 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
work on contest special and landing page
Modified paths:
  • /trunk/extensions/Contest/Contest.i18n.php (modified) (history)
  • /trunk/extensions/Contest/includes/ContestantPager.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialContest.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialContestWelcome.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/Contest.i18n.php
@@ -63,6 +63,10 @@
6464
6565 // Special:ContestWelcome
6666 'contest-welcome-unknown' => 'There is no contest with the provided name.',
 67+
 68+ // Special:Contest
 69+ 'contest-contest-title' => 'Contest: $1',
 70+ 'contest-contest-no-results' => 'There are no contestants to list.',
6771 );
6872
6973 /** Message documentation (Message documentation)
Index: trunk/extensions/Contest/specials/SpecialContestWelcome.php
@@ -45,8 +45,6 @@
4646
4747 $out = $this->getOutput();
4848
49 - $out->setPageTitle( $this->getDescription() );
50 -
5149 $contest = Contest::s()->selectRow( null, array( 'name' => $subPage ) );
5250
5351 if ( $contest === false ) {
@@ -55,6 +53,9 @@
5654 $out->returnToMain();
5755 }
5856 else {
 57+ // TODO: we might want to have a title field here
 58+ $out->setPageTitle( $contest->getField( 'name' ) );
 59+
5960 $this->showIntro( $contest );
6061 $this->showChallanges( $contest->getChallanges() );
6162 $this->showOpportunities();
Index: trunk/extensions/Contest/specials/SpecialContest.php
@@ -34,15 +34,42 @@
3535 return;
3636 }
3737
38 -
 38+ $out = $this->getOutput();
 39+
 40+ $contest = Contest::s()->selectRow( null, array( 'name' => $subPage ) );
 41+
 42+ if ( $contest === false ) {
 43+ $out->redirect( SpecialPage::getTitleFor( 'Contests' )->getLocalURL() );
 44+ }
 45+ else {
 46+ $out->setPageTitle( wfMsgExt( 'contest-contest-title', 'parseinline', $contest->getField( 'name' ) ) );
 47+ $this->showGeneralInfo( $contest );
 48+ $this->showContestants( $contest );
 49+ }
3950 }
4051
4152 protected function showGeneralInfo( Contest $contest ) {
42 -
 53+ // TODO
4354 }
4455
45 - protected function showParticipants( Contest $contest ) {
 56+ // TODO: list scores and comment counts as well
 57+ protected function showContestants( Contest $contest ) {
 58+ $conds = array(
 59+ 'contestant_contest_id' => $contest->getId()
 60+ );
4661
 62+ $pager = new ContestantPager( $this, $conds );
 63+
 64+ if ( $pager->getNumRows() ) {
 65+ $this->getOutput()->addHTML(
 66+ $pager->getNavigationBar() .
 67+ $pager->getBody().
 68+ $pager->getNavigationBar()
 69+ );
 70+ }
 71+ else {
 72+ $this->getOutput()->addWikiMsg( 'contest-contest-no-results' );
 73+ }
4774 }
4875
4976 }
\ No newline at end of file
Index: trunk/extensions/Contest/includes/ContestantPager.php
@@ -1,7 +1,7 @@
22 <?php
33
44 /**
5 - * Contestant pager, for on Special:Contestants
 5+ * Contestant pager, for on Special:Contest
66 *
77 * @since 0.1
88 *

Status & tagging log