r73164 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73163‎ | r73164 | r73165 >
Date:22:36, 16 September 2010
Author:aaron
Status:deferred (Comments)
Tags:
Comment:
* Removed all precedence/select features
* Deprecated ugly RC patrol coupling
* addToHistLine() display cleanups
* Review form tweaks. More improvements planned.
** Unified button scheme for tag & binary case
** Added simple "reject" button (JS confirmation still needed along with non-JS strategy)
** Reduced diff box-cruft by putting prompt/includes into review form
** Button name and CSS tweaks to make buttons distinct
** Fixed some rcid cruft (broken for non-JS review btw)
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticleView.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevision.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsXML.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/api/ApiStabilize.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/client/flaggedrevs.css (modified) (history)
  • /trunk/extensions/FlaggedRevs/client/review.js (modified) (history)
  • /trunk/extensions/FlaggedRevs/forms/PageStabilityForm.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/Stabilization.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/maintenance/updateTracking.inc (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/ConfiguredPages_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/api/ApiStabilize.php
@@ -82,7 +82,6 @@
8383 $form->setExpirySelection( 'other' ); # Expiry dropdown
8484 $restriction = $params['autoreview'];
8585 // Fill in config fields from URL params
86 - $form->setPrecedence( $this->precendenceFromKey( $params['precedence'] ) );
8786 if ( $params['default'] === null ) {
8887 // Default version setting not optional
8988 $this->dieUsageMsg( array( 'missingparam', 'default' ) );
@@ -105,7 +104,6 @@
106105 $res = array();
107106 $res['title'] = $title->getPrefixedText();
108107 $res['default'] = $params['default'];
109 - $res['precedence'] = $params['precedence'];
110108 $res['autoreview'] = $params['autoreview'];
111109 $res['expiry'] = $form->getExpiry();
112110 $this->getResult()->addValue( null, $this->getModuleName(), $res );
@@ -120,28 +118,6 @@
121119 return null; // bad key?
122120 }
123121
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 -
146122 public function getAllowedParams() {
147123 // Replace '' with more readable 'none' in autoreview restiction levels
148124 $autoreviewLevels = FlaggedRevs::getRestrictionLevels();
@@ -151,10 +127,6 @@
152128 ApiBase :: PARAM_TYPE => array( 'latest', 'stable' ),
153129 ApiBase :: PARAM_DFLT => null,
154130 ),
155 - 'precedence' => array(
156 - ApiBase :: PARAM_TYPE => array( 'pristine', 'quality', 'latest' ),
157 - ApiBase :: PARAM_DFLT => $this->keyFromPrecendence( FlaggedRevs::getPrecedence() )
158 - ),
159131 'autoreview' => array(
160132 ApiBase :: PARAM_TYPE => $autoreviewLevels,
161133 ApiBase :: PARAM_DFLT => 'none',
@@ -172,7 +144,6 @@
173145 public function getParamDescription() {
174146 return array(
175147 'default' => 'Default revision to show',
176 - 'precedence' => 'How the stable version is selected by precedence',
177148 'autoreview' => 'Auto-review restriction',
178149 'expiry' => 'Expiry for these settings',
179150 'title' => 'Title of page to be stabilized',
Index: trunk/extensions/FlaggedRevs/client/review.js
@@ -6,6 +6,7 @@
77 * a) Disable submit in case of invalid input.
88 * b) Update colors when select changes (Opera already does this).
99 * c) Also remove comment box clutter in case of invalid input.
 10+* NOTE: all buttons should exist (perhaps hidden though)
1011 */
1112 FlaggedRevs.updateRatingForm = function() {
1213 var ratingform = document.getElementById('mw-fr-ratingselects');
@@ -14,23 +15,17 @@
1516 if( disabled ) return;
1617
1718 var quality = true;
18 - var allzero = true;
1919 var somezero = false;
20 -
 20+
 21+ // Determine if this is a "quality" or "incomplete" review
2122 for( tag in wgFlaggedRevsParams.tags ) {
2223 var controlName = "wp" + tag;
2324 var levels = document.getElementsByName(controlName);
2425 if( !levels.length ) continue;
 26+
2527 var selectedlevel = 0; // default
26 -
2728 if( levels[0].nodeName == 'SELECT' ) {
2829 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 - }
3530 } else if( levels[0].type == 'radio' ) {
3631 for( i = 0; i < levels.length; i++ ) {
3732 if( levels[i].checked ) {
@@ -43,39 +38,62 @@
4439 } else {
4540 return; // error: should not happen
4641 }
47 -
 42+
4843 // Get quality level for this tag
4944 qualityLevel = wgFlaggedRevsParams.tags[tag]['quality'];
5045
5146 if( selectedlevel < qualityLevel ) {
5247 quality = false; // not a quality review
5348 }
54 - if( selectedlevel > 0 ) {
55 - allzero = false;
56 - } else {
 49+ if( selectedlevel <= 0 ) {
5750 somezero = true;
5851 }
5952 }
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"
6460 }
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+ }
7176 }
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+ }
7694 }
7795 }
7896
79 -addOnloadHook(FlaggedRevs.updateRatingForm);
 97+hookEvent( "load", FlaggedRevs.updateRatingFormColors );
