Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -427,8 +427,10 @@ |
428 | 428 | $wgHooks['SkinTemplateTabs'][] = 'FlaggedRevsHooks::setActionTabs'; |
429 | 429 | # Set navigation |
430 | 430 | $wgHooks['SkinTemplateNavigation'][] = 'FlaggedRevsHooks::setNavigation'; |
431 | | -# Add tags to edit view |
| 431 | +# Add notice tags to edit view |
432 | 432 | $wgHooks['EditPage::showEditForm:initial'][] = 'FlaggedRevsHooks::addToEditView'; |
| 433 | +# Add notice tags to history |
| 434 | +$wgHooks['PageHistoryBeforeList'][] = 'FlaggedRevsHooks::addToHistView'; |
433 | 435 | # Add review form and visiblity settings link |
434 | 436 | $wgHooks['SkinAfterContent'][] = 'FlaggedRevsHooks::onSkinAfterContent'; |
435 | 437 | # Add protection form field |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php |
— | — | @@ -323,4 +323,60 @@ |
324 | 324 | } |
325 | 325 | return $form; |
326 | 326 | } |
| 327 | + |
| 328 | + /* |
| 329 | + * @param FlaggedArticle $flaggedArticle |
| 330 | + * @returns string |
| 331 | + * Creates CSS lock icon if page is locked/unlocked |
| 332 | + */ |
| 333 | + public static function lockStatusIcon( $flaggedArticle ) { |
| 334 | + if( $flaggedArticle->isPageLocked() ) { |
| 335 | + return "<span class='fr-icon-locked' title=\"". |
| 336 | + wfMsgHtml('revreview-locked-title')."\"></span>"; |
| 337 | + } elseif( $flaggedArticle->isPageUnlocked() ) { |
| 338 | + return "<span class='fr-icon-unlocked' title=\"". |
| 339 | + wfMsgHtml('revreview-unlocked-title')."\"></span>"; |
| 340 | + } |
| 341 | + } |
| 342 | + |
| 343 | + /* |
| 344 | + * @param FlaggedArticle $flaggedArticle |
| 345 | + * @param FlaggedRevision $frev |
| 346 | + * @param int $revsSince |
| 347 | + * @returns string |
| 348 | + * Creates "there are x pending edits" message in a div |
| 349 | + */ |
| 350 | + public static function pendingEditBox( $flaggedArticle, $frev, $revsSince ) { |
| 351 | + global $wgLang; |
| 352 | + $flags = $frev->getTags(); |
| 353 | + $quality = FlaggedRevs::isQuality( $flags ); |
| 354 | + $time = $wgLang->date( $frev->getTimestamp(), true ); |
| 355 | + // Is the page config altered? |
| 356 | + $prot = self::lockStatusIcon( $flaggedArticle ); |
| 357 | + # Streamlined UI |
| 358 | + if( FlaggedRevs::useSimpleUI() ) { |
| 359 | + $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic'; |
| 360 | + $msg .= ($revsSince == 0) ? '-i' : ''; |
| 361 | + $tag = "{$prot}<span class='fr-checkbox'></span>" . |
| 362 | + wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time, $revsSince ); |
| 363 | + $tag = "<div id='mw-revisiontag-edit' class='flaggedrevs_editnotice plainlinks'>" . |
| 364 | + "$tag</div>"; |
| 365 | + # Standard UI |
| 366 | + } else { |
| 367 | + $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic'; |
| 368 | + $msg .= ($revsSince == 0) ? '-i' : ''; |
| 369 | + $tag = "{$prot}<span class='fr-checkbox'></span>" . |
| 370 | + wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time, $revsSince ); |
| 371 | + # Hide clutter |
| 372 | + if( !empty($flags) ) { |
| 373 | + $tag .= " " . FlaggedRevsXML::ratingToggle(); |
| 374 | + $tag .= '<span id="mw-revisionratings" style="display:block;"><br />' . |
| 375 | + wfMsg('revreview-oldrating') . FlaggedRevsXML::addTagRatings( $flags ) . |
| 376 | + '</span>'; |
| 377 | + } |
| 378 | + $tag = "<div id='mw-revisiontag-edit' class='flaggedrevs_editnotice plainlinks'>" . |
| 379 | + "$tag</div>"; |
| 380 | + } |
| 381 | + return $tag; |
| 382 | + } |
327 | 383 | } |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -1576,6 +1576,12 @@ |
1577 | 1577 | return true; |
1578 | 1578 | } |
1579 | 1579 | |
| 1580 | + public static function addToHistView( &$article ) { |
| 1581 | + $view = FlaggedArticleView::singleton(); |
| 1582 | + $view->addToHistView(); |
| 1583 | + return true; |
| 1584 | + } |
| 1585 | + |
1580 | 1586 | public static function onCategoryPageView( &$category ) { |
1581 | 1587 | $view = FlaggedArticleView::singleton(); |
1582 | 1588 | $view->addToCategoryView(); |
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -226,13 +226,7 @@ |
227 | 227 | return true; |
228 | 228 | } |
229 | 229 | // Is the page config altered? |
230 | | - if( $this->article->isPageLocked() ) { |
231 | | - $prot = "<span class='fr-icon-locked' title=\"". |
232 | | - wfMsgHtml('revreview-locked-title')."\"></span>"; |
233 | | - } elseif( $this->article->isPageUnlocked() ) { |
234 | | - $prot = "<span class='fr-icon-unlocked' title=\"". |
235 | | - wfMsgHtml('revreview-unlocked-title')."\"></span>"; |
236 | | - } |
| 230 | + $prot = FlaggedRevsXML::lockStatusIcon( $this->article ); |
237 | 231 | // Is there no stable version? |
238 | 232 | if( is_null($frev) ) { |
239 | 233 | # Add "no reviewed version" tag, but not for printable output |
— | — | @@ -648,8 +642,27 @@ |
649 | 643 | } |
650 | 644 | |
651 | 645 | /** |
652 | | - * Adds latest stable version tag to page when editing |
| 646 | + * Adds stable version tags to page when viewing history |
653 | 647 | */ |
| 648 | + public function addToHistView() { |
| 649 | + global $wgOut, $wgLang; |
| 650 | + $this->load(); |
| 651 | + # Must be reviewable. UI may be limited to unobtrusive patrolling system. |
| 652 | + if( !$this->article->isReviewable() || $this->article->limitedUI() ) |
| 653 | + return true; |
| 654 | + # Add a notice if there are pending edits... |
| 655 | + $frev = $this->article->getStableRev(); |
| 656 | + if( $frev && $frev->getRevId() < $this->article->getLatest() ) { |
| 657 | + $revsSince = FlaggedRevs::getRevCountSince( $this->article, $frev->getRevId() ); |
| 658 | + $tag = FlaggedRevsXML::pendingEditBox( $this->article, $frev, $revsSince ); |
| 659 | + $wgOut->addHTML( $tag ); |
| 660 | + } |
| 661 | + return true; |
| 662 | + } |
| 663 | + |
| 664 | + /** |
| 665 | + * Adds stable version tags to page when editing |
| 666 | + */ |
654 | 667 | public function addToEditView( $editPage ) { |
655 | 668 | global $wgRequest, $wgOut; |
656 | 669 | $this->load(); |
— | — | @@ -658,11 +671,11 @@ |
659 | 672 | return true; |
660 | 673 | # Show stabilization log |
661 | 674 | $this->showStabilityLog(); |
662 | | - # Set new body html text as that of now |
663 | 675 | $tag = $warning = $prot = ''; |
664 | 676 | # Check the newest stable version |
665 | 677 | $quality = 0; |
666 | | - if( $frev = $this->article->getStableRev() ) { |
| 678 | + $frev = $this->article->getStableRev(); |
| 679 | + if( $frev ) { |
667 | 680 | global $wgLang, $wgUser; |
668 | 681 | # Find out revision id |
669 | 682 | $revId = $editPage->oldid ? |
— | — | @@ -684,42 +697,10 @@ |
685 | 698 | $warning = "<div id='mw-editwarningtag' class='flaggedrevs_editnotice plainlinks'>" . |
686 | 699 | wfMsgExt('revreview-editnotice',array('parseinline')) . "</div>"; |
687 | 700 | } |
| 701 | + # Add a notice if there are pending edits... |
688 | 702 | if( $frev->getRevId() != $revId ) { |
689 | | - $time = $wgLang->date( $frev->getTimestamp(), true ); |
690 | | - $flags = $frev->getTags(); |
691 | | - if( FlaggedRevs::isQuality($flags) ) { |
692 | | - $quality = FlaggedRevs::isPristine($flags) ? 2 : 1; |
693 | | - } |
694 | 703 | $revsSince = FlaggedRevs::getRevCountSince( $this->article, $frev->getRevId() ); |
695 | | - // Is the page config altered? |
696 | | - if( $this->article->isPageLocked() ) { |
697 | | - $prot = "<span class='fr-icon-locked' title=\"". |
698 | | - wfMsgHtml('revreview-locked-title')."\"></span>"; |
699 | | - } elseif( $this->article->isPageUnlocked() ) { |
700 | | - $prot = "<span class='fr-icon-unlocked' title=\"". |
701 | | - wfMsgHtml('revreview-unlocked-title')."\"></span>"; |
702 | | - } |
703 | | - # Streamlined UI |
704 | | - if( FlaggedRevs::useSimpleUI() ) { |
705 | | - $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic'; |
706 | | - $msg .= ($revsSince == 0) ? '-i' : ''; |
707 | | - $tag = "{$prot}<span class='fr-checkbox'></span>" . |
708 | | - wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time, $revsSince ); |
709 | | - $tag = "<div id='mw-revisiontag-edit' class='flaggedrevs_editnotice plainlinks'>$tag</div>"; |
710 | | - # Standard UI |
711 | | - } else { |
712 | | - $msg = $quality ? 'revreview-newest-quality' : 'revreview-newest-basic'; |
713 | | - $msg .= ($revsSince == 0) ? '-i' : ''; |
714 | | - $tag = "{$prot}<span class='fr-checkbox'></span>" . |
715 | | - wfMsgExt( $msg, array('parseinline'), $frev->getRevId(), $time, $revsSince ); |
716 | | - # Hide clutter |
717 | | - if( !empty($flags) ) { |
718 | | - $tag .= " " . FlaggedRevsXML::ratingToggle(); |
719 | | - $tag .= '<span id="mw-revisionratings" style="display:block;"><br />' . |
720 | | - wfMsg('revreview-oldrating') . FlaggedRevsXML::addTagRatings( $flags ) . '</span>'; |
721 | | - } |
722 | | - $tag = "<div id='mw-revisiontag-edit' class='flaggedrevs_editnotice plainlinks'>$tag</div>"; |
723 | | - } |
| 704 | + $tag = FlaggedRevsXML::pendingEditBox( $this->article, $frev, $revsSince ); |
724 | 705 | } |
725 | 706 | # Output notice and warning for editors |
726 | 707 | if( $tag || $warning ) { |