r28579 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r28578‎ | r28579 | r28580 >
Date:04:01, 17 December 2007
Author:aaron
Status:old
Tags:
Comment:
* Add diff-to-stable link to diffs
* Add watch checkbox to stabilization page
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -744,7 +744,7 @@
745745 public function addDiffNoticeAfterEdit( $diff, $OldRev, $NewRev ) {
746746 global $wgRequest, $wgUser, $wgOut;
747747
748 - if( !$wgUser->isAllowed( 'review') || !$wgRequest->getBool('editreview') || !$NewRev->isCurrent() )
 748+ if( !$wgUser->isAllowed('review') || !$wgRequest->getBool('editreview') || !$NewRev->isCurrent() )
749749 return true;
750750
751751 $frev = $this->getStableRev();
@@ -920,15 +920,30 @@
921921 }
922922
923923 /**
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.
925926 */
926927 public function addPatrolLink( $diff, $OldRev, $NewRev ) {
927928 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+ }
931946 // Prepare a change patrol link, if applicable
932 - if( $wgUser->isAllowed( 'patrolother' ) ) {
 947+ } else if( $wgUser->isAllowed( 'patrolother' ) ) {
933948 // If we've been given an explicit change identifier, use it; saves time
934949 if( $diff->mRcidMarkPatrolled ) {
935950 $rcid = $diff->mRcidMarkPatrolled;
@@ -957,10 +972,9 @@
958973 $skin = $wgUser->getSkin();
959974
960975 $reviewtitle = SpecialPage::getTitleFor( 'Revisionreview' );
961 - $patrol = ' [' . $skin->makeKnownLinkObj( $reviewtitle,
 976+ $patrol = '[' . $skin->makeKnownLinkObj( $reviewtitle,
962977 wfMsgHtml( 'markaspatrolleddiff' ),
963 - "patrolonly=1&rcid={$rcid}"
964 - ) . ']';
 978+ "patrolonly=1&rcid={$rcid}") . ']';
965979 } else {
966980 $patrol = '';
967981 }
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php
@@ -60,6 +60,8 @@
6161 $wgOut->permissionRequired( 'badaccess-group0' );
6262 return;
6363 }
 64+ // Watch checkbox
 65+ $this->watchThis = $wgRequest->getCheck( 'wpWatchthis' );
6466 // Special parameter mapping
6567 $this->templateParams = $wgRequest->getVal( 'templateParams' );
6668 $this->imageParams = $wgRequest->getVal( 'imageParams' );
@@ -103,7 +105,7 @@
104106 $valid = false;
105107
106108 if( $valid && $wgRequest->wasPosted() ) {
107 - $this->submit( $wgRequest );
 109+ $this->submit();
108110 } else {
109111 $this->showRevision();
110112 }
@@ -250,7 +252,7 @@
251253 "<li> $difflink $revlink " . $this->skin->revUserLink( $rev ) . " " . $this->skin->revComment( $rev ) . "</li>";
252254 }
253255
254 - function submit( $request ) {
 256+ function submit() {
255257 global $wgOut, $wgUser, $wgFlaggedRevTags;
256258 # If all values are set to zero, this has been unapproved
257259 $approved = empty($wgFlaggedRevTags);
@@ -281,7 +283,7 @@
282284 $this->approveRevision( $rev, $this->notes ) : $this->unapproveRevision( $frev );
283285 // Return to our page
284286 if( $success ) {
285 - if( $request->getCheck( 'wpWatchthis' ) ) {
 287+ if( $this->watchThis ) {
286288 $wgUser->addWatch( $this->page );
287289 } else {
288290 $wgUser->removeWatch( $this->page );
@@ -999,6 +1001,8 @@
10001002 # Our target page
10011003 $this->target = $wgRequest->getText( 'page' );
10021004 $this->page = Title::newFromUrl( $this->target );
 1005+ # Watch checkbox
 1006+ $this->watchThis = $wgRequest->getCheck( 'wpWatchthis' );
10031007 # Params
10041008 $this->select = $wgRequest->getInt( 'select' );
10051009 $this->override = intval( $wgRequest->getBool( 'override' ) );
@@ -1095,6 +1099,13 @@
10961100 $form .= "</tr></table></fieldset>";
10971101
10981102 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>&nbsp;&nbsp;&nbsp;".Xml::check( 'wpWatchthis', $watchChecked, $watchAttribs );
 1108+ $form .= "&nbsp;<label for='wpWatchthis'".$this->skin->tooltipAndAccesskey('watch').">{$watchLabel}</label>";
 1109+
10991110 $form .= Xml::hidden('title', $wgTitle->getPrefixedText() );
11001111 $form .= Xml::hidden('page', $this->page->getPrefixedText() );
11011112 $form .= Xml::hidden( 'wpEditToken', $wgUser->editToken() );
@@ -1165,6 +1176,12 @@
11661177 $article = new Article( $this->page );
11671178 FlaggedRevs::articleLinksUpdate( $article );
11681179
 1180+ if( $this->watchThis ) {
 1181+ $wgUser->addWatch( $this->page );
 1182+ } else {
 1183+ $wgUser->removeWatch( $this->page );
 1184+ }
 1185+
11691186 # Success message
11701187 $wgOut->addHTML( wfMsgExt('stabilization-success',array('parse'),
11711188 $this->page->getPrefixedText() ) );

Status & tagging log