r21494 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21493‎ | r21494 | r21495 >
Date:16:11, 23 April 2007
Author:raymond
Status:old
Tags:
Comment:
Reapply predefined block reasons (r21200) after reworking:
* Better default block reasons (thanks to Rob)
* Consistent appearance at [[MediaWiki:ipbreason-dropdown]]
** () zero level, * first level (groups), ** second level (reasons for this group)
* field can be disabled with '-'
* link to MW message at block page
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialBlockip.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesDe.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -1265,6 +1265,8 @@
12661266 'ipadressorusername',
12671267 'ipbexpiry',
12681268 'ipbreason',
 1269+ 'ipbreasonotherlist',
 1270+ 'ipbreason-dropdown',
12691271 'ipbanononly',
12701272 'ipbcreateaccount',
12711273 'ipbenableautoblock',
@@ -1272,10 +1274,12 @@
12731275 'ipbother',
12741276 'ipboptions',
12751277 'ipbotheroption',
 1278+ 'ipbotherreason',
12761279 'ipbhidename',
12771280 'badipaddress',
12781281 'blockipsuccesssub',
12791282 'blockipsuccesstext',
 1283+ 'ipb-edit-dropdown',
12801284 'ipb-unblock-addr',
12811285 'ipb-unblock',
12821286 'ipb-blocklist-addr',
Index: trunk/phase3/includes/SpecialBlockip.php
@@ -50,6 +50,7 @@
5151 $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip', $par ) );
5252 $this->BlockAddress = strtr( $this->BlockAddress, '_', ' ' );
5353 $this->BlockReason = $wgRequest->getText( 'wpBlockReason' );
 54+ $this->BlockReasonList = $wgRequest->getText( 'wpBlockReasonList' );
5455 $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry', wfMsg('ipbotheroption') );
5556 $this->BlockOther = $wgRequest->getVal( 'wpBlockOther', '' );
5657
@@ -77,7 +78,10 @@
7879 $mIpbexpiry = Xml::label( wfMsg( 'ipbexpiry' ), 'wpBlockExpiry' );
7980 $mIpbother = Xml::label( wfMsg( 'ipbother' ), 'mw-bi-other' );
8081 $mIpbothertime = wfMsgHtml( 'ipbotheroption' );
81 - $mIpbreason = Xml::label( wfMsg( 'ipbreason' ), 'mw-bi-reason' );
 82+ $mIpbreasonother = Xml::label( wfMsg( 'ipbreason' ), 'wpBlockReasonList' );
 83+ $mIpbreason = Xml::label( wfMsg( 'ipbotherreason' ), 'mw-bi-reason' );
 84+ $mIpbreasonotherlist = wfMsgHtml( 'ipbreasonotherlist' );
 85+
8286 $titleObj = SpecialPage::getTitleFor( 'Blockip' );
8387 $action = $titleObj->escapeLocalURL( "action=submit" );
8488
@@ -104,6 +108,39 @@
105109 $blockExpiryFormOptions .= "<option value=\"$value\"$selected>$show</option>";
106110 }
107111
 112+ $scBlockReasonList = wfMsgForContent( 'ipbreason-dropdown' );
 113+ $blockReasonList = '';
 114+ if ( $scBlockReasonList != '' && $scBlockReasonList != '-' ) {
 115+ $blockReasonList = "<option value=\"other\">$mIpbreasonotherlist</option>";
 116+ $optgroup = "";
 117+ foreach ( explode( "\n", $scBlockReasonList ) as $option) {
 118+ $value = trim( htmlspecialchars($option) );
 119+ if ( $value == '' ) {
 120+ continue;
 121+ } elseif ( substr( $value, 0, 1) == '*' && substr( $value, 1, 1) != '*' ) {
 122+ // A new group is starting ...
 123+ $value = trim( substr( $value, 1 ) );
 124+ $blockReasonList .= "$optgroup<optgroup label=\"$value\">";
 125+ $optgroup = "</optgroup>";
 126+ } elseif ( substr( $value, 0, 2) == '**' ) {
 127+ // groupmember
 128+ $selected = "";
 129+ $value = trim( substr( $value, 2 ) );
 130+ if ( $this->BlockReasonList === $value)
 131+ $selected = ' selected="selected"';
 132+ $blockReasonList .= "<option value=\"$value\"$selected>$value</option>";
 133+ } else {
 134+ // groupless block reason
 135+ $selected = "";
 136+ if ( $this->BlockReasonList === $value)
 137+ $selected = ' selected="selected"';
 138+ $blockReasonList .= "$optgroup<option value=\"$value\"$selected>$value</option>";
 139+ $optgroup = "";
 140+ }
 141+ }
 142+ $blockReasonList .= $optgroup;
 143+ }
 144+
