r98359 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98358‎ | r98359 | r98360 >
Date:19:47, 28 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
work on contest special
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/SpecialContestPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/Contest.i18n.php
@@ -67,18 +67,41 @@
6868 // Special:Contest
6969 'contest-contest-title' => 'Contest: $1',
7070 'contest-contest-no-results' => 'There are no contestants to list.',
 71+ 'contest-contest-name' => 'Name',
 72+ 'contest-contest-status' => 'Status',
 73+ 'contest-contest-submissioncount' => 'Amount of participants',
 74+ 'contest-contest-contestants' => 'Contest contestants',
 75+
 76+ // Contestant pager
 77+ 'contest-contestant-id' => 'ID',
 78+ 'contest-contestant-volunteer' => 'Interested in volunteering oportunities',
 79+ 'contest-contestant-wmf' => 'Interested in job oportunities',
 80+ 'contest-contestant-no' => 'No',
 81+ 'contest-contestant-yes' => 'Yes',
7182 );
7283
7384 /** Message documentation (Message documentation)
7485 * @author Jeroen De Dauw
7586 */
7687 $messages['qqq'] = array(
77 - 'contest-special-name' => 'table header',
78 - 'contest-special-status' => 'table header',
79 - 'contest-special-submissioncount' => 'table header',
80 - 'contest-special-edit' => 'table header',
81 - 'contest-special-delete' => 'table header',
 88+ 'contest-special-name' => 'Table column header',
 89+ 'contest-special-status' => 'Table column header',
 90+ 'contest-special-submissioncount' => 'Table column header',
 91+ 'contest-special-edit' => 'Table column header',
 92+ 'contest-special-delete' => 'Table column header',
8293
8394 'contest-edit-name' => 'form field label',
8495 'contest-edit-status' => 'form field label',
 96+
 97+ 'contest-contest-title' => 'Page title',
 98+ 'contest-contest-name' => 'Table row header',
 99+ 'contest-contest-status' => 'Table row header',
 100+ 'contest-contest-submissioncount' => 'Table row header',
 101+ 'contest-contest-contestants' => 'Page section header',
 102+
 103+ 'contest-contestant-id' => 'Table column header',
 104+ 'contest-contestant-volunteer' => 'Table column header',
 105+ 'contest-contestant-wmf' => 'Table column header',
 106+ 'contest-contestant-no' => 'Table cell value',
 107+ 'contest-contestant-yes' => 'Table cell value',
85108 );
\ No newline at end of file
Index: trunk/extensions/Contest/specials/SpecialContestPage.php
@@ -81,4 +81,15 @@
8282 );
8383 }
8484
 85+ /**
 86+ * Display navigation links.
 87+ *
 88+ * @since 0.1
 89+ *
 90+ * @param array $links
 91+ */
 92+ protected function displayNavigation( array $links ) {
 93+ $this->getOutput()->addHTML( Html::rawElement( 'p', array(), $this->getLang()->pipeList( $links ) ) );
 94+ }
 95+
8596 }
Index: trunk/extensions/Contest/specials/SpecialContest.php
@@ -48,12 +48,64 @@
4949 }
5050 }
5151
 52+ /**
 53+ * Display the general contest info.
 54+ *
 55+ * @since 0.1
 56+ *
 57+ * @param Contest $contest
 58+ */
5259 protected function showGeneralInfo( Contest $contest ) {
53 - // TODO
 60+ $out = $this->getOutput();
 61+
 62+ $out->addHTML( Html::openElement( 'table', array( 'class' => 'wikitable contest-summary' ) ) );
 63+
 64+ foreach ( $this->getSummaryData( $contest ) as $stat => $value ) {
 65+ $out->addHTML( '<tr>' );
 66+
 67+ $out->addHTML( Html::element(
 68+ 'th',
 69+ array( 'class' => 'contest-summary-name' ),
 70+ wfMsg( 'contest-contest-' . $stat )
 71+ ) );
 72+
 73+ $out->addHTML( Html::element(
 74+ 'td',
 75+ array( 'class' => 'contest-summary-value' ),
 76+ $value
 77+ ) );
 78+
 79+ $out->addHTML( '</tr>' );
 80+ }
 81+
 82+ $out->addHTML( Html::closeElement( 'table' ) );
5483 }
5584
 85+ /**
 86+ * Gets the summary data.
 87+ *
 88+ * @since 0.1
 89+ *
 90+ * @param Contest $contest
 91+ *
 92+ * @return array
 93+ */
 94+ protected function getSummaryData( Contest $contest ) {
 95+ $stats = array();
 96+
 97+ $stats['name'] = $contest->getField( 'name' );
 98+ $stats['status'] = Contest::getStatusMessage( $contest->getField( 'status' ) );
 99+ $stats['submissioncount'] = $this->getLang()->formatNum( $contest->getField( 'submission_count' ) );
 100+
 101+ return $stats;
 102+ }
 103+
56104 // TODO: list scores and comment counts as well
57105 protected function showContestants( Contest $contest ) {
 106+ $out = $this->getOutput();
 107+
 108+ $out->addHTML( Html::element( 'h3', array(), wfMsg( 'contest-contest-contestants' ) ) );
 109+
58110 $conds = array(
59111 'contestant_contest_id' => $contest->getId()
60112 );
@@ -61,14 +113,14 @@
62114 $pager = new ContestantPager( $this, $conds );
63115
64116 if ( $pager->getNumRows() ) {
65 - $this->getOutput()->addHTML(
 117+ $out->addHTML(
66118 $pager->getNavigationBar() .
67119 $pager->getBody().
68120 $pager->getNavigationBar()
69121 );
70122 }
71123 else {
72 - $this->getOutput()->addWikiMsg( 'contest-contest-no-results' );
 124+ $out->addWikiMsg( 'contest-contest-no-results' );
73125 }
74126 }
75127
Index: trunk/extensions/Contest/includes/ContestantPager.php
@@ -41,6 +41,12 @@
4242 }
4343
4444 public function formatValue( $name, $value ) {
 45+ switch ( $name ) {
 46+ case 'contestant_volunteer': case 'contestant_wmf':
 47+ $value = wfMsg( 'contest-contestant-' . ( $value === '1' ? 'yes' : 'no' ) );
 48+ break;
 49+ }
 50+
4551 return $value;
4652 }
4753
@@ -82,7 +88,7 @@
8389 }
8490
8591 function getTitle() {
86 - return $this->page->getTitle();
 92+ return $this->page->getFullTitle();
8793 }
8894
8995 }

Status & tagging log