Index: trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | } |
17 | 17 | |
18 | 18 | $commentId = $this->revisionUpdate( $this->mStatus, $this->mAddTags, $this->mRemoveTags, |
19 | | - $this->mSignoffFlags, $this->mStrikeSignoffs, $this->mAddReference, $this->mRemoveReferences, |
| 19 | + $this->mSignoffFlags, $this->mStrikeSignoffs, $this->mAddReferences, $this->mRemoveReferences, |
20 | 20 | $this->text, $wgRequest->getIntOrNull( 'wpParent' ), |
21 | 21 | $wgRequest->getInt( 'wpReview' ) |
22 | 22 | ); |
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php |
— | — | @@ -4,6 +4,7 @@ |
5 | 5 | class CodeRevisionView extends CodeView { |
6 | 6 | |
7 | 7 | protected $showButtonsFormatReference = false, $showButtonsFormatSignoffs = false; |
| 8 | + protected $referenceInputName = ''; |
8 | 9 | |
9 | 10 | /** |
10 | 11 | * @param string|CodeRepository $repo |
— | — | @@ -48,8 +49,8 @@ |
49 | 50 | $this->mStrikeSignoffs = $wgRequest->getCheck( 'wpStrikeSignoffs' ) ? |
50 | 51 | $this->mSelectedSignoffs : array(); |
51 | 52 | |
52 | | - $this->mAddReference = $wgRequest->getCheck( 'wpAddReferenceSubmit' ) |
53 | | - ? $this->stringToRevList( $wgRequest->getText( 'wpAddReference' ) ) |
| 53 | + $this->mAddReferences = $wgRequest->getCheck( 'wpAddReferencesSubmit' ) |
| 54 | + ? $this->stringToRevList( $wgRequest->getText( 'wpAddReferences' ) ) |
54 | 55 | : array(); |
55 | 56 | |
56 | 57 | $this->mRemoveReferences = $wgRequest->getCheck( 'wpRemoveReferences' ) ? |
— | — | @@ -75,7 +76,6 @@ |
76 | 77 | |
77 | 78 | function execute() { |
78 | 79 | global $wgOut, $wgLang; |
79 | | - global $wgCodeReviewInlineComments; |
80 | 80 | if ( !$this->mRepo ) { |
81 | 81 | $view = new CodeRepoListView(); |
82 | 82 | $view->execute(); |
— | — | @@ -183,13 +183,13 @@ |
184 | 184 | $references = $this->mRev->getFollowupRevisions(); |
185 | 185 | if ( count( $references ) || $userCanAssociate ) { |
186 | 186 | $html .= "<h2 id='code-references'>" . wfMsgHtml( 'code-references' ) . |
187 | | - "</h2>\n" . $this->formatReferences( $references, $userCanAssociate ); |
| 187 | + "</h2>\n" . $this->formatReferences( $references, $userCanAssociate, 'References' ); |
188 | 188 | } |
189 | 189 | |
190 | 190 | $referenced = $this->mRev->getFollowedUpRevisions(); |
191 | | - if ( count( $referenced ) ) { |
192 | | - $html .= "<h2 id='code-references'>" . wfMsgHtml( 'code-referenced' ) . |
193 | | - "</h2>\n" . $this->formatReferences( $referenced, false ); |
| 191 | + if ( count( $referenced ) || $userCanAssociate ) { |
| 192 | + $html .= "<h2 id='code-referenced'>" . wfMsgHtml( 'code-referenced' ) . |
| 193 | + "</h2>\n" . $this->formatReferences( $referenced, /*$userCanAssociate*/false, 'Referenced' ); |
194 | 194 | } |
195 | 195 | |
196 | 196 | # Add revision comments |
— | — | @@ -608,8 +608,9 @@ |
609 | 609 | * @param $showButtons bool |
610 | 610 | * @return string |
611 | 611 | */ |
612 | | - protected function formatReferences( $references, $showButtons ) { |
| 612 | + protected function formatReferences( $references, $showButtons, $inputName ) { |
613 | 613 | $this->showButtonsFormatReference = $showButtons; |
| 614 | + $this->referenceInputName = $inputName; |
614 | 615 | $refs = implode( "\n", |
615 | 616 | array_map( array( $this, 'formatReferenceInline' ), $references ) |
616 | 617 | ); |
— | — | @@ -622,7 +623,7 @@ |
623 | 624 | $header .= '<th>' . wfMsgHtml( 'code-field-message' ) . '</th>'; |
624 | 625 | $header .= '<th>' . wfMsgHtml( 'code-field-author' ) . '</th>'; |
625 | 626 | $header .= '<th>' . wfMsgHtml( 'code-field-timestamp' ) . '</th>'; |
626 | | - $buttonrow = $showButtons ? $this->referenceButtons() : ''; |
| 627 | + $buttonrow = $showButtons ? $this->referenceButtons( $inputName ) : ''; |
627 | 628 | return "<table border='1' class='wikitable'><tr>{$header}</tr>{$refs}{$buttonrow}</table>"; |
628 | 629 | } |
629 | 630 | |
— | — | @@ -726,7 +727,7 @@ |
727 | 728 | |
728 | 729 | $ret = "<tr class='$css'>"; |
729 | 730 | if ( $this->showButtonsFormatReference ) { |
730 | | - $checkbox = Html::input( 'wpReferences[]', $rev, 'checkbox' ); |
| 731 | + $checkbox = Html::input( "wp{$this->referenceInputName}[]", $rev, 'checkbox' ); |
731 | 732 | $ret .= "<td>$checkbox</td>"; |
732 | 733 | } |
733 | 734 | $ret .= "<td>$revLink</td><td>$summary</td><td>$author</td><td>$date</td></tr>"; |
— | — | @@ -911,14 +912,15 @@ |
912 | 913 | /** |
913 | 914 | * Render the bottom row of the follow-up revisions table containing the buttons and |
914 | 915 | * textbox to add and remove follow-up associations |
| 916 | + * @param $inputName string |
915 | 917 | * @return string HTML |
916 | 918 | */ |
917 | | - protected function referenceButtons() { |
918 | | - $removeButton = Xml::submitButton( wfMsg( 'code-reference-remove' ), array( 'name' => 'wpRemoveReferences' ) ); |
| 919 | + protected function referenceButtons( $inputName ) { |
| 920 | + $removeButton = Xml::submitButton( wfMsg( 'code-reference-remove' ), array( 'name' => "wpRemove{$inputName}" ) ); |
919 | 921 | $associateText = wfMsgHtml( 'code-reference-associate' ); |
920 | 922 | $associateButton = Xml::submitButton( wfMsg( 'code-reference-associate-submit' ), |
921 | | - array( 'name' => 'wpAddReferenceSubmit' ) ); |
922 | | - $textbox = Html::input( 'wpAddReference' ); |
| 923 | + array( 'name' => "wpAdd{$inputName}Submit" ) ); |
| 924 | + $textbox = Html::input( "wpAdd{$inputName}" ); |
923 | 925 | return "<tr class='mw-codereview-associatebuttons'><td colspan='5'>$removeButton " . |
924 | 926 | "<div class='mw-codereview-associateform'>$associateText $textbox $associateButton</div></td></tr>"; |
925 | 927 | } |