Index: trunk/extensions/Contest/specials/SpecialContestWelcome.php |
— | — | @@ -90,14 +90,26 @@ |
91 | 91 | $out = $this->getOutput(); |
92 | 92 | |
93 | 93 | foreach ( $contest->getChallanges() as /* ContestChallange */ $challange ) { |
94 | | - $out->addHTML( Html::rawElement( |
95 | | - 'fieldset', |
| 94 | + $out->addHTML( '<fieldset>' ); |
| 95 | + |
| 96 | + $out->addHTML( Html::element( 'legend', array(), $challange->getField( 'title' ) ) ); |
| 97 | + |
| 98 | + $out->addHTML( '<div class="contest-challange">' ); |
| 99 | + |
| 100 | + $out->addHTML( Html::element( |
| 101 | + 'button', |
96 | 102 | array( |
97 | | - 'data-contest-target' => $this->getSignupLink( $challange->getId() ) |
| 103 | + 'class' => 'contest-signup challange-signup', |
| 104 | + 'data-contest-target' => $this->getSignupLink( $contest->getField( 'name' ), $challange->getId() ) |
98 | 105 | ), |
99 | | - Html::element( 'legend', array(), $challange->getField( 'title' ) ) |
100 | | - . htmlspecialchars( $challange->getField( 'text' ) ) |
| 106 | + wfMsg( 'contest-welcome-signup' ) |
101 | 107 | ) ); |
| 108 | + |
| 109 | + $out->addHTML( Html::element( 'p', array(), $challange->getField( 'text' ) ) ); |
| 110 | + |
| 111 | + $out->addHTML( '</div>' ); |
| 112 | + |
| 113 | + $out->addHTML( '</fieldset>' ); |
102 | 114 | } |
103 | 115 | } |
104 | 116 | |
— | — | @@ -158,6 +170,10 @@ |
159 | 171 | * @return string |
160 | 172 | */ |
161 | 173 | protected function getSignupLink( $contestName, $challangeId = false ) { |
| 174 | + if ( $challangeId !== false ) { |
| 175 | + $contestName .= '/' . $challangeId; |
| 176 | + } |
| 177 | + |
162 | 178 | $signupitle = SpecialPage::getTitleFor( 'ContestSignup', $contestName ); |
163 | 179 | |
164 | 180 | if ( $this->getUser()->isLoggedIn() ) { |
Index: trunk/extensions/Contest/specials/SpecialContest.php |
— | — | @@ -103,7 +103,15 @@ |
104 | 104 | return $stats; |
105 | 105 | } |
106 | 106 | |
107 | | - // TODO: list scores and comment counts as well |
| 107 | + /** |
| 108 | + * Show a paged list of the contestants foe this contest. |
| 109 | + * |
| 110 | + * @since 0.1 |
| 111 | + * |
| 112 | + * @param Contest $contest |
| 113 | + * |
| 114 | + * TODO: list scores and comment counts as well |
| 115 | + */ |
108 | 116 | protected function showContestants( Contest $contest ) { |
109 | 117 | $out = $this->getOutput(); |
110 | 118 | |
Index: trunk/extensions/Contest/specials/SpecialContestSignup.php |
— | — | @@ -77,11 +77,15 @@ |
78 | 78 | * |
79 | 79 | * @since 0.1 |
80 | 80 | * |
81 | | - * @param string $contestName |
| 81 | + * @param string $subPage |
82 | 82 | */ |
83 | | - protected function showPage( $contestName ) { |
| 83 | + protected function showPage( $subPage ) { |
84 | 84 | $out = $this->getOutput(); |
85 | 85 | |
| 86 | + $subPage = explode( '/', $subPage ); |
| 87 | + $contestName = $subPage[0]; |
| 88 | + $challangeId = count( $subPage ) > 1 ? $subPage[1] : false; |
| 89 | + |
86 | 90 | $contest = Contest::s()->selectRow( null, array( 'name' => $contestName ) ); |
87 | 91 | |
88 | 92 | if ( $contest === false ) { |
— | — | @@ -92,7 +96,7 @@ |
93 | 97 | else { |
94 | 98 | switch ( $contest->getField( 'status' ) ) { |
95 | 99 | case Contest::STATUS_ACTIVE: |
96 | | - $this->showEnabledPage( $contest ); |
| 100 | + $this->showEnabledPage( $contest, $challangeId ); |
97 | 101 | break; |
98 | 102 | case Contest::STATUS_DRAFT: |
99 | 103 | // TODO |
— | — | @@ -112,8 +116,9 @@ |
113 | 117 | * @since 0.1 |
114 | 118 | * |
115 | 119 | * @param Contest $contest |
| 120 | + * @param integer|false $challangeId |
116 | 121 | */ |
117 | | - protected function showEnabledPage( Contest $contest ) { |
| 122 | + protected function showEnabledPage( Contest $contest, $challangeId ) { |
118 | 123 | $out = $this->getOutput(); |
119 | 124 | |
120 | 125 | // Check if the user is already a contestant in this contest. |
— | — | @@ -131,7 +136,7 @@ |
132 | 137 | $out->setPageTitle( $contest->getField( 'name' ) ); |
133 | 138 | $out->addWikiMsg( 'contest-signup-header', $contest->getField( 'name' ) ); |
134 | 139 | |
135 | | - $this->showSignupForm( $contest ); |
| 140 | + $this->showSignupForm( $contest, $challangeId ); |
136 | 141 | } |
137 | 142 | else { |
138 | 143 | $out->redirect( SpecialPage::getTitleFor( 'ContestSubmission', $contest->getField( 'name' ) )->getLocalURL() ); |
— | — | @@ -144,9 +149,10 @@ |
145 | 150 | * @since 0.1 |
146 | 151 | * |
147 | 152 | * @param Contest $contest |
| 153 | + * @param integer|false $challangeId |
148 | 154 | */ |
149 | | - protected function showSignupForm( Contest $contest ) { |
150 | | - $form = new HTMLForm( $this->getFormFields( $contest ), $this->getContext() ); |
| 155 | + protected function showSignupForm( Contest $contest, $challangeId = false ) { |
| 156 | + $form = new HTMLForm( $this->getFormFields( $contest, $challangeId ), $this->getContext() ); |
151 | 157 | |
152 | 158 | $form->setSubmitCallback( array( __CLASS__, 'handleSubmission' ) ); |
153 | 159 | $form->setSubmitText( wfMsg( 'contest-signup-submit' ) ); |
— | — | @@ -175,8 +181,9 @@ |
176 | 182 | * @since 0.1 |
177 | 183 | * |
178 | 184 | * @param Contest $contest |
| 185 | + * @param integer|false $challangeId |
179 | 186 | */ |
180 | | - protected function getFormFields( Contest $contest ) { |
| 187 | + protected function getFormFields( Contest $contest, $challangeId ) { |
181 | 188 | $fields = array(); |
182 | 189 | |
183 | 190 | $user = $this->getUser(); |
— | — | @@ -218,6 +225,10 @@ |
219 | 226 | 'required' => true, |
220 | 227 | ); |
221 | 228 | |
| 229 | + if ( $challangeId !== false ) { |
| 230 | + $fields['contestant-challangeid']['default'] = $challangeId; |
| 231 | + } |
| 232 | + |
222 | 233 | $fields['contestant-volunteer'] = array( |
223 | 234 | 'type' => 'check', |
224 | 235 | 'default' => '0', |
Index: trunk/extensions/Contest/Contest.php |
— | — | @@ -154,8 +154,11 @@ |
155 | 155 | |
156 | 156 | $wgResourceModules['contest.special.welcome'] = $moduleTemplate + array( |
157 | 157 | 'scripts' => array( |
158 | | - 'contest.special.welcome.js' |
| 158 | + 'contest.special.welcome.js', |
159 | 159 | ), |
| 160 | + 'styles' => array( |
| 161 | + 'contest.special.welcome.css', |
| 162 | + ), |
160 | 163 | 'messages' => array( |
161 | 164 | ), |
162 | 165 | 'dependencies' => array( |
Index: trunk/extensions/Contest/resources/contest.special.welcome.css |
— | — | @@ -0,0 +1,16 @@ |
| 2 | +/** |
| 3 | + * CSS for the Contest MediaWiki extension. |
| 4 | + * @see https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Extension:Contest |
| 5 | + * |
| 6 | + * @licence GNU GPL v3 or later |
| 7 | + * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
| 8 | + */ |
| 9 | + |
| 10 | +button.challange-signup { |
| 11 | + position: absolute; |
| 12 | + right: 5px; |
| 13 | +} |
| 14 | + |
| 15 | +div.contest-challange { |
| 16 | + position: relative; |
| 17 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/Contest/resources/contest.special.welcome.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 18 | + native |