Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php |
— | — | @@ -379,35 +379,35 @@ |
380 | 380 | return array( $labels, $minLevels ); |
381 | 381 | } |
382 | 382 | |
383 | | - |
384 | | - public static function ratingSubmitButtons( $frev, $disabled ) { |
| 383 | + // $synced param is used to force the review button to be usable |
| 384 | + public static function ratingSubmitButtons( $frev, $disabled, $rereview = false ) { |
385 | 385 | $disAttrib = array( 'disabled' => 'disabled' ); |
386 | 386 | # Add the submit button |
387 | 387 | if ( FlaggedRevs::binaryFlagging() ) { |
388 | 388 | # We may want to re-review to change the notes ($wgFlaggedRevsComments) |
389 | 389 | $s = Xml::submitButton( wfMsg( 'revreview-submit-review' ), |
390 | 390 | array( |
391 | | - 'id' => 'mw-fr-submitreview', |
| 391 | + 'name' => 'wpApprove', |
| 392 | + 'id' => 'mw-fr-submitreview', |
392 | 393 | 'accesskey' => wfMsg( 'revreview-ak-review' ), |
393 | | - 'name' => 'wpApprove', |
394 | | - 'title' => wfMsg( 'revreview-tt-flag' ) . ' [' . |
| 394 | + 'title' => wfMsg( 'revreview-tt-flag' ) . ' [' . |
395 | 395 | wfMsg( 'revreview-ak-review' ) . ']' |
396 | | - ) + ( $disabled ? $disAttrib : array() ) |
| 396 | + ) + ( ( $disabled || ($frev && !$rereview) ) ? $disAttrib : array() ) |
397 | 397 | ); |
398 | 398 | $s .= ' '; |
399 | 399 | $s .= Xml::submitButton( wfMsg( 'revreview-submit-unreview' ), |
400 | 400 | array( |
401 | | - 'id' => 'mw-fr-submitunreview', |
402 | 401 | 'name' => 'wpUnapprove', |
| 402 | + 'id' => 'mw-fr-submitunreview', |
403 | 403 | 'title' => wfMsg( 'revreview-tt-unflag' ) |
404 | 404 | ) + ( ( $disabled || !$frev ) ? $disAttrib : array() ) |
405 | 405 | ); |
406 | 406 | } else { |
407 | 407 | $s = Xml::submitButton( wfMsg( 'revreview-submit' ), |
408 | 408 | array( |
409 | | - 'id' => 'mw-fr-submitreview', |
| 409 | + 'id' => 'mw-fr-submitreview', |
410 | 410 | 'accesskey' => wfMsg( 'revreview-ak-review' ), |
411 | | - 'title' => wfMsg( 'revreview-tt-review' ) . ' [' . |
| 411 | + 'title' => wfMsg( 'revreview-tt-review' ) . ' [' . |
412 | 412 | wfMsg( 'revreview-ak-review' ) . ']' |
413 | 413 | ) + ( $disabled ? $disAttrib : array() ) |
414 | 414 | ); |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -61,7 +61,6 @@ |
62 | 62 | 'flagMsg' => wfMsgHtml( 'revreview-submit-review' ), |
63 | 63 | 'unflagMsg' => wfMsgHtml( 'revreview-submit-unreview' ), |
64 | 64 | 'flagLegMsg' => wfMsgHtml( 'revreview-flag' ), |
65 | | - 'reflagLegMsg' => wfMsgHtml( 'revreview-reflag' ), |
66 | 65 | 'sendingMsg' => wfMsgHtml( 'revreview-submitting' ), |
67 | 66 | 'actioncomplete' => wfMsgHtml( 'actioncomplete' ), |
68 | 67 | 'actionfailed' => wfMsgHtml( 'actionfailed' ), |
Index: trunk/extensions/FlaggedRevs/client/review.js |
— | — | @@ -61,10 +61,12 @@ |
62 | 62 | if( notebox ) { |
63 | 63 | notebox.style.display = quality ? 'inline' : 'none'; |
64 | 64 | } |
65 | | - // If only a few levels are zero, don't show submit link |
66 | | - var submit = document.getElementById('mw-fr-submitreview'); |
67 | | - if( submit ) { |
68 | | - submit.disabled = ( somezero && !allzero ) ? 'disabled' : ''; |
| 65 | + // If only a few levels are zero and there is only one |
| 66 | + // submit button (for review/unreview), then disable it. |
| 67 | + var rsubmit = document.getElementById('mw-fr-submitreview'); |
| 68 | + var usubmit = document.getElementById('mw-fr-submitunreview'); |
| 69 | + if( rsubmit && !usubmit ) { |
| 70 | + rsubmit.disabled = ( somezero && !allzero ) ? 'disabled' : ''; |
69 | 71 | } |
70 | 72 | // Clear note box data if not shown |
71 | 73 | var notes = document.getElementById('wpNotes'); |
— | — | @@ -220,12 +222,12 @@ |
221 | 223 | if( usubmit ) { |
222 | 224 | // Revision was flagged |
223 | 225 | if( rsubmit.value == wgAjaxReview.sendingMsg ) { |
224 | | - legend.innerHTML = '<strong>'+wgAjaxReview.reflagLegMsg+'</strong>'; |
| 226 | + // For template review case go from re-review to review message |
| 227 | + legend.innerHTML = '<strong>'+wgAjaxReview.flagLegMsg+'</strong>'; |
225 | 228 | rsubmit.value = wgAjaxReview.flagMsg; // back to normal |
226 | 229 | usubmit.disabled = ''; // unlock unflag button |
227 | 230 | // Revision was unflagged |
228 | 231 | } else if( usubmit.value == wgAjaxReview.sendingMsg ) { |
229 | | - legend.innerHTML = '<strong>'+wgAjaxReview.flagLegMsg+'</strong>'; |
230 | 232 | usubmit.value = wgAjaxReview.unflagMsg; // back to normal |
231 | 233 | } |
232 | 234 | } else { |
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -1438,11 +1438,11 @@ |
1439 | 1439 | # Get the revision being displayed |
1440 | 1440 | $id = $wgOut->getRevisionId(); |
1441 | 1441 | if ( !$id ) { |
1442 | | - if ( !$this->isDiffFromStable ) { |
| 1442 | + if ( $this->isDiffFromStable ) { |
| 1443 | + $rev = Revision::newFromTitle( $this->article->getTitle() ); |
| 1444 | + $id = $rev->getId(); // if diff-to-stable, we know the revision is the current |
| 1445 | + } else { |
1443 | 1446 | return false; // only safe to assume current if diff-to-stable |
1444 | | - } else { |
1445 | | - $rev = Revision::newFromTitle( $this->article->getTitle() ); |
1446 | | - $id = $rev->getId(); |
1447 | 1447 | } |
1448 | 1448 | } else { |
1449 | 1449 | $rev = Revision::newFromTitle( $this->article->getTitle(), $id ); |
— | — | @@ -1476,10 +1476,14 @@ |
1477 | 1477 | $flags = $oldFlags; |
1478 | 1478 | } |
1479 | 1479 | $reviewNotes = $srev->getComment(); |
| 1480 | + # Re-review button is need for template/file only review case |
| 1481 | + $allowRereview = ($srev->getRevId() == $id) |
| 1482 | + && !FlaggedRevs::stableVersionIsSynced( $srev, $this->article ); |
1480 | 1483 | } else { |
1481 | 1484 | $flags = $oldFlags; |
1482 | 1485 | // Get existing notes to pre-fill field |
1483 | 1486 | $reviewNotes = $frev ? $frev->getComment() : ""; |
| 1487 | + $allowRereview = false; // re-review button |
1484 | 1488 | } |
1485 | 1489 | |
1486 | 1490 | # Begin form... |
— | — | @@ -1493,7 +1497,7 @@ |
1494 | 1498 | $form .= Xml::openElement( 'fieldset', |
1495 | 1499 | array( 'class' => 'flaggedrevs_reviewform noprint' ) ); |
1496 | 1500 | # Add appropriate legend text |
1497 | | - $legendMsg = ( FlaggedRevs::binaryFlagging() && $frev ) |
| 1501 | + $legendMsg = ( FlaggedRevs::binaryFlagging() && $allowRereview ) |
1498 | 1502 | ? 'revreview-reflag' |
1499 | 1503 | : 'revreview-flag'; |
1500 | 1504 | $form .= Xml::openElement( 'legend', array( 'id' => 'mw-fr-reviewformlegend' ) ); |
— | — | @@ -1569,7 +1573,7 @@ |
1570 | 1574 | array( 'class' => 'fr-comment-box' ) ) . " </span>"; |
1571 | 1575 | } |
1572 | 1576 | # Add the submit buttons |
1573 | | - $form .= FlaggedRevsXML::ratingSubmitButtons( $frev, (bool)$toggle ); |
| 1577 | + $form .= FlaggedRevsXML::ratingSubmitButtons( $frev, (bool)$toggle, $allowRereview ); |
1574 | 1578 | |
1575 | 1579 | $form .= Xml::closeElement( 'span' ); |
1576 | 1580 | $form .= Xml::closeElement( 'div' ) . "\n"; |