From 717fee63262780be7ff8db70372d48658146b058 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Mon, 15 Jan 2007 06:45:46 +0000 Subject: [PATCH] (bug 8628) Add user-aware block list link to Special:Blockip --- RELEASE-NOTES | 1 + includes/DefaultSettings.php | 2 +- includes/SpecialBlockip.php | 42 +++++++++++++++++++++++++------ languages/messages/MessagesEn.php | 2 ++ skins/common/common.css | 4 +-- skins/monobook/main.css | 4 +-- 6 files changed, 43 insertions(+), 12 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ee949ff4bb..bf69b6bede 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -71,6 +71,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 8407) Disallow indexing of "printable" versions * (bug 8522) Provide a "delete" link on Special:Brokenredirects for users with the appropriate permission +* (bug 8628) Add user-aware block list link to Special:Blockip == Languages updated == diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 2587413546..254fead38f 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1105,7 +1105,7 @@ $wgCacheEpoch = '20030516000000'; * to ensure that client-side caches don't keep obsolete copies of global * styles. */ -$wgStyleVersion = '48'; +$wgStyleVersion = '49'; # Server-side caching: diff --git a/includes/SpecialBlockip.php b/includes/SpecialBlockip.php index f3032947fc..e7626f0e2a 100644 --- a/includes/SpecialBlockip.php +++ b/includes/SpecialBlockip.php @@ -170,7 +170,7 @@ class IPBlockForm { \n" ); - $wgOut->addHtml( $this->getUnblockLink() ); + $wgOut->addHtml( $this->getConvenienceLinks() ); $user = User::newFromName( $this->BlockAddress ); if( is_object( $user ) ) { @@ -312,25 +312,53 @@ class IPBlockForm { return implode( ',', $flags ); } + /** + * Builds unblock and block list links + * + * @return string + */ + private function getConvenienceLinks() { + global $wgUser; + $skin = $wgUser->getSkin(); + $links[] = $this->getUnblockLink( $skin ); + $links[] = $this->getBlockListLink( $skin ); + return ''; + } + /** * Build a convenient link to unblock the given username or IP * address, if available; otherwise link to a blank unblock * form * + * @param $skin Skin to use * @return string */ - private function getUnblockLink() { - global $wgUser; + private function getUnblockLink( $skin ) { $list = SpecialPage::getTitleFor( 'Ipblocklist' ); - $skin = $wgUser->getSkin(); if( $this->BlockAddress ) { $addr = htmlspecialchars( $this->BlockAddress ); - $link = $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-unblock-addr', $addr ), + return $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-unblock-addr', $addr ), 'action=unblock&ip=' . $this->BlockAddress ); } else { - $link = $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-unblock' ), 'action=unblock' ); + return $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-unblock' ), 'action=unblock' ); + } + } + + /** + * Build a convenience link to the block list + * + * @param $skin Skin to use + * @return string + */ + private function getBlockListLink( $skin ) { + $list = SpecialPage::getTitleFor( 'Ipblocklist' ); + if( $this->BlockAddress ) { + $addr = htmlspecialchars( $this->BlockAddress ); + return $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-blocklist-addr', $addr ), + 'ip=' . $this->BlockAddress ); + } else { + return $skin->makeKnownLinkObj( $list, wfMsgHtml( 'ipb-blocklist' ) ); } - return ''; } } diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 0bc4ba83fa..f379b44cdf 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1855,6 +1855,8 @@ pages that were vandalized).",
See [[{{ns:Special}}:Ipblocklist|IP block list]] to review blocks.', 'ipb-unblock-addr' => 'Unblock $1', 'ipb-unblock' => 'Unblock a username or IP address', +'ipb-blocklist-addr' => 'View existing blocks for $1', +'ipb-blocklist' => 'View existing blocks', 'unblockip' => 'Unblock user', 'unblockiptext' => 'Use the form below to restore write access to a previously blocked IP address or username.', diff --git a/skins/common/common.css b/skins/common/common.css index 9a8abd9da9..46f6588e8d 100644 --- a/skins/common/common.css +++ b/skins/common/common.css @@ -453,8 +453,8 @@ table.multipageimage td { .templatesUsed { margin-top: 1em; } -/* "unblock" link on Special:Ipblocklist */ -p.mw-ipb-unblocklink { +/* Convenience links on Special:Ipblocklist */ +p.mw-ipb-conveniencelinks { font-size: 90%; float: right; } diff --git a/skins/monobook/main.css b/skins/monobook/main.css index 06e2304748..517765c4b8 100644 --- a/skins/monobook/main.css +++ b/skins/monobook/main.css @@ -1603,8 +1603,8 @@ tr.sv-space td { display: none; } margin: 0.1em 0; } -/* "unblock" link on Special:Ipblocklist */ -p.mw-ipb-unblocklink { +/* Convenience links on Special:Ipblocklist */ +p.mw-ipb-conveniencelinks { font-size: 90%; float: right; } -- 2.20.1