108145 $token = htmlspecialchars( $wgUser->editToken() );
109146
110147 global $wgStylePath, $wgStyleVersion;
@@ -133,7 +170,6 @@
134171 </td>
135172 ");
136173 }
137 -
138174 $wgOut->addHTML("
139175 </tr>
140176 <tr id='wpBlockOther'>
@@ -142,12 +178,24 @@
143179 " . Xml::input( 'wpBlockOther', 45, $this->BlockOther,
144180 array( 'tabindex' => '3', 'id' => 'mw-bi-other' ) ) . "
145181 </td>
146 - </tr>
147 - <tr>
 182+ </tr>");
 183+ if ( $blockReasonList != '' ) {
 184+ $wgOut->addHTML("
 185+ <tr>
 186+ <td align=\"right\">{$mIpbreasonother}:</td>
 187+ <td align=\"left\">
 188+ <select tabindex='4' id=\"wpBlockReasonList\" name=\"wpBlockReasonList\">
 189+ $blockReasonList
 190+ </select>
 191+ </td>
 192+ </tr>");
 193+ }
 194+ $wgOut->addHTML("
 195+ <tr id=\"wpBlockReason\">
148196 <td align=\"right\">{$mIpbreason}:</td>
149197 <td align=\"left\">
150198 " . Xml::input( 'wpBlockReason', 45, $this->BlockReason,
151 - array( 'tabindex' => '3', 'id' => 'mw-bi-reason' ) ) . "
 199+ array( 'tabindex' => '5', 'id' => 'mw-bi-reason' ) ) . "
152200 </td>
153201 </tr>
154202 <tr id='wpAnonOnlyRow'>
@@ -155,7 +203,7 @@
156204 <td align=\"left\">
157205 " . wfCheckLabel( wfMsgHtml( 'ipbanononly' ),
158206 'wpAnonOnly', 'wpAnonOnly', $this->BlockAnonOnly,
159 - array( 'tabindex' => '4' ) ) . "
 207+ array( 'tabindex' => '6' ) ) . "
160208 </td>
161209 </tr>
162210 <tr id='wpCreateAccountRow'>
@@ -163,7 +211,7 @@
164212 <td align=\"left\">
165213 " . wfCheckLabel( wfMsgHtml( 'ipbcreateaccount' ),
166214 'wpCreateAccount', 'wpCreateAccount', $this->BlockCreateAccount,
167 - array( 'tabindex' => '5' ) ) . "
 215+ array( 'tabindex' => '7' ) ) . "
168216 </td>
169217 </tr>
170218 <tr id='wpEnableAutoblockRow'>
@@ -171,7 +219,7 @@
172220 <td align=\"left\">
173221 " . wfCheckLabel( wfMsgHtml( 'ipbenableautoblock' ),
174222 'wpEnableAutoblock', 'wpEnableAutoblock', $this->BlockEnableAutoblock,
175 - array( 'tabindex' => '6' ) ) . "
 223+ array( 'tabindex' => '8' ) ) . "
176224 </td>
177225 </tr>
178226 ");
@@ -183,7 +231,7 @@
184232 <td align=\"left\">
185233 " . wfCheckLabel( wfMsgHtml( 'ipbhidename' ),
186234 'wpHideName', 'wpHideName', $this->BlockHideName,
187 - array( 'tabindex' => '6' ) ) . "
 235+ array( 'tabindex' => '9' ) ) . "
188236 </td>
189237 </tr>
190238 ");
@@ -193,7 +241,7 @@
194242 <td style='padding-top: 1em'>&nbsp;</td>
195243 <td style='padding-top: 1em' align=\"left\">
196244 " . Xml::submitButton( wfMsgHtml( 'ipbsubmit' ),
197 - array( 'name' => 'wpBlock', 'tabindex' => '7' ) ) . "
 245+ array( 'name' => 'wpBlock', 'tabindex' => '10' ) ) . "
198246 </td>
199247 </tr>
200248 </table>" .
@@ -273,6 +321,14 @@
274322 }
275323 }
276324
 325+ $reasonstr = $this->BlockReasonList;
 326+ if ( $reasonstr != 'other' && $this->BlockReason != '') {
 327+ // Entry from drop down menu + additional comment
 328+ $reasonstr .= ': ' . $this->BlockReason;
 329+ } elseif ( $reasonstr == 'other' ) {
 330+ $reasonstr = $this->BlockReason;
 331+ }
 332+
