* (bug 10655) Show standard tool links for blocked users in block log messages
authorRob Church <robchurch@users.mediawiki.org>
Mon, 6 Aug 2007 07:09:59 +0000 (07:09 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Mon, 6 Aug 2007 07:09:59 +0000 (07:09 +0000)
* Show standard tool links for blocked users in Special:Ipblocklist

The above exclude the block link (where applicable) using the first of the flags to be passed to Linker::userToolLinks().

RELEASE-NOTES
includes/Linker.php
includes/LogPage.php
includes/SpecialIpblocklist.php
languages/messages/MessagesEn.php

index bbf584b..fa683a2 100644 (file)
@@ -359,6 +359,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 10765) img_auth.php will now refuse logged-out requests where
   $wgWhitelistRead is undefined, instead of (incorrectly) honouring them
 * Fixed img_auth.php file name extraction for whitelist checking
+* (bug 10655) Show standard tool links for blocked users in block log messages
+* Show standard tool links for blocked users in Special:Ipblocklist
 
 == API changes since 1.10 ==
 
index 56377fa..f6bcf7f 100644 (file)
  * @addtogroup Skins
  */
 class Linker {
+
+       /**
+        * Flags for userToolLinks()
+        */
+       const TOOL_LINKS_NOBLOCK = 1;
+
        function __construct() {}
 
        /**
@@ -744,15 +750,18 @@ class Linker {
        }
 
        /**
-        * @param $userId Integer: user id in database.
-        * @param $userText String: user name in database.
-        * @param $redContribsWhenNoEdits Bool: return a red contribs link when the user had no edits and this is true.
-        * @return string HTML fragment with talk and/or block links
+        * Generate standard user tool links (talk, contributions, block link, etc.)
+        *
+        * @param int $userId User identifier
+        * @param string $userText User name or IP address
+        * @param bool $redContribsWhenNoEdits Should the contributions link be red if the user has no edits?
+        * @param int $flags Customisation flags (e.g. self::TOOL_LINKS_NOBLOCK)
+        * @return string
         */
-       public function userToolLinks( $userId, $userText, $redContribsWhenNoEdits = false ) {
+       public function userToolLinks( $userId, $userText, $redContribsWhenNoEdits = false, $flags = 0 ) {
                global $wgUser, $wgDisableAnonTalk, $wgSysopUserBans;
                $talkable = !( $wgDisableAnonTalk && 0 == $userId );
-               $blockable = ( $wgSysopUserBans || 0 == $userId );
+               $blockable = ( $wgSysopUserBans || 0 == $userId ) && !$flags & self::TOOL_LINKS_NOBLOCK;
 
                $items = array();
                if( $talkable ) {
index 864be5c..38f4fa2 100644 (file)
@@ -161,8 +161,11 @@ class LogPage {
                                                        if( substr( $title->getText(), 0, 1 ) == '#' ) {
                                                                $titleLink = $title->getText();
                                                        } else {
-                                                               $titleLink = $skin->makeLinkObj( $title, $title->getText() );
-                                                               $titleLink .= ' (' . $skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Contributions', $title->getDBkey() ), wfMsg( 'contribslink' ) ) . ')';
+                                                               // TODO: Store the user identifier in the parameters
+                                                               // to make this faster for future log entries
+                                                               $id = User::idFromName( $title->getText() );
+                                                               $titleLink = $skin->userLink( $id, $title->getText() )
+                                                                       . $skin->userToolLinks( $id, $title->getText(), false, Linker::TOOL_LINKS_NOBLOCK );
                                                        }
                                                        break;
                                                case 'rights':
index 61a941a..34c6dbd 100644 (file)
@@ -283,8 +283,8 @@ class IPUnblockForm {
                if( $block->mAuto ) {
                        $target = $block->getRedactedName(); # Hide the IP addresses of auto-blocks; privacy
                } else {
-                       $target = $sk->makeLinkObj( Title::makeTitle( NS_USER, $block->mAddress ), $block->mAddress );
-                       $target .= ' (' . $sk->makeKnownLinkObj( SpecialPage::getSafeTitleFor( 'Contributions', $block->mAddress ), $msg['contribslink'] ) . ')';
+                       $target = $sk->userLink( $block->mUser, $block->mAddress )
+                               . $sk->userToolLinks( $block->mUser, $block->mAddress, false, Linker::TOOL_LINKS_NOBLOCK );
                }
                
                $formattedTime = $wgLang->timeanddate( $block->mTimestamp, true );
index 4107826..a9c799a 100644 (file)
@@ -2034,7 +2034,7 @@ to a previously blocked IP address or username.',
 '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"',
 'blocklogpage'                => 'Block log',
-'blocklogentry'               => 'blocked "[[$1]]" with an expiry time of $2 $3',
+'blocklogentry'               => 'blocked [[$1]] with an expiry time of $2 $3',
 'blocklogtext'                => 'This is a log of user blocking and unblocking actions. Automatically
 blocked IP addresses are not listed. See the [[Special:Ipblocklist|IP block list]] for
 the list of currently operational bans and blocks.',