r77937 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77936‎ | r77937 | r77938 >
Date:00:50, 7 December 2010
Author:reedy
Status:ok
Tags:
Comment:
Technically reverting r77935, making r77839 live again (Confusing, eh? Good job, I am)

formatRevValue was only used in one case, so create a definition of this in SpecialCode, and if it's not overridden (so basically, only in CodeRevisionListView), have it just call formatValue like was originally wanted

Job done, duplication removed. Wasn't that hard, was it?
Modified paths:
  • /trunk/extensions/CodeReview/ui/CodeRevisionListView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/SpecialCode.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/ui/SpecialCode.php
@@ -226,6 +226,10 @@
227227 return $field == $this->getDefaultSort();
228228 }
229229
 230+ function formatRevValue( $name, $value, $row ) {
 231+ return $this->formatValue( $name, $value );
 232+ }
 233+
230234 // Note: this function is poorly factored in the parent class
231235 function formatRow( $row ) {
232236 $css = "mw-codereview-status-{$row->cr_status}";
@@ -235,7 +239,7 @@
236240 $this->mCurrentRow = $row; # In case formatValue needs to know
237241 foreach ( $fieldNames as $field => $name ) {
238242 $value = isset( $row->$field ) ? $row->$field : null;
239 - $formatted = strval( $this->formatValue( $field, $value ) );
 243+ $formatted = strval( $this->formatRevValue( $field, $value, $row ) );
240244 if ( $formatted == '' ) {
241245 $formatted = ' ';
242246 }
Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php
@@ -354,27 +354,6 @@
355355 }
356356 }
357357
358 - // Note: this function is poorly factored in the parent class
359 - function formatRow( $row ) {
360 - global $wgWikiSVN;
361 - $css = "mw-codereview-status-{$row->cr_status}";
362 - $s = "<tr class=\"$css\">\n";
363 - // Some of this stolen from Pager.php...sigh
364 - $fieldNames = $this->getFieldNames();
365 - $this->mCurrentRow = $row; # In case formatValue needs to know
366 - foreach ( $fieldNames as $field => $name ) {
367 - $value = isset( $row->$field ) ? $row->$field : null;
368 - $formatted = strval( $this->formatRevValue( $field, $value, $row ) );
369 - if ( $formatted == '' ) {
370 - $formatted = '&#160;';
371 - }
372 - $class = 'TablePager_col_' . htmlspecialchars( $field );
373 - $s .= "<td class=\"$class\">$formatted</td>\n";
374 - }
375 - $s .= "</tr>\n";
376 - return $s;
377 - }
378 -
379358 function getTitle() {
380359 return SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() );
381360 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r77839abstract class SvnTablePager extends TablePager...reedy22:49, 5 December 2010
r77935Revert r77839, tiny subtle change is subtle...reedy00:31, 7 December 2010

Status & tagging log