277333 $expirestr = $this->BlockExpiry;
278334 if( $expirestr == 'other' )
279335 $expirestr = $this->BlockOther;
@@ -300,7 +356,7 @@
301357 # Note: for a user block, ipb_address is only for display purposes
302358
303359 $block = new Block( $this->BlockAddress, $userId, $wgUser->getID(),
304 - $this->BlockReason, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly,
 360+ $reasonstr, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly,
305361 $this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName);
306362
307363 if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) {
@@ -322,7 +378,7 @@
323379 $log_type = ($this->BlockHideName) ? 'oversight' : 'block';
324380 $log = new LogPage( $log_type );
325381 $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ),
326 - $this->BlockReason, $logParams );
 382+ $reasonstr, $logParams );
327383
328384 # Report to the user
329385 $titleObj = SpecialPage::getTitleFor( 'Blockip' );
@@ -373,6 +429,7 @@
374430 private function getConvenienceLinks() {
375431 global $wgUser;
376432 $skin = $wgUser->getSkin();
 433+ $links[] = $skin->makeLink ( 'MediaWiki:ipbreason-dropdown', wfMsgHtml( 'ipb-edit-dropdown' ) );
377434 $links[] = $this->getUnblockLink( $skin );
378435 $links[] = $this->getBlockListLink( $skin );
379436 return '<p class="mw-ipb-conveniencelinks">' . implode( ' | ', $links ) . '</p>';
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -1946,6 +1946,23 @@
19471947 'ipadressorusername' => 'IP Address or username',
19481948 'ipbexpiry' => 'Expiry',
19491949 'ipbreason' => 'Reason',
 1950+'ipbreasonotherlist' => 'Other reason',
 1951+
 1952+// These are examples only. They can be translated but should be adjusted via
 1953+// [[MediaWiki:ipbreason-list]] by the local community
 1954+// defines a block reason not part of a group
 1955+// * defines a block reason group in the drow down menu
 1956+// ** defines a block reason
 1957+// To disable this drop down menu enter '-' in [[MediaWiki:ipbreason-dropdown]].
 1958+'ipbreason-dropdown' => '
 1959+*Common block reasons
 1960+** Inserting false information
 1961+** Removing content from pages
 1962+** Spamming links to external sites
 1963+** Inserting nonsense/gibberish into pages
 1964+** Intimidating behaviour/harassment
 1965+** Abusing multiple accounts
 1966+** Unacceptable username',
19501967 'ipbanononly' => 'Block anonymous users only',
19511968 'ipbcreateaccount' => 'Prevent account creation',
19521969 'ipbenableautoblock' => 'Automatically block the last IP address used by this user, and any subsequent IPs they try to edit from',
@@ -1953,11 +1970,13 @@
19541971 'ipbother' => 'Other time',
19551972 'ipboptions' => '2 hours:2 hours,1 day:1 day,3 days:3 days,1 week:1 week,2 weeks:2 weeks,1 month:1 month,3 months:3 months,6 months:6 months,1 year:1 year,infinite:infinite',
19561973 'ipbotheroption' => 'other',
 1974+'ipbotherreason' => 'Other/additional reason',
19571975 'ipbhidename' => 'Hide username/IP from the block log, active block list and user list',
19581976 'badipaddress' => 'Invalid IP address',
19591977 'blockipsuccesssub' => 'Block succeeded',
19601978 'blockipsuccesstext' => '[[Special:Contributions/$1|$1]] has been blocked.
19611979 <br />See [[Special:Ipblocklist|IP block list]] to review blocks.',
 1980+'ipb-edit-dropdown' => 'Edit block reasons',
19621981 'ipb-unblock-addr' => 'Unblock $1',
19631982 'ipb-unblock' => 'Unblock a username or IP address',
19641983 'ipb-blocklist-addr' => 'View existing blocks for $1',
@@ -1980,7 +1999,7 @@
19812000 'blocklink' => 'block',
19822001 'unblocklink' => 'unblock',
19832002 'contribslink' => 'contribs',
1984 -'autoblocker' => 'Autoblocked because your IP address has been recently used by "[[User:$1|$1]]". The reason given for $1\'s block is: "\'\'\'$2\'\'\'"',
 2003+'autoblocker' => 'Autoblocked because your IP address has been recently used by "[[User:$1|$1]]". The reason given for $1\'s block is: "$2"',
19852004 'blocklogpage' => 'Block log',
19862005 'blocklogentry' => 'blocked "[[$1]]" with an expiry time of $2 $3',
19872006 'blocklogtext' => 'This is a log of user blocking and unblocking actions. Automatically
Index: trunk/phase3/languages/messages/MessagesDe.php
@@ -1510,6 +1510,18 @@
15111511 'ipadressorusername' => 'IP-Adresse oder Benutzername',
15121512 'ipbexpiry' => 'Sperrdauer',
15131513 'ipbreason' => 'Begründung',
 1514+'ipbreasonotherlist' => 'Andere Begründung',
 1515+'ipbreason-dropdown' => '
 1516+* Allgemeine Sperrgründe
 1517+** Löschen von Seiten
 1518+** Einstellen unsinniger Seiten
 1519+** Fortgesetzte Verstöße gegen die Richtlinien für Weblinks
 1520+** Verstoß gegen den Grundsatz „Keine persönlichen Angriffe“
 1521+* Benutzerspezifische Sperrgründe
 1522+** Ungeeigneter Benutzername
 1523+** Neuanmeldung eines unbeschränkt gesperrten Benutzers
 1524+* IP-spezifische Sperrgründe
 1525+** Proxy, wegen Vandalismus einzelner Benutzer längerfristig gesperrt',
15141526 'ipbanononly' => 'Nur anonyme Benutzer sperren',
15151527 'ipbcreateaccount' => 'Erstellung von Benutzerkonten verhindern',
15161528 'ipbenableautoblock' => 'Sperre die aktuell von diesem Benutzer genutzte IP-Adresse sowie automatisch alle folgenden, von denen aus er Bearbeitungen oder das Anlegen von Benutzeraccounts versucht',
@@ -1517,12 +1529,14 @@
15181530 'ipbother' => 'Andere Dauer (englisch)',
15191531 'ipboptions' => '1 Stunde:1 hour,2 Stunden:2 hours,6 Stunden:6 hours,1 Tag:1 day,3 Tage:3 days,1 Woche:1 week,2 Wochen:2 weeks,1 Monat:1 month,3 Monate:3 months,1 Jahr:1 year,Unbeschränkt:indefinite',
15201532 'ipbotheroption' => 'Andere Dauer',
 1533+'ipbotherreason' => 'Andere/ergänzende Begründung',
15211534 'ipbhidename' => 'Benutzername/IP-Adresse im Sperr-Logbuch, der Liste aktiver Sperren und dem Benutzerverzeichnis verstecken.',
15221535 'badipaddress' => 'Die IP-Adresse hat ein falsches Format.',
15231536 'blockipsuccesssub' => 'Sperre erfolgreich',
15241537 'blockipsuccesstext' => 'Der Benutzer/die IP-Adresse [[{{ns:special}}:Contributions/$1|$1]] wurde gesperrt und die Aktion im [[{{ns:special}}:Log/block|Benutzersperr-Logbuch]] protokolliert
15251538
15261539 Zur Aufhebung der Sperre siehe die [[{{ns:special}}:Ipblocklist|Liste aller aktiven Sperren]].',
 1540+'ipb-edit-dropdown' => 'Sperrgründe bearbeiten',
15271541 'ipb-unblock-addr' => '„$1“ freigeben',
15281542 'ipb-unblock' => 'IP-Adresse/Benutzer freigeben',
15291543 'ipb-blocklist-addr' => 'Aktuelle Sperre für „$1“ anzeigen',
@@ -1551,7 +1565,7 @@
15521566 'unblocklogentry' => 'hat die Sperre von [[$1]] aufgehoben.',
15531567 'block-log-flags-anononly' => 'nur Anonyme',
15541568 'block-log-flags-nocreate' => 'Erstellung von Benutzerkonten gesperrt',
1555 -'block-log-flags-autoblock' => 'Autoblock aktiviert',
 1569+'block-log-flags-noautoblock' => 'Autoblock deaktiviert',
15561570 'range_block_disabled' => 'Die Möglichkeit, ganze Adressräume zu sperren, ist nicht aktiviert.',
15571571 'ipb_expiry_invalid' => 'Die eingegebene Dauer ist ungültig.',
15581572 'ipb_already_blocked' => '„$1“ wurde bereits gesperrt',
Index: trunk/phase3/RELEASE-NOTES
@@ -122,8 +122,8 @@
123123 * Added sharpening option for ImageMagick thumbnailing
124124 * (bug 9656) Autosummaries will be generated for deletion of pages longer than
125125 500 characters
 126+* Predefined block reasons added to Special:Blockip
126127
127 -
128128 == Bugfixes since 1.9 ==
129129
130130 * (bug 7292) Fix site statistics when moving pages in/out of content namespaces

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r21200* (bug 8599) Correct localized names of zh-variants...raymond15:10, 12 April 2007