Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -649,15 +649,9 @@ |
650 | 650 | $vis_id = $revid; |
651 | 651 | $tag = ''; $notes = ''; |
652 | 652 | // Check the newest stable version... |
653 | | - $quality = false; $featured = false; |
| 653 | + $quality = false; $pristine = false; |
654 | 654 | if ( $this->pageOverride() ) { |
655 | | - // getLatestQualityRev() is slower, don't use it if we won't need to |
656 | | - $tfrev = $this->getLatestQualityRev( $article ); |
657 | | - if ( is_null($tfrev) ) { |
658 | | - $tfrev = $this->getLatestStableRev( $article ); |
659 | | - } else { |
660 | | - $quality = true; |
661 | | - } |
| 655 | + $tfrev = $this->getOverridingRev( $article ); |
662 | 656 | } else { |
663 | 657 | $tfrev = $this->getLatestStableRev( $article ); |
664 | 658 | } |
— | — | @@ -694,8 +688,9 @@ |
695 | 689 | global $wgUser; |
696 | 690 | |
697 | 691 | $skin = $wgUser->getSkin(); |
698 | | - // See if this page is featured |
699 | | - $featured = parent::isPristine( $flags ); |
| 692 | + # See if this page is featured |
| 693 | + $quality = $this->isQuality( $flags ); |
| 694 | + $pristine = $this->isPristine( $flags ); |
700 | 695 | # We will be looking at the reviewed revision... |
701 | 696 | $vis_id = $tfrev->fr_rev_id; |
702 | 697 | $revs_since = parent::getRevCountSince( $pageid, $vis_id ); |
— | — | @@ -713,7 +708,7 @@ |
714 | 709 | # Update the general cache |
715 | 710 | parent::updatePageCache( $article, $parserOutput ); |
716 | 711 | } |
717 | | - $wgOut->addHTML( $parserOutput->getText() ); |
| 712 | + $wgOut->mBodytext = $parserOutput->getText(); |
718 | 713 | # Show stable categories and interwiki links only |
719 | 714 | $wgOut->mCategoryLinks = array(); |
720 | 715 | $wgOut->addCategoryLinks( $parserOutput->getCategories() ); |
— | — | @@ -727,7 +722,7 @@ |
728 | 723 | // Construct some tagging |
729 | 724 | $tag .= parent::addTagRatings( $flags ); |
730 | 725 | // Some checks for which tag CSS to use |
731 | | - if ( $featured ) |
| 726 | + if ( $pristine ) |
732 | 727 | $tag = '<div class="flaggedrevs_tag3 plainlinks">'.$tag.'</div>'; |
733 | 728 | else if ( $quality ) |
734 | 729 | $tag = '<div class="flaggedrevs_tag2 plainlinks">'.$tag.'</div>'; |
— | — | @@ -739,15 +734,6 @@ |
740 | 735 | $tag = '<div class="mw-warning plainlinks">'.wfMsgExt('revreview-noflagged', array('parse')).'</div>'; |
741 | 736 | $wgOut->addHTML( $tag ); |
742 | 737 | } |
743 | | - // Show review links for the VISIBLE revision |
744 | | - // We cannot review deleted revisions |
745 | | - if( is_object($article->mRevision) && $article->mRevision->mDeleted ) return; |
746 | | - // Add quick review links IF we did not override, otherwise, they might |
747 | | - // review a revision that parses out newer templates/images than what they say |
748 | | - // Note: overrides are never done when viewing with "oldid=" |
749 | | - if( $vis_id==$revid || !$this->pageOverride() ) { |
750 | | - $this->addQuickReview( $vis_id, false, $out ); |
751 | | - } |
752 | 738 | } |
753 | 739 | |
754 | 740 | function addToEditView( &$editform ) { |
— | — | @@ -802,13 +788,27 @@ |
803 | 789 | $wgOut->addHTML( '<div class="flaggedrevs_tag1 plainlinks">' . $tag . '</div><br/>' ); |
804 | 790 | } |
805 | 791 | } |
| 792 | + |
| 793 | + function addReviewForm( &$out ) { |
| 794 | + global $wgArticle; |
| 795 | + |
| 796 | + if ( !is_object($wgArticle) ) return; |
| 797 | + $revId = ( $wgArticle->mRevision ) ? $wgArticle->mRevision->mId : $wgArticle->getLatest(); |
| 798 | + // Show review links for the VISIBLE revision |
| 799 | + // We cannot review deleted revisions |
| 800 | + if( is_object($wgArticle->mRevision) && $wgArticle->mRevision->mDeleted ) return; |
| 801 | + // Add quick review links IF we did not override, otherwise, they might |
| 802 | + // review a revision that parses out newer templates/images than what they say |
| 803 | + // Note: overrides are never done when viewing with "oldid=" |
| 804 | + $this->addQuickReview( $revId, false ); |
| 805 | + } |
806 | 806 | |
807 | 807 | /** |
808 | 808 | * Get latest quality rev, if not, the latest reviewed one |
809 | 809 | */ |
810 | 810 | function getOverridingRev( $article=NULL ) { |
811 | | - if( !$row = $this->getLatestQualityRev() ) { |
812 | | - if( !$row = $this->getLatestStableRev() ) { |
| 811 | + if( !$row = $this->getLatestQualityRev( $article ) ) { |
| 812 | + if( !$row = $this->getLatestStableRev( $article ) ) { |
813 | 813 | return null; |
814 | 814 | } |
815 | 815 | } |
— | — | @@ -959,7 +959,7 @@ |
960 | 960 | } |
961 | 961 | } |
962 | 962 | |
963 | | - function addQuickReview( $id, $ontop=false, &$out=false ) { |
| 963 | + function addQuickReview( $id, $ontop=false ) { |
964 | 964 | global $wgOut, $wgTitle, $wgUser, $wgScript, $wgFlaggedRevComments, $wgArticle, $wgRequest; |
965 | 965 | // Hack, we don't want two forms! |
966 | 966 | if( isset($this->formCount) && $this->formCount > 0 ) return; |
— | — | @@ -1005,9 +1005,9 @@ |
1006 | 1006 | $form .= "<p>".wfInputLabel( wfMsgHtml( 'revreview-log' ), 'wpReason', 'wpReason', 60 )." "; |
1007 | 1007 | $form .= Xml::submitButton( wfMsgHtml( 'revreview-submit' ) ) . "</p></fieldset>"; |
1008 | 1008 | $form .= Xml::closeElement( 'form' ); |
1009 | | - // Hacks, to fiddle around with location a bit |
1010 | | - if( $ontop && $out ) { |
1011 | | - $out->mBodytext = $form . '<hr/>' . $out->mBodytext; |
| 1009 | + |
| 1010 | + if( $ontop ) { |
| 1011 | + $wgOut->mBodytext = $form . '<hr/>' . $wgOut->mBodytext; |
1012 | 1012 | } else { |
1013 | 1013 | $wgOut->addHTML( $form ); |
1014 | 1014 | } |
— | — | @@ -1054,6 +1054,7 @@ |
1055 | 1055 | $flaggedrevs = new FlaggedRevs(); |
1056 | 1056 | $flaggedarticle = new FlaggedArticle(); |
1057 | 1057 | $wgHooks['ArticleViewHeader'][] = array($flaggedarticle, 'setPageContent'); |
| 1058 | +$wgHooks['BeforePageDisplay'][] = array($flaggedarticle, 'addReviewForm'); |
1058 | 1059 | $wgHooks['DiffViewHeader'][] = array($flaggedarticle, 'addToDiff'); |
1059 | 1060 | $wgHooks['EditPage::showEditForm:initial'][] = array($flaggedarticle, 'addToEditView'); |
1060 | 1061 | $wgHooks['SkinTemplateTabs'][] = array($flaggedarticle, 'setCurrentTab'); |