Index: trunk/extensions/Contest/specials/SpecialContestWelcome.php |
— | — | @@ -64,14 +64,28 @@ |
65 | 65 | $this->showRules( $contest ); |
66 | 66 | $this->showSignupLinks( $contest ); |
67 | 67 | |
68 | | - $out->addModules( '' ); |
| 68 | + $out->addModules( 'contest.special.welcome' ); |
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
| 72 | + /** |
| 73 | + * Show the intro text for this contest. |
| 74 | + * |
| 75 | + * @since 0.1 |
| 76 | + * |
| 77 | + * @param Contest $contest |
| 78 | + */ |
72 | 79 | protected function showIntro( Contest $contest ) { |
73 | 80 | $this->getOutput()->addWikiText( $this->getArticleContent( $contest->getField( 'intro' ) ) ); |
74 | 81 | } |
75 | 82 | |
| 83 | + /** |
| 84 | + * Show a list of the challanges part of this contest. |
| 85 | + * |
| 86 | + * @since 0.1 |
| 87 | + * |
| 88 | + * @param Contest $contest |
| 89 | + */ |
76 | 90 | protected function showChallanges( Contest $contest ) { |
77 | 91 | $out = $this->getOutput(); |
78 | 92 | |
— | — | @@ -87,15 +101,36 @@ |
88 | 102 | } |
89 | 103 | } |
90 | 104 | |
| 105 | + /** |
| 106 | + * Show the oppertunities for this contest. |
| 107 | + * |
| 108 | + * @since 0.1 |
| 109 | + * |
| 110 | + * @param Contest $contest |
| 111 | + */ |
91 | 112 | protected function showOpportunities( Contest $contest ) { |
92 | 113 | $this->getOutput()->addWikiText( $this->getArticleContent( $contest->getField( 'oppertunities' ) ) ); |
93 | 114 | } |
94 | 115 | |
| 116 | + /** |
| 117 | + * Show the rules for this contest. |
| 118 | + * |
| 119 | + * @since 0.1 |
| 120 | + * |
| 121 | + * @param Contest $contest |
| 122 | + */ |
95 | 123 | protected function showRules( Contest $contest ) { |
96 | 124 | // TODO: we might want to have a pop-up with the content here, instead of a link to the page. |
97 | 125 | $this->getOutput()->addWikiMsgArray( 'contest-welcome-rules', $contest->getField( 'rules_page' ) ); |
98 | 126 | } |
99 | 127 | |
| 128 | + /** |
| 129 | + * Show the signup links for this contest. |
| 130 | + * |
| 131 | + * @since 0.1 |
| 132 | + * |
| 133 | + * @param Contest $contest |
| 134 | + */ |
100 | 135 | protected function showSignupLinks( Contest $contest ) { |
101 | 136 | $out = $this->getOutput(); |
102 | 137 | |
— | — | @@ -110,6 +145,18 @@ |
111 | 146 | ) ); |
112 | 147 | } |
113 | 148 | |
| 149 | + /** |
| 150 | + * Gets the URL for the signup links. |
| 151 | + * When the user has to login, this will be to the login page, |
| 152 | + * with a retunrto to the signup page. |
| 153 | + * |
| 154 | + * @since 0.1 |
| 155 | + * |
| 156 | + * @param string $contestName |
| 157 | + * @param integer|false $challangeId |
| 158 | + * |
| 159 | + * @return string |
| 160 | + */ |
114 | 161 | protected function getSignupLink( $contestName, $challangeId = false ) { |
115 | 162 | $signupitle = SpecialPage::getTitleFor( 'ContestSignup', $contestName ); |
116 | 163 | |
— | — | @@ -124,6 +171,16 @@ |
125 | 172 | } |
126 | 173 | } |
127 | 174 | |
| 175 | + /** |
| 176 | + * Gets the content of the article with the provided page name, |
| 177 | + * or an empty string when there is no such article. |
| 178 | + * |
| 179 | + * @since 0.1 |
| 180 | + * |
| 181 | + * @param string $pageName |
| 182 | + * |
| 183 | + * @return string |
| 184 | + */ |
128 | 185 | protected function getArticleContent( $pageName ) { |
129 | 186 | $title = Title::newFromText( $pageName ); |
130 | 187 | |
— | — | @@ -135,4 +192,4 @@ |
136 | 193 | return $article->getContent(); |
137 | 194 | } |
138 | 195 | |
139 | | -} |
\ No newline at end of file |
| 196 | +} |
Index: trunk/extensions/Contest/Contest.php |
— | — | @@ -152,6 +152,17 @@ |
153 | 153 | ) |
154 | 154 | ); |
155 | 155 | |
| 156 | +$wgResourceModules['contest.special.welcome'] = $moduleTemplate + array( |
| 157 | + 'scripts' => array( |
| 158 | + 'contest.special.welcome.js' |
| 159 | + ), |
| 160 | + 'messages' => array( |
| 161 | + ), |
| 162 | + 'dependencies' => array( |
| 163 | + 'jquery.ui.button' |
| 164 | + ) |
| 165 | +); |
| 166 | + |
156 | 167 | unset( $moduleTemplate ); |
157 | 168 | |
158 | 169 | $egContestSettings = array(); |
Index: trunk/extensions/Contest/resources/contest.special.welcome.js |
— | — | @@ -10,10 +10,10 @@ |
11 | 11 | |
12 | 12 | $( document ).ready( function() { |
13 | 13 | |
14 | | - $( '#contest-signup' ).click( function() { |
15 | | - |
| 14 | + $( '.contest-signup' ).button().click( function() { |
| 15 | + window.location = $( this ).attr( 'data-contest-target' ); |
16 | 16 | } ); |
17 | | - |
| 17 | + |
18 | 18 | } ); |
19 | 19 | |
20 | 20 | })( window.jQuery, window.mediaWiki ); |
\ No newline at end of file |