Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -388,7 +388,10 @@ |
389 | 389 | if ( $synced ) { |
390 | 390 | $this->setReviewNotes( $srev ); // Still the same |
391 | 391 | } else { |
392 | | - $this->setPendingNotice( $srev ); |
| 392 | + # Make sure there is always a notice bar when viewing the draft |
| 393 | + if ( $this->useSimpleUI() ) { // already one for detailed UI |
| 394 | + $this->setPendingNotice( $srev ); |
| 395 | + } |
393 | 396 | $this->maybeShowTopDiff( $srev, $quality ); // user may want diff (via prefs) |
394 | 397 | } |
395 | 398 | # If they are synced, do special styling |
— | — | @@ -677,12 +680,10 @@ |
678 | 681 | * @returns bool, diff added to output |
679 | 682 | */ |
680 | 683 | protected function maybeShowTopDiff( FlaggedRevision $srev, $quality ) { |
681 | | - global $wgUser, $wgOut; |
| 684 | + global $wgUser; |
682 | 685 | $this->load(); |
683 | 686 | if ( !$wgUser->getBoolOption( 'flaggedrevsviewdiffs' ) ) { |
684 | 687 | return false; // nothing to do here |
685 | | - } elseif ( !$wgUser->isAllowed( 'review' ) ) { |
686 | | - return false; // does not apply to this user |
687 | 688 | } |
688 | 689 | # Diff should only show for the draft |
689 | 690 | $oldid = $this->article->getOldIDFromRequest(); |
— | — | @@ -694,35 +695,24 @@ |
695 | 696 | if ( !$revsSince ) { |
696 | 697 | return false; // no pending changes |
697 | 698 | } |
698 | | - # Conditions are met to show diff... |
699 | | - # Left side of diff... |
| 699 | + $title = $this->article->getTitle(); // convenience |
| 700 | + # Review status of left diff revision... |
700 | 701 | $leftNote = $quality |
701 | 702 | ? 'revreview-hist-quality' |
702 | 703 | : 'revreview-hist-basic'; |
703 | 704 | $lClass = FlaggedRevsXML::getQualityColor( (int)$quality ); |
704 | 705 | $leftNote = "<span class='$lClass'>[" . wfMsgHtml( $leftNote ) . "]</span>"; |
705 | | - # Right side of diff... |
| 706 | + # Review status of right diff revision... |
706 | 707 | $rClass = FlaggedRevsXML::getQualityColor( false ); |
707 | 708 | $rightNote = "<span class='$rClass'>[" . |
708 | 709 | wfMsgHtml( 'revreview-hist-pending' ) . "]</span>"; |
709 | | - # Fetch the stable and draft revision text |
710 | | - $oText = $srev->getRevText(); |
711 | | - if ( $oText === false ) { |
712 | | - return false; // deleted revision or something? |
713 | | - } |
714 | | - $nText = $this->article->getContent(); |
715 | | - if ( $nText === false ) { |
716 | | - return false; // deleted revision or something? |
717 | | - } |
718 | | - # Build diff at the top of the page |
719 | | - if ( strcmp( $oText, $nText ) !== 0 ) { |
720 | | - $diffEngine = new DifferenceEngine( $this->article->getTitle() ); |
721 | | - $diffEngine->showDiffStyle(); |
722 | | - $diffBody = $diffEngine->generateDiffBody( $oText, $nText ); |
| 710 | + # Get the actual body of the diff... |
| 711 | + $diffEngine = new DifferenceEngine( $title, $srev->getRevId(), $latest ); |
| 712 | + $diffBody = $diffEngine->getDiffBody(); |
| 713 | + if ( strlen( $diffBody ) > 0 ) { |
723 | 714 | $nEdits = $revsSince - 1; // full diff-to-stable, no need for query |
724 | 715 | if ( $nEdits ) { |
725 | | - $nUsers = $this->article->getTitle()->countAuthorsBetween( |
726 | | - $this->article->getStable(), $latest, 101 ); |
| 716 | + $nUsers = $title->countAuthorsBetween( $srev->getRevId(), $latest, 101 ); |
727 | 717 | $multiNotice = DifferenceEngine::intermediateEditsMsg( $nEdits, $nUsers, 100 ); |
728 | 718 | } else { |
729 | 719 | $multiNotice = ''; |
— | — | @@ -740,7 +730,8 @@ |
741 | 731 | $html .= '<tr><td>' . $item . '</td></tr>'; |
742 | 732 | } |
743 | 733 | $html .= '</table>'; |
744 | | - $wgOut->addHtml( $html ); |
| 734 | + $this->reviewNotice .= $html; |
| 735 | + $diffEngine->showDiffStyle(); // add CSS |
745 | 736 | $this->isDiffFromStable = true; // alter default review form tags |
746 | 737 | return true; |
747 | 738 | } |
— | — | @@ -921,7 +912,6 @@ |
922 | 913 | } |
923 | 914 | if ( $text !== false && strcmp( $text, $editPage->textbox1 ) !== 0 ) { |
924 | 915 | $diffEngine = new DifferenceEngine( $this->article->getTitle() ); |
925 | | - $diffEngine->showDiffStyle(); |
926 | 916 | $diffBody = $diffEngine->generateDiffBody( $text, $editPage->textbox1 ); |
927 | 917 | $diffHtml = |
928 | 918 | wfMsgExt( 'review-edit-diff', 'parseinline' ) . ' ' . |
— | — | @@ -930,6 +920,7 @@ |
931 | 921 | self::getFormattedDiff( $diffBody, '', $leftNote, $rightNote ) . |
932 | 922 | "</div>\n"; |
933 | 923 | $items[] = $diffHtml; |
| 924 | + $diffEngine->showDiffStyle(); // add CSS |
934 | 925 | } |
935 | 926 | } |
936 | 927 | # Output items |
— | — | @@ -1259,24 +1250,24 @@ |
1260 | 1251 | * @param FlaggedRevision $frev |
1261 | 1252 | * @return void |
1262 | 1253 | */ |
1263 | | - public function setReviewNotes( $frev ) { |
| 1254 | + public function setReviewNotes( FlaggedRevision $frev ) { |
1264 | 1255 | global $wgUser; |
1265 | 1256 | $this->load(); |
1266 | | - if ( $frev && FlaggedRevs::allowComments() && $frev->getComment() != '' ) { |
| 1257 | + if ( FlaggedRevs::allowComments() && $frev->getComment() != '' ) { |
1267 | 1258 | $this->reviewNotes = "<br /><div class='flaggedrevs_notes plainlinks'>"; |
1268 | | - $this->reviewNotes .= wfMsgExt( 'revreview-note', array( 'parseinline' ), |
| 1259 | + $this->reviewNotes .= wfMsgExt( 'revreview-note', 'parseinline', |
1269 | 1260 | User::whoIs( $frev->getUser() ) ); |
1270 | 1261 | $this->reviewNotes .= '<br /><i>' . |
1271 | 1262 | $wgUser->getSkin()->formatComment( $frev->getComment() ) . '</i></div>'; |
1272 | 1263 | } |
1273 | 1264 | } |
1274 | | - |
| 1265 | + |
1275 | 1266 | /** |
1276 | 1267 | * Adds a notice saying that this revision is pending review |
1277 | 1268 | * @param FlaggedRevision $frev |
1278 | 1269 | * @return void |
1279 | 1270 | */ |
1280 | | - public function setPendingNotice( $frev ) { |
| 1271 | + public function setPendingNotice( FlaggedRevision $frev ) { |
1281 | 1272 | global $wgLang; |
1282 | 1273 | $this->load(); |
1283 | 1274 | $time = $wgLang->date( $frev->getTimestamp(), true ); |