Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -423,6 +423,7 @@ |
424 | 424 | $wgHooks['DiffViewHeader'][] = 'FlaggedRevsHooks::onDiffViewHeader'; |
425 | 425 | # Autoreview stuff |
426 | 426 | $wgHooks['EditPage::showEditForm:fields'][] = 'FlaggedRevsHooks::addRevisionIDField'; |
| 427 | +$wgHooks['EditPageBeforeEditChecks'][] = 'FlaggedRevsHooks::addReviewCheck'; |
427 | 428 | |
428 | 429 | # Add CSS/JS as needed |
429 | 430 | $wgHooks['OutputPageParserOutput'][] = 'FlaggedRevsHooks::injectStyleAndJS'; |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -1008,11 +1008,18 @@ |
1009 | 1009 | public static function autoReviewEdit( $article, $user, $text, $rev, $flags, $patrol = true ) { |
1010 | 1010 | global $wgMemc, $wgRevisionCacheExpiry; |
1011 | 1011 | wfProfileIn( __METHOD__ ); |
1012 | | - |
| 1012 | + # Default tags to level 1 for each dimension |
| 1013 | + if( !is_array($flags) ) { |
| 1014 | + $flags = array(); |
| 1015 | + foreach( self::getDimensions() as $tag => $minQL ) { |
| 1016 | + $flags[$tag] = 1; |
| 1017 | + } |
| 1018 | + } |
1013 | 1019 | $quality = 0; |
1014 | 1020 | if( self::isQuality($flags) ) { |
1015 | 1021 | $quality = self::isPristine($flags) ? 2 : 1; |
1016 | 1022 | } |
| 1023 | + |
1017 | 1024 | $tmpset = $imgset = array(); |
1018 | 1025 | $poutput = false; |
1019 | 1026 | |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -659,6 +659,12 @@ |
660 | 660 | global $wgFlaggedRevsAutoReview, $wgFlaggedRevsAutoReviewNew, $wgRequest; |
661 | 661 | # Get the user |
662 | 662 | $user = is_null($user) ? User::newFromId( $rev->getUser() ) : $user; |
| 663 | + $checked = $wgRequest->getCheck('wpReviewEdit') && $user->isAllowed('review'); |
| 664 | + if( $checked ) { |
| 665 | + # Review this revision of the page. Let articlesavecomplete hook do rc_patrolled bit... |
| 666 | + FlaggedRevs::autoReviewEdit( $article, $user, $rev->getText(), $rev, null, false ); |
| 667 | + return true; |
| 668 | + } |
663 | 669 | if( !$wgFlaggedRevsAutoReview || !$user->isAllowed('autoreview') ) |
664 | 670 | return true; |
665 | 671 | # If $baseRevId passed in, this is a null edit |
— | — | @@ -712,10 +718,7 @@ |
713 | 719 | if( $isNullEdit ) { |
714 | 720 | $flags = $frev->getTags(); |
715 | 721 | } else { |
716 | | - $flags = array(); |
717 | | - foreach( FlaggedRevs::getDimensions() as $tag => $minQL ) { |
718 | | - $flags[$tag] = 1; |
719 | | - } |
| 722 | + $flags = null; |
720 | 723 | } |
721 | 724 | # Review this revision of the page. Let articlesavecomplete hook do rc_patrolled bit... |
722 | 725 | FlaggedRevs::autoReviewEdit( $article, $user, $rev->getText(), $rev, $flags, false ); |
— | — | @@ -1260,6 +1263,29 @@ |
1261 | 1264 | return FlaggedArticle::getInstance( $editPage->mArticle )->addRevisionIDField( $editPage, $out ); |
1262 | 1265 | } |
1263 | 1266 | |
| 1267 | + public static function addReviewCheck( $editPage, &$checkboxes, &$tabindex ) { |
| 1268 | + global $wgUser, $wgRequest; |
| 1269 | + if( !$wgUser->isAllowed('review') ) { |
| 1270 | + return true; |
| 1271 | + } |
| 1272 | + $checkboxes['reviewed'] = ''; |
| 1273 | + $reviewLabel = wfMsgExt('revreview-flag', array('parseinline')); |
| 1274 | + $fa = FlaggedArticle::getTitleInstance( $editPage->getArticle() ); |
| 1275 | + if( $fa->isReviewable() ) { |
| 1276 | + $srev = $fa->getStableRev(); |
| 1277 | + # For pages with either no stable version, or an outdated one, let |
| 1278 | + # the user decide if he/she wants it reviewed on the spot. One might |
| 1279 | + # do this if he/she just saw the diff-to-stable and *then* decided to edit. |
| 1280 | + if( !$srev || $srev->getRevId() != $editPage->getArticle()->getLatest() ) { |
| 1281 | + $attribs = array( 'tabindex' => ++$tabindex, 'id' => 'wpReviewEdit' ); |
| 1282 | + $checkboxes['reviewed'] = Xml::check( 'wpReviewEdit', |
| 1283 | + $wgRequest->getCheck('wpReviewEdit'), $attribs ) . |
| 1284 | + ' ' . Xml::label( $reviewLabel, 'wpReviewEdit' ); |
| 1285 | + } |
| 1286 | + } |
| 1287 | + return true; |
| 1288 | + } |
| 1289 | + |
1264 | 1290 | public static function addBacklogNotice( &$notice ) { |
1265 | 1291 | global $wgUser, $wgTitle, $wgFlaggedRevsBacklog; |
1266 | 1292 | if( !empty($wgTitle) ) { |