r44657 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44656‎ | r44657 | r44658 >
Date:08:51, 16 December 2008
Author:raymond
Status:resolved (Comments)
Tags:
Comment:
* Add a 'change block' link to Special:IPBlockList und Special:Log
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialIpblocklist.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
@@ -1807,6 +1807,7 @@
18081808 'ipblocklist-no-results',
18091809 'blocklink',
18101810 'unblocklink',
 1811+ 'change-blocklink',
18111812 'contribslink',
18121813 'autoblocker',
18131814 'blocklogpage',
Index: trunk/phase3/includes/LogEventsList.php
@@ -38,7 +38,7 @@
3939 private function preCacheMessages() {
4040 // Precache various messages
4141 if( !isset( $this->message ) ) {
42 - $messages = 'revertmerge protect_change unblocklink revertmove undeletelink revdel-restore rev-delundel hist';
 42+ $messages = 'revertmerge protect_change unblocklink change-blocklink revertmove undeletelink revdel-restore rev-delundel hist';
4343 foreach( explode( ' ', $messages ) as $msg ) {
4444 $this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
4545 }
@@ -267,11 +267,19 @@
268268 } else if( self::typeAction($row,array('delete','suppress'),'delete') && $wgUser->isAllowed( 'delete' ) ) {
269269 $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Undelete' ),
270270 $this->message['undeletelink'], 'target='. urlencode( $title->getPrefixedDBkey() ) ) . ')';
271 - // Show unblock link
272 - } else if( self::typeAction($row,array('block','suppress'),'block') && $wgUser->isAllowed( 'block' ) ) {
273 - $revert = '(' . $this->skin->makeKnownLinkObj( SpecialPage::getTitleFor( 'Ipblocklist' ),
274 - $this->message['unblocklink'],
275 - 'action=unblock&ip=' . urlencode( $row->log_title ) ) . ')';
 271+ // Show unblock/change block link
 272+ } else if( self::typeAction( $row, array( 'block', 'suppress' ), 'block' ) && $wgUser->isAllowed( 'block' ) ) {
 273+ $revert = '(' .
 274+ $this->skin->link( SpecialPage::getTitleFor( 'Ipblocklist' ),
 275+ $this->message['unblocklink'],
 276+ array(),
 277+ array( 'action' => 'unblock', 'ip' => urlencode( $row->log_title ) ),
 278+ 'known' )
 279+ . ' ' . wfMsg( 'pipe-separator' ) . ' ' .
 280+ $this->skin->link( SpecialPage::getTitleFor( 'BlockIP/' . htmlspecialchars( $row->log_title ) ),
 281+ $this->message['change-blocklink'],
 282+ array(), array(), 'known' ) .
 283+ ')';
276284 // Show change protection link
277285 } else if( self::typeAction($row,'protect',array('modify','protect','unprotect')) ) {
278286 $revert .= ' (' . $this->skin->makeKnownLinkObj( $title, $this->message['hist'],
Index: trunk/phase3/includes/specials/SpecialIpblocklist.php
@@ -374,7 +374,7 @@
375375 $sk = $wgUser->getSkin();
376376 if( is_null( $msg ) ) {
377377 $msg = array();
378 - $keys = array( 'infiniteblock', 'expiringblock', 'unblocklink',
 378+ $keys = array( 'infiniteblock', 'expiringblock', 'unblocklink', 'change-blocklink',
379379 'anononlyblock', 'createaccountblock', 'noautoblockblock', 'emailblock', 'blocklist-nousertalk' );
380380 foreach( $keys as $key ) {
381381 $msg[$key] = wfMsgHtml( $key );
@@ -423,9 +423,22 @@
424424 $line = wfMsgReplaceArgs( $msg['blocklistline'], array( $formattedTime, $blocker, $target, $properties ) );
425425
426426 $unblocklink = '';
427 - if ( $wgUser->isAllowed('block') ) {
428 - $titleObj = SpecialPage::getTitleFor( "Ipblocklist" );
429 - $unblocklink = ' (' . $sk->makeKnownLinkObj($titleObj, $msg['unblocklink'], 'action=unblock&id=' . urlencode( $block->mId ) ) . ')';
 427+ $changeblocklink = '';
 428+ if ( $wgUser->isAllowed( 'block' ) ) {
 429+ $unblocklink = $sk->link( SpecialPage::getTitleFor( 'Ipblocklist' ),
 430+ $msg['unblocklink'],
 431+ array(),
 432+ array( 'action' => 'unblock', 'id' => urlencode( $block->mId ) ),
 433+ 'known' );
 434+
 435+ # Create changeblocklink for all blocks with exception of autoblocks
 436+ if( !$block->mAuto ) {
 437+ $changeblocklink = ' ' . wfMsg( 'pipe-separator' ) . ' ' .
 438+ $sk->link( SpecialPage::getTitleFor( 'BlockIP/' . htmlspecialchars( $block->mAddress ) ),
 439+ $msg['change-blocklink'],
 440+ array(), array(), 'known' );
 441+ }
 442+ $toolLinks = "($unblocklink$changeblocklink)";
430443 }
431444
432445 $comment = $sk->commentBlock( $block->mReason );
@@ -435,7 +448,7 @@
436449 $s = '<span class="history-deleted">' . $s . '</span>';
437450
438451 wfProfileOut( __METHOD__ );
439 - return "<li>$s $unblocklink</li>\n";
 452+ return "<li>$s $toolLinks</li>\n";
440453 }
441454 }
442455
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -2616,6 +2616,7 @@
26172617 'ipblocklist-no-results' => 'The requested IP address or username is not blocked.',
26182618 'blocklink' => 'block',
26192619 'unblocklink' => 'unblock',
 2620+'change-blocklink' => 'change block',
26202621 'contribslink' => 'contribs',
26212622 'autoblocker' => 'Autoblocked because your IP address has been recently used by "[[User:$1|$1]]".
26222623 The reason given for $1\'s block is: "$2"',
Index: trunk/phase3/RELEASE-NOTES
@@ -232,6 +232,7 @@
233233 * File objects returned by wfFindFile() are now cached by default
234234 * (bug 7492) Rights can now be assigned to specific IP addresses and ranges by
235235 using $wgAutopromote (new defines: APCOND_ISIP and APCOND_IPINRANGE)
 236+* Add a 'change block' link to Special:IPBlockList und Special:Log
236237
237238 === Bug fixes in 1.14 ===
238239

Follow-up revisions

RevisionCommit summaryAuthorDate
r44667Fix for r44657: correct usage of SpecialPage::getTitleFor()ialex11:41, 16 December 2008
r44695Fix broken and double escaping in r44657.werdna00:00, 17 December 2008

Comments

#Comment by Brion VIBBER (talk | contribs)   23:18, 16 December 2008

Links are mis-encoded...

#Comment by Werdna (talk | contribs)   00:03, 17 December 2008

Should be fixed up in r44695.

Status & tagging log