Index: trunk/extensions/FlaggedRevs/api/ApiStabilize.php |
— | — | @@ -82,7 +82,6 @@ |
83 | 83 | $form->setExpirySelection( 'other' ); # Expiry dropdown |
84 | 84 | $restriction = $params['autoreview']; |
85 | 85 | // Fill in config fields from URL params |
86 | | - $form->setPrecedence( $this->precendenceFromKey( $params['precedence'] ) ); |
87 | 86 | if ( $params['default'] === null ) { |
88 | 87 | // Default version setting not optional |
89 | 88 | $this->dieUsageMsg( array( 'missingparam', 'default' ) ); |
— | — | @@ -105,7 +104,6 @@ |
106 | 105 | $res = array(); |
107 | 106 | $res['title'] = $title->getPrefixedText(); |
108 | 107 | $res['default'] = $params['default']; |
109 | | - $res['precedence'] = $params['precedence']; |
110 | 108 | $res['autoreview'] = $params['autoreview']; |
111 | 109 | $res['expiry'] = $form->getExpiry(); |
112 | 110 | $this->getResult()->addValue( null, $this->getModuleName(), $res ); |
— | — | @@ -120,28 +118,6 @@ |
121 | 119 | return null; // bad key? |
122 | 120 | } |
123 | 121 | |
124 | | - protected function precendenceFromKey( $key ) { |
125 | | - if ( $key == 'pristine' ) { |
126 | | - return FLAGGED_VIS_PRISTINE; |
127 | | - } else if ( $key == 'quality' ) { |
128 | | - return FLAGGED_VIS_QUALITY; |
129 | | - } else if ( $key == 'latest' ) { |
130 | | - return FLAGGED_VIS_LATEST; |
131 | | - } |
132 | | - return null; // bad key? |
133 | | - } |
134 | | - |
135 | | - protected function keyFromPrecendence( $precedence ) { |
136 | | - if ( $precedence == FLAGGED_VIS_PRISTINE ) { |
137 | | - return 'pristine'; |
138 | | - } else if ( $precedence == FLAGGED_VIS_QUALITY ) { |
139 | | - return 'quality'; |
140 | | - } else if ( $precedence == FLAGGED_VIS_LATEST ) { |
141 | | - return 'lastest'; |
142 | | - } |
143 | | - return null; // bad key? |
144 | | - } |
145 | | - |
146 | 122 | public function getAllowedParams() { |
147 | 123 | // Replace '' with more readable 'none' in autoreview restiction levels |
148 | 124 | $autoreviewLevels = FlaggedRevs::getRestrictionLevels(); |
— | — | @@ -151,10 +127,6 @@ |
152 | 128 | ApiBase :: PARAM_TYPE => array( 'latest', 'stable' ), |
153 | 129 | ApiBase :: PARAM_DFLT => null, |
154 | 130 | ), |
155 | | - 'precedence' => array( |
156 | | - ApiBase :: PARAM_TYPE => array( 'pristine', 'quality', 'latest' ), |
157 | | - ApiBase :: PARAM_DFLT => $this->keyFromPrecendence( FlaggedRevs::getPrecedence() ) |
158 | | - ), |
159 | 131 | 'autoreview' => array( |
160 | 132 | ApiBase :: PARAM_TYPE => $autoreviewLevels, |
161 | 133 | ApiBase :: PARAM_DFLT => 'none', |
— | — | @@ -172,7 +144,6 @@ |
173 | 145 | public function getParamDescription() { |
174 | 146 | return array( |
175 | 147 | 'default' => 'Default revision to show', |
176 | | - 'precedence' => 'How the stable version is selected by precedence', |
177 | 148 | 'autoreview' => 'Auto-review restriction', |
178 | 149 | 'expiry' => 'Expiry for these settings', |
179 | 150 | 'title' => 'Title of page to be stabilized', |
Index: trunk/extensions/FlaggedRevs/client/review.js |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | * a) Disable submit in case of invalid input. |
8 | 8 | * b) Update colors when select changes (Opera already does this). |
9 | 9 | * c) Also remove comment box clutter in case of invalid input. |
| 10 | +* NOTE: all buttons should exist (perhaps hidden though) |
10 | 11 | */ |
11 | 12 | FlaggedRevs.updateRatingForm = function() { |
12 | 13 | var ratingform = document.getElementById('mw-fr-ratingselects'); |
— | — | @@ -14,23 +15,17 @@ |
15 | 16 | if( disabled ) return; |
16 | 17 | |
17 | 18 | var quality = true; |
18 | | - var allzero = true; |
19 | 19 | var somezero = false; |
20 | | - |
| 20 | + |
| 21 | + // Determine if this is a "quality" or "incomplete" review |
21 | 22 | for( tag in wgFlaggedRevsParams.tags ) { |
22 | 23 | var controlName = "wp" + tag; |
23 | 24 | var levels = document.getElementsByName(controlName); |
24 | 25 | if( !levels.length ) continue; |
| 26 | + |
25 | 27 | var selectedlevel = 0; // default |
26 | | - |
27 | 28 | if( levels[0].nodeName == 'SELECT' ) { |
28 | 29 | selectedlevel = levels[0].selectedIndex; |
29 | | - // Update color. Opera does this already, and doing so |
30 | | - // seems to kill custom pretty opera skin form styling. |
31 | | - if( navigator.appName != 'Opera') { |
32 | | - value = levels[0].getElementsByTagName('option')[selectedlevel].value; |
33 | | - levels[0].className = 'fr-rating-option-' + value; |
34 | | - } |
35 | 30 | } else if( levels[0].type == 'radio' ) { |
36 | 31 | for( i = 0; i < levels.length; i++ ) { |
37 | 32 | if( levels[i].checked ) { |
— | — | @@ -43,39 +38,62 @@ |
44 | 39 | } else { |
45 | 40 | return; // error: should not happen |
46 | 41 | } |
47 | | - |
| 42 | + |
48 | 43 | // Get quality level for this tag |
49 | 44 | qualityLevel = wgFlaggedRevsParams.tags[tag]['quality']; |
50 | 45 | |
51 | 46 | if( selectedlevel < qualityLevel ) { |
52 | 47 | quality = false; // not a quality review |
53 | 48 | } |
54 | | - if( selectedlevel > 0 ) { |
55 | | - allzero = false; |
56 | | - } else { |
| 49 | + if( selectedlevel <= 0 ) { |
57 | 50 | somezero = true; |
58 | 51 | } |
59 | 52 | } |
60 | | - // Show note box only for quality revs |
61 | | - var notebox = document.getElementById('mw-fr-notebox'); |
62 | | - if( notebox ) { |
63 | | - notebox.style.display = quality ? 'inline' : 'none'; |
| 53 | + |
| 54 | + // (a) If only a few levels are zero ("incomplete") then disable submission. |
| 55 | + // (b) Re-enable submission for already accepted revs when ratings change. |
| 56 | + var rsubmit = document.getElementById('mw-fr-submit-accept'); |
| 57 | + if( rsubmit ) { |
| 58 | + rsubmit.disabled = somezero ? 'disabled' : ''; |
| 59 | + rsubmit.value = wgAjaxReview.flagMsg; // reset to "Accept" |
64 | 60 | } |
65 | | - // If only a few levels are zero and there is only one |
66 | | - // submit button (for review/unreview), then disable it. |
67 | | - var rsubmit = document.getElementById('mw-fr-submitreview'); |
68 | | - var usubmit = document.getElementById('mw-fr-submitunreview'); |
69 | | - if( rsubmit && !usubmit ) { |
70 | | - rsubmit.disabled = ( somezero && !allzero ) ? 'disabled' : ''; |
| 61 | + |
| 62 | + // Update colors of <select> |
| 63 | + FlaggedRevs.updateRatingFormColors(); |
| 64 | +} |
| 65 | + |
| 66 | +/* |
| 67 | +* Disable 'accept' button if the revision was already reviewed |
| 68 | +* NOTE: this is used so that they can be re-enabled if a rating changes |
| 69 | +*/ |
| 70 | +FlaggedRevs.maybeDisableAcceptButton = function() { |
| 71 | + if ( typeof(jsReviewNeedsChange) != 'undefined' && jsReviewNeedsChange == 1 ) { |
| 72 | + var rsubmit = document.getElementById('mw-fr-submit-accept'); |
| 73 | + if( rsubmit ) { |
| 74 | + rsubmit.disabled = 'disabled'; |
| 75 | + } |
71 | 76 | } |
72 | | - // Clear note box data if not shown |
73 | | - var notes = document.getElementById('wpNotes'); |
74 | | - if( notes ) { |
75 | | - notes.value = quality ? notes.value : ''; |
| 77 | +} |
| 78 | + |
| 79 | +hookEvent( "load", FlaggedRevs.maybeDisableAcceptButton ); |
| 80 | + |
| 81 | +FlaggedRevs.updateRatingFormColors = function() { |
| 82 | + for( tag in wgFlaggedRevsParams.tags ) { |
| 83 | + var controlName = "wp" + tag; |
| 84 | + var levels = document.getElementsByName(controlName); |
| 85 | + if( levels.length && levels[0].nodeName == 'SELECT' ) { |
| 86 | + selectedlevel = levels[0].selectedIndex; |
| 87 | + // Update color. Opera does this already, and doing so |
| 88 | + // seems to kill custom pretty opera skin form styling. |
| 89 | + if( navigator.appName != 'Opera') { |
| 90 | + value = levels[0].getElementsByTagName('option')[selectedlevel].value; |
| 91 | + levels[0].className = 'fr-rating-option-' + value; |
| 92 | + } |
| 93 | + } |
76 | 94 | } |
77 | 95 | } |
78 | 96 | |
79 | | -addOnloadHook(FlaggedRevs.updateRatingForm); |
| 97 | +hookEvent( "load", FlaggedRevs.updateRatingFormColors ); |
80 | 98 | |
81 | 99 | // dependencies: |
82 | 100 | // * ajax.js: |
— | — | @@ -226,44 +244,31 @@ |
227 | 245 | sajax_request_type = old; |
228 | 246 | } |
229 | 247 | } |
230 | | - var rsubmit = document.getElementById("mw-fr-submitreview"); |
231 | | - var usubmit = document.getElementById("mw-fr-submitunreview"); |
| 248 | + var rsubmit = document.getElementById("mw-fr-submit-accept"); |
| 249 | + var usubmit = document.getElementById("mw-fr-submit-unaccept"); |
232 | 250 | var legend = document.getElementById("mw-fr-reviewformlegend"); |
233 | 251 | var diffNotice = document.getElementById("mw-fr-difftostable"); |
234 | 252 | var tagBox = document.getElementById('mw-fr-revisiontag'); |
235 | 253 | // On success... |
236 | 254 | if( response.indexOf('<suc#>') == 0 ) { |
237 | 255 | document.title = wgAjaxReview.actioncomplete; |
238 | | - if( rsubmit ) { |
239 | | - // If flagging is just binary, flip the form |
240 | | - if( usubmit ) { |
241 | | - // Revision was flagged |
242 | | - if( rsubmit.value == wgAjaxReview.sendingMsg ) { |
243 | | - // For template review case go from re-review to review message |
244 | | - legend.innerHTML = '<strong>'+wgAjaxReview.flagLegMsg+'</strong>'; |
245 | | - rsubmit.value = wgAjaxReview.flaggedMsg; // done! |
246 | | - rsubmit.style.fontWeight = 'bold'; |
247 | | - // Unlock and reset *unflag* button |
248 | | - usubmit.value = wgAjaxReview.unflagMsg; |
249 | | - usubmit.removeAttribute( 'style' ); // back to normal |
250 | | - usubmit.disabled = ''; |
251 | | - // Revision was unflagged |
252 | | - } else if( usubmit.value == wgAjaxReview.sendingMsg ) { |
253 | | - usubmit.value = wgAjaxReview.unflaggedMsg; // done! |
254 | | - usubmit.style.fontWeight = 'bold'; |
255 | | - // Unlock and reset *flag* button |
256 | | - rsubmit.value = wgAjaxReview.flagMsg; |
257 | | - rsubmit.removeAttribute( 'style' ); // back to normal |
258 | | - rsubmit.disabled = ''; |
259 | | - } |
260 | | - } else { |
261 | | - if( tier > 0 ) { |
262 | | - rsubmit.value = wgAjaxReview.flaggedMsg; |
263 | | - } else { |
264 | | - rsubmit.value = wgAjaxReview.unflaggedMsg; |
265 | | - } |
| 256 | + if( rsubmit && usubmit ) { |
| 257 | + // Revision was flagged |
| 258 | + if( rsubmit.value == wgAjaxReview.sendingMsg ) { |
| 259 | + rsubmit.value = wgAjaxReview.flaggedMsg; // done! |
266 | 260 | rsubmit.style.fontWeight = 'bold'; |
267 | | - rsubmit.disabled = ''; // unlock flag button |
| 261 | + // Unlock and reset *unflag* button |
| 262 | + usubmit.value = wgAjaxReview.unflagMsg; |
| 263 | + usubmit.removeAttribute( 'style' ); // back to normal |
| 264 | + usubmit.disabled = ''; |
| 265 | + // Revision was unflagged |
| 266 | + } else if( usubmit.value == wgAjaxReview.sendingMsg ) { |
| 267 | + usubmit.value = wgAjaxReview.unflaggedMsg; // done! |
| 268 | + usubmit.style.fontWeight = 'bold'; |
| 269 | + // Unlock and reset *flag* button |
| 270 | + rsubmit.value = wgAjaxReview.flagMsg; |
| 271 | + rsubmit.removeAttribute( 'style' ); // back to normal |
| 272 | + rsubmit.disabled = ''; |
268 | 273 | } |
269 | 274 | } |
270 | 275 | // Hide "review this" box on diffs |
— | — | @@ -273,7 +278,7 @@ |
274 | 279 | // On failure... |
275 | 280 | } else { |
276 | 281 | document.title = wgAjaxReview.actionfailed; |
277 | | - if( rsubmit ) { |
| 282 | + if( rsubmit && usubmit ) { |
278 | 283 | // Revision was flagged |
279 | 284 | if( rsubmit.value == wgAjaxReview.sendingMsg ) { |
280 | 285 | rsubmit.value = wgAjaxReview.flagMsg; // back to normal |
— | — | @@ -302,11 +307,11 @@ |
303 | 308 | } |
304 | 309 | |
305 | 310 | wgAjaxReview.onLoad = function() { |
306 | | - var rsubmit = document.getElementById("mw-fr-submitreview"); |
| 311 | + var rsubmit = document.getElementById("mw-fr-submit-accept"); |
307 | 312 | if( rsubmit ) { |
308 | 313 | rsubmit.onclick = wgAjaxReview.ajaxCall; |
309 | 314 | } |
310 | | - var usubmit = document.getElementById("mw-fr-submitunreview"); |
| 315 | + var usubmit = document.getElementById("mw-fr-submit-unaccept"); |
311 | 316 | if( usubmit ) { |
312 | 317 | usubmit.onclick = wgAjaxReview.ajaxCall; |
313 | 318 | } |
Index: trunk/extensions/FlaggedRevs/client/flaggedrevs.css |
— | — | @@ -279,7 +279,6 @@ |
280 | 280 | .fr-rating-controls, |
281 | 281 | .fr-rating-controls-disabled { |
282 | 282 | vertical-align: middle; |
283 | | - line-height: 1em; |
284 | 283 | } |
285 | 284 | |
286 | 285 | .fr-rating-controls-disabled { |
— | — | @@ -290,6 +289,13 @@ |
291 | 290 | margin-right: 1.5em; |
292 | 291 | } |
293 | 292 | |
| 293 | +#mw-fr-submit-unaccept { |
| 294 | + color: darkblue; |
| 295 | +} |
| 296 | +#mw-fr-submit-reject { |
| 297 | + color: darkred; |
| 298 | +} |
| 299 | + |
294 | 300 | .fr-rating-option-0 { |
295 | 301 | background-color: #f5ecec; |
296 | 302 | } |
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php |
— | — | @@ -5,6 +5,8 @@ |
6 | 6 | class FlaggedArticleView { |
7 | 7 | protected $article = null; |
8 | 8 | |
| 9 | + protected $diffRevs = null; |
| 10 | + protected $isReviewableDiff = false; |
9 | 11 | protected $isDiffFromStable = false; |
10 | 12 | protected $isMultiPageDiff = false; |
11 | 13 | protected $reviewNotice = ''; |
— | — | @@ -1038,10 +1040,10 @@ |
1039 | 1041 | $rev = Revision::newFromId( $wgOut->getRevisionId() ); |
1040 | 1042 | } |
1041 | 1043 | # Build the review form as needed |
1042 | | - if ( $rev ) { |
1043 | | - $templateIDs = $fileSHA1Keys = null; |
| 1044 | + if ( $rev && ( !$this->diffRevs || $this->isReviewableDiff ) ) { |
1044 | 1045 | # $wgOut may not already have the inclusion IDs, such as for diffonly=1. |
1045 | 1046 | # RevisionReviewForm will fetch them as needed however. |
| 1047 | + $templateIDs = $fileSHA1Keys = null; |
1046 | 1048 | if ( $wgOut->getRevisionId() == $rev->getId() |
1047 | 1049 | && isset( $wgOut->mTemplateIds ) |
1048 | 1050 | && isset( $wgOut->fr_fileSHA1Keys ) ) |
— | — | @@ -1049,12 +1051,14 @@ |
1050 | 1052 | $templateIDs = $wgOut->mTemplateIds; |
1051 | 1053 | $fileSHA1Keys = $wgOut->fr_fileSHA1Keys; |
1052 | 1054 | } |
1053 | | - $form = RevisionReviewForm::buildQuickReview( $wgUser, $this->article, |
1054 | | - $rev, $templateIDs, $fileSHA1Keys, $this->isDiffFromStable ); |
| 1055 | + # Review notice box goes in top of form |
| 1056 | + $form = RevisionReviewForm::buildQuickReview( |
| 1057 | + $wgUser, $this->article, $rev, $this->diffRevs['old'], |
| 1058 | + $this->diffNoticeBox, $templateIDs, $fileSHA1Keys |
| 1059 | + ); |
1055 | 1060 | # Diff action: place the form at the top of the page |
1056 | | - if ( $wgRequest->getVal( 'diff' ) ) { |
1057 | | - # Review notice box goes above form |
1058 | | - $wgOut->prependHTML( $this->diffNoticeBox . $form ); |
| 1061 | + if ( $this->diffRevs ) { |
| 1062 | + $wgOut->prependHTML( $form ); |
1059 | 1063 | # View action: place the form at the bottom of the page |
1060 | 1064 | } else { |
1061 | 1065 | $data .= $form; |
— | — | @@ -1292,7 +1296,7 @@ |
1293 | 1297 | && $this->isDiffFromStable |
1294 | 1298 | && !$this->article->stableVersionIsSynced() ) // pending changes |
1295 | 1299 | { |
1296 | | - $form = ''; |
| 1300 | + $changeDiv = ''; |
1297 | 1301 | $this->reviewFormRev = $newRev; |
1298 | 1302 | $changeList = array(); |
1299 | 1303 | # Page not synced only due to includes? |
— | — | @@ -1345,16 +1349,17 @@ |
1346 | 1350 | $changeDiv .= wfMsgExt( 'revreview-update-use', 'parse' ); |
1347 | 1351 | } |
1348 | 1352 | } |
1349 | | - if ( $changeDiv != '' ) { |
| 1353 | + } |
| 1354 | + if ( $changeDiv != '' ) { |
| 1355 | + if ( $wgUser->isAllowed( 'review' ) ) { |
| 1356 | + $this->diffNoticeBox = $changeDiv; // add as part of form |
| 1357 | + } else { |
1350 | 1358 | $css = 'flaggedrevs_diffnotice plainlinks'; |
1351 | | - $form .= "<div id='mw-fr-difftostable' class='$css'>$changeDiv</div>\n"; |
| 1359 | + $wgOut->addHTML( |
| 1360 | + "<div id='mw-fr-difftostable' class='$css'>$changeDiv</div>\n" |
| 1361 | + ); |
1352 | 1362 | } |
1353 | 1363 | } |
1354 | | - if ( $wgUser->isAllowed( 'review' ) ) { |
1355 | | - $this->diffNoticeBox = $form; // add as part of form |
1356 | | - } else { |
1357 | | - $wgOut->addHTML( $form ); |
1358 | | - } |
1359 | 1364 | } |
1360 | 1365 | # Add a link to diff from stable to current as needed. |
1361 | 1366 | # Show review status of the diff revision(s). Uses a <table>. |
— | — | @@ -1537,9 +1542,17 @@ |
1538 | 1543 | // Is this a diff of a draft rev against the stable rev? |
1539 | 1544 | if ( self::isDiffToStable( $srev, $oldRev, $newRev ) ) { |
1540 | 1545 | $this->isDiffFromStable = true; |
| 1546 | + $this->isReviewableDiff = true; |
| 1547 | + // Is this a diff of a draft rev against a reviewed rev? |
| 1548 | + } elseif ( |
| 1549 | + FlaggedRevision::newFromTitle( $diff->getTitle(), $oldRev->getId() ) || |
| 1550 | + FlaggedRevision::newFromTitle( $diff->getTitle(), $newRev->getId() ) |
| 1551 | + ) { |
| 1552 | + $this->isReviewableDiff = true; |
1541 | 1553 | } |
1542 | 1554 | } |
1543 | 1555 | } |
| 1556 | + $this->diffRevs = array( 'old' => $oldRev->getId(), 'new' => $newRev->getId() ); |
1544 | 1557 | return true; |
1545 | 1558 | } |
1546 | 1559 | |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -28,16 +28,6 @@ |
29 | 29 | return; |
30 | 30 | } |
31 | 31 | |
32 | | -# Quality -> Sighted (default) |
33 | | -if ( !defined( 'FLAGGED_VIS_QUALITY' ) ) |
34 | | - define( 'FLAGGED_VIS_QUALITY', 0 ); |
35 | | -# No precedence |
36 | | -if ( !defined( 'FLAGGED_VIS_LATEST' ) ) |
37 | | - define( 'FLAGGED_VIS_LATEST', 1 ); |
38 | | -# Pristine -> Quality -> Sighted |
39 | | -if ( !defined( 'FLAGGED_VIS_PRISTINE' ) ) |
40 | | - define( 'FLAGGED_VIS_PRISTINE', 2 ); |
41 | | - |
42 | 32 | # SELECT parameters... |
43 | 33 | if ( !defined( 'FR_FOR_UPDATE' ) ) |
44 | 34 | define( 'FR_FOR_UPDATE', 1 ); |
— | — | @@ -76,7 +66,7 @@ |
77 | 67 | |
78 | 68 | # This will only distinguish "sighted", "quality", and unreviewed |
79 | 69 | # A small icon will show in the upper right hand corner |
80 | | -$wgSimpleFlaggedRevsUI = true; |
| 70 | +$wgSimpleFlaggedRevsUI = true; // @TODO: remove when ready |
81 | 71 | # For visitors, only show tags/icons for unreviewed/outdated pages |
82 | 72 | $wgFlaggedRevsLowProfile = true; |
83 | 73 | |
— | — | @@ -89,19 +79,14 @@ |
90 | 80 | # Is a "stable version" used as the default display |
91 | 81 | # version for all pages in reviewable namespaces? |
92 | 82 | $wgFlaggedRevsOverride = true; |
93 | | -# Precedence order for stable version selection. |
94 | | -# The stable version will be the highest ranked version in the page. |
95 | | -# FR_PRISTINE : "pristine" > "quality" > "sighted" |
96 | | -# FR_QUALITY : "pristine" = "quality" > "sighted" |
97 | | -# FR_SIGHTED : "pristine" = "quality" = "sighted" |
98 | | -$wgFlaggedRevsPrecedence = FR_QUALITY; |
99 | 83 | # Below are groups that see the current revision by default. |
100 | 84 | # This makes editing easier since the users always start off |
101 | 85 | # viewing the latest version of pages. |
102 | 86 | $wgFlaggedRevsExceptions = array( 'user' ); |
103 | 87 | |
104 | 88 | # Can users make comments that will show up below flagged revisions? |
105 | | -$wgFlaggedRevsComments = false; |
| 89 | +# NOTE: this is NOT the same as the simple log comment |
| 90 | +$wgFlaggedRevsComments = false; // @TODO: remove when ready? |
106 | 91 | # Auto-review edits that are: |
107 | 92 | # (a) directly to the stable version by users with 'autoreview'/'bot' |
108 | 93 | # (b) self-reversions back to the stable version by any user |
— | — | @@ -144,7 +129,6 @@ |
145 | 130 | # on the protection form of pages. Each level has the stable version shown by default. |
146 | 131 | # A "none" level will appear in the form as well, to disable the review process. |
147 | 132 | # Pages will only be reviewable if manually restricted to a level above "none". |
148 | | -# NOTE: The stable version precedence cannot be configured per page with this. |
149 | 133 | $wgFlaggedRevsProtection = false; |
150 | 134 | |
151 | 135 | # Define our basic reviewer class of established editors (Editors) |
— | — | @@ -253,8 +237,10 @@ |
254 | 238 | # End of configuration variables. |
255 | 239 | # ######## |
256 | 240 | |
257 | | -# Patrollable namespaces (overridden by reviewable namespaces) |
258 | | -$wgFlaggedRevsPatrolNamespaces = array(); |
| 241 | +# Temp var |
| 242 | +$wgFlaggedRevsRCCrap = true; |
| 243 | +# Patrollable namespaces (overridden by reviewable namespaces) (don't use) |
| 244 | +$wgFlaggedRevsPatrolNamespaces = array(); // @TODO: remove when ready |
259 | 245 | |
260 | 246 | # Bots are granted autoreview via hooks, mark in rights |
261 | 247 | # array so that it shows up in sp:ListGroupRights... |
— | — | @@ -535,20 +521,22 @@ |
536 | 522 | # ####### END HOOK TRIGGERED FUNCTIONS ######### |
537 | 523 | |
538 | 524 | function efLoadFlaggedRevs() { |
539 | | - global $wgUseRCPatrol, $wgFlaggedRevsNamespaces; |
540 | | - # If patrolling is already on, then we know that it |
541 | | - # was intended to have all namespaces patrollable. |
542 | | - if ( $wgUseRCPatrol ) { |
543 | | - global $wgFlaggedRevsPatrolNamespaces, $wgCanonicalNamespaceNames; |
544 | | - $wgFlaggedRevsPatrolNamespaces = array_keys( $wgCanonicalNamespaceNames ); |
| 525 | + global $wgFlaggedRevsRCCrap, $wgUseRCPatrol, $wgFlaggedRevsNamespaces; |
| 526 | + if ( $wgFlaggedRevsRCCrap ) { |
| 527 | + # If patrolling is already on, then we know that it |
| 528 | + # was intended to have all namespaces patrollable. |
| 529 | + if ( $wgUseRCPatrol ) { |
| 530 | + global $wgFlaggedRevsPatrolNamespaces, $wgCanonicalNamespaceNames; |
| 531 | + $wgFlaggedRevsPatrolNamespaces = array_keys( $wgCanonicalNamespaceNames ); |
| 532 | + } |
| 533 | + /* TODO: decouple from rc patrol */ |
| 534 | + # Check if FlaggedRevs is enabled by default for pages... |
| 535 | + if ( $wgFlaggedRevsNamespaces && !FlaggedRevs::useOnlyIfProtected() ) { |
| 536 | + # Use RC Patrolling to check for vandalism. |
| 537 | + # Edits to reviewable pages must be flagged to be patrolled. |
| 538 | + $wgUseRCPatrol = true; |
| 539 | + } |
545 | 540 | } |
546 | | - /* TODO: decouple from rc patrol */ |
547 | | - # Check if FlaggedRevs is enabled by default for pages... |
548 | | - if ( $wgFlaggedRevsNamespaces && !FlaggedRevs::useOnlyIfProtected() ) { |
549 | | - # Use RC Patrolling to check for vandalism. |
550 | | - # Edits to reviewable pages must be flagged to be patrolled. |
551 | | - $wgUseRCPatrol = true; |
552 | | - } |
553 | 541 | # Conditional API modules |
554 | 542 | efSetFlaggedRevsConditionalAPIModules(); |
555 | 543 | # Load hooks that aren't always set |
Index: trunk/extensions/FlaggedRevs/maintenance/updateTracking.inc |
— | — | @@ -152,7 +152,6 @@ |
153 | 153 | # Remove manual config settings that simply restate the site defaults |
154 | 154 | $db->delete( 'flaggedpage_config', |
155 | 155 | array( "fpc_page_id BETWEEN $blockStart AND $blockEnd", |
156 | | - 'fpc_select' => FlaggedRevs::getPrecedence(), |
157 | 156 | 'fpc_override' => intval( FlaggedRevs::isStableShownByDefault() ), |
158 | 157 | 'fpc_level' => '' |
159 | 158 | ), |
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php |
— | — | @@ -172,8 +172,9 @@ |
173 | 173 | 'revreview-style-4' => 'Featured', |
174 | 174 | 'revreview-submit' => 'Submit', |
175 | 175 | 'revreview-submitting' => 'Submitting...', |
176 | | - 'revreview-submit-review' => 'Accept', |
177 | | - 'revreview-submit-unreview' => 'Unaccept', |
| 176 | + 'revreview-submit-review' => 'Accept revision', |
| 177 | + 'revreview-submit-unreview' => 'Unaccept revision', |
| 178 | + 'revreview-submit-reject' => 'Reject changes', |
178 | 179 | 'revreview-submit-reviewed' => 'Done. Accepted!', |
179 | 180 | 'revreview-submit-unreviewed' => 'Done. Unaccepted!', |
180 | 181 | 'revreview-successful' => '\'\'\'Revision of [[:$1|$1]] successfully flagged. ([{{fullurl:{{#Special:ReviewedVersions}}|page=$2}} view reviewed versions])\'\'\'', |
— | — | @@ -184,19 +185,19 @@ |
185 | 186 | 'revreview-toggle-title' => 'show/hide details', |
186 | 187 | 'revreview-toolow' => '\'\'\'You must rate each of the attributes higher than "inadequate" in order for a revision to be considered reviewed.\'\'\' |
187 | 188 | |
188 | | -To remove the review status of a revision, set \'\'all\'\' fields to "inadequate". |
| 189 | +To remove the review status of a revision, click "unaccept". |
189 | 190 | |
190 | 191 | Please hit the "back" button in your browser and try again.', |
191 | 192 | 'revreview-update' => '\'\'\'Please [[{{MediaWiki:Validationpage}}|review]] any pending changes \'\'(shown below)\'\' made since the stable version.\'\'\' |
192 | | - You may first need to follow-up on or "undo" edits.', |
| 193 | + You may need to follow-up on or "undo" edits.', |
193 | 194 | 'revreview-update-edited' => '<span class="flaggedrevs_important">Your changes are not yet in the stable version.</span> |
194 | 195 | |
195 | 196 | Please review all the changes shown below to make your edits appear in the stable version. |
196 | | -You may first need to follow-up on or "undo" edits.', |
| 197 | +You may need to follow-up on or "undo" edits.', |
197 | 198 | 'revreview-update-edited-prev' => '<span class="flaggedrevs_important">Your changes are not yet in the stable version. There are previous changes pending review.</span> |
198 | 199 | |
199 | 200 | Please review all the changes shown below to make your edits appear in the stable version. |
200 | | -You may first need to follow-up on or "undo" edits.', |
| 201 | +You may need to follow-up on or "undo" edits.', |
201 | 202 | 'revreview-update-includes' => '\'\'\'Some templates/files were updated:\'\'\'', |
202 | 203 | 'revreview-update-use' => '\'\'\'NOTE:\'\'\' The stable version of each of these templates/files is used in the stable version of this page.', |
203 | 204 | 'revreview-visibility' => '\'\'\'This page has an updated [[{{MediaWiki:Validationpage}}|stable version]]; page stability settings can be [{{fullurl:{{#Special:Stabilization}}|page={{FULLPAGENAMEE}}}} configured].\'\'\'', |
— | — | @@ -272,7 +273,8 @@ |
273 | 274 | |
274 | 275 | 'revreview-tt-review' => 'Apply this status to this revision', |
275 | 276 | 'revreview-tt-flag' => 'Accept this revision by marking it as "checked"', |
276 | | - 'revreview-tt-unflag' => 'Unaccept this revision by marking it as "unchecked"', |
| 277 | + 'revreview-tt-unflag' => 'Unaccept this revision by marking it as "unchecked" (ignores ratings)', |
| 278 | + 'revreview-tt-reject' => 'Reject these changes by reverting them (ignores ratings)', |
277 | 279 | 'validationpage' => '{{ns:help}}:Page validation', |
278 | 280 | ); |
279 | 281 | |
Index: trunk/extensions/FlaggedRevs/language/Stabilization.i18n.php |
— | — | @@ -11,10 +11,8 @@ |
12 | 12 | $messages['en'] = array( |
13 | 13 | 'stabilization-tab' => 'vet', |
14 | 14 | 'stabilization' => 'Page stabilization', |
15 | | - 'stabilization-text' => '\'\'\'Change the settings below to adjust how the stable version of [[:$1|$1]] is selected and displayed.\'\'\' |
16 | | - |
17 | | -\'\'\'Note:\'\'\' changing the \'\'stable version selection\'\' to prefer "quality" or "pristine" versions will have no effect if there are no such versions. Also, note that a "quality" version is also considered a "checked" version and so on.', |
18 | | - 'stabilization-perm' => 'Your account does not have permission to change the stable version configuration. |
| 15 | + 'stabilization-text' => '\'\'\'Change the settings below to adjust how the stable version of [[:$1|$1]] is selected and displayed.\'\'\'', |
| 16 | + 'stabilization-perm' => 'Your account does not have permission to change the stable version configuration. |
19 | 17 | Here are the current settings for [[:$1|$1]]:', |
20 | 18 | 'stabilization-page' => 'Page name:', |
21 | 19 | 'stabilization-leg' => 'Confirm stable version settings', |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -962,7 +962,7 @@ |
963 | 963 | $db = ( $flags & FR_MASTER ) ? |
964 | 964 | wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE ); |
965 | 965 | $row = $db->selectRow( 'flaggedpage_config', |
966 | | - array( 'fpc_select', 'fpc_override', 'fpc_level', 'fpc_expiry' ), |
| 966 | + array( 'fpc_override', 'fpc_level', 'fpc_expiry' ), |
967 | 967 | array( 'fpc_page_id' => $title->getArticleID() ), |
968 | 968 | __METHOD__ |
969 | 969 | ); |
— | — | @@ -978,16 +978,11 @@ |
979 | 979 | } |
980 | 980 | // Is there a non-expired row? |
981 | 981 | if ( $row ) { |
982 | | - $precedence = intval( $row->fpc_select ); |
983 | | - if ( self::useProtectionLevels() || !self::isValidPrecedence( $precedence ) ) { |
984 | | - $precedence = self::getPrecedence(); // site default; ignore fpc_select |
985 | | - } |
986 | 982 | $level = $row->fpc_level; |
987 | 983 | if ( !self::isValidRestriction( $row->fpc_level ) ) { |
988 | 984 | $level = ''; // site default; ignore fpc_level |
989 | 985 | } |
990 | 986 | $config = array( |
991 | | - 'select' => $precedence, |
992 | 987 | 'override' => $row->fpc_override ? 1 : 0, |
993 | 988 | 'autoreview' => $level, |
994 | 989 | 'expiry' => Block::decodeExpiry( $row->fpc_expiry ) // TS_MW |
— | — | @@ -1012,11 +1007,6 @@ |
1013 | 1008 | */ |
1014 | 1009 | public static function getDefaultVisibilitySettings() { |
1015 | 1010 | return array( |
1016 | | - # Keep this consistent across settings: |
1017 | | - # # 2 = pristine -> quality -> stable; |
1018 | | - # # 1 = quality -> stable |
1019 | | - # # 0 = none |
1020 | | - 'select' => self::getPrecedence(), |
1021 | 1011 | # Keep this consistent across settings: |
1022 | 1012 | # # 1 -> override, 0 -> don't |
1023 | 1013 | 'override' => self::isStableShownByDefault() ? 1 : 0, |
— | — | @@ -1053,15 +1043,6 @@ |
1054 | 1044 | } |
1055 | 1045 | |
1056 | 1046 | /** |
1057 | | - * Check if an fpc_select value is valid |
1058 | | - * @param int $select |
1059 | | - */ |
1060 | | - public static function isValidPrecedence( $select ) { |
1061 | | - $allowed = array( FLAGGED_VIS_QUALITY, FLAGGED_VIS_LATEST, FLAGGED_VIS_PRISTINE ); |
1062 | | - return in_array( $select, $allowed, true ); |
1063 | | - } |
1064 | | - |
1065 | | - /** |
1066 | 1047 | * Check if an fpc_level value is valid |
1067 | 1048 | * @param string $right |
1068 | 1049 | */ |
— | — | @@ -1079,11 +1060,11 @@ |
1080 | 1061 | public static function purgeExpiredConfigurations() { |
1081 | 1062 | $dbw = wfGetDB( DB_MASTER ); |
1082 | 1063 | $pageIds = array(); |
1083 | | - $pagesClearTracking = $pagesRetrack = array(); |
| 1064 | + $pagesClearTracking = array(); |
1084 | 1065 | $config = self::getDefaultVisibilitySettings(); // config is to be reset |
1085 | 1066 | $encCutoff = $dbw->addQuotes( $dbw->timestamp() ); |
1086 | 1067 | $ret = $dbw->select( 'flaggedpage_config', |
1087 | | - array( 'fpc_page_id', 'fpc_select' ), |
| 1068 | + array( 'fpc_page_id' ), |
1088 | 1069 | array( 'fpc_expiry < ' . $encCutoff ), |
1089 | 1070 | __METHOD__ |
1090 | 1071 | // array( 'FOR UPDATE' ) |
— | — | @@ -1094,10 +1075,6 @@ |
1095 | 1076 | // from the tracking tables... |
1096 | 1077 | if ( !$config['override'] && self::useOnlyIfProtected() ) { |
1097 | 1078 | $pagesClearTracking[] = $row->fpc_page_id; // no stable version |
1098 | | - // Check if the new (default) config has a different way |
1099 | | - // of selecting the stable version of this page... |
1100 | | - } else if ( $config['select'] !== intval( $row->fpc_select ) ) { |
1101 | | - $pagesRetrack[] = $row->fpc_page_id; // new stable version |
1102 | 1079 | } |
1103 | 1080 | $pageIds[] = $row->fpc_page_id; // page with expired config |
1104 | 1081 | } |
— | — | @@ -1111,14 +1088,8 @@ |
1112 | 1089 | if ( count( $pagesClearTracking ) ) { |
1113 | 1090 | self::clearTrackingRows( $pagesClearTracking ); |
1114 | 1091 | } |
1115 | | - // Find and track the new stable version where needed |
1116 | | - foreach ( $pagesRetrack as $pageId ) { |
1117 | | - $title = Title::newFromId( $pageId, GAID_FOR_UPDATE ); |
1118 | | - // Determine the new stable version and update the tracking tables... |
1119 | | - self::stableVersionUpdates( $title ); |
1120 | | - } |
1121 | 1092 | } |
1122 | | - |
| 1093 | + |
1123 | 1094 | # ################ Other utility functions ################# |
1124 | 1095 | |
1125 | 1096 | /** |
— | — | @@ -1182,52 +1153,24 @@ |
1183 | 1154 | } |
1184 | 1155 | return true; |
1185 | 1156 | } |
1186 | | - |
| 1157 | + |
1187 | 1158 | /** |
1188 | 1159 | * Get the quality tier of review flags |
1189 | 1160 | * @param array $flags |
1190 | 1161 | * @return int, flagging tier (-1 for non-sighted) |
1191 | 1162 | */ |
1192 | 1163 | public static function getLevelTier( array $flags ) { |
1193 | | - if ( self::isPristine( $flags ) ) |
| 1164 | + if ( self::isPristine( $flags ) ) { |
1194 | 1165 | return FR_PRISTINE; // 2 |
1195 | | - elseif ( self::isQuality( $flags ) ) |
| 1166 | + } elseif ( self::isQuality( $flags ) ) { |
1196 | 1167 | return FR_QUALITY; // 1 |
1197 | | - elseif ( self::isSighted( $flags ) ) |
| 1168 | + } elseif ( self::isSighted( $flags ) ) { |
1198 | 1169 | return FR_SIGHTED; // 0 |
1199 | | - else |
1200 | | - return -1; |
| 1170 | + } |
| 1171 | + return -1; |
1201 | 1172 | } |
1202 | 1173 | |
1203 | 1174 | /** |
1204 | | - * Get global revision status precedence setting |
1205 | | - * or a specific one if given a tag tier (e.g. FR_QUALITY). |
1206 | | - * Returns one of FLAGGED_VIS_PRISTINE, FLAGGED_VIS_QUALITY, FLAGGED_VIS_LATEST. |
1207 | | - * |
1208 | | - * @param int config tier, optional (FR_PRISTINE,FR_QUALITY,FR_SIGHTED) |
1209 | | - * @return int |
1210 | | - */ |
1211 | | - public static function getPrecedence( $configTier = null ) { |
1212 | | - global $wgFlaggedRevsPrecedence; |
1213 | | - if ( is_null( $configTier ) ) { |
1214 | | - $configTier = (int)$wgFlaggedRevsPrecedence; |
1215 | | - } |
1216 | | - switch( $configTier ) |
1217 | | - { |
1218 | | - case FR_PRISTINE: |
1219 | | - $select = FLAGGED_VIS_PRISTINE; |
1220 | | - break; |
1221 | | - case FR_QUALITY: |
1222 | | - $select = FLAGGED_VIS_QUALITY; |
1223 | | - break; |
1224 | | - default: |
1225 | | - $select = FLAGGED_VIS_LATEST; |
1226 | | - break; |
1227 | | - } |
1228 | | - return $select; |
1229 | | - } |
1230 | | - |
1231 | | - /** |
1232 | 1175 | * Get minimum level tags for a tier |
1233 | 1176 | * @return array |
1234 | 1177 | */ |
Index: trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php |
— | — | @@ -15,10 +15,11 @@ |
16 | 16 | { |
17 | 17 | /* Form parameters which can be user given */ |
18 | 18 | protected $page = null; |
19 | | - protected $rcid = 0; |
20 | 19 | protected $approve = false; |
21 | 20 | protected $unapprove = false; |
| 21 | + protected $reject = false; |
22 | 22 | protected $oldid = 0; |
| 23 | + protected $refid = 0; |
23 | 24 | protected $templateParams = ''; |
24 | 25 | protected $imageParams = ''; |
25 | 26 | protected $fileVersion = ''; |
— | — | @@ -50,14 +51,6 @@ |
51 | 52 | $this->trySet( $this->page, $value ); |
52 | 53 | } |
53 | 54 | |
54 | | - public function getRCId() { |
55 | | - return $this->rcid; |
56 | | - } |
57 | | - |
58 | | - public function setRCId( $value ) { |
59 | | - $this->trySet( $this->rcid, (int)$value ); |
60 | | - } |
61 | | - |
62 | 55 | public function setApprove( $value ) { |
63 | 56 | $this->trySet( $this->approve, $value ); |
64 | 57 | } |
— | — | @@ -66,6 +59,18 @@ |
67 | 60 | $this->trySet( $this->unapprove, $value ); |
68 | 61 | } |
69 | 62 | |
| 63 | + public function setReject( $value ) { |
| 64 | + $this->trySet( $this->reject, $value ); |
| 65 | + } |
| 66 | + |
| 67 | + public function getRefId() { |
| 68 | + return $this->refid; |
| 69 | + } |
| 70 | + |
| 71 | + public function setRefId( $value ) { |
| 72 | + $this->trySet( $this->refid, (int)$value ); |
| 73 | + } |
| 74 | + |
70 | 75 | public function getOldId() { |
71 | 76 | return $this->oldid; |
72 | 77 | } |
— | — | @@ -199,7 +204,7 @@ |
200 | 205 | return 'review_no_oldid'; |
201 | 206 | } |
202 | 207 | # Check that this is an approval or de-approval |
203 | | - if ( $this->isApproval() === null ) { |
| 208 | + if ( $this->getAction() === null ) { |
204 | 209 | return 'review_param_missing'; // user didn't say |
205 | 210 | } |
206 | 211 | # Fill in implicit tag data for binary flag case |
— | — | @@ -220,7 +225,7 @@ |
221 | 226 | return 'review_too_low'; |
222 | 227 | } |
223 | 228 | # Special token to discourage fiddling with template/files... |
224 | | - if ( $this->isApproval() ) { |
| 229 | + if ( $this->getAction() === 'approve' ) { |
225 | 230 | $k = self::validationKey( |
226 | 231 | $this->templateParams, $this->imageParams, $this->fileVersion, $this->oldid ); |
227 | 232 | if ( $this->validatedParams !== $k ) { |
— | — | @@ -256,21 +261,19 @@ |
257 | 262 | return null; |
258 | 263 | } |
259 | 264 | |
260 | | - public function isApproval() { |
261 | | - # If all values are set to zero, this has been unapproved |
262 | | - if ( FlaggedRevs::dimensionsEmpty() ) { |
263 | | - if ( $this->approve && !$this->unapprove ) { |
264 | | - return true; // no tags & approve param given |
265 | | - } elseif ( $this->unapprove && !$this->approve ) { |
266 | | - return false; |
267 | | - } |
268 | | - return null; // nothing valid asserted |
269 | | - } else { |
270 | | - foreach ( $this->dims as $quality => $value ) { |
271 | | - if ( $value ) return true; |
272 | | - } |
273 | | - return false; |
| 265 | + /* |
| 266 | + * What are we doing? |
| 267 | + * @return string (approve,unapprove,reject) |
| 268 | + */ |
| 269 | + public function getAction() { |
| 270 | + if ( !$this->reject && !$this->unapprove && $this->approve ) { |
| 271 | + return 'approve'; |
| 272 | + } elseif ( !$this->reject && $this->unapprove && !$this->approve ) { |
| 273 | + return 'unapprove'; |
| 274 | + } elseif ( $this->reject && !$this->unapprove && !$this->approve ) { |
| 275 | + return 'reject'; |
274 | 276 | } |
| 277 | + return null; // nothing valid asserted |
275 | 278 | } |
276 | 279 | |
277 | 280 | /** |
— | — | @@ -291,7 +294,7 @@ |
292 | 295 | return 'review_denied'; |
293 | 296 | } |
294 | 297 | # We can only approve actual revisions... |
295 | | - if ( $this->isApproval() ) { |
| 298 | + if ( $this->getAction() === 'approve' ) { |
296 | 299 | $rev = Revision::newFromTitle( $this->page, $this->oldid ); |
297 | 300 | # Do not mess with archived/deleted revisions |
298 | 301 | if ( is_null( $rev ) || $rev->mDeleted ) { |
— | — | @@ -299,13 +302,29 @@ |
300 | 303 | } |
301 | 304 | $status = $this->approveRevision( $rev ); |
302 | 305 | # We can only unapprove approved revisions... |
303 | | - } else { |
| 306 | + } elseif ( $this->getAction() === 'unapprove' ) { |
304 | 307 | $frev = FlaggedRevision::newFromTitle( $this->page, $this->oldid ); |
305 | 308 | # If we can't find this flagged rev, return to page??? |
306 | 309 | if ( is_null( $frev ) ) { |
307 | 310 | return 'review_not_flagged'; |
308 | 311 | } |
309 | 312 | $status = $this->unapproveRevision( $frev ); |
| 313 | + } elseif ( $this->getAction() === 'reject' ) { |
| 314 | + $newRev = Revision::newFromTitle( $this->page, $this->oldid ); |
| 315 | + $oldRev = Revision::newFromTitle( $this->page, $this->refid ); |
| 316 | + # Do not mess with archived/deleted revisions |
| 317 | + if ( is_null( $oldRev ) || $oldRev->mDeleted ) { |
| 318 | + return 'review_bad_oldid'; |
| 319 | + } elseif ( is_null( $newRev ) || $newRev->mDeleted ) { |
| 320 | + return 'review_bad_oldid'; |
| 321 | + } |
| 322 | + $article = new Article( $this->page ); |
| 323 | + $new_text = $article->getUndoText( $newRev, $oldRev ); |
| 324 | + if ( $new_text === false ) { |
| 325 | + return 'review_cannot_undo'; |
| 326 | + } |
| 327 | + $baseRevId = $newRev->isCurrent() ? $oldRev->getId() : 0; |
| 328 | + $article->doEdit( $new_text, $this->getComment(), 0, $baseRevId, $this->user ); |
310 | 329 | } |
311 | 330 | # Watch page if set to do so |
312 | 331 | if ( $status === true ) { |
— | — | @@ -390,7 +409,8 @@ |
391 | 410 | ) ); |
392 | 411 | $flaggedRevision->insertOn(); |
393 | 412 | # Update recent changes... |
394 | | - self::updateRecentChanges( $this->page, $rev->getId(), $this->rcid, true ); |
| 413 | + $rcId = $rev->isUnpatrolled(); // int |
| 414 | + self::updateRecentChanges( $this->page, $rev->getId(), $rcId, true ); |
395 | 415 | |
396 | 416 | # Update the article review log... |
397 | 417 | $oldSvId = $oldSv ? $oldSv->getRevId() : 0; |
— | — | @@ -583,36 +603,42 @@ |
584 | 604 | |
585 | 605 | /** |
586 | 606 | * Generates a brief review form for a page. |
| 607 | + * NOTE: use ONLY for diff-to-stable views and page version views |
587 | 608 | * @param User $user |
588 | 609 | * @param FlaggedArticle $article |
589 | 610 | * @param Revision $rev |
| 611 | + * @param int $refId (left side version ID for diffs, $rev is the right rev) |
590 | 612 | * @param array $templateIDs |
591 | 613 | * @param array $imageSHA1Keys |
592 | | - * @param bool $stableDiff this is a diff-to-stable |
593 | 614 | * @return mixed (string/false) |
594 | 615 | */ |
595 | 616 | public static function buildQuickReview( |
596 | | - $user, FlaggedArticle $article, Revision $rev, |
597 | | - $templateIDs, $imageSHA1Keys, $stableDiff = false |
| 617 | + User $user, FlaggedArticle $article, Revision $rev, |
| 618 | + $refId = 0, $topNotice = '', $templateIDs, $imageSHA1Keys |
598 | 619 | ) { |
599 | | - global $wgRequest, $wgOut; |
| 620 | + global $wgOut; |
| 621 | + $id = $rev->getId(); |
600 | 622 | if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) { |
601 | 623 | return false; # The revision must be valid and public |
602 | 624 | } |
603 | | - $id = $rev->getId(); |
604 | | - $skin = $user->getSkin(); |
605 | 625 | # Do we need to get inclusion IDs from parser output? |
606 | 626 | $getPOut = !( $templateIDs && $imageSHA1Keys ); |
607 | 627 | |
| 628 | + $srev = $article->getStableRev(); |
608 | 629 | # See if the version being displayed is flagged... |
609 | | - $frev = FlaggedRevision::newFromTitle( $article->getTitle(), $id ); |
| 630 | + if ( $id == $article->getStable() ) { |
| 631 | + $frev = $srev; // avoid query |
| 632 | + } else { |
| 633 | + $frev = FlaggedRevision::newFromTitle( $article->getTitle(), $id ); |
| 634 | + } |
610 | 635 | $oldFlags = $frev |
611 | 636 | ? $frev->getTags() // existing tags |
612 | | - : FlaggedRevision::expandRevisionTags( '' ); // unset tags |
| 637 | + : FlaggedRevs::quickTags( FR_SIGHTED ); // basic tags |
| 638 | + |
613 | 639 | # If we are reviewing updates to a page, start off with the stable revision's |
614 | 640 | # flags. Otherwise, we just fill them in with the selected revision's flags. |
615 | | - if ( $stableDiff ) { |
616 | | - $srev = $article->getStableRev(); |
| 641 | + # @TODO: do we want to carry over info for other diffs? |
| 642 | + if ( $srev && $srev->getRevId() == $refId ) { // diff-to-stable |
617 | 643 | $flags = $srev->getTags(); |
618 | 644 | # Check if user is allowed to renew the stable version. |
619 | 645 | # If not, then get the flags for the new revision itself. |
— | — | @@ -621,12 +647,12 @@ |
622 | 648 | } |
623 | 649 | $reviewNotes = $srev->getComment(); |
624 | 650 | # Re-review button is need for template/file only review case |
625 | | - $allowRereview = ( $srev->getRevId() == $id && !$article->stableVersionIsSynced() ); |
626 | | - } else { |
| 651 | + $reviewIncludes = ( $srev->getRevId() == $id && !$article->stableVersionIsSynced() ); |
| 652 | + } else { // views |
627 | 653 | $flags = $oldFlags; |
628 | 654 | // Get existing notes to pre-fill field |
629 | 655 | $reviewNotes = $frev ? $frev->getComment() : ""; |
630 | | - $allowRereview = false; // re-review button |
| 656 | + $reviewIncludes = false; // re-review button |
631 | 657 | } |
632 | 658 | |
633 | 659 | # Disable form for unprivileged users |
— | — | @@ -646,13 +672,12 @@ |
647 | 673 | $form .= Xml::openElement( 'fieldset', |
648 | 674 | array( 'class' => 'flaggedrevs_reviewform noprint' ) ); |
649 | 675 | # Add appropriate legend text |
650 | | - $legendMsg = ( FlaggedRevs::binaryFlagging() && $allowRereview ) |
651 | | - ? 'revreview-reflag' |
652 | | - : 'revreview-flag'; |
| 676 | + $legendMsg = $frev ? 'revreview-reflag' : 'revreview-flag'; |
653 | 677 | $form .= Xml::openElement( 'legend', array( 'id' => 'mw-fr-reviewformlegend' ) ); |
654 | 678 | $form .= "<strong>" . wfMsgHtml( $legendMsg ) . "</strong>"; |
655 | 679 | $form .= Xml::closeElement( 'legend' ) . "\n"; |
656 | 680 | # Show explanatory text |
| 681 | + $form .= $topNotice; |
657 | 682 | if ( !FlaggedRevs::lowProfileUI() ) { |
658 | 683 | $form .= wfMsgExt( 'revreview-text', array( 'parse' ) ); |
659 | 684 | } |
— | — | @@ -674,7 +699,8 @@ |
675 | 700 | $form .= "<div id='mw-fr-notebox'>\n"; |
676 | 701 | $form .= "<p>" . wfMsgHtml( 'revreview-notes' ) . "</p>\n"; |
677 | 702 | $params = array( 'name' => 'wpNotes', 'id' => 'wpNotes', |
678 | | - 'class' => 'fr-notes-box', 'rows' => '2', 'cols' => '80' ) + $disabled; |
| 703 | + 'class' => 'fr-notes-box', 'rows' => '2', 'cols' => '80', |
| 704 | + 'onchange' => "FlaggedRevs.updateRatingForm()" ) + $disabled; |
679 | 705 | $form .= Xml::openElement( 'textarea', $params ) . |
680 | 706 | htmlspecialchars( $reviewNotes ) . |
681 | 707 | Xml::closeElement( 'textarea' ) . "\n"; |
— | — | @@ -719,7 +745,10 @@ |
720 | 746 | array( 'class' => 'fr-comment-box' ) ) . "   </span>"; |
721 | 747 | } |
722 | 748 | # Add the submit buttons |
723 | | - $form .= self::submitButtons( $frev, (bool)$disabled, $allowRereview ); |
| 749 | + if ( $rev->getId() == $refId ) { |
| 750 | + $refId = 0; // revisions are the same => can't reject |
| 751 | + } |
| 752 | + $form .= self::submitButtons( $refId, $frev, (bool)$disabled, $reviewIncludes ); |
724 | 753 | # Show stability log if there is anything interesting... |
725 | 754 | if ( $article->isPageLocked() ) { |
726 | 755 | $form .= ' ' . FlaggedRevsXML::logToggle( 'revreview-log-toggle-show' ); |
— | — | @@ -734,6 +763,7 @@ |
735 | 764 | # Hidden params |
736 | 765 | $form .= Xml::hidden( 'title', $reviewTitle->getPrefixedText() ) . "\n"; |
737 | 766 | $form .= Xml::hidden( 'target', $article->getTitle()->getPrefixedDBKey() ) . "\n"; |
| 767 | + $form .= Xml::hidden( 'refid', $refId ) . "\n"; |
738 | 768 | $form .= Xml::hidden( 'oldid', $id ) . "\n"; |
739 | 769 | $form .= Xml::hidden( 'action', 'submit' ) . "\n"; |
740 | 770 | $form .= Xml::hidden( 'wpEditToken', $user->editToken() ) . "\n"; |
— | — | @@ -741,8 +771,6 @@ |
742 | 772 | $form .= Xml::hidden( 'templateParams', $templateParams ) . "\n"; |
743 | 773 | $form .= Xml::hidden( 'imageParams', $imageParams ) . "\n"; |
744 | 774 | $form .= Xml::hidden( 'fileVersion', $fileVersion ) . "\n"; |
745 | | - # Pass this in if given; useful for new page patrol |
746 | | - $form .= Xml::hidden( 'rcid', $wgRequest->getVal( 'rcid' ) ) . "\n"; |
747 | 775 | # Special token to discourage fiddling... |
748 | 776 | $checkCode = self::validationKey( |
749 | 777 | $templateParams, $imageParams, $fileVersion, $id |
— | — | @@ -781,7 +809,7 @@ |
782 | 810 | // Display the value for each tag as text |
783 | 811 | foreach ( $dimensions as $quality => $levels ) { |
784 | 812 | $selected = isset( $flags[$quality] ) ? $flags[$quality] : 0; |
785 | | - $items[] = "<b>" . FlaggedRevs::getTagMsg( $quality ) . ":</b> " . |
| 813 | + $items[] = FlaggedRevs::getTagMsg( $quality ) . ": " . |
786 | 814 | FlaggedRevs::getTagValueMsg( $quality, $selected ); |
787 | 815 | } |
788 | 816 | } else { |
— | — | @@ -798,8 +826,8 @@ |
799 | 827 | } |
800 | 828 | # Show label as needed |
801 | 829 | if ( !FlaggedRevs::binaryFlagging() ) { |
802 | | - $item .= "<b>" . Xml::tags( 'label', array( 'for' => "wp$quality" ), |
803 | | - FlaggedRevs::getTagMsg( $quality ) ) . ":</b>\n"; |
| 830 | + $item .= Xml::tags( 'label', array( 'for' => "wp$quality" ), |
| 831 | + FlaggedRevs::getTagMsg( $quality ) ) . ":\n"; |
804 | 832 | } |
805 | 833 | # If the sum of qualities of all flags is above 6, use drop down boxes. |
806 | 834 | # 6 is an arbitrary value choosen according to screen space and usability. |
— | — | @@ -870,51 +898,58 @@ |
871 | 899 | |
872 | 900 | /** |
873 | 901 | * Generates review form submit buttons |
| 902 | + * @param int $refId left rev ID for "reject" on diffs |
874 | 903 | * @param FlaggedRevision $frev, the flagged revision, if any |
875 | 904 | * @param bool $disabled, is the form disabled? |
876 | | - * @param bool $rereview, force the review button to be usable? |
| 905 | + * @param bool $reviewIncludes, force the review button to be usable? |
877 | 906 | * @returns string |
878 | 907 | */ |
879 | | - private static function submitButtons( $frev, $disabled, $rereview = false ) { |
| 908 | + private static function submitButtons( $refId, $frev, $disabled, $reviewIncludes = false ) { |
880 | 909 | $disAttrib = array( 'disabled' => 'disabled' ); |
881 | | - # Add the submit button |
882 | | - if ( FlaggedRevs::binaryFlagging() ) { |
883 | | - # ACCEPT BUTTON: accept a revision |
884 | | - # We may want to re-review to change the notes ($wgFlaggedRevsComments) |
885 | | - # or re-review due to pending template/file changes |
886 | | - $s = Xml::submitButton( wfMsgHtml( 'revreview-submit-review' ), |
887 | | - array( |
888 | | - 'name' => 'wpApprove', |
889 | | - 'id' => 'mw-fr-submitreview', |
890 | | - 'accesskey' => wfMsg( 'revreview-ak-review' ), |
891 | | - 'title' => wfMsg( 'revreview-tt-flag' ) . ' [' . |
892 | | - wfMsg( 'revreview-ak-review' ) . ']' |
893 | | - ) + ( ( $disabled || ( $frev && !$rereview ) ) ? $disAttrib : array() ) |
894 | | - ); |
895 | | - # UNDO BUTTON: revert from a pending revision to the stable |
896 | | - # @TODO... |
897 | | - |
898 | | - # UNACCEPT BUTTON: revoke a revisions acceptance |
899 | | - # Hide if revision is not flagged |
| 910 | + # ACCEPT BUTTON: accept a revision |
| 911 | + # We may want to re-review to change: |
| 912 | + # (a) notes (b) tags (c) pending template/file changes |
| 913 | + if ( FlaggedRevs::binaryFlagging() ) { // just the buttons |
| 914 | + $applicable = ( !$frev || $reviewIncludes ); // no tags/notes |
| 915 | + $needsChange = false; // no state change possible |
| 916 | + } else { // buttons + ratings |
| 917 | + $applicable = true; // tags might change |
| 918 | + $needsChange = ( $frev && !$reviewIncludes ); |
| 919 | + } |
| 920 | + $s = Xml::submitButton( wfMsgHtml( 'revreview-submit-review' ), |
| 921 | + array( |
| 922 | + 'name' => 'wpApprove', |
| 923 | + 'id' => 'mw-fr-submit-accept', |
| 924 | + 'accesskey' => wfMsg( 'revreview-ak-review' ), |
| 925 | + 'title' => wfMsg( 'revreview-tt-flag' ) . ' [' . |
| 926 | + wfMsg( 'revreview-ak-review' ) . ']' |
| 927 | + ) + ( ( $disabled || !$applicable ) ? $disAttrib : array() ) |
| 928 | + ); |
| 929 | + # REJECT BUTTON: revert from a pending revision to the stable |
| 930 | + if ( $refId ) { |
900 | 931 | $s .= ' '; |
901 | | - $s .= Xml::submitButton( wfMsgHtml( 'revreview-submit-unreview' ), |
| 932 | + $s .= Xml::submitButton( wfMsgHtml( 'revreview-submit-reject' ), |
902 | 933 | array( |
903 | | - 'name' => 'wpUnapprove', |
904 | | - 'id' => 'mw-fr-submitunreview', |
905 | | - 'title' => wfMsg( 'revreview-tt-unflag' ), |
906 | | - 'style' => $frev ? '' : 'display:none;' |
| 934 | + 'name' => 'wpReject', |
| 935 | + 'id' => 'mw-fr-submit-reject', |
| 936 | + 'title' => wfMsg( 'revreview-tt-reject' ), |
907 | 937 | ) + ( $disabled ? $disAttrib : array() ) |
908 | 938 | ); |
909 | | - } else { |
910 | | - $s = Xml::submitButton( wfMsgHtml( 'revreview-submit' ), |
911 | | - array( |
912 | | - 'id' => 'mw-fr-submitreview', |
913 | | - 'accesskey' => wfMsg( 'revreview-ak-review' ), |
914 | | - 'title' => wfMsg( 'revreview-tt-review' ) . ' [' . |
915 | | - wfMsg( 'revreview-ak-review' ) . ']' |
916 | | - ) + ( $disabled ? $disAttrib : array() ) |
917 | | - ); |
918 | 939 | } |
| 940 | + # UNACCEPT BUTTON: revoke a revisions acceptance |
| 941 | + # Hide if revision is not flagged |
| 942 | + $s .= ' '; |
| 943 | + $s .= Xml::submitButton( wfMsgHtml( 'revreview-submit-unreview' ), |
| 944 | + array( |
| 945 | + 'name' => 'wpUnapprove', |
| 946 | + 'id' => 'mw-fr-submit-unaccept', |
| 947 | + 'title' => wfMsg( 'revreview-tt-unflag' ), |
| 948 | + 'style' => $frev ? '' : 'display:none' |
| 949 | + ) + ( $disabled ? $disAttrib : array() ) |
| 950 | + ); |
| 951 | + // Disable buttons unless state changes in some cases (non-JS compatible) |
| 952 | + $s .= "<script type=\"text/javascript\"> |
| 953 | + var jsReviewNeedsChange = " . (int)$needsChange . "</script>"; |
919 | 954 | return $s; |
920 | 955 | } |
921 | 956 | |
Index: trunk/extensions/FlaggedRevs/forms/PageStabilityForm.php |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | public function getExpiry() { |
73 | 73 | return $this->expiry; |
74 | 74 | } |
75 | | - |
| 75 | + |
76 | 76 | public function setExpiry( $value ) { |
77 | 77 | $this->trySet( $this->expiry, $value ); |
78 | 78 | } |
— | — | @@ -87,7 +87,7 @@ |
88 | 88 | public function getAutoreview() { |
89 | 89 | return $this->autoreview; |
90 | 90 | } |
91 | | - |
| 91 | + |
92 | 92 | public function setAutoreview( $value ) { |
93 | 93 | $this->trySet( $this->autoreview, $value ); |
94 | 94 | } |
— | — | @@ -366,7 +366,7 @@ |
367 | 367 | } |
368 | 368 | |
369 | 369 | protected function loadExpiry() { |
370 | | - # Custom expiry takes precedence |
| 370 | + # Custom expiry replaces dropdown |
371 | 371 | if ( $this->expiry == '' ) { |
372 | 372 | $this->expiry = $this->expirySelection; |
373 | 373 | if ( $this->expiry == 'existing' ) { |
— | — | @@ -376,7 +376,7 @@ |
377 | 377 | } |
378 | 378 | |
379 | 379 | protected function loadReason() { |
380 | | - # Custom reason takes precedence |
| 380 | + # Custom reason replaces dropdown |
381 | 381 | if ( $this->reasonSelection != 'other' ) { |
382 | 382 | $comment = $this->reasonSelection; // start with dropdown reason |
383 | 383 | if ( $this->reason != '' ) { |
— | — | @@ -407,9 +407,6 @@ |
408 | 408 | |
409 | 409 | // Assumes $wgFlaggedRevsProtection is off |
410 | 410 | class PageStabilityGeneralForm extends PageStabilityForm { |
411 | | - /* Form parameters which can be user given */ |
412 | | - public $select = -1; # Precedence |
413 | | - |
414 | 411 | public function getReviewThis() { |
415 | 412 | return $this->reviewThis; |
416 | 413 | } |
— | — | @@ -418,14 +415,6 @@ |
419 | 416 | $this->trySet( $this->reviewThis, $value ); |
420 | 417 | } |
421 | 418 | |
422 | | - public function getPrecedence() { |
423 | | - return $this->select; |
424 | | - } |
425 | | - |
426 | | - public function setPrecedence( $value ) { |
427 | | - $this->trySet( $this->select, $value ); |
428 | | - } |
429 | | - |
430 | 419 | public function getOverride() { |
431 | 420 | return $this->override; |
432 | 421 | } |
— | — | @@ -435,7 +424,6 @@ |
436 | 425 | } |
437 | 426 | |
438 | 427 | protected function reallyPreloadSettings() { |
439 | | - $this->select = $this->oldConfig['select']; |
440 | 428 | $this->override = $this->oldConfig['override']; |
441 | 429 | $this->autoreview = $this->oldConfig['autoreview']; |
442 | 430 | $this->expiry = $this->oldExpiry; |
— | — | @@ -448,9 +436,6 @@ |
449 | 437 | $this->loadReason(); |
450 | 438 | $this->loadExpiry(); |
451 | 439 | $this->override = $this->override ? 1 : 0; // default version settings is 0 or 1 |
452 | | - if ( !FlaggedRevs::isValidPrecedence( $this->select ) ) { |
453 | | - return 'stabilize_invalid_precedence'; // invalid precedence value |
454 | | - } |
455 | 440 | // Check autoreview restriction setting |
456 | 441 | if ( $this->autoreview != '' // restriction other than 'none' |
457 | 442 | && !in_array( $this->autoreview, FlaggedRevs::getRestrictionLevels() ) ) |
— | — | @@ -468,7 +453,7 @@ |
469 | 454 | 'override' => $this->override, |
470 | 455 | 'autoreview' => $this->autoreview, |
471 | 456 | 'expiry' => $this->expiry, // TS_MW/infinity |
472 | | - 'precedence' => $this->select |
| 457 | + 'precedence' => 1 // here for log hook b/c |
473 | 458 | ); |
474 | 459 | } |
475 | 460 | |
— | — | @@ -510,7 +495,7 @@ |
511 | 496 | array( 'PRIMARY' ), |
512 | 497 | array( |
513 | 498 | 'fpc_page_id' => $this->page->getArticleID(), |
514 | | - 'fpc_select' => (int)$this->select, |
| 499 | + 'fpc_select' => 1, // unused |
515 | 500 | 'fpc_override' => (int)$this->override, |
516 | 501 | 'fpc_level' => $this->autoreview, |
517 | 502 | 'fpc_expiry' => $dbExpiry |
— | — | @@ -523,18 +508,16 @@ |
524 | 509 | } |
525 | 510 | |
526 | 511 | protected function newConfigIsReset() { |
527 | | - return ( $this->select == FlaggedRevs::getPrecedence() |
528 | | - && $this->override == FlaggedRevs::isStableShownByDefault() |
| 512 | + return ( $this->override == FlaggedRevs::isStableShownByDefault() |
529 | 513 | && $this->autoreview == '' ); |
530 | 514 | } |
531 | 515 | |
532 | 516 | // Checks if new config is different than the existing row |
533 | | - protected function configIsDifferent( $oldRow, $select, $override, $autoreview, $dbExpiry ) { |
| 517 | + protected function configIsDifferent( $oldRow, $override, $autoreview, $dbExpiry ) { |
534 | 518 | if( !$oldRow ) { |
535 | 519 | return true; // no previous config |
536 | 520 | } |
537 | | - return ( $oldRow->fpc_select != $select // ...precedence changed, or... |
538 | | - || $oldRow->fpc_override != $override // ...override changed, or... |
| 521 | + return ( $oldRow->fpc_override != $override // ...override changed, or... |
539 | 522 | || $oldRow->fpc_level != $autoreview // ...autoreview level changed, or... |
540 | 523 | || $oldRow->fpc_expiry != $dbExpiry // ...expiry changed |
541 | 524 | ); |
— | — | @@ -588,7 +571,7 @@ |
589 | 572 | return true; |
590 | 573 | } |
591 | 574 | |
592 | | - // Doesn't include 'precedence'; checked in FlaggedRevsLogs |
| 575 | + // Doesn't and shouldn't include 'precedence'; checked in FlaggedRevsLogs |
593 | 576 | protected function getLogParams() { |
594 | 577 | return array( |
595 | 578 | 'override' => $this->override, // in case of site changes |
Index: trunk/extensions/FlaggedRevs/FlaggedRevision.php |
— | — | @@ -126,10 +126,9 @@ |
127 | 127 | * Get a FlaggedRevision of the stable version of a title. |
128 | 128 | * @param Title $title, page title |
129 | 129 | * @param int $flags FR_MASTER |
130 | | - * @param array $config, optional page config (use to skip queries) |
131 | 130 | * @return mixed FlaggedRevision (null on failure) |
132 | 131 | */ |
133 | | - public static function newFromStable( Title $title, $flags = 0, $config = array() ) { |
| 132 | + public static function newFromStable( Title $title, $flags = 0 ) { |
134 | 133 | if ( !FlaggedRevs::inReviewNamespace( $title ) ) { |
135 | 134 | return null; // short-circuit |
136 | 135 | } |
— | — | @@ -171,9 +170,12 @@ |
172 | 171 | * @param Title $title, page title |
173 | 172 | * @param int $flags FR_MASTER |
174 | 173 | * @param array $config, optional page config (use to skip queries) |
| 174 | + * @param string $precedence (latest,quality,pristine) |
175 | 175 | * @return mixed FlaggedRevision (null on failure) |
176 | 176 | */ |
177 | | - public static function determineStable( Title $title, $flags = 0, $config = array() ) { |
| 177 | + public static function determineStable( |
| 178 | + Title $title, $flags = 0, $config = array(), $precedence = 'latest' |
| 179 | + ) { |
178 | 180 | if ( !FlaggedRevs::inReviewNamespace( $title ) ) { |
179 | 181 | return null; // short-circuit |
180 | 182 | } |
— | — | @@ -200,7 +202,7 @@ |
201 | 203 | $row = null; |
202 | 204 | $options['ORDER BY'] = 'fr_rev_id DESC'; |
203 | 205 | # Look for the latest pristine revision... |
204 | | - if ( FlaggedRevs::pristineVersions() && $config['select'] != FLAGGED_VIS_LATEST ) { |
| 206 | + if ( FlaggedRevs::pristineVersions() && $precedence !== 'latest' ) { |
205 | 207 | $prow = $db->selectRow( |
206 | 208 | array( 'flaggedrevs', 'revision' ), |
207 | 209 | $columns, |
— | — | @@ -216,10 +218,10 @@ |
217 | 219 | # Looks like a plausible revision |
218 | 220 | $row = $prow ? $prow : $row; |
219 | 221 | } |
220 | | - if ( $row && $config['select'] == FLAGGED_VIS_PRISTINE ) { |
| 222 | + if ( $row && $precedence === 'pristine' ) { |
221 | 223 | // we have what we want already |
222 | 224 | # Look for the latest quality revision... |
223 | | - } elseif ( FlaggedRevs::qualityVersions() && $config['select'] != FLAGGED_VIS_LATEST ) { |
| 225 | + } elseif ( FlaggedRevs::qualityVersions() && $precedence !== 'latest' ) { |
224 | 226 | // If we found a pristine rev above, this one must be newer... |
225 | 227 | $newerClause = $row ? "fr_rev_id > {$row->fr_rev_id}" : "1 = 1"; |
226 | 228 | $qrow = $db->selectRow( |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php |
— | — | @@ -70,33 +70,6 @@ |
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
74 | | - * Get a <select> of options of available precendents. Used for filters. |
75 | | - * @param int $selected selected level, null for "all" |
76 | | - * @returns string |
77 | | - */ |
78 | | - public static function getPrecedenceFilterMenu( $selected = null ) { |
79 | | - if ( is_null( $selected ) ) { |
80 | | - $selected = ''; // "all" |
81 | | - } |
82 | | - $s = Xml::label( wfMsg( 'revreview-precedencefilter' ), 'wpPrecedence' ) . "\n"; |
83 | | - $s .= Xml::openElement( 'select', |
84 | | - array( 'name' => 'precedence', 'id' => 'wpPrecedence' ) ); |
85 | | - $s .= Xml::option( wfMsg( 'revreview-lev-all' ), '', $selected === '' ); |
86 | | - $s .= Xml::option( wfMsg( 'revreview-lev-basic' ), FLAGGED_VIS_LATEST, |
87 | | - $selected === FLAGGED_VIS_LATEST ); |
88 | | - if ( FlaggedRevs::qualityVersions() ) { |
89 | | - $s .= Xml::option( wfMsg( 'revreview-lev-quality' ), FLAGGED_VIS_QUALITY, |
90 | | - $selected === FLAGGED_VIS_QUALITY ); |
91 | | - } |
92 | | - if ( FlaggedRevs::pristineVersions() ) { |
93 | | - $s .= Xml::option( wfMsg( 'revreview-lev-pristine' ), FLAGGED_VIS_PRISTINE, |
94 | | - $selected === FLAGGED_VIS_PRISTINE ); |
95 | | - } |
96 | | - $s .= Xml::closeElement( 'select' ) . "\n"; |
97 | | - return $s; |
98 | | - } |
99 | | - |
100 | | - /** |
101 | 74 | * Get a <select> of default page version (stable or draft). Used for filters. |
102 | 75 | * @param int $selected (0=draft, 1=stable, null=either ) |
103 | 76 | * @returns string |
Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php |
— | — | @@ -57,8 +57,7 @@ |
58 | 58 | # Expiry |
59 | 59 | $form->setExpiry( $wgRequest->getText( 'mwStabilize-expiry' ) ); |
60 | 60 | $form->setExpirySelection( $wgRequest->getVal( 'wpExpirySelection' ) ); |
61 | | - # Precedence |
62 | | - $form->setPrecedence( $wgRequest->getInt( 'wpStableconfig-select' ) ); |
| 61 | + # Default version |
63 | 62 | $form->setOverride( (int)$wgRequest->getBool( 'wpStableconfig-override' ) ); |
64 | 63 | # Get autoreview restrictions... |
65 | 64 | $form->setAutoreview( $wgRequest->getVal( 'mwProtect-level-autoreview' ) ); |
— | — | @@ -152,21 +151,6 @@ |
153 | 152 | '<br />' . "\n" . |
154 | 153 | Xml::radioLabel( wfMsg( 'stabilization-def2' ), 'wpStableconfig-override', 0, |
155 | 154 | 'default-current', 0 == $form->getOverride(), $this->disabledAttr() ) . "\n" . |
156 | | - Xml::closeElement( 'fieldset' ) . |
157 | | - |
158 | | - Xml::fieldset( wfMsg( 'stabilization-select' ), false ) . |
159 | | - Xml::radioLabel( wfMsg( 'stabilization-select3' ), 'wpStableconfig-select', |
160 | | - FLAGGED_VIS_PRISTINE, 'stable-select3', |
161 | | - FLAGGED_VIS_PRISTINE == $form->getPrecedence(), |
162 | | - $this->disabledAttr() ) . '<br />' . "\n" . |
163 | | - Xml::radioLabel( wfMsg( 'stabilization-select1' ), 'wpStableconfig-select', |
164 | | - FLAGGED_VIS_QUALITY, 'stable-select1', |
165 | | - FLAGGED_VIS_QUALITY == $form->getPrecedence(), |
166 | | - $this->disabledAttr() ) . '<br />' . "\n" . |
167 | | - Xml::radioLabel( wfMsg( 'stabilization-select2' ), 'wpStableconfig-select', |
168 | | - FLAGGED_VIS_LATEST, 'stable-select2', |
169 | | - FLAGGED_VIS_LATEST == $form->getPrecedence(), |
170 | | - $this->disabledAttr() ) . '<br />' . "\n" . |
171 | 155 | Xml::closeElement( 'fieldset' ); |
172 | 156 | # Add autoreview restriction select |
173 | 157 | $s .= Xml::fieldset( wfMsg( 'stabilization-restrict' ), false ) . |
— | — | @@ -323,4 +307,4 @@ |
324 | 308 | ? array() |
325 | 309 | : array( 'disabled' => 'disabled' ); |
326 | 310 | } |
327 | | -} |
\ No newline at end of file |
| 311 | +} |
Index: trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php |
— | — | @@ -45,9 +45,10 @@ |
46 | 46 | # Param for sites with binary flagging |
47 | 47 | $form->setApprove( $wgRequest->getCheck( 'wpApprove' ) ); |
48 | 48 | $form->setUnapprove( $wgRequest->getCheck( 'wpUnapprove' ) ); |
| 49 | + $form->setReject( $wgRequest->getCheck( 'wpReject' ) ); |
49 | 50 | # Rev ID |
50 | | - $oldid = $wgRequest->getInt( 'oldid' ); |
51 | | - $form->setOldId( $oldid ); |
| 51 | + $form->setOldId( $wgRequest->getInt( 'oldid' ) ); |
| 52 | + $form->setRefId( $wgRequest->getInt( 'refid' ) ); |
52 | 53 | # Special parameter mapping |
53 | 54 | $form->setTemplateParams( $wgRequest->getVal( 'templateParams' ) ); |
54 | 55 | $form->setFileParams( $wgRequest->getVal( 'imageParams' ) ); |
— | — | @@ -96,10 +97,12 @@ |
97 | 98 | // Success for either flagging or unflagging |
98 | 99 | if ( $status === true ) { |
99 | 100 | $wgOut->setPageTitle( wfMsgHtml( 'actioncomplete' ) ); |
100 | | - if ( $form->isApproval() ) { |
| 101 | + if ( $form->getAction() === 'approve' ) { |
101 | 102 | $wgOut->addHTML( $form->approvalSuccessHTML( true ) ); |
102 | | - } else { |
| 103 | + } elseif ( $form->getAction() === 'unapprove' ) { |
103 | 104 | $wgOut->addHTML( $form->deapprovalSuccessHTML( true ) ); |
| 105 | + } elseif ( $form->getAction() === 'reject' ) { |
| 106 | + $wgOut->redirect( $this->page->getFullUrl() ); |
104 | 107 | } |
105 | 108 | // Failure for flagging or unflagging |
106 | 109 | } else { |
— | — | @@ -151,8 +154,8 @@ |
152 | 155 | case "oldid": |
153 | 156 | $form->setOldId( $val ); |
154 | 157 | break; |
155 | | - case "rcid": |
156 | | - $form->setRCId( $val ); |
| 158 | + case "refid": |
| 159 | + $form->setRefId( $val ); |
157 | 160 | break; |
158 | 161 | case "validatedParams": |
159 | 162 | $form->setValidatedParams( $val ); |
— | — | @@ -172,6 +175,9 @@ |
173 | 176 | case "wpUnapprove": |
174 | 177 | $form->setUnapprove( $val ); |
175 | 178 | break; |
| 179 | + case "wpReject": |
| 180 | + $form->setReject( $val ); |
| 181 | + break; |
176 | 182 | case "wpReason": |
177 | 183 | $form->setComment( $val ); |
178 | 184 | break; |
— | — | @@ -221,10 +227,12 @@ |
222 | 228 | # Success... |
223 | 229 | if ( $status === true ) { |
224 | 230 | $tier = FlaggedRevs::getLevelTier( $form->getDims() ) + 1; // shift to 0-3 |
225 | | - if ( $form->isApproval() ) { // approve |
| 231 | + if ( $form->getAction() === 'approve' ) { // approve |
226 | 232 | return "<suc#><t#$tier>" . $form->approvalSuccessHTML( false ); |
227 | | - } else { // de-approve |
| 233 | + } elseif ( $form->getAction() === 'unapprove' ) { // de-approve |
228 | 234 | return "<suc#><t#$tier>" . $form->deapprovalSuccessHTML( false ); |
| 235 | + } elseif ( $form->getAction() === 'reject' ) { // revert |
| 236 | + return "<suc#><t#$tier>" . $form->rejectSuccessHTML( false ); |
229 | 237 | } |
230 | 238 | # Failure... |
231 | 239 | } else { |
Index: trunk/extensions/FlaggedRevs/specialpages/ConfiguredPages_body.php |
— | — | @@ -19,7 +19,6 @@ |
20 | 20 | |
21 | 21 | $this->namespace = $wgRequest->getIntOrNull( 'namespace' ); |
22 | 22 | $this->override = $wgRequest->getIntOrNull( 'stable' ); |
23 | | - $this->precedence = $wgRequest->getIntOrNull( 'precedence' ); |
24 | 23 | $this->autoreview = $wgRequest->getVal( 'restriction', '' ); |
25 | 24 | |
26 | 25 | $this->showForm(); |
— | — | @@ -40,10 +39,6 @@ |
41 | 40 | if( FlaggedRevs::getRestrictionLevels() ) { |
42 | 41 | $fields[] = FlaggedRevsXML::getRestrictionFilterMenu( $this->autoreview ); |
43 | 42 | } |
44 | | - # Stable version selection precedence |
45 | | - if ( FlaggedRevs::qualityVersions() ) { |
46 | | - $fields[] = FlaggedRevsXML::getPrecedenceFilterMenu( $this->precedence ); |
47 | | - } |
48 | 43 | if ( count( $fields ) ) { |
49 | 44 | $form = Xml::openElement( 'form', |
50 | 45 | array( 'name' => 'configuredpages', 'action' => $wgScript, 'method' => 'get' ) ); |
— | — | @@ -60,7 +55,7 @@ |
61 | 56 | protected function showPageList() { |
62 | 57 | global $wgOut; |
63 | 58 | $pager = new ConfiguredPagesPager( $this, array(), |
64 | | - $this->namespace, $this->override, $this->precedence, $this->autoreview ); |
| 59 | + $this->namespace, $this->override, $this->autoreview ); |
65 | 60 | if ( $pager->getNumRows() ) { |
66 | 61 | $wgOut->addHTML( $pager->getNavigationBar() ); |
67 | 62 | $wgOut->addHTML( $pager->getBody() ); |
— | — | @@ -89,19 +84,6 @@ |
90 | 85 | } else { |
91 | 86 | $default = wfMsgHtml( 'configuredpages-def-draft' ); |
92 | 87 | } |
93 | | - // Show precedence if there are several possible levels |
94 | | - $type = ''; |
95 | | - if ( FlaggedRevs::qualityVersions() ) { |
96 | | - $select = intval( $row->fpc_select ); |
97 | | - if ( $select === FLAGGED_VIS_PRISTINE ) { |
98 | | - $type = wfMsgHtml( 'configuredpages-prec-pristine' ); |
99 | | - } elseif ( $select === FLAGGED_VIS_QUALITY ) { |
100 | | - $type = wfMsgHtml( 'configuredpages-prec-quality' ); |
101 | | - } elseif( $select === FLAGGED_VIS_LATEST ) { |
102 | | - $type = wfMsgHtml( 'configuredpages-prec-none' ); |
103 | | - } |
104 | | - if ( $type ) $type = "({$type})"; |
105 | | - } |
106 | 88 | # Autoreview/review restriction level |
107 | 89 | $restr = ''; |
108 | 90 | if ( $row->fpc_level != '' ) { |
— | — | @@ -119,7 +101,7 @@ |
120 | 102 | } else { |
121 | 103 | $expiry_description = ""; |
122 | 104 | } |
123 | | - return "<li>{$link} ({$config}) <b>[$default]</b> {$type} {$restr}<i>{$expiry_description}</i></li>"; |
| 105 | + return "<li>{$link} ({$config}) <b>[$default]</b> {$restr}<i>{$expiry_description}</i></li>"; |
124 | 106 | } |
125 | 107 | } |
126 | 108 | |
— | — | @@ -127,14 +109,13 @@ |
128 | 110 | * Query to list out stable versions for a page |
129 | 111 | */ |
130 | 112 | class ConfiguredPagesPager extends AlphabeticPager { |
131 | | - public $mForm, $mConds, $namespace, $override, $precedence, $autoreview; |
| 113 | + public $mForm, $mConds, $namespace, $override, $autoreview; |
132 | 114 | |
133 | 115 | // @param int $namespace (null for "all") |
134 | 116 | // @param int $override (null for "either") |
135 | | - // @param int $precedence (null for "all") |
136 | 117 | // @param string $autoreview ('' for "all", 'none' for no restriction) |
137 | 118 | function __construct( |
138 | | - $form, $conds = array(), $namespace, $override, $precedence, $autoreview |
| 119 | + $form, $conds = array(), $namespace, $override, $autoreview |
139 | 120 | ) { |
140 | 121 | $this->mForm = $form; |
141 | 122 | $this->mConds = $conds; |
— | — | @@ -152,10 +133,6 @@ |
153 | 134 | $override = null; // "all" |
154 | 135 | } |
155 | 136 | $this->override = $override; |
156 | | - if ( !is_integer( $precedence ) ) { |
157 | | - $precedence = null; // "all" |
158 | | - } |
159 | | - $this->precedence = $precedence; |
160 | 137 | if ( $autoreview === 'none' ) { |
161 | 138 | $autoreview = ''; // 'none' => '' |
162 | 139 | } elseif ( $autoreview === '' ) { |
— | — | @@ -175,9 +152,6 @@ |
176 | 153 | if ( $this->override !== null ) { |
177 | 154 | $conds['fpc_override'] = $this->override; |
178 | 155 | } |
179 | | - if ( $this->precedence !== null ) { |
180 | | - $conds['fpc_select'] = $this->precedence; |
181 | | - } |
182 | 156 | if ( $this->autoreview !== null ) { |
183 | 157 | $conds['fpc_level'] = $this->autoreview; |
184 | 158 | } |
— | — | @@ -188,7 +162,7 @@ |
189 | 163 | return array( |
190 | 164 | 'tables' => array( 'flaggedpage_config', 'page' ), |
191 | 165 | 'fields' => array( 'page_namespace', 'page_title', 'fpc_override', |
192 | | - 'fpc_expiry', 'fpc_page_id', 'fpc_select', 'fpc_level' ), |
| 166 | + 'fpc_expiry', 'fpc_page_id', 'fpc_level' ), |
193 | 167 | 'conds' => $conds, |
194 | 168 | 'options' => array() |
195 | 169 | ); |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -113,7 +113,6 @@ |
114 | 114 | 'sendMsg' => wfMsgHtml( 'revreview-submit' ), |
115 | 115 | 'flagMsg' => wfMsgHtml( 'revreview-submit-review' ), |
116 | 116 | 'unflagMsg' => wfMsgHtml( 'revreview-submit-unreview' ), |
117 | | - 'flagLegMsg' => wfMsgHtml( 'revreview-flag' ), |
118 | 117 | 'sendingMsg' => wfMsgHtml( 'revreview-submitting' ), |
119 | 118 | 'flaggedMsg' => wfMsgHtml( 'revreview-submit-reviewed' ), |
120 | 119 | 'unflaggedMsg' => wfMsgHtml( 'revreview-submit-unreviewed' ), |
— | — | @@ -873,39 +872,43 @@ |
874 | 873 | $revId = $rc->mAttribs['rc_this_oldid']; |
875 | 874 | $quality = FlaggedRevs::getRevQuality( |
876 | 875 | $rc->mAttribs['rc_cur_id'], $revId, FR_MASTER ); |
| 876 | + // Reviewed => patrolled |
877 | 877 | if ( $quality !== false && $quality >= FR_SIGHTED ) { |
878 | 878 | RevisionReviewForm::updateRecentChanges( $rc->getTitle(), $revId ); |
879 | 879 | $rc->mAttribs['rc_patrolled'] = 1; // make sure irc/email notifs know status |
880 | 880 | } |
881 | 881 | return true; |
882 | 882 | } |
883 | | - // Is this page in patrollable namespace? |
884 | | - $patrol = $record = false; |
885 | | - if ( FlaggedRevs::inPatrolNamespace( $rc->getTitle() ) ) { |
886 | | - # Bots and users with 'autopatrol' have edits to patrollable |
887 | | - # pages marked automatically on edit. |
888 | | - $patrol = $wgUser->isAllowed( 'autopatrol' ) || $wgUser->isAllowed( 'bot' ); |
889 | | - $record = true; // record if patrolled |
890 | | - } else { |
891 | | - global $wgUseNPPatrol; |
892 | | - // Is this is a new page edit and $wgUseNPPatrol is enabled? |
893 | | - if ( $wgUseNPPatrol && !empty( $rc->mAttribs['rc_new'] ) ) { |
894 | | - # Automatically mark it patrolled if the user can do so |
895 | | - $patrol = $wgUser->isAllowed( 'autopatrol' ); |
896 | | - $record = true; |
897 | | - // Otherwise, this edit is not patrollable |
| 883 | + global $wgFlaggedRevsRCCrap; |
| 884 | + if ( $wgFlaggedRevsRCCrap ) { |
| 885 | + // Is this page in patrollable namespace? |
| 886 | + $patrol = $record = false; |
| 887 | + if ( FlaggedRevs::inPatrolNamespace( $rc->getTitle() ) ) { |
| 888 | + # Bots and users with 'autopatrol' have edits to patrollable |
| 889 | + # pages marked automatically on edit. |
| 890 | + $patrol = $wgUser->isAllowed( 'autopatrol' ) || $wgUser->isAllowed( 'bot' ); |
| 891 | + $record = true; // record if patrolled |
898 | 892 | } else { |
899 | | - # Silently mark it "patrolled" so that it doesn't show up as being unpatrolled |
900 | | - $patrol = true; |
901 | | - $record = false; |
| 893 | + global $wgUseNPPatrol; |
| 894 | + // Is this is a new page edit and $wgUseNPPatrol is enabled? |
| 895 | + if ( $wgUseNPPatrol && !empty( $rc->mAttribs['rc_new'] ) ) { |
| 896 | + # Automatically mark it patrolled if the user can do so |
| 897 | + $patrol = $wgUser->isAllowed( 'autopatrol' ); |
| 898 | + $record = true; |
| 899 | + // Otherwise, this edit is not patrollable |
| 900 | + } else { |
| 901 | + # Silently mark it "patrolled" so that it doesn't show up as being unpatrolled |
| 902 | + $patrol = true; |
| 903 | + $record = false; |
| 904 | + } |
902 | 905 | } |
903 | | - } |
904 | | - // Set rc_patrolled flag and add log entry as needed |
905 | | - if ( $patrol ) { |
906 | | - $rc->reallyMarkPatrolled(); |
907 | | - $rc->mAttribs['rc_patrolled'] = 1; // make sure irc/email notifs now status |
908 | | - if ( $record ) { |
909 | | - PatrolLog::record( $rc->mAttribs['rc_id'], true ); |
| 906 | + // Set rc_patrolled flag and add log entry as needed |
| 907 | + if ( $patrol ) { |
| 908 | + $rc->reallyMarkPatrolled(); |
| 909 | + $rc->mAttribs['rc_patrolled'] = 1; // make sure irc/email notifs now status |
| 910 | + if ( $record ) { |
| 911 | + PatrolLog::record( $rc->mAttribs['rc_id'], true ); |
| 912 | + } |
910 | 913 | } |
911 | 914 | } |
912 | 915 | return true; |
— | — | @@ -1589,7 +1592,9 @@ |
1590 | 1593 | return true; |
1591 | 1594 | } |
1592 | 1595 | |
1593 | | - public static function addToRCQuery( &$conds, array &$tables, array &$join_conds, $opts, &$query_opts, &$select ) { |
| 1596 | + public static function addToRCQuery( |
| 1597 | + &$conds, array &$tables, array &$join_conds, $opts, &$query_opts, &$select |
| 1598 | + ) { |
1594 | 1599 | $tables[] = 'flaggedpages'; |
1595 | 1600 | $join_conds['flaggedpages'] = array( 'LEFT JOIN', 'fp_page_id = rc_cur_id' ); |
1596 | 1601 | if( is_array( $select ) ) { |
— | — | @@ -1619,31 +1624,30 @@ |
1620 | 1625 | $title = $history->getArticle()->getTitle(); |
1621 | 1626 | # Fetch and process cache the stable revision |
1622 | 1627 | if ( !isset( $history->fr_stableRevId ) ) { |
1623 | | - $frev = $fa->getStableRev(); |
1624 | | - $history->fr_stableRevId = $frev ? $frev->getRevId() : 0; |
| 1628 | + $history->fr_stableRevId = $fa->getStable(); |
1625 | 1629 | $history->fr_pendingRevs = false; |
| 1630 | + if ( !$history->fr_stableRevId ) { |
| 1631 | + return true; // nothing to do here |
| 1632 | + } |
1626 | 1633 | } |
1627 | | - if ( !$history->fr_stableRevId ) { |
1628 | | - return true; // nothing to do here |
1629 | | - } |
1630 | 1634 | $revId = (int)$row->rev_id; |
1631 | | - // Unreviewed revision: highlight if pending |
| 1635 | + // Pending revision: highlight and add diff link |
1632 | 1636 | $link = $class = ''; |
1633 | | - if ( !isset( $row->fr_quality ) ) { |
1634 | | - if ( $revId > $history->fr_stableRevId ) { |
1635 | | - $class = 'flaggedrevs-pending'; |
1636 | | - $link = wfMsgExt( 'revreview-hist-pending-difflink', 'parseinline', |
1637 | | - $title->getPrefixedText(), $history->fr_stableRevId, $revId ); |
1638 | | - $link = '<span class="plainlinks">' . $link . '</span>'; |
1639 | | - $history->fr_pendingRevs = true; // pending rev shown above stable |
1640 | | - } |
| 1637 | + if ( $revId > $history->fr_stableRevId ) { |
| 1638 | + $class = 'flaggedrevs-pending'; |
| 1639 | + $link = wfMsgExt( 'revreview-hist-pending-difflink', 'parseinline', |
| 1640 | + $title->getPrefixedText(), $history->fr_stableRevId, $revId ); |
| 1641 | + $link = '<span class="plainlinks">' . $link . '</span>'; |
| 1642 | + $history->fr_pendingRevs = true; // pending rev shown above stable |
1641 | 1643 | // Reviewed revision: highlight and add link |
1642 | | - } else if ( !( $row->rev_deleted & Revision::DELETED_TEXT ) ) { |
1643 | | - # Add link to stable version of *this* rev, if any |
1644 | | - list( $link, $class ) = self::markHistoryRow( $title, $row ); |
1645 | | - # Space out and demark the stable revision |
1646 | | - if ( $revId == $history->fr_stableRevId && $history->fr_pendingRevs ) { |
1647 | | - $liClasses[] = 'fr-hist-stable-margin'; |
| 1644 | + } elseif ( isset( $row->fr_quality ) ) { |
| 1645 | + if ( !( $row->rev_deleted & Revision::DELETED_TEXT ) ) { |
| 1646 | + # Add link to stable version of *this* rev, if any |
| 1647 | + list( $link, $class ) = self::markHistoryRow( $title, $row ); |
| 1648 | + # Space out and demark the stable revision |
| 1649 | + if ( $revId == $history->fr_stableRevId && $history->fr_pendingRevs ) { |
| 1650 | + $liClasses[] = 'fr-hist-stable-margin'; |
| 1651 | + } |
1648 | 1652 | } |
1649 | 1653 | } |
1650 | 1654 | # Style the row as needed |