* Add a 'change block' link to Special:IPBlockList und Special:Log
authorRaimond Spekking <raymond@users.mediawiki.org>
Tue, 16 Dec 2008 08:51:56 +0000 (08:51 +0000)
committerRaimond Spekking <raymond@users.mediawiki.org>
Tue, 16 Dec 2008 08:51:56 +0000 (08:51 +0000)
RELEASE-NOTES
includes/LogEventsList.php
includes/specials/SpecialIpblocklist.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index 674f7c6..58f313f 100644 (file)
@@ -232,6 +232,7 @@ The following extensions are migrated into MediaWiki 1.14:
 * File objects returned by wfFindFile() are now cached by default
 * (bug 7492) Rights can now be assigned to specific IP addresses and ranges by
   using $wgAutopromote (new defines: APCOND_ISIP and APCOND_IPINRANGE)
+* Add a 'change block' link to Special:IPBlockList und Special:Log
 
 === Bug fixes in 1.14 ===
 
index 672dc33..71ee13a 100644 (file)
@@ -38,7 +38,7 @@ class LogEventsList {
        private function preCacheMessages() {
                // Precache various messages
                if( !isset( $this->message ) ) {
-                       $messages = 'revertmerge protect_change unblocklink revertmove undeletelink revdel-restore rev-delundel hist';
+                       $messages = 'revertmerge protect_change unblocklink change-blocklink revertmove undeletelink revdel-restore rev-delundel hist';
                        foreach( explode( ' ', $messages ) as $msg ) {
                                $this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
                        }
@@ -267,11 +267,19 @@ class LogEventsList {
                } else if( self::typeAction($row,array('delete','suppress'),'delete') && $wgUser->isAllowed( 'delete' ) ) {
                        $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Undelete' ),
                                $this->message['undeletelink'], 'target='. urlencode( $title->getPrefixedDBkey() ) ) . ')';
-               // Show unblock link
-               } else if( self::typeAction($row,array('block','suppress'),'block') && $wgUser->isAllowed( 'block' ) ) {
-                       $revert = '(' .  $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Ipblocklist' ),
-                               $this->message['unblocklink'],
-                               'action=unblock&ip=' . urlencode( $row->log_title ) ) . ')';
+               // Show unblock/change block link
+               } else if( self::typeAction( $row, array( 'block', 'suppress' ), 'block' ) && $wgUser->isAllowed( 'block' ) ) {
+                       $revert = '(' .
+                               $this->skin->link( SpecialPage::getTitleFor( 'Ipblocklist' ),
+                                       $this->message['unblocklink'],
+                                       array(),
+                                       array( 'action' => 'unblock', 'ip' => urlencode( $row->log_title ) ),
+                                       'known' ) 
+                               . ' ' . wfMsg( 'pipe-separator' ) . ' ' .
+                               $this->skin->link( SpecialPage::getTitleFor( 'BlockIP/' . htmlspecialchars( $row->log_title ) ), 
+                                       $this->message['change-blocklink'],
+                                       array(), array(), 'known' ) .
+                               ')';
                // Show change protection link
                } else if( self::typeAction($row,'protect',array('modify','protect','unprotect')) ) {
                        $revert .= ' (' .  $this->skin->makeKnownLinkObj( $title, $this->message['hist'], 
index 5ddb8d0..2f3c4bb 100644 (file)
@@ -374,7 +374,7 @@ class IPUnblockForm {
                        $sk = $wgUser->getSkin();
                if( is_null( $msg ) ) {
                        $msg = array();
-                       $keys = array( 'infiniteblock', 'expiringblock', 'unblocklink',
+                       $keys = array( 'infiniteblock', 'expiringblock', 'unblocklink', 'change-blocklink',
                                'anononlyblock', 'createaccountblock', 'noautoblockblock', 'emailblock', 'blocklist-nousertalk' );
                        foreach( $keys as $key ) {
                                $msg[$key] = wfMsgHtml( $key );
@@ -423,9 +423,22 @@ class IPUnblockForm {
                $line = wfMsgReplaceArgs( $msg['blocklistline'], array( $formattedTime, $blocker, $target, $properties ) );
 
                $unblocklink = '';
-               if ( $wgUser->isAllowed('block') ) {
-                       $titleObj = SpecialPage::getTitleFor( "Ipblocklist" );
-                       $unblocklink = ' (' . $sk->makeKnownLinkObj($titleObj, $msg['unblocklink'], 'action=unblock&id=' . urlencode( $block->mId ) ) . ')';
+               $changeblocklink = '';
+               if ( $wgUser->isAllowed( 'block' ) ) {
+                       $unblocklink = $sk->link( SpecialPage::getTitleFor( 'Ipblocklist' ),
+                                       $msg['unblocklink'],
+                                       array(),
+                                       array( 'action' => 'unblock', 'id' => urlencode( $block->mId ) ),
+                                       'known' );
+
+                       # Create changeblocklink for all blocks with exception of autoblocks
+                       if( !$block->mAuto ) {
+                               $changeblocklink = ' ' . wfMsg( 'pipe-separator' ) . ' ' .
+                                       $sk->link( SpecialPage::getTitleFor( 'BlockIP/' . htmlspecialchars( $block->mAddress ) ), 
+                                               $msg['change-blocklink'],
+                                               array(), array(), 'known' );
+                       }
+               $toolLinks = "($unblocklink$changeblocklink)";
                }
 
                $comment = $sk->commentBlock( $block->mReason );
@@ -435,7 +448,7 @@ class IPUnblockForm {
                        $s = '<span class="history-deleted">' . $s . '</span>';
 
                wfProfileOut( __METHOD__ );
-               return "<li>$s $unblocklink</li>\n";
+               return "<li>$s $toolLinks</li>\n";
        }
 }
 
index bfda7d1..7e815bd 100644 (file)
@@ -2616,6 +2616,7 @@ See [[Special:IPBlockList|IP block list]] to review blocks.',
 'ipblocklist-no-results'          => 'The requested IP address or username is not blocked.',
 'blocklink'                       => 'block',
 'unblocklink'                     => 'unblock',
+'change-blocklink'                => 'change block',
 '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"',
index a55041b..79d4b40 100644 (file)
@@ -1807,6 +1807,7 @@ $wgMessageStructure = array(
                'ipblocklist-no-results',
                'blocklink',
                'unblocklink',
+               'change-blocklink',
                'contribslink',
                'autoblocker',
                'blocklogpage',