8098
8199 // dependencies:
82100 // * ajax.js:
@@ -226,44 +244,31 @@
227245 sajax_request_type = old;
228246 }
229247 }
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");
232250 var legend = document.getElementById("mw-fr-reviewformlegend");
233251 var diffNotice = document.getElementById("mw-fr-difftostable");
234252 var tagBox = document.getElementById('mw-fr-revisiontag');
235253 // On success...
236254 if( response.indexOf('<suc#>') == 0 ) {
237255 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!
266260 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 = '';
268273 }
269274 }
270275 // Hide "review this" box on diffs
@@ -273,7 +278,7 @@
274279 // On failure...
275280 } else {
276281 document.title = wgAjaxReview.actionfailed;
277 - if( rsubmit ) {
 282+ if( rsubmit && usubmit ) {
278283 // Revision was flagged
279284 if( rsubmit.value == wgAjaxReview.sendingMsg ) {
280285 rsubmit.value = wgAjaxReview.flagMsg; // back to normal
@@ -302,11 +307,11 @@
303308 }
304309
305310 wgAjaxReview.onLoad = function() {
306 - var rsubmit = document.getElementById("mw-fr-submitreview");
 311+ var rsubmit = document.getElementById("mw-fr-submit-accept");
307312 if( rsubmit ) {
308313 rsubmit.onclick = wgAjaxReview.ajaxCall;
309314 }
310 - var usubmit = document.getElementById("mw-fr-submitunreview");
 315+ var usubmit = document.getElementById("mw-fr-submit-unaccept");
311316 if( usubmit ) {
312317 usubmit.onclick = wgAjaxReview.ajaxCall;
313318 }
Index: trunk/extensions/FlaggedRevs/client/flaggedrevs.css
@@ -279,7 +279,6 @@
280280 .fr-rating-controls,
281281 .fr-rating-controls-disabled {
282282 vertical-align: middle;
283 - line-height: 1em;
284283 }
285284
286285 .fr-rating-controls-disabled {
@@ -290,6 +289,13 @@
291290 margin-right: 1.5em;
292291 }
293292
 293+#mw-fr-submit-unaccept {
 294+ color: darkblue;
 295+}
 296+#mw-fr-submit-reject {
 297+ color: darkred;
 298+}
 299+
294300 .fr-rating-option-0 {
295301 background-color: #f5ecec;
296302 }
Index: trunk/extensions/FlaggedRevs/FlaggedArticleView.php
@@ -5,6 +5,8 @@
66 class FlaggedArticleView {
77 protected $article = null;
88
 9+ protected $diffRevs = null;
 10+ protected $isReviewableDiff = false;
911 protected $isDiffFromStable = false;
1012 protected $isMultiPageDiff = false;
1113 protected $reviewNotice = '';
@@ -1038,10 +1040,10 @@
10391041 $rev = Revision::newFromId( $wgOut->getRevisionId() );
10401042 }
10411043 # Build the review form as needed
1042 - if ( $rev ) {
1043 - $templateIDs = $fileSHA1Keys = null;
 1044+ if ( $rev && ( !$this->diffRevs || $this->isReviewableDiff ) ) {
10441045 # $wgOut may not already have the inclusion IDs, such as for diffonly=1.
10451046 # RevisionReviewForm will fetch them as needed however.
 1047+ $templateIDs = $fileSHA1Keys = null;
10461048 if ( $wgOut->getRevisionId() == $rev->getId()
10471049 && isset( $wgOut->mTemplateIds )
10481050 && isset( $wgOut->fr_fileSHA1Keys ) )
@@ -1049,12 +1051,14 @@
10501052 $templateIDs = $wgOut->mTemplateIds;
10511053 $fileSHA1Keys = $wgOut->fr_fileSHA1Keys;
10521054 }
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+ );
10551060 # 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 );
10591063 # View action: place the form at the bottom of the page
10601064 } else {
10611065 $data .= $form;
@@ -1292,7 +1296,7 @@
12931297 && $this->isDiffFromStable
12941298 && !$this->article->stableVersionIsSynced() ) // pending changes
12951299 {
1296 - $form = '';
 1300+ $changeDiv = '';
12971301 $this->reviewFormRev = $newRev;
12981302 $changeList = array();
12991303 # Page not synced only due to includes?
@@ -1345,16 +1349,17 @@
13461350 $changeDiv .= wfMsgExt( 'revreview-update-use', 'parse' );
13471351 }
13481352 }
1349 - if ( $changeDiv != '' ) {
 1353+ }
 1354+ if ( $changeDiv != '' ) {
 1355+ if ( $wgUser->isAllowed( 'review' ) ) {
 1356+ $this->diffNoticeBox = $changeDiv; // add as part of form
 1357+ } else {
13501358 $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+ );
13521362 }
13531363 }
1354 - if ( $wgUser->isAllowed( 'review' ) ) {
1355 - $this->diffNoticeBox = $form; // add as part of form
1356 - } else {
1357 - $wgOut->addHTML( $form );
1358 - }
13591364 }
13601365 # Add a link to diff from stable to current as needed.
13611366 # Show review status of the diff revision(s). Uses a <table>.
@@ -1537,9 +1542,17 @@
15381543 // Is this a diff of a draft rev against the stable rev?
15391544 if ( self::isDiffToStable( $srev, $oldRev, $newRev ) ) {
15401545 $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;
15411553 }
15421554 }
15431555 }
 1556+ $this->diffRevs = array( 'old' => $oldRev->getId(), 'new' => $newRev->getId() );
15441557 return true;
15451558 }
15461559
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -28,16 +28,6 @@
2929 return;
3030 }
3131
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 -
4232 # SELECT parameters...
4333 if ( !defined( 'FR_FOR_UPDATE' ) )
4434 define( 'FR_FOR_UPDATE', 1 );
@@ -76,7 +66,7 @@
7767
7868 # This will only distinguish "sighted", "quality", and unreviewed
7969 # A small icon will show in the upper right hand corner
80 -$wgSimpleFlaggedRevsUI = true;
 70+$wgSimpleFlaggedRevsUI = true; // @TODO: remove when ready
