r40873 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40872‎ | r40873 | r40874 >
Date:19:36, 15 September 2008
Author:brion
Status:old
Tags:
Comment:
Code review UI updates:
* apply bug/rev link formatting to table list
* drop <code> from commit messages
* link to ViewVC for path lists
Modified paths:
  • /trunk/extensions/CodeReview/SpecialCode.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/SpecialCode.php
@@ -74,7 +74,7 @@
7575 $value = nl2br( htmlspecialchars( $value ) );
7676 $value = preg_replace_callback( '/\br(\d+)\b/', array( $this, 'messageRevLink' ), $value );
7777 $value = preg_replace_callback( '/\bbug (\d+)\b/i', array( $this, 'messageBugLink' ), $value );
78 - return "<code>$value</code>";
 78+ return $value;
7979 }
8080
8181 function messageBugLink( $arr ){
@@ -100,7 +100,7 @@
101101 $lines = explode( "\n", $message, 2 );
102102 $first = $lines[0];
103103 $trimmed = $wgLang->truncate( $first, 60, '...' );
104 - return htmlspecialchars( $trimmed );
 104+ return $this->formatMessage( $trimmed );
105105 }
106106 }
107107
@@ -214,9 +214,7 @@
215215 $paths = '';
216216 $modifiedPaths = $this->mRev->getModifiedPaths();
217217 foreach( $modifiedPaths as $row ){
218 - $action = wfMsgHtml( 'code-rev-modified-'.strtolower( $row->cp_action ) );
219 - $encPath = htmlspecialchars( $row->cp_path );
220 - $paths .= "<li>$encPath ($action)</li>\n";
 218+ $paths .= $this->formatPathLine( $row->cp_path, $row->cp_action );
221219 }
222220 if( $paths ){
223221 $paths = "<ul>\n$paths</ul>";
@@ -230,4 +228,20 @@
231229 </table>';
232230 $wgOut->addHtml( $html );
233231 }
 232+
 233+ function formatPathLine( $path, $action ) {
 234+ $desc = wfMsgHtml( 'code-rev-modified-'.strtolower( $action ) );
 235+ $encPath = htmlspecialchars( $path );
 236+ $viewvc = $this->mRepo->getViewVcBase();
 237+ if( $viewvc ) {
 238+ $rev = $this->mRev->getId();
 239+ $safePath = wfUrlEncode( $path );
 240+ $link = $this->mSkin->makeExternalLink(
 241+ "$viewvc$safePath?view=markup&pathrev=$rev",
 242+ $encPath );
 243+ } else {
 244+ $link = $encPath;
 245+ }
 246+ return "<li>$link ($desc)</li>\n";
 247+ }
234248 }

Status & tagging log