r82302 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82301‎ | r82302 | r82303 >
Date:21:58, 16 February 2011
Author:reedy
Status:ok
Tags:
Comment:
Revert r82299

*grumble objects* *grumble arrays*
Modified paths:
  • /trunk/extensions/CodeReview/ui/CodeRevisionView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php
@@ -2,6 +2,9 @@
33
44 // Special:Code/MediaWiki/40696
55 class CodeRevisionView extends CodeView {
 6+
 7+ protected $showButtonsFormatReference = false, $showButtonsFormatSignoffs = false;
 8+
69 /**
710 * @param string|CodeRepository $repo
811 * @param string|CodeRevision $rev
@@ -456,13 +459,14 @@
457460
458461 /**
459462 * Format the sign-offs table
460 - * @param $signOffs Array
461463 * @param $showButtons bool Whether the buttons to strike and submit sign-offs should be shown
462464 * @return string HTML
463465 */
464466 protected function formatSignoffs( $signOffs, $showButtons ) {
465 - array_walk( $signOffs, array( $this, 'formatSignoffInline' ), $showButtons );
466 - $signoffs = implode( "\n", $signOffs );
 467+ $this->showButtonsFormatSignoffs = $showButtons;
 468+ $signoffs = implode( "\n",
 469+ array_map( array( $this, 'formatSignoffInline' ), $signOffs )
 470+ );
467471
468472 $header = '';
469473 if ( $showButtons ) {
@@ -498,14 +502,11 @@
499503 return "<ul class='mw-codereview-changes'>$changes</ul>";
500504 }
501505
502 - /**
503 - * @param $references Array
504 - * @param $showButtons Bool
505 - * @return string
506 - */
507506 protected function formatReferences( $references, $showButtons ) {
508 - array_walk( $references, array( $this, 'formatReferenceInline' ), $showButtons );
509 - $refs = implode( "\n", $references );
 507+ $this->showButtonsFormatReference = $showButtons;
 508+ $refs = implode( "\n",
 509+ array_map( array( $this, 'formatReferenceInline' ), $references )
 510+ );
510511
511512 $header = '';
512513 if ( $showButtons ) {
@@ -522,10 +523,9 @@
523524 /**
524525 * Format a single sign-off row. Helper function for formatSignoffs()
525526 * @param $signoff CodeSignoff
526 - * @param $showButtons Bool
527527 * @return string HTML
528528 */
529 - protected function formatSignoffInline( $signoff, $showButtons ) {
 529+ protected function formatSignoffInline( $signoff ) {
530530 global $wgLang;
531531 $user = $this->skin->userLink( $signoff->user, $signoff->userText );
532532 $flag = htmlspecialchars( $signoff->flag );
@@ -540,7 +540,7 @@
541541 }
542542
543543 $ret = "<tr class='$class'>";
544 - if ( $showButtons ) {
 544+ if ( $this->showButtonsFormatSignoffs ) {
545545 $checkbox = Html::input( 'wpSignoffs[]', $signoff->getID(), 'checkbox' );
546546 $ret .= "<td>$checkbox</td>";
547547 }
@@ -602,7 +602,7 @@
603603 return "<li>$line</li>";
604604 }
605605
606 - protected function formatReferenceInline( $row, $showButtons ) {
 606+ protected function formatReferenceInline( $row ) {
607607 global $wgLang;
608608 $rev = intval( $row->cr_id );
609609 $repo = $this->mRepo->getName();
@@ -615,7 +615,7 @@
616616 $author = $this->authorLink( $row->cr_author );
617617
618618 $ret = "<tr class='$css'>";
619 - if ( $showButtons ) {
 619+ if ( $this->showButtonsFormatReference ) {
620620 $checkbox = Html::input( 'wpReferences[]', $rev, 'checkbox' );
621621 $ret .= "<td>$checkbox</td>";
622622 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82299Followup r82146...reedy21:45, 16 February 2011

Status & tagging log