r41960 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41959‎ | r41960 | r41961 >
Date:06:13, 11 October 2008
Author:aaron
Status:old
Tags:
Comment:
Add 'commit & next' button
Modified paths:
  • /trunk/extensions/CodeReview/CodeReview.i18n.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeRevision.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeRevisionCommitter.php (modified) (history)
  • /trunk/extensions/CodeReview/CodeRevisionView.php (modified) (history)
  • /trunk/extensions/CodeReview/SpecialCode.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeRevision.php
@@ -334,16 +334,37 @@
335335 'cr_id',
336336 array(
337337 'cr_repo_id' => $this->mRepo,
338 - "cr_id>$encId" ),
 338+ "cr_id > $encId" ),
339339 __METHOD__,
340340 array(
341341 'ORDER BY' => 'cr_repo_id, cr_id',
342342 'LIMIT' => 1 ) );
343343
344344 if( $row ) {
345 - return $row->cr_id;
 345+ return intval($row->cr_id);
346346 } else {
347347 return false;
348348 }
349349 }
 350+
 351+ function getNextUnresolved() {
 352+ $dbr = wfGetDB( DB_SLAVE );
 353+ $encId = $dbr->addQuotes( $this->mId );
 354+ $row = $dbr->selectRow( 'code_rev',
 355+ 'cr_id',
 356+ array(
 357+ 'cr_repo_id' => $this->mRepo,
 358+ "cr_id > $encId",
 359+ 'cr_status' => array('new','fixme') ),
 360+ __METHOD__,
 361+ array(
 362+ 'ORDER BY' => 'cr_repo_id, cr_id',
 363+ 'LIMIT' => 1 ) );
 364+
 365+ if( $row ) {
 366+ return intval($row->cr_id);
 367+ } else {
 368+ return false;
 369+ }
 370+ }
350371 }
Index: trunk/extensions/CodeReview/CodeReview.i18n.php
@@ -64,6 +64,7 @@
6565 'code-status-ok' => 'ok',
6666 'code-status-deferred' => 'deferred',
6767 'code-rev-submit' => 'Commit changes',
 68+ 'code-rev-submit-next' => 'Commit & next unresolved',
6869
6970 'codereview-reply-link' => 'reply',
7071
Index: trunk/extensions/CodeReview/SpecialCode.php
@@ -23,7 +23,7 @@
2424 $view = new CodeRevisionListView( $params[0] );
2525 break;
2626 case 2:
27 - if( $wgRequest->wasPosted() && $wgRequest->getCheck('wpSave') ) {
 27+ if( $wgRequest->wasPosted() && !$wgRequest->getCheck('wpPreview') ) {
2828 # Add any tags, Set status, Adds comments
2929 $submit = new CodeRevisionCommitter( $params[0], $params[1] );
3030 $submit->execute();
Index: trunk/extensions/CodeReview/CodeRevisionCommitter.php
@@ -11,6 +11,7 @@
1212 $this->mRemoveTags = $this->splitTags( $wgRequest->getText( 'wpRemoveTag' ) );
1313 $this->mStatus = $wgRequest->getText( 'wpStatus' );
1414 $this->text = $wgRequest->getText( "wpReply{$this->mReplyTarget}" );
 15+ $this->jumpToNext = $wgRequest->getCheck('wpSaveAndNext');
1516 }
1617
1718 function execute() {
@@ -30,13 +31,23 @@
3132 $isPreview = $wgRequest->getCheck( 'wpPreview' );
3233 $id = $this->mRev->saveComment( $this->text, $review, $parent );
3334 // For comments, take us back to the rev page focused on the new comment
34 - $permaLink = $this->commentLink( $id );
35 - $wgOut->redirect( $permaLink->getFullUrl() );
36 - return;
 35+ if( !$this->jumpToNext ) {
 36+ $permaLink = $this->commentLink( $id );
 37+ $wgOut->redirect( $permaLink->getFullUrl() );
 38+ return;
 39+ }
3740 }
3841 // Return to rev page
39 - $permaLink = $this->revLink();
40 - $wgOut->redirect( $permaLink->getFullUrl() );
 42+ if( $this->jumpToNext ) {
 43+ if( $next = $this->mRev->getNextUnresolved() ) {
 44+ $redirTitle = SpecialPage::getTitleFor( 'Code', $this->mRepo->getName().'/'.$next );
 45+ } else {
 46+ $redirTitle = SpecialPage::getTitleFor( 'Code', $this->mRepo->getName() );
 47+ }
 48+ } else {
 49+ $redirTitle = $this->revLink();
 50+ }
 51+ $wgOut->redirect( $redirTitle->getFullUrl() );
4152 }
4253
4354 function splitTags( $input ) {
Index: trunk/extensions/CodeReview/CodeRevisionView.php
@@ -55,6 +55,8 @@
5656 $html .= '<div>' .
5757 Xml::submitButton( wfMsg( 'code-rev-submit' ), array( 'name' => 'wpSave' ) ) .
5858 ' ' .
 59+ Xml::submitButton( wfMsg( 'code-rev-submit-next' ), array( 'name' => 'wpSaveAndNext' ) ) .
 60+ ' ' .
5961 Xml::submitButton( wfMsg( 'code-rev-comment-preview' ), array( 'name' => 'wpPreview' ) ) .
6062 '</div>';
6163
@@ -83,6 +85,8 @@
8486 $html .= '<div>' .
8587 Xml::submitButton( wfMsg( 'code-rev-submit' ), array( 'name' => 'wpSave' ) ) .
8688 ' ' .
 89+ Xml::submitButton( wfMsg( 'code-rev-submit-next' ), array( 'name' => 'wpSaveAndNext' ) ) .
 90+ ' ' .
8791 Xml::submitButton( wfMsg( 'code-rev-comment-preview' ), array( 'name' => 'wpPreview' ) ) .
8892 '</div>' .
8993 '</form>';

Status & tagging log