From 1aebe5faaa0a064917bd3544bdcec0f62ea664fb Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Mon, 23 Apr 2007 16:11:49 +0000 Subject: [PATCH] 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 --- RELEASE-NOTES | 2 +- includes/SpecialBlockip.php | 81 ++++++++++++++++++++++++++----- languages/messages/MessagesDe.php | 16 +++++- languages/messages/MessagesEn.php | 21 +++++++- maintenance/language/messages.inc | 4 ++ 5 files changed, 109 insertions(+), 15 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ce1074a7ef..eb0f9a71fc 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -122,7 +122,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Added sharpening option for ImageMagick thumbnailing * (bug 9656) Autosummaries will be generated for deletion of pages longer than 500 characters - +* Predefined block reasons added to Special:Blockip == Bugfixes since 1.9 == diff --git a/includes/SpecialBlockip.php b/includes/SpecialBlockip.php index 5b73ef44cd..5f47fa13fc 100644 --- a/includes/SpecialBlockip.php +++ b/includes/SpecialBlockip.php @@ -50,6 +50,7 @@ class IPBlockForm { $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip', $par ) ); $this->BlockAddress = strtr( $this->BlockAddress, '_', ' ' ); $this->BlockReason = $wgRequest->getText( 'wpBlockReason' ); + $this->BlockReasonList = $wgRequest->getText( 'wpBlockReasonList' ); $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry', wfMsg('ipbotheroption') ); $this->BlockOther = $wgRequest->getVal( 'wpBlockOther', '' ); @@ -77,7 +78,10 @@ class IPBlockForm { $mIpbexpiry = Xml::label( wfMsg( 'ipbexpiry' ), 'wpBlockExpiry' ); $mIpbother = Xml::label( wfMsg( 'ipbother' ), 'mw-bi-other' ); $mIpbothertime = wfMsgHtml( 'ipbotheroption' ); - $mIpbreason = Xml::label( wfMsg( 'ipbreason' ), 'mw-bi-reason' ); + $mIpbreasonother = Xml::label( wfMsg( 'ipbreason' ), 'wpBlockReasonList' ); + $mIpbreason = Xml::label( wfMsg( 'ipbotherreason' ), 'mw-bi-reason' ); + $mIpbreasonotherlist = wfMsgHtml( 'ipbreasonotherlist' ); + $titleObj = SpecialPage::getTitleFor( 'Blockip' ); $action = $titleObj->escapeLocalURL( "action=submit" ); @@ -104,6 +108,39 @@ class IPBlockForm { $blockExpiryFormOptions .= ""; } + $scBlockReasonList = wfMsgForContent( 'ipbreason-dropdown' ); + $blockReasonList = ''; + if ( $scBlockReasonList != '' && $scBlockReasonList != '-' ) { + $blockReasonList = ""; + $optgroup = ""; + foreach ( explode( "\n", $scBlockReasonList ) as $option) { + $value = trim( htmlspecialchars($option) ); + if ( $value == '' ) { + continue; + } elseif ( substr( $value, 0, 1) == '*' && substr( $value, 1, 1) != '*' ) { + // A new group is starting ... + $value = trim( substr( $value, 1 ) ); + $blockReasonList .= "$optgroup"; + $optgroup = ""; + } elseif ( substr( $value, 0, 2) == '**' ) { + // groupmember + $selected = ""; + $value = trim( substr( $value, 2 ) ); + if ( $this->BlockReasonList === $value) + $selected = ' selected="selected"'; + $blockReasonList .= ""; + } else { + // groupless block reason + $selected = ""; + if ( $this->BlockReasonList === $value) + $selected = ' selected="selected"'; + $blockReasonList .= "$optgroup"; + $optgroup = ""; + } + } + $blockReasonList .= $optgroup; + } + $token = htmlspecialchars( $wgUser->editToken() ); global $wgStylePath, $wgStyleVersion; @@ -133,7 +170,6 @@ class IPBlockForm { "); } - $wgOut->addHTML(" @@ -142,12 +178,24 @@ class IPBlockForm { " . Xml::input( 'wpBlockOther', 45, $this->BlockOther, array( 'tabindex' => '3', 'id' => 'mw-bi-other' ) ) . " - - + "); + if ( $blockReasonList != '' ) { + $wgOut->addHTML(" + + {$mIpbreasonother}: + + + + "); + } + $wgOut->addHTML(" + {$mIpbreason}: " . Xml::input( 'wpBlockReason', 45, $this->BlockReason, - array( 'tabindex' => '3', 'id' => 'mw-bi-reason' ) ) . " + array( 'tabindex' => '5', 'id' => 'mw-bi-reason' ) ) . " @@ -155,7 +203,7 @@ class IPBlockForm { " . wfCheckLabel( wfMsgHtml( 'ipbanononly' ), 'wpAnonOnly', 'wpAnonOnly', $this->BlockAnonOnly, - array( 'tabindex' => '4' ) ) . " + array( 'tabindex' => '6' ) ) . " @@ -163,7 +211,7 @@ class IPBlockForm { " . wfCheckLabel( wfMsgHtml( 'ipbcreateaccount' ), 'wpCreateAccount', 'wpCreateAccount', $this->BlockCreateAccount, - array( 'tabindex' => '5' ) ) . " + array( 'tabindex' => '7' ) ) . " @@ -171,7 +219,7 @@ class IPBlockForm { " . wfCheckLabel( wfMsgHtml( 'ipbenableautoblock' ), 'wpEnableAutoblock', 'wpEnableAutoblock', $this->BlockEnableAutoblock, - array( 'tabindex' => '6' ) ) . " + array( 'tabindex' => '8' ) ) . " "); @@ -183,7 +231,7 @@ class IPBlockForm { " . wfCheckLabel( wfMsgHtml( 'ipbhidename' ), 'wpHideName', 'wpHideName', $this->BlockHideName, - array( 'tabindex' => '6' ) ) . " + array( 'tabindex' => '9' ) ) . " "); @@ -193,7 +241,7 @@ class IPBlockForm {   " . Xml::submitButton( wfMsgHtml( 'ipbsubmit' ), - array( 'name' => 'wpBlock', 'tabindex' => '7' ) ) . " + array( 'name' => 'wpBlock', 'tabindex' => '10' ) ) . " " . @@ -273,6 +321,14 @@ class IPBlockForm { } } + $reasonstr = $this->BlockReasonList; + if ( $reasonstr != 'other' && $this->BlockReason != '') { + // Entry from drop down menu + additional comment + $reasonstr .= ': ' . $this->BlockReason; + } elseif ( $reasonstr == 'other' ) { + $reasonstr = $this->BlockReason; + } + $expirestr = $this->BlockExpiry; if( $expirestr == 'other' ) $expirestr = $this->BlockOther; @@ -300,7 +356,7 @@ class IPBlockForm { # Note: for a user block, ipb_address is only for display purposes $block = new Block( $this->BlockAddress, $userId, $wgUser->getID(), - $this->BlockReason, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly, + $reasonstr, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly, $this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName); if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) { @@ -322,7 +378,7 @@ class IPBlockForm { $log_type = ($this->BlockHideName) ? 'oversight' : 'block'; $log = new LogPage( $log_type ); $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ), - $this->BlockReason, $logParams ); + $reasonstr, $logParams ); # Report to the user $titleObj = SpecialPage::getTitleFor( 'Blockip' ); @@ -373,6 +429,7 @@ class IPBlockForm { private function getConvenienceLinks() { global $wgUser; $skin = $wgUser->getSkin(); + $links[] = $skin->makeLink ( 'MediaWiki:ipbreason-dropdown', wfMsgHtml( 'ipb-edit-dropdown' ) ); $links[] = $this->getUnblockLink( $skin ); $links[] = $this->getBlockListLink( $skin ); return ''; diff --git a/languages/messages/MessagesDe.php b/languages/messages/MessagesDe.php index d0761a0eb8..26deed2ad1 100644 --- a/languages/messages/MessagesDe.php +++ b/languages/messages/MessagesDe.php @@ -1510,6 +1510,18 @@ Bitte geben Sie den Grund für die Sperre an.', 'ipadressorusername' => 'IP-Adresse oder Benutzername', 'ipbexpiry' => 'Sperrdauer', 'ipbreason' => 'Begründung', +'ipbreasonotherlist' => 'Andere Begründung', +'ipbreason-dropdown' => ' +* Allgemeine Sperrgründe +** Löschen von Seiten +** Einstellen unsinniger Seiten +** Fortgesetzte Verstöße gegen die Richtlinien für Weblinks +** Verstoß gegen den Grundsatz „Keine persönlichen Angriffe“ +* Benutzerspezifische Sperrgründe +** Ungeeigneter Benutzername +** Neuanmeldung eines unbeschränkt gesperrten Benutzers +* IP-spezifische Sperrgründe +** Proxy, wegen Vandalismus einzelner Benutzer längerfristig gesperrt', 'ipbanononly' => 'Nur anonyme Benutzer sperren', 'ipbcreateaccount' => 'Erstellung von Benutzerkonten verhindern', '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 @@ Bitte geben Sie den Grund für die Sperre an.', 'ipbother' => 'Andere Dauer (englisch)', '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', 'ipbotheroption' => 'Andere Dauer', +'ipbotherreason' => 'Andere/ergänzende Begründung', 'ipbhidename' => 'Benutzername/IP-Adresse im Sperr-Logbuch, der Liste aktiver Sperren und dem Benutzerverzeichnis verstecken.', 'badipaddress' => 'Die IP-Adresse hat ein falsches Format.', 'blockipsuccesssub' => 'Sperre erfolgreich', 'blockipsuccesstext' => 'Der Benutzer/die IP-Adresse [[{{ns:special}}:Contributions/$1|$1]] wurde gesperrt und die Aktion im [[{{ns:special}}:Log/block|Benutzersperr-Logbuch]] protokolliert Zur Aufhebung der Sperre siehe die [[{{ns:special}}:Ipblocklist|Liste aller aktiven Sperren]].', +'ipb-edit-dropdown' => 'Sperrgründe bearbeiten', 'ipb-unblock-addr' => '„$1“ freigeben', 'ipb-unblock' => 'IP-Adresse/Benutzer freigeben', 'ipb-blocklist-addr' => 'Aktuelle Sperre für „$1“ anzeigen', @@ -1551,7 +1565,7 @@ Zur Aufhebung der Sperre siehe die [[{{ns:special}}:Ipblocklist|Liste aller akti 'unblocklogentry' => 'hat die Sperre von [[$1]] aufgehoben.', 'block-log-flags-anononly' => 'nur Anonyme', 'block-log-flags-nocreate' => 'Erstellung von Benutzerkonten gesperrt', -'block-log-flags-autoblock' => 'Autoblock aktiviert', +'block-log-flags-noautoblock' => 'Autoblock deaktiviert', 'range_block_disabled' => 'Die Möglichkeit, ganze Adressräume zu sperren, ist nicht aktiviert.', 'ipb_expiry_invalid' => 'Die eingegebene Dauer ist ungültig.', 'ipb_already_blocked' => '„$1“ wurde bereits gesperrt', diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index d4c4fb9dd1..3c24b424b6 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1946,6 +1946,23 @@ pages that were vandalized).", 'ipadressorusername' => 'IP Address or username', 'ipbexpiry' => 'Expiry', 'ipbreason' => 'Reason', +'ipbreasonotherlist' => 'Other reason', + +// These are examples only. They can be translated but should be adjusted via +// [[MediaWiki:ipbreason-list]] by the local community +// defines a block reason not part of a group +// * defines a block reason group in the drow down menu +// ** defines a block reason +// To disable this drop down menu enter '-' in [[MediaWiki:ipbreason-dropdown]]. +'ipbreason-dropdown' => ' +*Common block reasons +** Inserting false information +** Removing content from pages +** Spamming links to external sites +** Inserting nonsense/gibberish into pages +** Intimidating behaviour/harassment +** Abusing multiple accounts +** Unacceptable username', 'ipbanononly' => 'Block anonymous users only', 'ipbcreateaccount' => 'Prevent account creation', 'ipbenableautoblock' => 'Automatically block the last IP address used by this user, and any subsequent IPs they try to edit from', @@ -1953,11 +1970,13 @@ pages that were vandalized).", 'ipbother' => 'Other time', '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', 'ipbotheroption' => 'other', +'ipbotherreason' => 'Other/additional reason', 'ipbhidename' => 'Hide username/IP from the block log, active block list and user list', 'badipaddress' => 'Invalid IP address', 'blockipsuccesssub' => 'Block succeeded', 'blockipsuccesstext' => '[[Special:Contributions/$1|$1]] has been blocked.
See [[Special:Ipblocklist|IP block list]] to review blocks.', +'ipb-edit-dropdown' => 'Edit block reasons', 'ipb-unblock-addr' => 'Unblock $1', 'ipb-unblock' => 'Unblock a username or IP address', 'ipb-blocklist-addr' => 'View existing blocks for $1', @@ -1980,7 +1999,7 @@ to a previously blocked IP address or username.', 'blocklink' => 'block', 'unblocklink' => 'unblock', 'contribslink' => 'contribs', -'autoblocker' => 'Autoblocked because your IP address has been recently used by "[[User:$1|$1]]". The reason given for $1\'s block is: "\'\'\'$2\'\'\'"', +'autoblocker' => 'Autoblocked because your IP address has been recently used by "[[User:$1|$1]]". The reason given for $1\'s block is: "$2"', 'blocklogpage' => 'Block log', 'blocklogentry' => 'blocked "[[$1]]" with an expiry time of $2 $3', 'blocklogtext' => 'This is a log of user blocking and unblocking actions. Automatically diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 51a2d6552c..5e02d096a2 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1265,6 +1265,8 @@ $wgMessageStructure = array( 'ipadressorusername', 'ipbexpiry', 'ipbreason', + 'ipbreasonotherlist', + 'ipbreason-dropdown', 'ipbanononly', 'ipbcreateaccount', 'ipbenableautoblock', @@ -1272,10 +1274,12 @@ $wgMessageStructure = array( 'ipbother', 'ipboptions', 'ipbotheroption', + 'ipbotherreason', 'ipbhidename', 'badipaddress', 'blockipsuccesssub', 'blockipsuccesstext', + 'ipb-edit-dropdown', 'ipb-unblock-addr', 'ipb-unblock', 'ipb-blocklist-addr', -- 2.20.1