Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -744,7 +744,7 @@ |
745 | 745 | public function addDiffNoticeAfterEdit( $diff, $OldRev, $NewRev ) { |
746 | 746 | global $wgRequest, $wgUser, $wgOut; |
747 | 747 | |
748 | | - if( !$wgUser->isAllowed( 'review') || !$wgRequest->getBool('editreview') || !$NewRev->isCurrent() ) |
| 748 | + if( !$wgUser->isAllowed('review') || !$wgRequest->getBool('editreview') || !$NewRev->isCurrent() ) |
749 | 749 | return true; |
750 | 750 | |
751 | 751 | $frev = $this->getStableRev(); |
— | — | @@ -920,15 +920,30 @@ |
921 | 921 | } |
922 | 922 | |
923 | 923 | /** |
924 | | - * Add a link to patrol non-reviewable pages |
| 924 | + * Add a link to patrol non-reviewable pages. |
| 925 | + * Also add a diff to stable for other pages if possible. |
925 | 926 | */ |
926 | 927 | public function addPatrolLink( $diff, $OldRev, $NewRev ) { |
927 | 928 | global $wgUser, $wgOut; |
928 | | - |
929 | | - if( FlaggedRevs::isPageReviewable( $NewRev->getTitle() ) ) |
930 | | - return true; |
| 929 | + // Is there a stable version? |
| 930 | + if( FlaggedRevs::isPageReviewable( $NewRev->getTitle() ) ) { |
| 931 | + global $wgFlaggedArticle; |
| 932 | + |
| 933 | + $frev = $this->getStableRev(); |
| 934 | + if( $frev && $frev->fr_rev_id==$OldRev->getID() && $NewRev->isCurrent() ) { |
| 935 | + $wgFlaggedArticle->isDiffFromStable = true; |
| 936 | + } |
| 937 | + // Give a link to the diff-to-stable if needed |
| 938 | + if( $frev && !$wgFlaggedArticle->isDiffFromStable ) { |
| 939 | + $skin = $wgUser->getSkin(); |
| 940 | + |
| 941 | + $patrol = '(' . $skin->makeKnownLinkObj( $NewRev->getTitle(), |
| 942 | + wfMsgHtml( 'review-diff2stable' ), |
| 943 | + "oldid={$frev->fr_rev_id}&diff=cur&editreview=1" ) . ')'; |
| 944 | + $wgOut->addHTML( '<div align=center>' . $patrol . '</div>' ); |
| 945 | + } |
931 | 946 | // Prepare a change patrol link, if applicable |
932 | | - if( $wgUser->isAllowed( 'patrolother' ) ) { |
| 947 | + } else if( $wgUser->isAllowed( 'patrolother' ) ) { |
933 | 948 | // If we've been given an explicit change identifier, use it; saves time |
934 | 949 | if( $diff->mRcidMarkPatrolled ) { |
935 | 950 | $rcid = $diff->mRcidMarkPatrolled; |
— | — | @@ -957,10 +972,9 @@ |
958 | 973 | $skin = $wgUser->getSkin(); |
959 | 974 | |
960 | 975 | $reviewtitle = SpecialPage::getTitleFor( 'Revisionreview' ); |
961 | | - $patrol = ' [' . $skin->makeKnownLinkObj( $reviewtitle, |
| 976 | + $patrol = '[' . $skin->makeKnownLinkObj( $reviewtitle, |
962 | 977 | wfMsgHtml( 'markaspatrolleddiff' ), |
963 | | - "patrolonly=1&rcid={$rcid}" |
964 | | - ) . ']'; |
| 978 | + "patrolonly=1&rcid={$rcid}") . ']'; |
965 | 979 | } else { |
966 | 980 | $patrol = ''; |
967 | 981 | } |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php |
— | — | @@ -60,6 +60,8 @@ |
61 | 61 | $wgOut->permissionRequired( 'badaccess-group0' ); |
62 | 62 | return; |
63 | 63 | } |
| 64 | + // Watch checkbox |
| 65 | + $this->watchThis = $wgRequest->getCheck( 'wpWatchthis' ); |
64 | 66 | // Special parameter mapping |
65 | 67 | $this->templateParams = $wgRequest->getVal( 'templateParams' ); |
66 | 68 | $this->imageParams = $wgRequest->getVal( 'imageParams' ); |
— | — | @@ -103,7 +105,7 @@ |
104 | 106 | $valid = false; |
105 | 107 | |
106 | 108 | if( $valid && $wgRequest->wasPosted() ) { |
107 | | - $this->submit( $wgRequest ); |
| 109 | + $this->submit(); |
108 | 110 | } else { |
109 | 111 | $this->showRevision(); |
110 | 112 | } |
— | — | @@ -250,7 +252,7 @@ |
251 | 253 | "<li> $difflink $revlink " . $this->skin->revUserLink( $rev ) . " " . $this->skin->revComment( $rev ) . "</li>"; |
252 | 254 | } |
253 | 255 | |
254 | | - function submit( $request ) { |
| 256 | + function submit() { |
255 | 257 | global $wgOut, $wgUser, $wgFlaggedRevTags; |
256 | 258 | # If all values are set to zero, this has been unapproved |
257 | 259 | $approved = empty($wgFlaggedRevTags); |
— | — | @@ -281,7 +283,7 @@ |
282 | 284 | $this->approveRevision( $rev, $this->notes ) : $this->unapproveRevision( $frev ); |
283 | 285 | // Return to our page |
284 | 286 | if( $success ) { |
285 | | - if( $request->getCheck( 'wpWatchthis' ) ) { |
| 287 | + if( $this->watchThis ) { |
286 | 288 | $wgUser->addWatch( $this->page ); |
287 | 289 | } else { |
288 | 290 | $wgUser->removeWatch( $this->page ); |
— | — | @@ -999,6 +1001,8 @@ |
1000 | 1002 | # Our target page |
1001 | 1003 | $this->target = $wgRequest->getText( 'page' ); |
1002 | 1004 | $this->page = Title::newFromUrl( $this->target ); |
| 1005 | + # Watch checkbox |
| 1006 | + $this->watchThis = $wgRequest->getCheck( 'wpWatchthis' ); |
1003 | 1007 | # Params |
1004 | 1008 | $this->select = $wgRequest->getInt( 'select' ); |
1005 | 1009 | $this->override = intval( $wgRequest->getBool( 'override' ) ); |
— | — | @@ -1095,6 +1099,13 @@ |
1096 | 1100 | $form .= "</tr></table></fieldset>"; |
1097 | 1101 | |
1098 | 1102 | if( $this->isAllowed ) { |
| 1103 | + $watchLabel = wfMsgExt('watchthis', array('parseinline')); |
| 1104 | + $watchAttribs = array('accesskey' => wfMsg( 'accesskey-watch' ), 'id' => 'wpWatchthis'); |
| 1105 | + $watchChecked = ( $wgUser->getOption( 'watchdefault' ) || $wgTitle->userIsWatching() ); |
| 1106 | + |
| 1107 | + $form .= "<p> ".Xml::check( 'wpWatchthis', $watchChecked, $watchAttribs ); |
| 1108 | + $form .= " <label for='wpWatchthis'".$this->skin->tooltipAndAccesskey('watch').">{$watchLabel}</label>"; |
| 1109 | + |
1099 | 1110 | $form .= Xml::hidden('title', $wgTitle->getPrefixedText() ); |
1100 | 1111 | $form .= Xml::hidden('page', $this->page->getPrefixedText() ); |
1101 | 1112 | $form .= Xml::hidden( 'wpEditToken', $wgUser->editToken() ); |
— | — | @@ -1165,6 +1176,12 @@ |
1166 | 1177 | $article = new Article( $this->page ); |
1167 | 1178 | FlaggedRevs::articleLinksUpdate( $article ); |
1168 | 1179 | |
| 1180 | + if( $this->watchThis ) { |
| 1181 | + $wgUser->addWatch( $this->page ); |
| 1182 | + } else { |
| 1183 | + $wgUser->removeWatch( $this->page ); |
| 1184 | + } |
| 1185 | + |
1169 | 1186 | # Success message |
1170 | 1187 | $wgOut->addHTML( wfMsgExt('stabilization-success',array('parse'), |
1171 | 1188 | $this->page->getPrefixedText() ) ); |