8171 # For visitors, only show tags/icons for unreviewed/outdated pages
8272 $wgFlaggedRevsLowProfile = true;
8373
@@ -89,19 +79,14 @@
9080 # Is a "stable version" used as the default display
9181 # version for all pages in reviewable namespaces?
9282 $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;
9983 # Below are groups that see the current revision by default.
10084 # This makes editing easier since the users always start off
10185 # viewing the latest version of pages.
10286 $wgFlaggedRevsExceptions = array( 'user' );
10387
10488 # 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?
10691 # Auto-review edits that are:
10792 # (a) directly to the stable version by users with 'autoreview'/'bot'
10893 # (b) self-reversions back to the stable version by any user
@@ -144,7 +129,6 @@
145130 # on the protection form of pages. Each level has the stable version shown by default.
146131 # A "none" level will appear in the form as well, to disable the review process.
147132 # 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.
149133 $wgFlaggedRevsProtection = false;
150134
151135 # Define our basic reviewer class of established editors (Editors)
@@ -253,8 +237,10 @@
254238 # End of configuration variables.
255239 # ########
256240
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
259245
260246 # Bots are granted autoreview via hooks, mark in rights
261247 # array so that it shows up in sp:ListGroupRights...
@@ -535,20 +521,22 @@
536522 # ####### END HOOK TRIGGERED FUNCTIONS #########
537523
538524 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+ }
545540 }
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 - }
553541 # Conditional API modules
554542 efSetFlaggedRevsConditionalAPIModules();
555543 # Load hooks that aren't always set
Index: trunk/extensions/FlaggedRevs/maintenance/updateTracking.inc
@@ -152,7 +152,6 @@
153153 # Remove manual config settings that simply restate the site defaults
154154 $db->delete( 'flaggedpage_config',
155155 array( "fpc_page_id BETWEEN $blockStart AND $blockEnd",
156 - 'fpc_select' => FlaggedRevs::getPrecedence(),
157156 'fpc_override' => intval( FlaggedRevs::isStableShownByDefault() ),
158157 'fpc_level' => ''
159158 ),
Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php
@@ -172,8 +172,9 @@
173173 'revreview-style-4' => 'Featured',
174174 'revreview-submit' => 'Submit',
175175 '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',
178179 'revreview-submit-reviewed' => 'Done. Accepted!',
179180 'revreview-submit-unreviewed' => 'Done. Unaccepted!',
180181 'revreview-successful' => '\'\'\'Revision of [[:$1|$1]] successfully flagged. ([{{fullurl:{{#Special:ReviewedVersions}}|page=$2}} view reviewed versions])\'\'\'',
@@ -184,19 +185,19 @@
185186 'revreview-toggle-title' => 'show/hide details',
186187 'revreview-toolow' => '\'\'\'You must rate each of the attributes higher than "inadequate" in order for a revision to be considered reviewed.\'\'\'
187188
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".
189190
190191 Please hit the "back" button in your browser and try again.',
191192 '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.',
193194 'revreview-update-edited' => '<span class="flaggedrevs_important">Your changes are not yet in the stable version.</span>
194195
195196 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.',
197198 'revreview-update-edited-prev' => '<span class="flaggedrevs_important">Your changes are not yet in the stable version. There are previous changes pending review.</span>
198199
199200 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.',
201202 'revreview-update-includes' => '\'\'\'Some templates/files were updated:\'\'\'',
202203 'revreview-update-use' => '\'\'\'NOTE:\'\'\' The stable version of each of these templates/files is used in the stable version of this page.',
203204 '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 @@
273274
274275 'revreview-tt-review' => 'Apply this status to this revision',
275276 '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)',
277279 'validationpage' => '{{ns:help}}:Page validation',
278280 );
279281
Index: trunk/extensions/FlaggedRevs/language/Stabilization.i18n.php
@@ -11,10 +11,8 @@
1212 $messages['en'] = array(
1313 'stabilization-tab' => 'vet',
1414 '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.
1917 Here are the current settings for [[:$1|$1]]:',
2018 'stabilization-page' => 'Page name:',
2119 'stabilization-leg' => 'Confirm stable version settings',
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -962,7 +962,7 @@
963963 $db = ( $flags & FR_MASTER ) ?
964964 wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
965965 $row = $db->selectRow( 'flaggedpage_config',
966 - array( 'fpc_select', 'fpc_override', 'fpc_level', 'fpc_expiry' ),
 966+ array( 'fpc_override', 'fpc_level', 'fpc_expiry' ),
967967 array( 'fpc_page_id' => $title->getArticleID() ),
968968 __METHOD__
969969 );
@@ -978,16 +978,11 @@
979979 }
980980 // Is there a non-expired row?
981981 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 - }
986982 $level = $row->fpc_level;
987983 if ( !self::isValidRestriction( $row->fpc_level ) ) {
988984 $level = ''; // site default; ignore fpc_level
989985 }
990986 $config = array(
991 - 'select' => $precedence,
992987 'override' => $row->fpc_override ? 1 : 0,
993988 'autoreview' => $level,
994989 'expiry' => Block::decodeExpiry( $row->fpc_expiry ) // TS_MW
@@ -1012,11 +1007,6 @@
10131008 */
10141009 public static function getDefaultVisibilitySettings() {
10151010 return array(
1016 - # Keep this consistent across settings:
1017 - # # 2 = pristine -> quality -> stable;
1018 - # # 1 = quality -> stable
1019 - # # 0 = none
1020 - 'select' => self::getPrecedence(),
10211011 # Keep this consistent across settings:
10221012 # # 1 -> override, 0 -> don't
10231013 'override' => self::isStableShownByDefault() ? 1 : 0,
@@ -1053,15 +1043,6 @@
10541044 }
10551045
10561046 /**
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 - /**
10661047 * Check if an fpc_level value is valid
10671048 * @param string $right
10681049 */
@@ -1079,11 +1060,11 @@
10801061 public static function purgeExpiredConfigurations() {
10811062 $dbw = wfGetDB( DB_MASTER );
10821063 $pageIds = array();
1083 - $pagesClearTracking = $pagesRetrack = array();
 1064+ $pagesClearTracking = array();
10841065 $config = self::getDefaultVisibilitySettings(); // config is to be reset
10851066 $encCutoff = $dbw->addQuotes( $dbw->timestamp() );
10861067 $ret = $dbw->select( 'flaggedpage_config',
1087 - array( 'fpc_page_id', 'fpc_select' ),
 1068+ array( 'fpc_page_id' ),
10881069 array( 'fpc_expiry < ' . $encCutoff ),
10891070 __METHOD__
10901071 // array( 'FOR UPDATE' )
@@ -1094,10 +1075,6 @@
10951076 // from the tracking tables...
10961077 if ( !$config['override'] && self::useOnlyIfProtected() ) {
10971078 $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
11021079 }
11031080 $pageIds[] = $row->fpc_page_id; // page with expired config
11041081 }
@@ -1111,14 +1088,8 @@
11121089 if ( count( $pagesClearTracking ) ) {
11131090 self::clearTrackingRows( $pagesClearTracking );
11141091 }
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 - }
11211092 }
1122 -
 1093+
11231094 # ################ Other utility functions #################
11241095
11251096 /**
@@ -1182,52 +1153,24 @@
11831154 }
11841155 return true;
11851156 }
1186 -
 1157+
11871158 /**
11881159 * Get the quality tier of review flags
11891160 * @param array $flags
11901161 * @return int, flagging tier (-1 for non-sighted)
11911162 */
11921163 public static function getLevelTier( array $flags ) {
1193 - if ( self::isPristine( $flags ) )
 1164+ if ( self::isPristine( $flags ) ) {
11941165 return FR_PRISTINE; // 2
1195 - elseif ( self::isQuality( $flags ) )
 1166+ } elseif ( self::isQuality( $flags ) ) {
11961167 return FR_QUALITY; // 1
1197 - elseif ( self::isSighted( $flags ) )
 1168+ } elseif ( self::isSighted( $flags ) ) {
11981169 return FR_SIGHTED; // 0
1199 - else
1200 - return -1;
 1170+ }
 1171+ return -1;
12011172 }
12021173
12031174 /**
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 - /**
12321175 * Get minimum level tags for a tier
12331176 * @return array
12341177 */
Index: trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php
@@ -15,10 +15,11 @@
1616 {
1717 /* Form parameters which can be user given */
1818 protected $page = null;
19 - protected $rcid = 0;
2019 protected $approve = false;
2120 protected $unapprove = false;
 21+ protected $reject = false;
2222 protected $oldid = 0;
 23+ protected $refid = 0;
2324 protected $templateParams = '';
2425 protected $imageParams = '';
2526 protected $fileVersion = '';
@@ -50,14 +51,6 @@
5152 $this->trySet( $this->page, $value );
5253 }
5354
54 - public function getRCId() {
55 - return $this->rcid;
56 - }
57 -
58 - public function setRCId( $value ) {
59 - $this->trySet( $this->rcid, (int)$value );
60 - }
61 -
6255 public function setApprove( $value ) {
6356 $this->trySet( $this->approve, $value );
6457 }
@@ -66,6 +59,18 @@
6760 $this->trySet( $this->unapprove, $value );
6861 }
6962
 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+
