r98283 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98282‎ | r98283 | r98284 >
Date:23:10, 27 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
work on landing page
Modified paths:
  • /trunk/extensions/Contest/Contest.i18n.php (modified) (history)
  • /trunk/extensions/Contest/includes/Contest.class.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialContestWelcome.php (modified) (history)
  • /trunk/extensions/Contest/specials/SpecialEditContest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Contest/Contest.i18n.php
@@ -59,6 +59,10 @@
6060 'editcontest-legend' => 'Contest',
6161 'contest-edit-name' => 'Contest name',
6262 'contest-edit-status' => 'Contest status',
 63+ 'contest-edit-exists-already' => 'Note: you are editing an already existing contest, not creating a new one.',
 64+
 65+ // Special:ContestWelcome
 66+ 'contest-welcome-unknown' => 'There is no contest with the provided name.',
6367 );
6468
6569 /** Message documentation (Message documentation)
Index: trunk/extensions/Contest/specials/SpecialContestWelcome.php
@@ -43,7 +43,44 @@
4444 return;
4545 }
4646
 47+ $out = $this->getOutput();
4748
 49+ $out->setPageTitle( $this->getDescription() );
 50+
 51+ $contest = Contest::s()->selectRow( null, array( 'name' => $subPage ) );
 52+
 53+ if ( $contest === false ) {
 54+ $this->showError( 'contest-welcome-unknown' );
 55+ $out->addHTML( '<br /><br /><br /><br />' );
 56+ $out->returnToMain();
 57+ }
 58+ else {
 59+ $this->showIntro( $contest );
 60+ $this->showChallanges( $contest->getChallanges() );
 61+ $this->showOpportunities();
 62+ $this->showRules();
 63+ $this->showSignupLinks( $contest );
 64+ }
4865 }
4966
 67+ protected function showIntro( Contest $contest ) {
 68+
 69+ }
 70+
 71+ protected function showChallanges( array /* of ContestChallange */ $challanges ) {
 72+
 73+ }
 74+
 75+ protected function showOpportunities() {
 76+
 77+ }
 78+
 79+ protected function showRules() {
 80+
 81+ }
 82+
 83+ protected function showSignupLinks( Contest $contest ) {
 84+
 85+ }
 86+
5087 }
\ No newline at end of file
Index: trunk/extensions/Contest/specials/SpecialEditContest.php
@@ -91,7 +91,7 @@
9292 $contest = new Contest( $data, true );
9393 }
9494 else {
95 - // TODO: warn not new
 95+ $this->showWarning( 'contest-edit-exists-already' );
9696 }
9797 }
9898 else {
@@ -212,5 +212,18 @@
213213 public function onSuccess() {
214214 $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Contests' )->getLocalURL() );
215215 }
 216+
 217+ /**
 218+ * Show a message in a warning box.
 219+ *
 220+ * @since 0.1
 221+ *
 222+ * @param string $message
 223+ */
 224+ protected function showWarning( $message ) {
 225+ $this->getOutput()->addHTML(
 226+ '<p class="visualClear warningbox">' . wfMsgExt( $message, 'parseinline' ) . '</p>'
 227+ );
 228+ }
216229
217230 }
\ No newline at end of file
Index: trunk/extensions/Contest/includes/Contest.class.php
@@ -104,6 +104,13 @@
105105 );
106106 }
107107
 108+ /**
 109+ * Gets the message for the provided status.
 110+ *
 111+ * @param Contest::STATUS_ $status
 112+ *
 113+ * @return string
 114+ */
108115 public static function getStatusMessage( $status ) {
109116 static $map = false;
110117
@@ -114,6 +121,13 @@
115122 return $map[$status];
116123 }
117124
 125+ /**
 126+ * Returns a list of status messages and their corresponding constants.
 127+ *
 128+ * @since 0.1
 129+ *
 130+ * @return array
 131+ */
118132 public static function getStatusMessages() {
119133 static $map = false;
120134
@@ -128,4 +142,17 @@
129143 return $map;
130144 }
131145
 146+ /**
 147+ * Gets the challanges that are part of this contest.
 148+ *
 149+ * @since 0.1
 150+ *
 151+ * @return array of ContestChallange
 152+ */
 153+ public function getChallanges() {
 154+ // TODO
 155+
 156+ return array();
 157+ }
 158+
132159 }
\ No newline at end of file

Status & tagging log