From 3991cdcbae1b1086cd56306f1f47437cedef0d07 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 20 Feb 2007 00:55:54 +0000 Subject: [PATCH] * Hide irrelevant block options in Special:Blockip based on whether an IP address/range or username is listed. (Dynamic using JS.) --- RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 2 +- includes/SpecialBlockip.php | 18 ++++++++++---- skins/common/block.js | 47 ++++++++++++++++++++++++++++++++++++ skins/common/wikibits.js | 21 ---------------- 5 files changed, 63 insertions(+), 27 deletions(-) create mode 100644 skins/common/block.js diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b4a3ed7d9a..634a4aa411 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -202,6 +202,8 @@ lighter making things easier to read. LocalSettings.php files. * Give Content-Length header for HTTP/1.0 clients. * Partial support for Flash cross-domain-policy filtering. +* Hide irrelevant block options in Special:Blockip based on whether an + IP address/range or username is listed. (Dynamic using JS.) == Languages updated == diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 30a7f37046..6db13e9dbc 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1117,7 +1117,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '58'; +$wgStyleVersion = '59'; # Server-side caching: diff --git a/includes/SpecialBlockip.php b/includes/SpecialBlockip.php index b7518eb5d5..af36689550 100644 --- a/includes/SpecialBlockip.php +++ b/includes/SpecialBlockip.php @@ -104,14 +104,20 @@ class IPBlockForm { $token = htmlspecialchars( $wgUser->editToken() ); + global $wgStylePath, $wgStyleVersion; $wgOut->addHTML( " +
"); @@ -141,7 +147,7 @@ class IPBlockForm { array( 'tabindex' => '3', 'id' => 'mw-bi-reason' ) ) . " - + - + - +
{$mIpaddress}: " . Xml::input( 'wpBlockAddress', 40, $this->BlockAddress, - array( 'tabindex' => '1', 'id' => 'mw-bi-target' ) ) . " + array( + 'tabindex' => '1', + 'id' => 'mw-bi-target', + 'onchange' => 'updateBlockOptions()' ) ) . "
  " . wfCheckLabel( wfMsg( 'ipbanononly' ), @@ -149,7 +155,7 @@ class IPBlockForm { array( 'tabindex' => 4 ) ) . "
  " . wfCheckLabel( wfMsg( 'ipbcreateaccount' ), @@ -157,7 +163,7 @@ class IPBlockForm { array( 'tabindex' => 5 ) ) . "
  " . wfCheckLabel( wfMsg( 'ipbenableautoblock' ), @@ -174,7 +180,9 @@ class IPBlockForm {
" . Xml::hidden( 'wpEditToken', $token ) . -"
\n" ); +" + +\n" ); $wgOut->addHtml( $this->getConvenienceLinks() ); diff --git a/skins/common/block.js b/skins/common/block.js new file mode 100644 index 0000000000..958faa3a24 --- /dev/null +++ b/skins/common/block.js @@ -0,0 +1,47 @@ + +function considerChangingExpiryFocus() { + if (!document.getElementById) { + return; + } + var drop = document.getElementById('wpBlockExpiry'); + if (!drop) { + return; + } + var field = document.getElementById('wpBlockOther'); + if (!field) { + return; + } + var opt = drop.value; + if (opt == 'other') { + field.style.display = ''; + } else { + field.style.display = 'none'; + } +} + +function updateBlockOptions() { + if (!document.getElementById) + return; + + var target = document.getElementById('mw-bi-target'); + if (!target) + return; + + var addy = target.value; + var isEmpty = addy.match(/^\s*$/); + var isIp = addy.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\/\d+)?$/); + + /* + var anonymousCheck = document.getElementById('wpAnonOnly'); + anonymousCheck.disabled = !isIp && !isEmpty; + + var autoblockCheck = document.getElementById('wpEnableAutoblock'); + autoblockCheck.disabled = isIp && !isEmpty; + */ + + var anonymousRow = document.getElementById('wpAnonOnlyRow'); + anonymousRow.style.display = (!isIp && !isEmpty) ? 'none' : ''; + + var autoblockRow = document.getElementById('wpEnableAutoblockRow'); + autoblockRow.style.display = isIp && !isEmpty ? 'none' : ''; +} diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index bb2280b923..6299e5fa88 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -794,27 +794,6 @@ function fillDestFilename(id) { } } - -function considerChangingExpiryFocus() { - if (!document.getElementById) { - return; - } - var drop = document.getElementById('wpBlockExpiry'); - if (!drop) { - return; - } - var field = document.getElementById('wpBlockOther'); - if (!field) { - return; - } - var opt = drop.value; - if (opt == 'other') { - field.style.display = ''; - } else { - field.style.display = 'none'; - } -} - function scrollEditBox() { var editBoxEl = document.getElementById("wpTextbox1"); var scrollTopEl = document.getElementById("wpScrolltop"); -- 2.20.1