Index: trunk/extensions/Contest/specials/SpecialContestWelcome.php |
— | — | @@ -142,11 +142,13 @@ |
143 | 143 | $challenges[] = $data; |
144 | 144 | } |
145 | 145 | |
| 146 | + global $wgContestDeletionEnabled; |
146 | 147 | $this->getOutput()->addScript( |
147 | 148 | Skin::makeVariablesScript( |
148 | 149 | array( |
149 | 150 | 'ContestChallenges' => $challenges, |
150 | | - 'ContestConfig' => array() |
| 151 | + 'ContestConfig' => array(), |
| 152 | + 'ContestDeletionEnabled' => $wgContestDeletionEnabled, |
151 | 153 | ) |
152 | 154 | ) |
153 | 155 | ); |
— | — | @@ -188,7 +190,7 @@ |
189 | 191 | */ |
190 | 192 | protected function showRules( Contest $contest ) { |
191 | 193 | // TODO: we might want to have a pop-up with the content here, instead of a link to the page. |
192 | | - $this->getOutput()->addWikiMsgArray( 'contest-welcome-rules', $contest->getField( 'rules_page' ) ); |
| 194 | + $this->getOutput()->addWikiMsgArray( 'contest-welcome-rules', $contest->getField( 'rules_page' ) ); |
193 | 195 | } |
194 | 196 | |
195 | 197 | /** |
Index: trunk/extensions/Contest/specials/SpecialEditContest.php |
— | — | @@ -312,7 +312,11 @@ |
313 | 313 | if ( $idString == '' ) { |
314 | 314 | return true; |
315 | 315 | } |
316 | | - |
| 316 | + global $wgContestDeletionEnabled; |
| 317 | + if ( !$wgContestDeletionEnabled ) { |
| 318 | + // Shouldn't get here (UI should prevent it) |
| 319 | + throw new MWException( 'Contest deletion is disabled', 'contestdeletiondisabled' ); |
| 320 | + } |
317 | 321 | return ContestChallenge::s()->delete( array( 'id' => explode( '|', $idString ) ) ); |
318 | 322 | } |
319 | 323 | |
Index: trunk/extensions/Contest/resources/contest.special.editcontest.js |
— | — | @@ -80,14 +80,16 @@ |
81 | 81 | ).append( '<br />' ).append( this.textInput ) |
82 | 82 | ); |
83 | 83 | |
84 | | - this.deleteButton = $( '<button />' ) |
85 | | - .button( { 'label': mw.msg( 'contest-edit-delete' ) } ) |
86 | | - .click( function() { |
87 | | - if ( confirm( mw.msg( 'contest-edit-confirm-delete' ) ) ) { |
88 | | - _this.remove(); |
89 | | - return false; |
90 | | - } |
91 | | - } ); |
| 84 | + if ( mw.config.get( 'ContestDeletionEnabled' ) ) { |
| 85 | + this.deleteButton = $( '<button />' ) |
| 86 | + .button( { 'label': mw.msg( 'contest-edit-delete' ) } ) |
| 87 | + .click( function() { |
| 88 | + if ( confirm( mw.msg( 'contest-edit-confirm-delete' ) ) ) { |
| 89 | + _this.remove(); |
| 90 | + return false; |
| 91 | + } |
| 92 | + } ); |
| 93 | + } |
92 | 94 | |
93 | 95 | $this.append( this.deleteButton ); |
94 | 96 | }; |