7075 public function getOldId() {
7176 return $this->oldid;
7277 }
@@ -199,7 +204,7 @@
200205 return 'review_no_oldid';
201206 }
202207 # Check that this is an approval or de-approval
203 - if ( $this->isApproval() === null ) {
 208+ if ( $this->getAction() === null ) {
204209 return 'review_param_missing'; // user didn't say
205210 }
206211 # Fill in implicit tag data for binary flag case
@@ -220,7 +225,7 @@
221226 return 'review_too_low';
222227 }
223228 # Special token to discourage fiddling with template/files...
224 - if ( $this->isApproval() ) {
 229+ if ( $this->getAction() === 'approve' ) {
225230 $k = self::validationKey(
226231 $this->templateParams, $this->imageParams, $this->fileVersion, $this->oldid );
227232 if ( $this->validatedParams !== $k ) {
@@ -256,21 +261,19 @@
257262 return null;
258263 }
259264
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';
274276 }
 277+ return null; // nothing valid asserted
275278 }
276279
277280 /**
@@ -291,7 +294,7 @@
292295 return 'review_denied';
293296 }
294297 # We can only approve actual revisions...
295 - if ( $this->isApproval() ) {
 298+ if ( $this->getAction() === 'approve' ) {
296299 $rev = Revision::newFromTitle( $this->page, $this->oldid );
297300 # Do not mess with archived/deleted revisions
298301 if ( is_null( $rev ) || $rev->mDeleted ) {
@@ -299,13 +302,29 @@
300303 }
301304 $status = $this->approveRevision( $rev );
302305 # We can only unapprove approved revisions...
303 - } else {
 306+ } elseif ( $this->getAction() === 'unapprove' ) {
304307 $frev = FlaggedRevision::newFromTitle( $this->page, $this->oldid );
305308 # If we can't find this flagged rev, return to page???
306309 if ( is_null( $frev ) ) {
307310 return 'review_not_flagged';
308311 }
309312 $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 );
310329 }
311330 # Watch page if set to do so
312331 if ( $status === true ) {
@@ -390,7 +409,8 @@
391410 ) );
392411 $flaggedRevision->insertOn();
393412 # 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 );
395415
396416 # Update the article review log...
397417 $oldSvId = $oldSv ? $oldSv->getRevId() : 0;
@@ -583,36 +603,42 @@
584604
585605 /**
586606 * Generates a brief review form for a page.
 607+ * NOTE: use ONLY for diff-to-stable views and page version views
587608 * @param User $user
588609 * @param FlaggedArticle $article
589610 * @param Revision $rev
 611+ * @param int $refId (left side version ID for diffs, $rev is the right rev)
590612 * @param array $templateIDs
591613 * @param array $imageSHA1Keys
592 - * @param bool $stableDiff this is a diff-to-stable
593614 * @return mixed (string/false)
594615 */
595616 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
598619 ) {
599 - global $wgRequest, $wgOut;
 620+ global $wgOut;
 621+ $id = $rev->getId();
600622 if ( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
601623 return false; # The revision must be valid and public
602624 }
603 - $id = $rev->getId();
604 - $skin = $user->getSkin();
605625 # Do we need to get inclusion IDs from parser output?
606626 $getPOut = !( $templateIDs && $imageSHA1Keys );
607627
 628+ $srev = $article->getStableRev();
608629 # 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+ }
610635 $oldFlags = $frev
611636 ? $frev->getTags() // existing tags
612 - : FlaggedRevision::expandRevisionTags( '' ); // unset tags
 637+ : FlaggedRevs::quickTags( FR_SIGHTED ); // basic tags
 638+
613639 # If we are reviewing updates to a page, start off with the stable revision's
614640 # 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
617643 $flags = $srev->getTags();
618644 # Check if user is allowed to renew the stable version.
619645 # If not, then get the flags for the new revision itself.
@@ -621,12 +647,12 @@
622648 }
623649 $reviewNotes = $srev->getComment();
624650 # 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
627653 $flags = $oldFlags;
628654 // Get existing notes to pre-fill field
629655 $reviewNotes = $frev ? $frev->getComment() : "";
630 - $allowRereview = false; // re-review button
 656+ $reviewIncludes = false; // re-review button
