| Index: trunk/extensions/Contest/Contest.i18n.php |
| — | — | @@ -71,6 +71,9 @@ |
| 72 | 72 | // Special:ContestWelcome |
| 73 | 73 | 'contest-welcome-unknown' => 'There is no contest with the provided name.', |
| 74 | 74 | |
| | 75 | + // Special:ContestSignup |
| | 76 | + 'contest-signup-unknown' => 'There is no contest with the provided name.', |
| | 77 | + |
| 75 | 78 | // Special:Contest |
| 76 | 79 | 'contest-contest-title' => 'Contest: $1', |
| 77 | 80 | 'contest-contest-no-results' => 'There are no contestants to list.', |
| Index: trunk/extensions/Contest/specials/SpecialContests.php |
| — | — | @@ -124,11 +124,13 @@ |
| 125 | 125 | Html::element( 'th', array(), wfMsg( 'contest-special-submissioncount' ) ) |
| 126 | 126 | ); |
| 127 | 127 | |
| 128 | | - if ( $user->isAllowed( 'contestadmin' ) ) { |
| 129 | | - $headers[] = Html::element( 'th', array( 'class' => 'unsortable' ), wfMsg( 'contest-special-edit' ) ); |
| 130 | | - $headers[] = Html::element( 'th', array( 'class' => 'unsortable' ), wfMsg( 'contest-special-delete' ) ); |
| 131 | | - } |
| | 128 | + $headers[] = Html::element( 'th', array( 'class' => 'unsortable' ) ); |
| 132 | 129 | |
| | 130 | +// if ( $user->isAllowed( 'contestadmin' ) ) { |
| | 131 | +// $headers[] = Html::element( 'th', array( 'class' => 'unsortable' ), wfMsg( 'contest-special-edit' ) ); |
| | 132 | +// $headers[] = Html::element( 'th', array( 'class' => 'unsortable' ), wfMsg( 'contest-special-delete' ) ); |
| | 133 | +// } |
| | 134 | + |
| 133 | 135 | $out->addHTML( '<thead><tr>' . implode( '', $headers ) . '</tr></thead>' ); |
| 134 | 136 | |
| 135 | 137 | $out->addHTML( '<tbody>' ); |
| — | — | @@ -167,35 +169,63 @@ |
| 168 | 170 | $this->getLang()->formatNum( $contest->getField( 'submission_count' ) ) |
| 169 | 171 | ); |
| 170 | 172 | |
| | 173 | + $links = array(); |
| | 174 | + |
| | 175 | + if ( $user->isAllowed( 'contestjudge' ) ) { |
| | 176 | + $links[] = Html::element( |
| | 177 | + 'a', |
| | 178 | + array( |
| | 179 | + 'href' => SpecialPage::getTitleFor( 'Contest', $contest->getField( 'name' ) )->getLocalURL() |
| | 180 | + ), |
| | 181 | + wfMsg( 'contest-nav-contest' ) |
| | 182 | + ); |
| | 183 | + } |
| | 184 | + |
| 171 | 185 | if ( $user->isAllowed( 'contestadmin' ) ) { |
| 172 | | - $fields[] = Html::rawElement( |
| 173 | | - 'td', |
| 174 | | - array(), |
| 175 | | - Html::element( |
| 176 | | - 'a', |
| 177 | | - array( |
| 178 | | - 'href' => SpecialPage::getTitleFor( 'EditContest', $contest->getField( 'name' ) )->getLocalURL() |
| 179 | | - ), |
| 180 | | - wfMsg( 'contest-special-edit' ) |
| 181 | | - ) |
| | 186 | + $links[] = Html::element( |
| | 187 | + 'a', |
| | 188 | + array( |
| | 189 | + 'href' => SpecialPage::getTitleFor( 'EditContest', $contest->getField( 'name' ) )->getLocalURL() |
| | 190 | + ), |
| | 191 | + wfMsg( 'contest-special-edit' ) |
| 182 | 192 | ); |
| 183 | 193 | |
| 184 | | - $fields[] = Html::rawElement( |
| 185 | | - 'td', |
| 186 | | - array(), |
| 187 | | - Html::element( |
| 188 | | - 'a', |
| 189 | | - array( |
| 190 | | - 'href' => '#', |
| 191 | | - 'class' => 'contest-delete', |
| 192 | | - 'data-contest-id' => $contest->getId(), |
| 193 | | - 'data-contest-token' => $this->getUser()->editToken( 'deletecontest' . $contest->getId() ) |
| 194 | | - ), |
| 195 | | - wfMsg( 'contest-special-delete' ) |
| 196 | | - ) |
| | 194 | + $links[] = Html::element( |
| | 195 | + 'a', |
| | 196 | + array( |
| | 197 | + 'href' => '#', |
| | 198 | + 'class' => 'contest-delete', |
| | 199 | + 'data-contest-id' => $contest->getId(), |
| | 200 | + 'data-contest-token' => $this->getUser()->editToken( 'deletecontest' . $contest->getId() ) |
| | 201 | + ), |
| | 202 | + wfMsg( 'contest-special-delete' ) |
| 197 | 203 | ); |
| 198 | 204 | } |
| 199 | 205 | |
| | 206 | + $links[] = Html::element( |
| | 207 | + 'a', |
| | 208 | + array( |
| | 209 | + 'href' => SpecialPage::getTitleFor( 'ContestWelcome', $contest->getField( 'name' ) )->getLocalURL() |
| | 210 | + ), |
| | 211 | + wfMsg( 'contest-nav-contestwelcome' ) |
| | 212 | + ); |
| | 213 | + |
| | 214 | + if ( $user->isAllowed( 'contestparticipant' ) ) { |
| | 215 | + $links[] = Html::element( |
| | 216 | + 'a', |
| | 217 | + array( |
| | 218 | + 'href' => SpecialPage::getTitleFor( 'ContestSignup', $contest->getField( 'name' ) )->getLocalURL() |
| | 219 | + ), |
| | 220 | + wfMsg( 'contest-nav-contestsignup' ) |
| | 221 | + ); |
| | 222 | + } |
| | 223 | + |
| | 224 | + $fields[] = Html::rawElement( |
| | 225 | + 'td', |
| | 226 | + array(), |
| | 227 | + $this->getLang()->pipeList( $links ) |
| | 228 | + ); |
| | 229 | + |
| 200 | 230 | $out->addHTML( '<tr>' . implode( '', $fields ) . '</tr>' ); |
| 201 | 231 | } |
| 202 | 232 | |
| Index: trunk/extensions/Contest/specials/SpecialContestSignup.php |
| — | — | @@ -34,7 +34,21 @@ |
| 35 | 35 | return; |
| 36 | 36 | } |
| 37 | 37 | |
| | 38 | + $out = $this->getOutput(); |
| 38 | 39 | |
| | 40 | + $contest = Contest::s()->selectRow( null, array( 'name' => $subPage ) ); |
| | 41 | + |
| | 42 | + if ( $contest === false ) { |
| | 43 | + $this->showError( 'contest-signup-unknown' ); |
| | 44 | + $out->addHTML( '<br /><br /><br /><br />' ); |
| | 45 | + $out->returnToMain(); |
| | 46 | + } |
| | 47 | + else { |
| | 48 | + // TODO: we might want to have a title field here |
| | 49 | + $out->setPageTitle( $contest->getField( 'name' ) ); |
| | 50 | + |
| | 51 | + |
| | 52 | + } |
| 39 | 53 | } |
| 40 | 54 | |
| 41 | | -} |
| \ No newline at end of file |
| | 55 | +} |