From: Bartosz DziewoƄski Date: Sun, 26 Jul 2015 23:44:25 +0000 (+0200) Subject: SpecialBlock: Switch to OOUI form X-Git-Tag: 1.31.0-rc.0~1906^2 X-Git-Url: http://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=d56758e134358fdac3f8dda16417bfd30f78bab9 SpecialBlock: Switch to OOUI form * Remove additional wrapper, and the 'blockip-legend' message. * Replace autocompletion using 'mediawiki.userSuggest' with OOUI, by using 'type' => 'user' for the username field Bug: T107036 Change-Id: Ib8f7e03388073450ecff28ad2c0d3f9161f259d8 --- diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index cd3c0289c8..c1a1f78e17 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -99,7 +99,6 @@ class SpecialBlock extends FormSpecialPage { * @param HTMLForm $form */ protected function alterForm( HTMLForm $form ) { - $form->setWrapperLegendMsg( 'blockip-legend' ); $form->setHeaderText( '' ); $form->setSubmitDestructive(); @@ -121,6 +120,10 @@ class SpecialBlock extends FormSpecialPage { } } + protected function getDisplayFormat() { + return 'ooui'; + } + /** * Get the HTMLForm descriptor array for the block form * @return array @@ -134,14 +137,15 @@ class SpecialBlock extends FormSpecialPage { $a = [ 'Target' => [ - 'type' => 'text', + 'type' => 'user', + 'ipallowed' => true, + 'iprange' => true, 'label-message' => 'ipaddressorusername', 'id' => 'mw-bi-target', 'size' => '45', 'autofocus' => true, 'required' => true, 'validation-callback' => [ __CLASS__, 'validateTargetField' ], - 'cssclass' => 'mw-autocomplete-user', // used by mediawiki.userSuggest ], 'Expiry' => [ 'type' => !count( $suggestedDurations ) ? 'text' : 'selectorother', @@ -323,7 +327,7 @@ class SpecialBlock extends FormSpecialPage { * @return string */ protected function preText() { - $this->getOutput()->addModules( [ 'mediawiki.special.block', 'mediawiki.userSuggest' ] ); + $this->getOutput()->addModules( [ 'mediawiki.special.block' ] ); $blockCIDRLimit = $this->getConfig()->get( 'BlockCIDRLimit' ); $text = $this->msg( 'blockiptext', $blockCIDRLimit['IPv4'], $blockCIDRLimit['IPv6'] )->parse(); diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 875da04e32..6a95ec46e1 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -2493,7 +2493,6 @@ "unblock": "Unblock user", "unblock-summary": "", "blockip": "Block {{GENDER:$1|user}}", - "blockip-legend": "Block user", "blockiptext": "Use the form below to block write access from a specific IP address or username.\nThis should be done only to prevent vandalism, and in accordance with [[{{MediaWiki:Policy-url}}|policy]].\nFill in a specific reason below (for example, citing particular pages that were vandalized).\nYou can block IP address ranges using the [https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing CIDR] syntax; the largest allowed range is /$1 for IPv4 and /$2 for IPv6.", "ipaddressorusername": "IP address or username:", "ipbexpiry": "Expiration:", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index 4ff05befab..1a037dda1e 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -2685,7 +2685,6 @@ "unblock": "{{doc-special|Unblock}}", "unblock-summary": "{{doc-specialpagesummary|unblock}}", "blockip": "Used as the text of a link in the sidebar toolbox. Clicking this link takes you to [[Special:Block]], with a relevant username or IP address (e.g. \"Username\" on [[User talk:Username]], [[Special:Contributions/Username]], etc.) already filled in.\n\nParameters:\n* $1 - username, for GENDER support\n{{Identical|Block user}}", - "blockip-legend": "Legend/Header for the fieldset around the input form of [[Special:Block]].\n\n{{Identical|Block user}}", "blockiptext": "Used in the {{msg-mw|Blockip}} form in [[Special:Block]].\n\nRefers to {{msg-mw|Policy-url}}.\n\nThis message may follow the message {{msg-mw|Ipb-otherblocks-header}} and other block messages.\n\nParameters:\n* $1 - CIDR suffix of the largest allowed IPv4 block (as an integer)\n* $2 - CIDR suffix of the largest allowed IPv6 block (as an integer)\n\nSee also:\n* {{msg-mw|Unblockiptext}}", "ipaddressorusername": "{{Identical|IP address or username}}", "ipbexpiry": "{{Identical|Expiry}}",