Index: trunk/extensions/CodeReview/CodeRevision.php |
— | — | @@ -334,16 +334,37 @@ |
335 | 335 | 'cr_id', |
336 | 336 | array( |
337 | 337 | 'cr_repo_id' => $this->mRepo, |
338 | | - "cr_id>$encId" ), |
| 338 | + "cr_id > $encId" ), |
339 | 339 | __METHOD__, |
340 | 340 | array( |
341 | 341 | 'ORDER BY' => 'cr_repo_id, cr_id', |
342 | 342 | 'LIMIT' => 1 ) ); |
343 | 343 | |
344 | 344 | if( $row ) { |
345 | | - return $row->cr_id; |
| 345 | + return intval($row->cr_id); |
346 | 346 | } else { |
347 | 347 | return false; |
348 | 348 | } |
349 | 349 | } |
| 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 | + } |
350 | 371 | } |
Index: trunk/extensions/CodeReview/CodeReview.i18n.php |
— | — | @@ -64,6 +64,7 @@ |
65 | 65 | 'code-status-ok' => 'ok', |
66 | 66 | 'code-status-deferred' => 'deferred', |
67 | 67 | 'code-rev-submit' => 'Commit changes', |
| 68 | + 'code-rev-submit-next' => 'Commit & next unresolved', |
68 | 69 | |
69 | 70 | 'codereview-reply-link' => 'reply', |
70 | 71 | |
Index: trunk/extensions/CodeReview/SpecialCode.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | $view = new CodeRevisionListView( $params[0] ); |
25 | 25 | break; |
26 | 26 | case 2: |
27 | | - if( $wgRequest->wasPosted() && $wgRequest->getCheck('wpSave') ) { |
| 27 | + if( $wgRequest->wasPosted() && !$wgRequest->getCheck('wpPreview') ) { |
28 | 28 | # Add any tags, Set status, Adds comments |
29 | 29 | $submit = new CodeRevisionCommitter( $params[0], $params[1] ); |
30 | 30 | $submit->execute(); |
Index: trunk/extensions/CodeReview/CodeRevisionCommitter.php |
— | — | @@ -11,6 +11,7 @@ |
12 | 12 | $this->mRemoveTags = $this->splitTags( $wgRequest->getText( 'wpRemoveTag' ) ); |
13 | 13 | $this->mStatus = $wgRequest->getText( 'wpStatus' ); |
14 | 14 | $this->text = $wgRequest->getText( "wpReply{$this->mReplyTarget}" ); |
| 15 | + $this->jumpToNext = $wgRequest->getCheck('wpSaveAndNext'); |
15 | 16 | } |
16 | 17 | |
17 | 18 | function execute() { |
— | — | @@ -30,13 +31,23 @@ |
31 | 32 | $isPreview = $wgRequest->getCheck( 'wpPreview' ); |
32 | 33 | $id = $this->mRev->saveComment( $this->text, $review, $parent ); |
33 | 34 | // 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 | + } |
37 | 40 | } |
38 | 41 | // 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() ); |
41 | 52 | } |
42 | 53 | |
43 | 54 | function splitTags( $input ) { |
Index: trunk/extensions/CodeReview/CodeRevisionView.php |
— | — | @@ -55,6 +55,8 @@ |
56 | 56 | $html .= '<div>' . |
57 | 57 | Xml::submitButton( wfMsg( 'code-rev-submit' ), array( 'name' => 'wpSave' ) ) . |
58 | 58 | ' ' . |
| 59 | + Xml::submitButton( wfMsg( 'code-rev-submit-next' ), array( 'name' => 'wpSaveAndNext' ) ) . |
| 60 | + ' ' . |
59 | 61 | Xml::submitButton( wfMsg( 'code-rev-comment-preview' ), array( 'name' => 'wpPreview' ) ) . |
60 | 62 | '</div>'; |
61 | 63 | |
— | — | @@ -83,6 +85,8 @@ |
84 | 86 | $html .= '<div>' . |
85 | 87 | Xml::submitButton( wfMsg( 'code-rev-submit' ), array( 'name' => 'wpSave' ) ) . |
86 | 88 | ' ' . |
| 89 | + Xml::submitButton( wfMsg( 'code-rev-submit-next' ), array( 'name' => 'wpSaveAndNext' ) ) . |
| 90 | + ' ' . |
87 | 91 | Xml::submitButton( wfMsg( 'code-rev-comment-preview' ), array( 'name' => 'wpPreview' ) ) . |
88 | 92 | '</div>' . |
89 | 93 | '</form>'; |