Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php |
— | — | @@ -249,6 +249,13 @@ |
250 | 250 | 'revreview-restriction-any' => 'any', |
251 | 251 | 'revreview-restriction-none' => 'none', |
252 | 252 | |
| 253 | + 'revreview-reject-header' => 'Reject changes for $1', |
| 254 | + 'revreview-reject-text' => 'By completing this action, you will be \'\'\'rejecting\'\'\' the following changes. This will revert the article back to this [$1 older revision]', |
| 255 | + 'revreview-reject-summary' => 'Edit summary:', |
| 256 | + 'revreview-reject-confirm' => 'Reject these changes', |
| 257 | + 'revreview-reject-cancel' => 'Cancel', |
| 258 | + 'revreview-reject-default-summary' => 'Rejecting changes by [[User:$1|$1]] to version $2 by [[User:$3|$3]]', |
| 259 | + |
253 | 260 | 'revreview-reviewlink' => 'pending edits', |
254 | 261 | 'revreview-reviewlink-title' => 'View diff of all pending changes', |
255 | 262 | 'revreview-unreviewedpage' => 'unchecked page', |
Index: trunk/extensions/FlaggedRevs/forms/RevisionReviewForm.php |
— | — | @@ -18,6 +18,7 @@ |
19 | 19 | protected $approve = false; |
20 | 20 | protected $unapprove = false; |
21 | 21 | protected $reject = false; |
| 22 | + protected $rejectConfirm = false; |
22 | 23 | protected $oldid = 0; |
23 | 24 | protected $refid = 0; |
24 | 25 | protected $templateParams = ''; |
— | — | @@ -63,6 +64,10 @@ |
64 | 65 | $this->trySet( $this->reject, $value ); |
65 | 66 | } |
66 | 67 | |
| 68 | + public function setRejectConfirm( $value ) { |
| 69 | + $this->trySet( $this->rejectConfirm, $value ); |
| 70 | + } |
| 71 | + |
67 | 72 | public function getRefId() { |
68 | 73 | return $this->refid; |
69 | 74 | } |
— | — | @@ -312,6 +317,11 @@ |
313 | 318 | } elseif ( $this->getAction() === 'reject' ) { |
314 | 319 | $newRev = Revision::newFromTitle( $this->page, $this->oldid ); |
315 | 320 | $oldRev = Revision::newFromTitle( $this->page, $this->refid ); |
| 321 | + |
| 322 | + if( !$this->rejectConfirm ) { |
| 323 | + $this->rejectConfirmationForm( $oldRev, $newRev ); |
| 324 | + return false; |
| 325 | + } |
316 | 326 | # Do not mess with archived/deleted revisions |
317 | 327 | if ( is_null( $oldRev ) || $oldRev->mDeleted ) { |
318 | 328 | return 'review_bad_oldid'; |
— | — | @@ -988,6 +998,64 @@ |
989 | 999 | return $form; |
990 | 1000 | } |
991 | 1001 | |
| 1002 | + /** |
| 1003 | + * Output the "are you sure you want to reject this" form |
| 1004 | + * |
| 1005 | + * A bit hacky, but we don't have a way to pass more complicated |
| 1006 | + * UI things back up, since RevisionReview expects either true |
| 1007 | + * or a string message key |
| 1008 | + */ |
| 1009 | + private function rejectConfirmationForm( Revision $oldRev, $newRev ) { |
| 1010 | + global $wgOut; |
| 1011 | + |
| 1012 | + $thisPage = SpecialPage::getTitleFor( 'RevisionReview' ); |
| 1013 | + |
| 1014 | + $permaLink = $oldRev->getTitle()->getFullURL( 'oldid=' . $oldRev->getId() ); |
| 1015 | + $wgOut->addWikiMsg( 'revreview-reject-text', $permaLink ); |
| 1016 | + |
| 1017 | + $thisPage->skin = $this->user->getSkin(); |
| 1018 | + $dbr = wfGetDB( DB_SLAVE ); |
| 1019 | + $oldid = $dbr->addQuotes( $oldRev->getId() ); |
| 1020 | + $res = $dbr->select( 'revision', 'rev_id', |
| 1021 | + array( 'rev_id > ' . $oldid, 'rev_page' => $oldRev->getPage() ), |
| 1022 | + __METHOD__ |
| 1023 | + ); |
| 1024 | + |
| 1025 | + $ids = array(); |
| 1026 | + foreach( $res as $r ) { |
| 1027 | + $ids[] = $r->rev_id; |
| 1028 | + } |
| 1029 | + |
| 1030 | + $list = new RevDel_RevisionList( $thisPage, $oldRev->getTitle(), $ids ); |
| 1031 | + for ( $list->reset(); $list->current(); $list->next() ) { |
| 1032 | + $item = $list->current(); |
| 1033 | + if ( $item->canView() ) { |
| 1034 | + $wgOut->addHTML( $item->getHTML() ); |
| 1035 | + } |
| 1036 | + } |
| 1037 | + $form = Html::openElement( 'form', |
| 1038 | + array( 'method' => 'POST', 'action' => $thisPage->getFullUrl() ) |
| 1039 | + ); |
| 1040 | + $form .= Html::hidden( 'action', 'reject' ); |
| 1041 | + $form .= Html::hidden( 'wpReject', 1 ); |
| 1042 | + $form .= Html::hidden( 'wpRejectConfirm', 1 ); |
| 1043 | + $form .= Html::hidden( 'oldid', $this->oldid ); |
| 1044 | + $form .= Html::hidden( 'refid', $this->refid ); |
| 1045 | + $form .= Html::hidden( 'target', $oldRev->getTitle()->getPrefixedDBKey() ); |
| 1046 | + $form .= Html::hidden( 'wpEditToken', $this->user->editToken() ); |
| 1047 | + $form .= "<br />"; |
| 1048 | + |
| 1049 | + $defaultSummary = wfMsg( 'revreview-reject-default-summary', |
| 1050 | + $newRev->getUserText(), $oldRev->getId(), $oldRev->getUserText() ); |
| 1051 | + $form .= Xml::inputLabel( wfMsg( 'revreview-reject-summary' ), 'wpReason', |
| 1052 | + 'wpReason', 120, $defaultSummary ) . "<br />"; |
| 1053 | + $form .= Html::input( 'wpSubmit', wfMsg( 'revreview-reject-confirm' ), 'submit' ); |
| 1054 | + $form .= Html::input( 'wpCancel', wfMsg( 'revreview-reject-cancel' ), |
| 1055 | + 'button', array( 'onClick' => 'history.back();' ) ); |
| 1056 | + $form .= Html::closeElement( 'form' ); |
| 1057 | + $wgOut->addHtml( $form ); |
| 1058 | + } |
| 1059 | + |
992 | 1060 | private function getSpecialLinks() { |
993 | 1061 | $s = '<p>' . wfMsg( 'returnto', |
994 | 1062 | $this->skin->makeLinkObj( SpecialPage::getTitleFor( 'UnreviewedPages' ) ) ) . '</p>'; |
Index: trunk/extensions/FlaggedRevs/specialpages/RevisionReview_body.php |
— | — | @@ -46,6 +46,7 @@ |
47 | 47 | $form->setApprove( $wgRequest->getCheck( 'wpApprove' ) ); |
48 | 48 | $form->setUnapprove( $wgRequest->getCheck( 'wpUnapprove' ) ); |
49 | 49 | $form->setReject( $wgRequest->getCheck( 'wpReject' ) ); |
| 50 | + $form->setRejectConfirm( $wgRequest->getBool( 'wpRejectConfirm' ) ); |
50 | 51 | # Rev ID |
51 | 52 | $form->setOldId( $wgRequest->getInt( 'oldid' ) ); |
52 | 53 | $form->setRefId( $wgRequest->getInt( 'refid' ) ); |
— | — | @@ -104,7 +105,9 @@ |
105 | 106 | } elseif ( $form->getAction() === 'reject' ) { |
106 | 107 | $wgOut->redirect( $this->page->getFullUrl() ); |
107 | 108 | } |
108 | | - // Failure for flagging or unflagging |
| 109 | + } elseif( $status === false ) { |
| 110 | + // Reject confirmation screen. HACKY :( |
| 111 | + return; |
109 | 112 | } else { |
110 | 113 | if ( $status === 'review_denied' ) { |
111 | 114 | $wgOut->permissionRequired( 'badaccess-group0' ); // protected? |