631657 }
632658
633659 # Disable form for unprivileged users
@@ -646,13 +672,12 @@
647673 $form .= Xml::openElement( 'fieldset',
648674 array( 'class' => 'flaggedrevs_reviewform noprint' ) );
649675 # Add appropriate legend text
650 - $legendMsg = ( FlaggedRevs::binaryFlagging() && $allowRereview )
651 - ? 'revreview-reflag'
652 - : 'revreview-flag';
 676+ $legendMsg = $frev ? 'revreview-reflag' : 'revreview-flag';
653677 $form .= Xml::openElement( 'legend', array( 'id' => 'mw-fr-reviewformlegend' ) );
654678 $form .= "<strong>" . wfMsgHtml( $legendMsg ) . "</strong>";
655679 $form .= Xml::closeElement( 'legend' ) . "\n";
656680 # Show explanatory text
 681+ $form .= $topNotice;
657682 if ( !FlaggedRevs::lowProfileUI() ) {
658683 $form .= wfMsgExt( 'revreview-text', array( 'parse' ) );
659684 }
@@ -674,7 +699,8 @@
675700 $form .= "<div id='mw-fr-notebox'>\n";
676701 $form .= "<p>" . wfMsgHtml( 'revreview-notes' ) . "</p>\n";
677702 $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;
679705 $form .= Xml::openElement( 'textarea', $params ) .
680706 htmlspecialchars( $reviewNotes ) .
681707 Xml::closeElement( 'textarea' ) . "\n";
@@ -719,7 +745,10 @@
720746 array( 'class' => 'fr-comment-box' ) ) . "&#160;&#160;&#160;</span>";
721747 }
722748 # 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 );
724753 # Show stability log if there is anything interesting...
725754 if ( $article->isPageLocked() ) {
726755 $form .= ' ' . FlaggedRevsXML::logToggle( 'revreview-log-toggle-show' );
@@ -734,6 +763,7 @@
735764 # Hidden params
736765 $form .= Xml::hidden( 'title', $reviewTitle->getPrefixedText() ) . "\n";
737766 $form .= Xml::hidden( 'target', $article->getTitle()->getPrefixedDBKey() ) . "\n";
 767+ $form .= Xml::hidden( 'refid', $refId ) . "\n";
738768 $form .= Xml::hidden( 'oldid', $id ) . "\n";
739769 $form .= Xml::hidden( 'action', 'submit' ) . "\n";
740770 $form .= Xml::hidden( 'wpEditToken', $user->editToken() ) . "\n";
@@ -741,8 +771,6 @@
742772 $form .= Xml::hidden( 'templateParams', $templateParams ) . "\n";
743773 $form .= Xml::hidden( 'imageParams', $imageParams ) . "\n";
744774 $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";
747775 # Special token to discourage fiddling...
748776 $checkCode = self::validationKey(
749777 $templateParams, $imageParams, $fileVersion, $id
@@ -781,7 +809,7 @@
782810 // Display the value for each tag as text
783811 foreach ( $dimensions as $quality => $levels ) {
784812 $selected = isset( $flags[$quality] ) ? $flags[$quality] : 0;
785 - $items[] = "<b>" . FlaggedRevs::getTagMsg( $quality ) . ":</b> " .
 813+ $items[] = FlaggedRevs::getTagMsg( $quality ) . ": " .
786814 FlaggedRevs::getTagValueMsg( $quality, $selected );
787815 }
788816 } else {
@@ -798,8 +826,8 @@
799827 }
800828 # Show label as needed
801829 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";
804832 }
805833 # If the sum of qualities of all flags is above 6, use drop down boxes.
806834 # 6 is an arbitrary value choosen according to screen space and usability.
@@ -870,51 +898,58 @@
871899
872900 /**
873901 * Generates review form submit buttons
 902+ * @param int $refId left rev ID for "reject" on diffs
874903 * @param FlaggedRevision $frev, the flagged revision, if any
875904 * @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?
877906 * @returns string
878907 */
879 - private static function submitButtons( $frev, $disabled, $rereview = false ) {
 908+ private static function submitButtons( $refId, $frev, $disabled, $reviewIncludes = false ) {
880909 $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 ) {
900931 $s .= ' ';
901 - $s .= Xml::submitButton( wfMsgHtml( 'revreview-submit-unreview' ),
 932+ $s .= Xml::submitButton( wfMsgHtml( 'revreview-submit-reject' ),
902933 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' ),
907937 ) + ( $disabled ? $disAttrib : array() )
908938 );
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 - );
918939 }
 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>";
919954 return $s;
920955 }
921956
Index: trunk/extensions/FlaggedRevs/forms/PageStabilityForm.php
@@ -71,7 +71,7 @@
7272 public function getExpiry() {
7373 return $this->expiry;
7474 }
75 -
 75+
7676 public function setExpiry( $value ) {
7777 $this->trySet( $this->expiry, $value );
7878 }
@@ -87,7 +87,7 @@
8888 public function getAutoreview() {
8989 return $this->autoreview;
9090 }
91 -
 91+
