Index: trunk/extensions/GlobalBlocking/SpecialGlobalBlock.php |
— | — | @@ -104,6 +104,7 @@ |
105 | 105 | $this->mAddress = $par; |
106 | 106 | |
107 | 107 | $this->mReason = $wgRequest->getText( 'wpReason' ); |
| 108 | + $this->mReasonList = $wgRequest->getText( 'wpBlockReasonList' ); |
108 | 109 | $this->mExpiry = $this->mExpirySelection = $wgRequest->getText( 'wpExpiry' ); |
109 | 110 | if ($this->mExpiry == 'other') { |
110 | 111 | $this->mExpiry = $wgRequest->getText( 'wpExpiryOther' ); |
— | — | @@ -123,7 +124,15 @@ |
124 | 125 | if ($this->mModify) |
125 | 126 | $options[] = 'modify'; |
126 | 127 | |
127 | | - $errors = GlobalBlocking::block( $this->mAddress, $this->mReason, $this->mExpiry, $options ); |
| 128 | + $reasonstr = $this->mReasonList; |
| 129 | + if( $reasonstr != 'other' && $this->mReason != '' ) { |
| 130 | + // Entry from drop down menu + additional comment |
| 131 | + $reasonstr .= wfMsgForContent( 'colon-separator' ) . $this->mReason; |
| 132 | + } elseif( $reasonstr == 'other' ) { |
| 133 | + $reasonstr = $this->mReason; |
| 134 | + } |
| 135 | + |
| 136 | + $errors = GlobalBlocking::block( $this->mAddress, $reasonstr, $this->mExpiry, $options ); |
128 | 137 | |
129 | 138 | if ( count($errors) ) { |
130 | 139 | return $errors; |
— | — | @@ -181,12 +190,15 @@ |
182 | 191 | ); |
183 | 192 | |
184 | 193 | // How long to block them for |
185 | | - if ( ( $dropdown = wfMsgNoTrans( 'globalblocking-expiry-options' ) ) != '-') { |
186 | | - # Drop-down list |
187 | | - } elseif ( ( $dropdown = wfMsgNoTrans( 'ipboptions' ) ) != '-' ) { |
188 | | - # Also a drop-down list |
189 | | - } else { |
190 | | - $dropdown = false; |
| 194 | + $dropdown = wfMsgForContentNoTrans( 'globalblocking-expiry-options' ); |
| 195 | + if ( $dropdown === '' || $dropdown == '-' ) { |
| 196 | + // 'globalblocking-expiry-options' is empty, try the message from core |
| 197 | + $dropdown = wfMsgForContentNoTrans( 'ipboptions' ); |
| 198 | + if ( wfEmptyMsg( 'ipboptions', $dropdown ) || $dropdown === '' || $dropdown == '-' ) { |
| 199 | + // 'ipboptions' is empty too. Do not show a dropdown |
| 200 | + // Do not assume that 'ipboptions' exists forever, therefore check with wfEmptyMsg too |
| 201 | + $dropdown = false; |
| 202 | + } |
191 | 203 | } |
192 | 204 | |
193 | 205 | if ($dropdown == false ) { |
— | — | @@ -216,6 +228,15 @@ |
217 | 229 | |
218 | 230 | // Why to block them |
219 | 231 | $fields['globalblocking-block-reason'] = |
| 232 | + Xml::listDropDown( |
| 233 | + 'wpBlockReasonList', |
| 234 | + wfMsgForContent( 'globalblocking-block-reason-dropdown' ), |
| 235 | + wfMsgForContent( 'globalblocking-block-reasonotherlist' ), |
| 236 | + $this->mReasonList, |
| 237 | + 'mw-globalblock-reasonlist' |
| 238 | + ); |
| 239 | + |
| 240 | + $fields['globalblocking-block-otherreason'] = |
220 | 241 | Xml::input( |
221 | 242 | 'wpReason', |
222 | 243 | 45, |
Index: trunk/extensions/GlobalBlocking/GlobalBlocking.class.php |
— | — | @@ -349,6 +349,10 @@ |
350 | 350 | $title = SpecialPage::getTitleFor( 'GlobalBlockStatus' ); |
351 | 351 | $links[] = $sk->linkKnown( $title, wfMsg( 'globalblocking-goto-status' ) ); |
352 | 352 | } |
| 353 | + if( $pagetype == 'GlobalBlock' && $wgUser->isAllowed( 'editinterface' ) ) { |
| 354 | + $title = Title::makeTitle( NS_MEDIAWIKI, 'Globalblocking-block-reason-dropdown' ); |
| 355 | + $links[] = $sk->linkKnown( $title, wfMsg( 'globalblocking-block-edit-dropdown' ), array(), array( 'action' => 'edit' ) ); |
| 356 | + } |
353 | 357 | $linkItems = count( $links ) ? wfMsg( 'parentheses', $wgLang->pipeList( $links ) ) : ''; |
354 | 358 | return $linkItems; |
355 | 359 | } |
Index: trunk/extensions/GlobalBlocking/GlobalBlocking.i18n.php |
— | — | @@ -16,8 +16,15 @@ |
17 | 17 | 'globalblocking-expiry-options' => '-', # do not translate or duplicate this message to other languages |
18 | 18 | 'globalblocking-modify-intro' => 'You can use this form to change the settings of a global block.', |
19 | 19 | 'globalblocking-block-intro' => 'You can use this page to block an IP address on all wikis.', |
20 | | - 'globalblocking-block-reason' => 'Reason for this block:', |
21 | | - 'globalblocking-block-expiry' => 'Block expiry:', |
| 20 | + 'globalblocking-block-reason' => 'Reason:', |
| 21 | + 'globalblocking-block-otherreason' => 'Other/additional reason:', |
| 22 | + 'globalblocking-block-reasonotherlist' => 'Other reason', |
| 23 | + 'globalblocking-block-reason-dropdown' => '* Common block reasons |
| 24 | +** Crosswiki spamming |
| 25 | +** Crosswiki abuse |
| 26 | +** Vandalism', |
| 27 | + 'globalblocking-block-edit-dropdown' => 'Edit block reasons', |
| 28 | + 'globalblocking-block-expiry' => 'Expiry:', |
22 | 29 | 'globalblocking-block-expiry-other' => 'Other expiry time', |
23 | 30 | 'globalblocking-block-expiry-otherfield' => 'Other time:', |
24 | 31 | 'globalblocking-block-legend' => 'Block an IP address globally', |