Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -40,14 +40,6 @@ |
41 | 41 | $config = $this->getVisibilitySettings(); |
42 | 42 | return (bool)$config['override']; |
43 | 43 | } |
44 | | - |
45 | | - /** |
46 | | - * Is most of the UI on this page to be hidden? |
47 | | - * @returns bool |
48 | | - */ |
49 | | - public function limitedUI() { |
50 | | - return ( FlaggedRevs::forDefaultVersionOnly() && !$this->isStableShownByDefault() ); |
51 | | - } |
52 | 44 | |
53 | 45 | /** |
54 | 46 | * Is this page less open than the site defaults? |
Index: trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php |
— | — | @@ -92,10 +92,11 @@ |
93 | 93 | public function formatRow( $row ) { |
94 | 94 | global $wgLang, $wgUser, $wgMemc; |
95 | 95 | |
| 96 | + $stxt = $underReview = $watching = ''; |
96 | 97 | $title = Title::newFromRow( $row ); |
97 | | - $link = $this->skin->makeKnownLinkObj( $title, null, 'redirect=no&reviewform=1' ); |
98 | | - $hist = $this->skin->makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' ); |
99 | | - $stxt = $review = $underReview = $watching = ''; |
| 98 | + $link = $this->skin->makeKnownLinkObj( $title, null, 'redirect=no&reviewing=1' ); |
| 99 | + $hist = $this->skin->makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), |
| 100 | + 'action=history&reviewing=1' ); |
100 | 101 | if ( !is_null( $size = $row->page_len ) ) { |
101 | 102 | $stxt = ( $size == 0 ) |
102 | 103 | ? wfMsgHtml( 'historyempty' ) |
— | — | @@ -110,13 +111,13 @@ |
111 | 112 | // After three days, just use days |
112 | 113 | if ( $hours > ( 3 * 24 ) ) { |
113 | 114 | $days = round( $hours / 24, 0 ); |
114 | | - $age = wfMsgExt( 'unreviewed-days', array( 'parsemag' ), $days ); |
| 115 | + $age = ' ' . wfMsgExt( 'unreviewed-days', array( 'parsemag' ), $days ); |
115 | 116 | // If one or more hours, use hours |
116 | 117 | } elseif ( $hours >= 1 ) { |
117 | 118 | $hours = round( $hours, 0 ); |
118 | | - $age = wfMsgExt( 'unreviewed-hours', array( 'parsemag' ), $hours ); |
| 119 | + $age = ' ' . wfMsgExt( 'unreviewed-hours', array( 'parsemag' ), $hours ); |
119 | 120 | } else { |
120 | | - $age = wfMsg( 'unreviewed-recent' ); // hot off the press :) |
| 121 | + $age = ' ' . wfMsg( 'unreviewed-recent' ); // hot off the press :) |
121 | 122 | } |
122 | 123 | if ( $wgUser->isAllowed( 'unwatchedpages' ) ) { |
123 | 124 | $uw = self::usersWatching( $title ); |
— | — | @@ -133,13 +134,13 @@ |
134 | 135 | $key = wfMemcKey( 'unreviewedPages', 'underReview', $pageId ); |
135 | 136 | $val = $wgMemc->get( $key ); |
136 | 137 | # Show if a user is looking at this page |
137 | | - if ( ( $val = $wgMemc->get( $key ) ) ) { |
| 138 | + if ( $val ) { |
138 | 139 | $underReview = " <b class='fr-under-review'>" . |
139 | 140 | wfMsgHtml( 'unreviewed-viewing' ) . '</b>'; |
140 | 141 | } |
141 | 142 | |
142 | 143 | return( "<li{$css}>{$link} {$stxt} ({$hist})" . |
143 | | - "{$review}{$age}{$watching}{$underReview}</li>" ); |
| 144 | + "{$age}{$watching}{$underReview}</li>" ); |
144 | 145 | } |
145 | 146 | |
146 | 147 | /** |
Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php |
— | — | @@ -206,8 +206,9 @@ |
207 | 207 | $link = $this->skin->makeKnownLinkObj( $title ); |
208 | 208 | $css = $stxt = $review = $quality = $underReview = ''; |
209 | 209 | $stxt = ChangesList::showCharacterDifference( $row->rev_len, $row->page_len ); |
210 | | - $review = $this->skin->makeKnownLinkObj( $title, wfMsg( 'oldreviewed-diff' ), |
211 | | - "diff=cur&oldid={$row->stable}&reviewform=1&diffonly=0" ); |
| 210 | + $review = $this->skin->makeKnownLinkObj( $title, |
| 211 | + wfMsg( 'oldreviewed-diff' ), |
| 212 | + 'diff=cur&oldid='.intval($row->stable).'&diffonly=0' ); |
212 | 213 | # Show quality level if there are several |
213 | 214 | if ( FlaggedRevs::qualityVersions() ) { |
214 | 215 | $quality = $row->quality ? |
Index: trunk/extensions/FlaggedRevs/specialpages/ProblemChanges_body.php |
— | — | @@ -174,11 +174,12 @@ |
175 | 175 | public function formatRow( $row ) { |
176 | 176 | global $wgLang, $wgUser, $wgMemc; |
177 | 177 | |
| 178 | + $css = $stxt = $quality = $underReview = ''; |
178 | 179 | $title = Title::makeTitle( $row->page_namespace, $row->page_title ); |
179 | 180 | $link = $this->skin->makeKnownLinkObj( $title ); |
180 | | - $css = $stxt = $review = $quality = $underReview = ''; |
181 | | - $review = $this->skin->makeKnownLinkObj( $title, wfMsg( 'oldreviewed-diff' ), |
182 | | - "diff=cur&oldid={$row->stable}&reviewform=1&diffonly=0" ); |
| 181 | + $review = $this->skin->makeKnownLinkObj( $title, |
| 182 | + wfMsg( 'oldreviewed-diff' ), |
| 183 | + 'diff=cur&oldid='.intval($row->stable).'&diffonly=0' ); |
183 | 184 | # Show quality level if there are several |
184 | 185 | if ( FlaggedRevs::qualityVersions() ) { |
185 | 186 | $quality = $row->quality ? |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -4,12 +4,10 @@ |
5 | 5 | /** |
6 | 6 | * Add FlaggedRevs css/js. |
7 | 7 | */ |
8 | | - public static function injectStyleAndJS() { |
| 8 | + protected static function injectStyleAndJS() { |
9 | 9 | global $wgOut, $wgUser; |
10 | | - if ( $wgOut->hasHeadItem( 'FlaggedRevs' ) ) |
| 10 | + if ( $wgOut->hasHeadItem( 'FlaggedRevs' ) ) { |
11 | 11 | return true; # Don't double-load |
12 | | - if ( !$wgOut->isArticleRelated() ) { |
13 | | - return self::InjectStyleForSpecial(); // try special page CSS? |
14 | 12 | } |
15 | 13 | $fa = FlaggedArticleView::globalArticleInstance(); |
16 | 14 | # Try to only add to relevant pages |
— | — | @@ -38,6 +36,7 @@ |
39 | 37 | $head .= "\n<script type=\"{$wgJsMimeType}\">" . |
40 | 38 | "FlaggedRevs.messages = " . Xml::encodeJsVar( $msgs ) . ";</script>\n"; |
41 | 39 | $wgOut->addHeadItem( 'FlaggedRevs', $head ); |
| 40 | + |
42 | 41 | return true; |
43 | 42 | } |
44 | 43 | |
— | — | @@ -76,7 +75,7 @@ |
77 | 76 | /** |
78 | 77 | * Add FlaggedRevs css for relevant special pages. |
79 | 78 | */ |
80 | | - public static function InjectStyleForSpecial() { |
| 79 | + protected static function injectStyleForSpecial() { |
81 | 80 | global $wgTitle, $wgOut; |
82 | 81 | if ( empty( $wgTitle ) || $wgTitle->getNamespace() !== NS_SPECIAL ) { |
83 | 82 | return true; |
— | — | @@ -108,21 +107,18 @@ |
109 | 108 | $view->setRobotPolicy(); // set indexing policy |
110 | 109 | self::injectStyleAndJS(); // full CSS/JS |
111 | 110 | } else { |
112 | | - self::InjectStyleForSpecial(); // try special page CSS |
| 111 | + self::injectStyleForSpecial(); // try special page CSS |
113 | 112 | } |
114 | 113 | return true; |
115 | 114 | } |
116 | 115 | |
117 | 116 | public static function markUnderReview( $output, $article, $title, $user, $request ) { |
118 | | - $action = $request->getVal( 'action', 'view' ); |
119 | | - $reviewing = ( $action == 'history' ); // default |
120 | | - if ( $action == 'view' |
121 | | - && ( $request->getInt( 'reviewform' ) || $request->getInt( 'rcid' ) ) ) |
122 | | - { |
123 | | - $reviewing = true; |
| 117 | + if( !$user->isAllowed( 'review' ) ) { |
| 118 | + return true; // user cannot review |
124 | 119 | } |
125 | | - # Set a key to note that someone is viewing this |
126 | | - if ( $reviewing && $user->isAllowed( 'review' ) ) { |
| 120 | + # Set a key to note when someone is reviewing this. |
| 121 | + # NOTE: diff-to-stable views already handled elsewhere. |
| 122 | + if ( $request->getInt( 'reviewing' ) || $request->getInt( 'rcid' ) ) { |
127 | 123 | global $wgMemc; |
128 | 124 | $key = wfMemcKey( 'unreviewedPages', 'underReview', $title->getArticleId() ); |
129 | 125 | $wgMemc->set( $key, '1', 20 * 60 ); // 20 min |
— | — | @@ -1896,7 +1892,7 @@ |
1897 | 1893 | return true; // not needed |
1898 | 1894 | } |
1899 | 1895 | $fa = FlaggedArticleView::globalArticleInstance(); |
1900 | | - if ( $fa->isReviewable() && !$fa->limitedUI() ) { |
| 1896 | + if ( $fa->isReviewable() ) { |
1901 | 1897 | $srev = $fa->getStableRev(); |
1902 | 1898 | # For pages with either no stable version, or an outdated one, let |
1903 | 1899 | # the user decide if he/she wants it reviewed on the spot. One might |
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -121,8 +121,8 @@ |
122 | 122 | public function displayTag() { |
123 | 123 | global $wgOut, $wgRequest; |
124 | 124 | $this->load(); |
125 | | - // UI may be limited to unobtrusive patrolling system |
126 | | - if ( $wgRequest->getVal( 'stableid' ) || !$this->article->limitedUI() ) { |
| 125 | + // Sanity check that this is in reviewable namespace |
| 126 | + if ( $this->article->isReviewable( true ) ) { |
127 | 127 | $wgOut->appendSubtitle( $this->reviewNotice ); |
128 | 128 | } |
129 | 129 | return true; |
— | — | @@ -136,9 +136,9 @@ |
137 | 137 | public function addStableLink() { |
138 | 138 | global $wgRequest, $wgOut, $wgLang; |
139 | 139 | $this->load(); |
140 | | - # Only for viewing old versions. UI may be limited to unobtrusive patrolling system. |
141 | | - if ( !$wgRequest->getVal( 'oldid' ) || $this->article->limitedUI() ) |
| 140 | + if ( !$this->article->isReviewable() || !$wgRequest->getVal( 'oldid' ) ) { |
142 | 141 | return true; |
| 142 | + } |
143 | 143 | # We may have nav links like "direction=prev&oldid=x" |
144 | 144 | $revID = $this->article->getOldIDFromRequest(); |
145 | 145 | $frev = FlaggedRevision::newFromTitle( $this->article->getTitle(), $revID ); |
— | — | @@ -721,7 +721,7 @@ |
722 | 722 | global $wgOut; |
723 | 723 | $this->load(); |
724 | 724 | # Must be reviewable. UI may be limited to unobtrusive patrolling system. |
725 | | - if ( !$this->article->isReviewable() || $this->article->limitedUI() ) { |
| 725 | + if ( !$this->article->isReviewable() ) { |
726 | 726 | return true; |
727 | 727 | } |
728 | 728 | # Add a notice if there are pending edits... |
— | — | @@ -743,7 +743,7 @@ |
744 | 744 | global $wgRequest, $wgOut, $wgLang, $wgUser; |
745 | 745 | $this->load(); |
746 | 746 | # Must be reviewable. UI may be limited to unobtrusive patrolling system. |
747 | | - if ( !$this->article->isReviewable() || $this->article->limitedUI() ) { |
| 747 | + if ( !$this->article->isReviewable() ) { |
748 | 748 | return true; |
749 | 749 | } |
750 | 750 | $items = array(); |
— | — | @@ -912,10 +912,6 @@ |
913 | 913 | { |
914 | 914 | return true; |
915 | 915 | } |
916 | | - # Unobtrusive patrolling UI only shows forms if requested |
917 | | - if ( !$wgRequest->getInt( 'reviewform' ) && $this->article->limitedUI() ) { |
918 | | - return true; |
919 | | - } |
920 | 916 | # Avoid multi-page diffs that are useless and misbehave (bug 19327) |
921 | 917 | if ( $this->isMultiPageDiff ) { |
922 | 918 | return true; |
— | — | @@ -1014,7 +1010,7 @@ |
1015 | 1011 | $fa = FlaggedArticle::getTitleInstance( $title ); |
1016 | 1012 | |
1017 | 1013 | $action = $wgRequest->getVal( 'action', 'view' ); |
1018 | | - if ( !$fa->isReviewable() || $fa->limitedUI() ) { |
| 1014 | + if ( !$fa->isReviewable() ) { |
1019 | 1015 | return true; // Not a reviewable page or the UI is hidden |
1020 | 1016 | } |
1021 | 1017 | $flags = ( $action == 'rollback' ) ? FR_MASTER : 0; |
— | — | @@ -1126,7 +1122,7 @@ |
1127 | 1123 | return true; |
1128 | 1124 | } |
1129 | 1125 | # Page must be reviewable. UI may be limited to unobtrusive patrolling system. |
1130 | | - if ( !$this->article->isReviewable() || $this->article->limitedUI() ) { |
| 1126 | + if ( !$this->article->isReviewable() ) { |
1131 | 1127 | return true; |
1132 | 1128 | } |
1133 | 1129 | # Check if this might be the diff to stable. If so, enhance it. |