9292 public function setAutoreview( $value ) {
9393 $this->trySet( $this->autoreview, $value );
9494 }
@@ -366,7 +366,7 @@
367367 }
368368
369369 protected function loadExpiry() {
370 - # Custom expiry takes precedence
 370+ # Custom expiry replaces dropdown
371371 if ( $this->expiry == '' ) {
372372 $this->expiry = $this->expirySelection;
373373 if ( $this->expiry == 'existing' ) {
@@ -376,7 +376,7 @@
377377 }
378378
379379 protected function loadReason() {
380 - # Custom reason takes precedence
 380+ # Custom reason replaces dropdown
381381 if ( $this->reasonSelection != 'other' ) {
382382 $comment = $this->reasonSelection; // start with dropdown reason
383383 if ( $this->reason != '' ) {
@@ -407,9 +407,6 @@
408408
409409 // Assumes $wgFlaggedRevsProtection is off
410410 class PageStabilityGeneralForm extends PageStabilityForm {
411 - /* Form parameters which can be user given */
412 - public $select = -1; # Precedence
413 -
414411 public function getReviewThis() {
415412 return $this->reviewThis;
416413 }
@@ -418,14 +415,6 @@
419416 $this->trySet( $this->reviewThis, $value );
420417 }
421418
422 - public function getPrecedence() {
423 - return $this->select;
424 - }
425 -
426 - public function setPrecedence( $value ) {
427 - $this->trySet( $this->select, $value );
428 - }
429 -
430419 public function getOverride() {
431420 return $this->override;
432421 }
@@ -435,7 +424,6 @@
436425 }
437426
438427 protected function reallyPreloadSettings() {
439 - $this->select = $this->oldConfig['select'];
440428 $this->override = $this->oldConfig['override'];
441429 $this->autoreview = $this->oldConfig['autoreview'];
442430 $this->expiry = $this->oldExpiry;
@@ -448,9 +436,6 @@
449437 $this->loadReason();
450438 $this->loadExpiry();
451439 $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 - }
455440 // Check autoreview restriction setting
456441 if ( $this->autoreview != '' // restriction other than 'none'
457442 && !in_array( $this->autoreview, FlaggedRevs::getRestrictionLevels() ) )
@@ -468,7 +453,7 @@
469454 'override' => $this->override,
470455 'autoreview' => $this->autoreview,
471456 'expiry' => $this->expiry, // TS_MW/infinity
472 - 'precedence' => $this->select
 457+ 'precedence' => 1 // here for log hook b/c
473458 );
474459 }
475460
@@ -510,7 +495,7 @@
511496 array( 'PRIMARY' ),
512497 array(
513498 'fpc_page_id' => $this->page->getArticleID(),
514 - 'fpc_select' => (int)$this->select,
 499+ 'fpc_select' => 1, // unused
515500 'fpc_override' => (int)$this->override,
516501 'fpc_level' => $this->autoreview,
517502 'fpc_expiry' => $dbExpiry
@@ -523,18 +508,16 @@
524509 }
525510
526511 protected function newConfigIsReset() {
527 - return ( $this->select == FlaggedRevs::getPrecedence()
528 - && $this->override == FlaggedRevs::isStableShownByDefault()
 512+ return ( $this->override == FlaggedRevs::isStableShownByDefault()
529513 && $this->autoreview == '' );
530514 }
531515
532516 // 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 ) {
534518 if( !$oldRow ) {
535519 return true; // no previous config
536520 }
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...
539522 || $oldRow->fpc_level != $autoreview // ...autoreview level changed, or...
540523 || $oldRow->fpc_expiry != $dbExpiry // ...expiry changed
541524 );
@@ -588,7 +571,7 @@
589572 return true;
590573 }
591574
592 - // Doesn't include 'precedence'; checked in FlaggedRevsLogs
 575+ // Doesn't and shouldn't include 'precedence'; checked in FlaggedRevsLogs
593576 protected function getLogParams() {
594577 return array(
595578 'override' => $this->override, // in case of site changes
Index: trunk/extensions/FlaggedRevs/FlaggedRevision.php
@@ -126,10 +126,9 @@
127127 * Get a FlaggedRevision of the stable version of a title.
128128 * @param Title $title, page title
129129 * @param int $flags FR_MASTER
130 - * @param array $config, optional page config (use to skip queries)
131130 * @return mixed FlaggedRevision (null on failure)
132131 */
133 - public static function newFromStable( Title $title, $flags = 0, $config = array() ) {
 132+ public static function newFromStable( Title $title, $flags = 0 ) {
134133 if ( !FlaggedRevs::inReviewNamespace( $title ) ) {
135134 return null; // short-circuit
136135 }
@@ -171,9 +170,12 @@
172171 * @param Title $title, page title
173172 * @param int $flags FR_MASTER
174173 * @param array $config, optional page config (use to skip queries)
 174+ * @param string $precedence (latest,quality,pristine)
175175 * @return mixed FlaggedRevision (null on failure)
176176 */
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+ ) {
178180 if ( !FlaggedRevs::inReviewNamespace( $title ) ) {
179181 return null; // short-circuit
180182 }
@@ -200,7 +202,7 @@
201203 $row = null;
202204 $options['ORDER BY'] = 'fr_rev_id DESC';
203205 # Look for the latest pristine revision...
204 - if ( FlaggedRevs::pristineVersions() && $config['select'] != FLAGGED_VIS_LATEST ) {
 206+ if ( FlaggedRevs::pristineVersions() && $precedence !== 'latest' ) {
205207 $prow = $db->selectRow(
206208 array( 'flaggedrevs', 'revision' ),
207209 $columns,
@@ -216,10 +218,10 @@
217219 # Looks like a plausible revision
218220 $row = $prow ? $prow : $row;
219221 }
220 - if ( $row && $config['select'] == FLAGGED_VIS_PRISTINE ) {
 222+ if ( $row && $precedence === 'pristine' ) {
221223 // we have what we want already
222224 # Look for the latest quality revision...
223 - } elseif ( FlaggedRevs::qualityVersions() && $config['select'] != FLAGGED_VIS_LATEST ) {
 225+ } elseif ( FlaggedRevs::qualityVersions() && $precedence !== 'latest' ) {
224226 // If we found a pristine rev above, this one must be newer...
225227 $newerClause = $row ? "fr_rev_id > {$row->fr_rev_id}" : "1 = 1";
226228 $qrow = $db->selectRow(
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php
@@ -70,33 +70,6 @@
7171 }
7272
7373 /**
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 - /**
10174 * Get a <select> of default page version (stable or draft). Used for filters.
10275 * @param int $selected (0=draft, 1=stable, null=either )
10376 * @returns string
Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php
@@ -57,8 +57,7 @@
5858 # Expiry
5959 $form->setExpiry( $wgRequest->getText( 'mwStabilize-expiry' ) );
6060 $form->setExpirySelection( $wgRequest->getVal( 'wpExpirySelection' ) );
61 - # Precedence
62 - $form->setPrecedence( $wgRequest->getInt( 'wpStableconfig-select' ) );
 61+ # Default version
6362 $form->setOverride( (int)$wgRequest->getBool( 'wpStableconfig-override' ) );
6463 # Get autoreview restrictions...
6564 $form->setAutoreview( $wgRequest->getVal( 'mwProtect-level-autoreview' ) );
@@ -152,21 +151,6 @@
153152 '<br />' . "\n" .
154153 Xml::radioLabel( wfMsg( 'stabilization-def2' ), 'wpStableconfig-override', 0,
155154 '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" .
171155 Xml::closeElement( 'fieldset' );
172156 # Add autoreview restriction select
173157 $s .= Xml::fieldset( wfMsg( 'stabilization-restrict' ), false ) .
@@ -323,4 +307,4 @@
324308 ? array()
325309 : array( 'disabled' => 'disabled' );
326310 }
327 -}
\ No newline at end of file
 311+}
Index: trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php
@@ -45,9 +45,10 @@
4646 # Param for sites with binary flagging
4747 $form->setApprove( $wgRequest->getCheck( 'wpApprove' ) );
4848 $form->setUnapprove( $wgRequest->getCheck( 'wpUnapprove' ) );
 49+ $form->setReject( $wgRequest->getCheck( 'wpReject' ) );
4950 # Rev ID
50 - $oldid = $wgRequest->getInt( 'oldid' );
51 - $form->setOldId( $oldid );
 51+ $form->setOldId( $wgRequest->getInt( 'oldid' ) );
 52+ $form->setRefId( $wgRequest->getInt( 'refid' ) );
5253 # Special parameter mapping
5354 $form->setTemplateParams( $wgRequest->getVal( 'templateParams' ) );
5455 $form->setFileParams( $wgRequest->getVal( 'imageParams' ) );
@@ -96,10 +97,12 @@
9798 // Success for either flagging or unflagging
9899 if ( $status === true ) {
99100 $wgOut->setPageTitle( wfMsgHtml( 'actioncomplete' ) );
100 - if ( $form->isApproval() ) {
 101+ if ( $form->getAction() === 'approve' ) {
101102 $wgOut->addHTML( $form->approvalSuccessHTML( true ) );
102 - } else {
 103+ } elseif ( $form->getAction() === 'unapprove' ) {
103104 $wgOut->addHTML( $form->deapprovalSuccessHTML( true ) );
 105+ } elseif ( $form->getAction() === 'reject' ) {
 106+ $wgOut->redirect( $this->page->getFullUrl() );
104107 }
105108 // Failure for flagging or unflagging
106109 } else {
@@ -151,8 +154,8 @@
152155 case "oldid":
153156 $form->setOldId( $val );
154157 break;
155 - case "rcid":
156 - $form->setRCId( $val );
 158+ case "refid":
 159+ $form->setRefId( $val );
157160 break;
158161 case "validatedParams":
159162 $form->setValidatedParams( $val );
@@ -172,6 +175,9 @@
173176 case "wpUnapprove":
174177 $form->setUnapprove( $val );
175178 break;
 179+ case "wpReject":
 180+ $form->setReject( $val );
 181+ break;
176182 case "wpReason":
177183 $form->setComment( $val );
178184 break;
@@ -221,10 +227,12 @@
222228 # Success...
223229 if ( $status === true ) {
224230 $tier = FlaggedRevs::getLevelTier( $form->getDims() ) + 1; // shift to 0-3
225 - if ( $form->isApproval() ) { // approve
 231+ if ( $form->getAction() === 'approve' ) { // approve
226232 return "<suc#><t#$tier>" . $form->approvalSuccessHTML( false );
227 - } else { // de-approve
 233+ } elseif ( $form->getAction() === 'unapprove' ) { // de-approve
228234 return "<suc#><t#$tier>" . $form->deapprovalSuccessHTML( false );
 235+ } elseif ( $form->getAction() === 'reject' ) { // revert
 236+ return "<suc#><t#$tier>" . $form->rejectSuccessHTML( false );
229237 }
230238 # Failure...
231239 } else {
Index: trunk/extensions/FlaggedRevs/specialpages/ConfiguredPages_body.php
@@ -19,7 +19,6 @@
2020
2121 $this->namespace = $wgRequest->getIntOrNull( 'namespace' );
2222 $this->override = $wgRequest->getIntOrNull( 'stable' );
23 - $this->precedence = $wgRequest->getIntOrNull( 'precedence' );
2423 $this->autoreview = $wgRequest->getVal( 'restriction', '' );
2524
2625 $this->showForm();
@@ -40,10 +39,6 @@
4140 if( FlaggedRevs::getRestrictionLevels() ) {
4241 $fields[] = FlaggedRevsXML::getRestrictionFilterMenu( $this->autoreview );
4342 }
44 - # Stable version selection precedence
45 - if ( FlaggedRevs::qualityVersions() ) {
46 - $fields[] = FlaggedRevsXML::getPrecedenceFilterMenu( $this->precedence );
47 - }
4843 if ( count( $fields ) ) {
4944 $form = Xml::openElement( 'form',
5045 array( 'name' => 'configuredpages', 'action' => $wgScript, 'method' => 'get' ) );
@@ -60,7 +55,7 @@
6156 protected function showPageList() {
6257 global $wgOut;
6358 $pager = new ConfiguredPagesPager( $this, array(),
64 - $this->namespace, $this->override, $this->precedence, $this->autoreview );
 59+ $this->namespace, $this->override, $this->autoreview );
6560 if ( $pager->getNumRows() ) {
6661 $wgOut->addHTML( $pager->getNavigationBar() );
6762 $wgOut->addHTML( $pager->getBody() );
@@ -89,19 +84,6 @@
9085 } else {
9186 $default = wfMsgHtml( 'configuredpages-def-draft' );
9287 }
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 - }
10688 # Autoreview/review restriction level
10789 $restr = '';
10890 if ( $row->fpc_level != '' ) {
@@ -119,7 +101,7 @@
120102 } else {
121103 $expiry_description = "";
122104 }
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>";
124106 }
125107 }
126108
@@ -127,14 +109,13 @@
128110 * Query to list out stable versions for a page
129111 */
130112 class ConfiguredPagesPager extends AlphabeticPager {
131 - public $mForm, $mConds, $namespace, $override, $precedence, $autoreview;
 113+ public $mForm, $mConds, $namespace, $override, $autoreview;
132114
133115 // @param int $namespace (null for "all")
134116 // @param int $override (null for "either")
135 - // @param int $precedence (null for "all")
136117 // @param string $autoreview ('' for "all", 'none' for no restriction)
137118 function __construct(
138 - $form, $conds = array(), $namespace, $override, $precedence, $autoreview
 119+ $form, $conds = array(), $namespace, $override, $autoreview
139120 ) {
140121 $this->mForm = $form;
141122 $this->mConds = $conds;
@@ -152,10 +133,6 @@
153134 $override = null; // "all"
154135 }
155136 $this->override = $override;
156 - if ( !is_integer( $precedence ) ) {
157 - $precedence = null; // "all"
158 - }
159 - $this->precedence = $precedence;
160137 if ( $autoreview === 'none' ) {
161138 $autoreview = ''; // 'none' => ''
162139 } elseif ( $autoreview === '' ) {
@@ -175,9 +152,6 @@
176153 if ( $this->override !== null ) {
177154 $conds['fpc_override'] = $this->override;
178155 }
179 - if ( $this->precedence !== null ) {
180 - $conds['fpc_select'] = $this->precedence;
181 - }
182156 if ( $this->autoreview !== null ) {
183157 $conds['fpc_level'] = $this->autoreview;
184158 }
@@ -188,7 +162,7 @@
189163 return array(
190164 'tables' => array( 'flaggedpage_config', 'page' ),
191165 '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' ),
193167 'conds' => $conds,
194168 'options' => array()
195169 );
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -113,7 +113,6 @@
114114 'sendMsg' => wfMsgHtml( 'revreview-submit' ),
115115 'flagMsg' => wfMsgHtml( 'revreview-submit-review' ),
116116 'unflagMsg' => wfMsgHtml( 'revreview-submit-unreview' ),
117 - 'flagLegMsg' => wfMsgHtml( 'revreview-flag' ),
118117 'sendingMsg' => wfMsgHtml( 'revreview-submitting' ),
119118 'flaggedMsg' => wfMsgHtml( 'revreview-submit-reviewed' ),
120119 'unflaggedMsg' => wfMsgHtml( 'revreview-submit-unreviewed' ),
@@ -873,39 +872,43 @@
874873 $revId = $rc->mAttribs['rc_this_oldid'];
875874 $quality = FlaggedRevs::getRevQuality(
876875 $rc->mAttribs['rc_cur_id'], $revId, FR_MASTER );
 876+ // Reviewed => patrolled
877877 if ( $quality !== false && $quality >= FR_SIGHTED ) {
878878 RevisionReviewForm::updateRecentChanges( $rc->getTitle(), $revId );
879879 $rc->mAttribs['rc_patrolled'] = 1; // make sure irc/email notifs know status
880880 }
881881 return true;
882882 }
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
898892 } 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+ }
902905 }
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+ }
910913 }
911914 }
912915 return true;
@@ -1589,7 +1592,9 @@
15901593 return true;
15911594 }
15921595
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+ ) {
15941599 $tables[] = 'flaggedpages';
15951600 $join_conds['flaggedpages'] = array( 'LEFT JOIN', 'fp_page_id = rc_cur_id' );
15961601 if( is_array( $select ) ) {
@@ -1619,31 +1624,30 @@
16201625 $title = $history->getArticle()->getTitle();
16211626 # Fetch and process cache the stable revision
16221627 if ( !isset( $history->fr_stableRevId ) ) {
1623 - $frev = $fa->getStableRev();
1624 - $history->fr_stableRevId = $frev ? $frev->getRevId() : 0;
 1628+ $history->fr_stableRevId = $fa->getStable();
16251629 $history->fr_pendingRevs = false;
 1630+ if ( !$history->fr_stableRevId ) {
 1631+ return true; // nothing to do here
 1632+ }
16261633 }
1627 - if ( !$history->fr_stableRevId ) {
1628 - return true; // nothing to do here
1629 - }
16301634 $revId = (int)$row->rev_id;
1631 - // Unreviewed revision: highlight if pending
 1635+ // Pending revision: highlight and add diff link
16321636 $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
16411643 // 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+ }
16481652 }
16491653 }
16501654 # Style the row as needed

Follow-up revisions

RevisionCommit summaryAuthorDate
r73258Follow-up r73164:...aaron23:23, 17 September 2010
r76481Followup r73164: Fix fatal if the oldrev or newrev isn't defined.demon22:46, 10 November 2010

Comments

#Comment by Aaron Schulz (talk | contribs)   22:37, 16 September 2010

i18n message cruft still left here

#Comment by RobLa (talk | contribs)   22:04, 10 November 2010

This line: + $this->diffRevs = array( 'old' => $oldRev->getId(), 'new' => $newRev->getId() );

...is currently causing a problem when attempting a diff on the very first version, ala: http://prototype.wikimedia.org/flaggedrevs-w/index.php?title=Main_Page&diff=prev&oldid=7866

For comparison: http://en.wikipedia.org/w/index.php?title=Main_Page&diff=prev&oldid=139871

The error we're seeing with 1.16wmf4 core + FlaggedRevs trunk is: Fatal error: Call to a member function getId() on a non-object in /srv/org/wikimedia/prototype/wikis/flaggedrevs-w/extensions/FlaggedRevs/FlaggedArticleView.php on line 1542

Chad may be already working on a fix, but wanted to put this in here to keep track of it.

Status & tagging log