r108920 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108919‎ | r108920 | r108921 >
Date:17:02, 14 January 2012
Author:reedy
Status:ok
Tags:
Comment:
Few more bits of refactoring for bug 33713
Modified paths:
  • /trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php
@@ -15,7 +15,7 @@
1616 }
1717
1818 $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,
2020 $this->text, $wgRequest->getIntOrNull( 'wpParent' ),
2121 $wgRequest->getInt( 'wpReview' )
2222 );
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php
@@ -4,6 +4,7 @@
55 class CodeRevisionView extends CodeView {
66
77 protected $showButtonsFormatReference = false, $showButtonsFormatSignoffs = false;
 8+ protected $referenceInputName = '';
89
910 /**
1011 * @param string|CodeRepository $repo
@@ -48,8 +49,8 @@
4950 $this->mStrikeSignoffs = $wgRequest->getCheck( 'wpStrikeSignoffs' ) ?
5051 $this->mSelectedSignoffs : array();
5152
52 - $this->mAddReference = $wgRequest->getCheck( 'wpAddReferenceSubmit' )
53 - ? $this->stringToRevList( $wgRequest->getText( 'wpAddReference' ) )
 53+ $this->mAddReferences = $wgRequest->getCheck( 'wpAddReferencesSubmit' )
 54+ ? $this->stringToRevList( $wgRequest->getText( 'wpAddReferences' ) )
5455 : array();
5556
5657 $this->mRemoveReferences = $wgRequest->getCheck( 'wpRemoveReferences' ) ?
@@ -75,7 +76,6 @@
7677
7778 function execute() {
7879 global $wgOut, $wgLang;
79 - global $wgCodeReviewInlineComments;
8080 if ( !$this->mRepo ) {
8181 $view = new CodeRepoListView();
8282 $view->execute();
@@ -183,13 +183,13 @@
184184 $references = $this->mRev->getFollowupRevisions();
185185 if ( count( $references ) || $userCanAssociate ) {
186186 $html .= "<h2 id='code-references'>" . wfMsgHtml( 'code-references' ) .
187 - "</h2>\n" . $this->formatReferences( $references, $userCanAssociate );
 187+ "</h2>\n" . $this->formatReferences( $references, $userCanAssociate, 'References' );
188188 }
189189
190190 $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' );
194194 }
195195
196196 # Add revision comments
@@ -608,8 +608,9 @@
609609 * @param $showButtons bool
610610 * @return string
611611 */
612 - protected function formatReferences( $references, $showButtons ) {
 612+ protected function formatReferences( $references, $showButtons, $inputName ) {
613613 $this->showButtonsFormatReference = $showButtons;
 614+ $this->referenceInputName = $inputName;
614615 $refs = implode( "\n",
615616 array_map( array( $this, 'formatReferenceInline' ), $references )
616617 );
@@ -622,7 +623,7 @@
623624 $header .= '<th>' . wfMsgHtml( 'code-field-message' ) . '</th>';
624625 $header .= '<th>' . wfMsgHtml( 'code-field-author' ) . '</th>';
625626 $header .= '<th>' . wfMsgHtml( 'code-field-timestamp' ) . '</th>';
626 - $buttonrow = $showButtons ? $this->referenceButtons() : '';
 627+ $buttonrow = $showButtons ? $this->referenceButtons( $inputName ) : '';
627628 return "<table border='1' class='wikitable'><tr>{$header}</tr>{$refs}{$buttonrow}</table>";
628629 }
629630
@@ -726,7 +727,7 @@
727728
728729 $ret = "<tr class='$css'>";
729730 if ( $this->showButtonsFormatReference ) {
730 - $checkbox = Html::input( 'wpReferences[]', $rev, 'checkbox' );
 731+ $checkbox = Html::input( "wp{$this->referenceInputName}[]", $rev, 'checkbox' );
731732 $ret .= "<td>$checkbox</td>";
732733 }
733734 $ret .= "<td>$revLink</td><td>$summary</td><td>$author</td><td>$date</td></tr>";
@@ -911,14 +912,15 @@
912913 /**
913914 * Render the bottom row of the follow-up revisions table containing the buttons and
914915 * textbox to add and remove follow-up associations
 916+ * @param $inputName string
915917 * @return string HTML
916918 */
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}" ) );
919921 $associateText = wfMsgHtml( 'code-reference-associate' );
920922 $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}" );
923925 return "<tr class='mw-codereview-associatebuttons'><td colspan='5'>$removeButton " .
924926 "<div class='mw-codereview-associateform'>$associateText $textbox $associateButton</div></td></tr>";
925927 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r108922And that should be the rest of bug 33713reedy17:13, 14 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r108907Bit of prep work for bug 33713...reedy15:25, 14 January 2012
r108911Bug 33713 - Show "previous" revisions in addition to follow-ups...reedy15:54, 14 January 2012
r108912Bug 33713 - Show "previous" revisions in addition to follow-ups...reedy15:59, 14 January 2012

Status & tagging log