Index: trunk/extensions/Contest/Contest.i18n.php |
— | — | @@ -59,6 +59,10 @@ |
60 | 60 | 'editcontest-legend' => 'Contest', |
61 | 61 | 'contest-edit-name' => 'Contest name', |
62 | 62 | '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.', |
63 | 67 | ); |
64 | 68 | |
65 | 69 | /** Message documentation (Message documentation) |
Index: trunk/extensions/Contest/specials/SpecialContestWelcome.php |
— | — | @@ -43,7 +43,44 @@ |
44 | 44 | return; |
45 | 45 | } |
46 | 46 | |
| 47 | + $out = $this->getOutput(); |
47 | 48 | |
| 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 | + } |
48 | 65 | } |
49 | 66 | |
| 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 | + |
50 | 87 | } |
\ No newline at end of file |
Index: trunk/extensions/Contest/specials/SpecialEditContest.php |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | $contest = new Contest( $data, true ); |
93 | 93 | } |
94 | 94 | else { |
95 | | - // TODO: warn not new |
| 95 | + $this->showWarning( 'contest-edit-exists-already' ); |
96 | 96 | } |
97 | 97 | } |
98 | 98 | else { |
— | — | @@ -212,5 +212,18 @@ |
213 | 213 | public function onSuccess() { |
214 | 214 | $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Contests' )->getLocalURL() ); |
215 | 215 | } |
| 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 | + } |
216 | 229 | |
217 | 230 | } |
\ No newline at end of file |
Index: trunk/extensions/Contest/includes/Contest.class.php |
— | — | @@ -104,6 +104,13 @@ |
105 | 105 | ); |
106 | 106 | } |
107 | 107 | |
| 108 | + /** |
| 109 | + * Gets the message for the provided status. |
| 110 | + * |
| 111 | + * @param Contest::STATUS_ $status |
| 112 | + * |
| 113 | + * @return string |
| 114 | + */ |
108 | 115 | public static function getStatusMessage( $status ) { |
109 | 116 | static $map = false; |
110 | 117 | |
— | — | @@ -114,6 +121,13 @@ |
115 | 122 | return $map[$status]; |
116 | 123 | } |
117 | 124 | |
| 125 | + /** |
| 126 | + * Returns a list of status messages and their corresponding constants. |
| 127 | + * |
| 128 | + * @since 0.1 |
| 129 | + * |
| 130 | + * @return array |
| 131 | + */ |
118 | 132 | public static function getStatusMessages() { |
119 | 133 | static $map = false; |
120 | 134 | |
— | — | @@ -128,4 +142,17 @@ |
129 | 143 | return $map; |
130 | 144 | } |
131 | 145 | |
| 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 | + |
132 | 159 | } |
\ No newline at end of file |