Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -683,6 +683,34 @@ |
684 | 684 | ); |
685 | 685 | return $quality; |
686 | 686 | } |
| 687 | + |
| 688 | + /** |
| 689 | + * Make stable version link and return the css |
| 690 | + * @param Title $title |
| 691 | + * @param int $rev_id |
| 692 | + * @param Database $db, optional |
| 693 | + * @returns array (string,string) |
| 694 | + */ |
| 695 | + public static function makeStableVersionLink( $title, $rev_id, $skin, $db = NULL ) { |
| 696 | + $db = $db ? $db : wfGetDB( DB_SLAVE ); |
| 697 | + $row = $db->selectRow( 'flaggedrevs', |
| 698 | + array( 'fr_quality', 'fr_user' ), |
| 699 | + array( 'fr_page_id' => $title->getArticleID(), |
| 700 | + 'fr_rev_id' => $rev_id ), |
| 701 | + __METHOD__, |
| 702 | + array( 'FORCE INDEX' => 'PRIMARY' ) |
| 703 | + ); |
| 704 | + if( $row ) { |
| 705 | + $css = self::getQualityColor( $row->fr_quality ); |
| 706 | + $user = User::whois( $row->fr_user ); |
| 707 | + $msg = ($row->fr_quality >= 1) ? 'hist-quality-user' : 'hist-stable-user'; |
| 708 | + $st = $title->getPrefixedDBkey(); |
| 709 | + $link = "<span class='plainlinks'>".wfMsgExt($msg,array('parseinline'),$st,$rev_id,$user)."</span>"; |
| 710 | + } else { |
| 711 | + return array("",""); |
| 712 | + } |
| 713 | + return array($link,$css); |
| 714 | + } |
687 | 715 | |
688 | 716 | /** |
689 | 717 | * Get the "prime" flagged revision of a page |
— | — | @@ -931,6 +959,25 @@ |
932 | 960 | |
933 | 961 | return true; |
934 | 962 | } |
| 963 | + |
| 964 | + /** |
| 965 | + * @param int $quality |
| 966 | + * @return string, css color for this quality |
| 967 | + */ |
| 968 | + public static function getQualityColor( $quality ) { |
| 969 | + switch( $quality ) { |
| 970 | + case 2: |
| 971 | + $css = 'flaggedrevs-color-3'; |
| 972 | + break; |
| 973 | + case 1: |
| 974 | + $css = 'flaggedrevs-color-2'; |
| 975 | + break; |
| 976 | + default: |
| 977 | + $css = 'flaggedrevs-color-1'; |
| 978 | + break; |
| 979 | + } |
| 980 | + return $css; |
| 981 | + } |
935 | 982 | |
936 | 983 | /** |
937 | 984 | * Is this page in reviewable namespace? |
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -650,25 +650,10 @@ |
651 | 651 | if( !$this->dbr ) { |
652 | 652 | $this->dbr = wfGetDB( DB_SLAVE ); |
653 | 653 | } |
654 | | - $quality = FlaggedRevs::getRevQuality( $this->getTitle(), $row->rev_id, $this->dbr ); |
655 | | - if( $quality !== false ) { |
656 | | - $skin = $wgUser->getSkin(); |
657 | | - $quality = intval($quality); |
658 | | - switch( $quality ) { |
659 | | - case 2: |
660 | | - $css = 'flaggedrevs-color-3'; |
661 | | - break; |
662 | | - case 1: |
663 | | - $css = 'flaggedrevs-color-2'; |
664 | | - break; |
665 | | - default: |
666 | | - $css = 'flaggedrevs-color-1'; |
667 | | - break; |
668 | | - } |
669 | | - $msg = ($quality >= 1) ? 'hist-quality' : 'hist-stable'; |
670 | | - $s = "<span class='$css'>{$s}</span> <small><strong>[" . |
671 | | - $skin->makeLinkObj( $this->getTitle(), wfMsgHtml( $msg ),'stableid=' . $row->rev_id ) . |
672 | | - "]</strong></small>"; |
| 654 | + $skin = $wgUser->getSkin(); |
| 655 | + list($link,$css) = FlaggedRevs::makeStableVersionLink( $this->getTitle(), $row->rev_id, $skin, $this->dbr ); |
| 656 | + if( $link ) { |
| 657 | + $s = "<span class='$css'>$s</span> <small><strong>[$link]</strong></small>"; |
673 | 658 | } |
674 | 659 | return true; |
675 | 660 | } |
— | — | @@ -757,29 +742,31 @@ |
758 | 743 | $oldRevQ = $OldRev ? FlaggedRevs::getRevQuality( $NewRev->getTitle(), $OldRev->getId() ) : false; |
759 | 744 | # Diff between two revisions |
760 | 745 | if( $OldRev ) { |
| 746 | + $css = FlaggedRevs::getQualityColor( $oldRevQ ); |
761 | 747 | if( $oldRevQ !== false ) { |
762 | | - $msg = $oldRevQ ? 'revreview-quality-title' : 'revreview-stable-title'; |
| 748 | + $msg = $oldRevQ ? 'hist-quality' : 'hist-stable'; |
763 | 749 | } else { |
764 | | - $msg = 'revreview-draft-title'; |
| 750 | + $msg = 'hist-draft'; |
765 | 751 | } |
766 | 752 | $wgOut->addHTML( "<table class='fr-diff-ratings' width='100%'><tr><td class='fr-$msg' width='50%' align='center'>" ); |
767 | | - $wgOut->addHTML( "<b>[" . wfMsgHtml( $msg ) . "]</b>" ); |
| 753 | + $wgOut->addHTML( "<span class='$css'><b>[" . wfMsgHtml( $msg ) . "]</b></span>" ); |
768 | 754 | |
| 755 | + $css = FlaggedRevs::getQualityColor( $newRevQ ); |
769 | 756 | if( $newRevQ !== false ) { |
770 | | - $msg = $newRevQ ? 'revreview-quality-title' : 'revreview-stable-title'; |
| 757 | + $msg = $newRevQ ? 'hist-quality' : 'hist-stable'; |
771 | 758 | } else { |
772 | | - $msg = 'revreview-draft-title'; |
| 759 | + $msg = 'hist-draft'; |
773 | 760 | } |
774 | 761 | $wgOut->addHTML( "</td><td class='fr-$msg' width='50%' align='center'>" ); |
775 | | - $wgOut->addHTML( "<b>[" . wfMsgHtml( $msg ) . "]</b>" ); |
| 762 | + $wgOut->addHTML( "<span class='$css'><b>[" . wfMsgHtml( $msg ) . "]</b></span>" ); |
776 | 763 | |
777 | 764 | $wgOut->addHTML( '</td></tr></table>' ); |
778 | 765 | # New page "diffs" - just one rev |
779 | 766 | } else { |
780 | 767 | if( $newRevQ !== false ) { |
781 | | - $msg = $newRevQ ? 'revreview-quality-title' : 'revreview-stable-title'; |
| 768 | + $msg = $newRevQ ? 'hist-quality' : 'hist-stable'; |
782 | 769 | } else { |
783 | | - $msg = 'revreview-draft-title'; |
| 770 | + $msg = 'hist-draft'; |
784 | 771 | } |
785 | 772 | $wgOut->addHTML( "<table class='fr-diff-ratings' width='100%'><tr><td class='fr-$msg' align='center'>" ); |
786 | 773 | $wgOut->addHTML( "<b>[" . wfMsgHtml( $msg ) . "]</b>" ); |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.i18n.php |
— | — | @@ -96,8 +96,11 @@ |
97 | 97 | 'revreview-auto-w-old' => "You are editing a reviewed revision; changes will '''automatically be reviewed'''.", |
98 | 98 | 'revreview-patrolled' => 'The selected revision of [[:$1|$1]] has been marked as patrolled.', |
99 | 99 | |
100 | | - 'hist-stable' => 'sighted revision', |
101 | | - 'hist-quality' => 'quality revision', |
| 100 | + 'hist-draft' => 'draft revision', |
| 101 | + 'hist-stable' => 'sighted revision', |
| 102 | + 'hist-quality' => 'quality revision', |
| 103 | + 'hist-stable-user' => '[{{fullurl:$1|stableid=$2}} sighted] by [[User:$3|$3]]', |
| 104 | + 'hist-quality-user' => '[{{fullurl:$1|stableid=$2}} validated] by [[User:$3|$3]]', |
102 | 105 | |
103 | 106 | 'flaggedrevs' => 'Flagged Revisions', |
104 | 107 | 'review-logpage' => 'Review log', |
— | — | @@ -169,7 +172,7 @@ |
170 | 173 | 'unreviewedpages' => 'Unreviewed pages', |
171 | 174 | 'unreviewed-legend' => 'List unreviewed content pages', |
172 | 175 | 'unreviewed-category' => 'Category:', |
173 | | - 'unreviewed-diff' => 'review changes', |
| 176 | + 'unreviewed-diff' => 'review', |
174 | 177 | 'unreviewed-unwatched' => '(unwatched)', |
175 | 178 | 'unreviewed-watched' => '($2 {{PLURAL:$1|user|users}} watching)', |
176 | 179 | 'unreviewed-list' => 'This page lists articles that have not been reviewed.', |
— | — | @@ -181,6 +184,9 @@ |
182 | 185 | 'oldreviewedpages-none' => 'There are currently no pages meeting these criteria', |
183 | 186 | 'oldreviewedpages-stable' => 'sighted', |
184 | 187 | 'oldreviewedpages-quality' => 'quality', |
| 188 | + 'oldreviewedpages-hours' => '($1 {{PLURAL:$1|hour|hours}})', |
| 189 | + 'oldreviewedpages-days' => '($1 {{PLURAL:$1|day|days}})', |
| 190 | + 'oldreviewedpages-recent' => '(less than 1 hour)', |
185 | 191 | |
186 | 192 | 'revreview-visibility' => "'''This page has a [[{{MediaWiki:Validationpage}}|stable version]]; settings for it can be [{{fullurl:Special:Stabilization|page={{FULLPAGENAMEE}}}} configured].'''", |
187 | 193 | |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php |
— | — | @@ -8,7 +8,6 @@ |
9 | 9 | |
10 | 10 | class RevisionReview extends UnlistedSpecialPage |
11 | 11 | { |
12 | | - |
13 | 12 | function __construct() { |
14 | 13 | UnlistedSpecialPage::UnlistedSpecialPage( 'RevisionReview', 'review' ); |
15 | 14 | } |
— | — | @@ -750,7 +749,6 @@ |
751 | 750 | |
752 | 751 | class StableVersions extends UnlistedSpecialPage |
753 | 752 | { |
754 | | - |
755 | 753 | function __construct() { |
756 | 754 | UnlistedSpecialPage::UnlistedSpecialPage( 'StableVersions' ); |
757 | 755 | } |
— | — | @@ -862,7 +860,6 @@ |
863 | 861 | */ |
864 | 862 | class UnreviewedPages extends SpecialPage |
865 | 863 | { |
866 | | - |
867 | 864 | function __construct() { |
868 | 865 | SpecialPage::SpecialPage( 'UnreviewedPages', 'unreviewedpages' ); |
869 | 866 | } |
— | — | @@ -1038,7 +1035,6 @@ |
1039 | 1036 | */ |
1040 | 1037 | class OldReviewedPages extends SpecialPage |
1041 | 1038 | { |
1042 | | - |
1043 | 1039 | function __construct() { |
1044 | 1040 | SpecialPage::SpecialPage( 'OldReviewedPages', 'unreviewedpages' ); |
1045 | 1041 | } |
— | — | @@ -1099,15 +1095,32 @@ |
1100 | 1096 | } |
1101 | 1097 | $review = $this->skin->makeKnownLinkObj( $title, wfMsg('unreviewed-diff'), |
1102 | 1098 | "diff=cur&oldid={$result->fp_stable}" ); |
1103 | | - $hist = $this->skin->makeKnownLinkObj( $title, wfMsg('hist'), |
1104 | | - "action=history" ); |
1105 | 1099 | $quality = $result->fp_quality ? wfMsgHtml('oldreviewedpages-quality') : wfMsgHtml('oldreviewedpages-stable'); |
1106 | | - |
| 1100 | + # Get how old the reviewed revision is from the current |
| 1101 | + if( $stableTS = Revision::getTimestampFromID( $result->fp_stable ) ) { |
| 1102 | + $latestTS = wfTimestamp( TS_UNIX, $result->rev_timestamp ); |
| 1103 | + $stableTS = wfTimestamp( TS_UNIX, $stableTS ); |
| 1104 | + $hours = ($latestTS - $stableTS)/3600; |
| 1105 | + // After three days, just use days |
| 1106 | + if( $hours > (3*24) ) { |
| 1107 | + $days = round($hours/24,0); |
| 1108 | + $age = wfMsgExt('oldreviewedpages-days',array('parsemag'),$days); |
| 1109 | + // If one or more hours, use hours |
| 1110 | + } else if( $hours >= 1 ) { |
| 1111 | + $hours = round($hours,0); |
| 1112 | + $age = wfMsgExt('oldreviewedpages-hours',array('parsemag'),$hours); |
| 1113 | + } else { |
| 1114 | + $age = wfMsg('oldreviewedpages-recent'); // hot of the press :) |
| 1115 | + } |
| 1116 | + } else { |
| 1117 | + $age = ""; // wtf? |
| 1118 | + } |
| 1119 | + # Is anybody watching? |
1107 | 1120 | $uw = UnreviewedPages::usersWatching( $title ); |
1108 | 1121 | $uwPar = $uw >= 5 ? '5+' : $uw; |
1109 | 1122 | $watching = $uw ? wfMsgExt("unreviewed-watched",array('parsemag'),$uw,$uwPar) : wfMsgHtml("unreviewed-unwatched"); |
1110 | 1123 | |
1111 | | - return( "<li>{$link} {$stxt} ({$review}) ({$hist}) <strong>[{$quality}]</strong> {$watching}</li>" ); |
| 1124 | + return( "<li>{$link} {$stxt} ({$review}) <i>{$age}</i> <strong>[{$quality}]</strong> {$watching}</li>" ); |
1112 | 1125 | } |
1113 | 1126 | } |
1114 | 1127 | |
— | — | @@ -1133,10 +1146,13 @@ |
1134 | 1147 | |
1135 | 1148 | function getQueryInfo() { |
1136 | 1149 | $conds = $this->mConds; |
1137 | | - $tables = array( 'flaggedpages', 'page' ); |
1138 | | - $fields = array('page_namespace','page_title','page_len','fp_stable','fp_quality'); |
| 1150 | + $tables = array( 'flaggedpages', 'page', 'revision' ); |
| 1151 | + $fields = array('page_namespace','page_title','page_len','fp_stable','fp_quality', |
| 1152 | + 'rev_timestamp'); |
1139 | 1153 | $conds['fp_reviewed'] = 0; |
1140 | | - $conds[] = 'fp_page_id = page_id'; |
| 1154 | + $conds[] = 'page_id = fp_page_id'; |
| 1155 | + $conds[] = 'rev_page = page_id'; |
| 1156 | + $conds[] = 'rev_id = page_latest'; |
1141 | 1157 | # Reviewable pages only (moves can make oddities, so check here) |
1142 | 1158 | global $wgFlaggedRevsNamespaces; |
1143 | 1159 | $conds['page_namespace'] = $wgFlaggedRevsNamespaces; |
— | — | @@ -1168,7 +1184,6 @@ |
1169 | 1185 | |
1170 | 1186 | class ReviewedPages extends SpecialPage |
1171 | 1187 | { |
1172 | | - |
1173 | 1188 | function __construct() { |
1174 | 1189 | SpecialPage::SpecialPage( 'ReviewedPages' ); |
1175 | 1190 | } |
— | — | @@ -1290,7 +1305,6 @@ |
1291 | 1306 | |
1292 | 1307 | class StablePages extends SpecialPage |
1293 | 1308 | { |
1294 | | - |
1295 | 1309 | function __construct() { |
1296 | 1310 | SpecialPage::SpecialPage( 'StablePages' ); |
1297 | 1311 | } |
— | — | @@ -1375,7 +1389,6 @@ |
1376 | 1390 | |
1377 | 1391 | class Stabilization extends UnlistedSpecialPage |
1378 | 1392 | { |
1379 | | - |
1380 | 1393 | function __construct() { |
1381 | 1394 | UnlistedSpecialPage::UnlistedSpecialPage( 'Stabilization', 'stablesettings' ); |
1382 | 1395 | } |
— | — | @@ -1640,7 +1653,6 @@ |
1641 | 1654 | |
1642 | 1655 | class QualityOversight extends SpecialPage |
1643 | 1656 | { |
1644 | | - |
1645 | 1657 | function __construct() { |
1646 | 1658 | SpecialPage::SpecialPage( 'QualityOversight' ); |
1647 | 1659 | } |