Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php |
— | — | @@ -2,6 +2,9 @@ |
3 | 3 | |
4 | 4 | // Special:Code/MediaWiki/40696 |
5 | 5 | class CodeRevisionView extends CodeView { |
| 6 | + |
| 7 | + protected $showButtonsFormatReference = false, $showButtonsFormatSignoffs = false; |
| 8 | + |
6 | 9 | /** |
7 | 10 | * @param string|CodeRepository $repo |
8 | 11 | * @param string|CodeRevision $rev |
— | — | @@ -456,13 +459,14 @@ |
457 | 460 | |
458 | 461 | /** |
459 | 462 | * Format the sign-offs table |
460 | | - * @param $signOffs Array |
461 | 463 | * @param $showButtons bool Whether the buttons to strike and submit sign-offs should be shown |
462 | 464 | * @return string HTML |
463 | 465 | */ |
464 | 466 | 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 | + ); |
467 | 471 | |
468 | 472 | $header = ''; |
469 | 473 | if ( $showButtons ) { |
— | — | @@ -498,14 +502,11 @@ |
499 | 503 | return "<ul class='mw-codereview-changes'>$changes</ul>"; |
500 | 504 | } |
501 | 505 | |
502 | | - /** |
503 | | - * @param $references Array |
504 | | - * @param $showButtons Bool |
505 | | - * @return string |
506 | | - */ |
507 | 506 | 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 | + ); |
510 | 511 | |
511 | 512 | $header = ''; |
512 | 513 | if ( $showButtons ) { |
— | — | @@ -522,10 +523,9 @@ |
523 | 524 | /** |
524 | 525 | * Format a single sign-off row. Helper function for formatSignoffs() |
525 | 526 | * @param $signoff CodeSignoff |
526 | | - * @param $showButtons Bool |
527 | 527 | * @return string HTML |
528 | 528 | */ |
529 | | - protected function formatSignoffInline( $signoff, $showButtons ) { |
| 529 | + protected function formatSignoffInline( $signoff ) { |
530 | 530 | global $wgLang; |
531 | 531 | $user = $this->skin->userLink( $signoff->user, $signoff->userText ); |
532 | 532 | $flag = htmlspecialchars( $signoff->flag ); |
— | — | @@ -540,7 +540,7 @@ |
541 | 541 | } |
542 | 542 | |
543 | 543 | $ret = "<tr class='$class'>"; |
544 | | - if ( $showButtons ) { |
| 544 | + if ( $this->showButtonsFormatSignoffs ) { |
545 | 545 | $checkbox = Html::input( 'wpSignoffs[]', $signoff->getID(), 'checkbox' ); |
546 | 546 | $ret .= "<td>$checkbox</td>"; |
547 | 547 | } |
— | — | @@ -602,7 +602,7 @@ |
603 | 603 | return "<li>$line</li>"; |
604 | 604 | } |
605 | 605 | |
606 | | - protected function formatReferenceInline( $row, $showButtons ) { |
| 606 | + protected function formatReferenceInline( $row ) { |
607 | 607 | global $wgLang; |
608 | 608 | $rev = intval( $row->cr_id ); |
609 | 609 | $repo = $this->mRepo->getName(); |
— | — | @@ -615,7 +615,7 @@ |
616 | 616 | $author = $this->authorLink( $row->cr_author ); |
617 | 617 | |
618 | 618 | $ret = "<tr class='$css'>"; |
619 | | - if ( $showButtons ) { |
| 619 | + if ( $this->showButtonsFormatReference ) { |
620 | 620 | $checkbox = Html::input( 'wpReferences[]', $rev, 'checkbox' ); |
621 | 621 | $ret .= "<td>$checkbox</td>"; |
622 | 622 | } |