From d53b216aa7819db154b3bde9cb797f20f42900f5 Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Fri, 6 Jul 2007 06:52:52 +0000 Subject: [PATCH] Add (undo) buttons onto page history, for people with rollback privilege only (that's changeable very simply.. just put in place to ward off whingers). Also, minorly, switch the undoafter and undo parameters if they're given the wrong way around, which seems like a more sensible thing to do than silently fail. I would have renamed them undo1 and undo2, but that'd cause all kinds of chaos. --- RELEASE-NOTES | 2 ++ includes/EditPage.php | 7 +++++++ includes/PageHistory.php | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e193f9bd94..a9bc70b8d1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -122,6 +122,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 10438) HTML TeX formulas should not wrap * Introduce "raw editing" mode for the watchlist, to allow bulk additions, removals, and convenient exporting of watchlist contents +* Put an (undo) button on the page history page, for people with rollback + permission only. == Bugfixes since 1.10 == diff --git a/includes/EditPage.php b/includes/EditPage.php index 4b44012334..b5d967b3c0 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -98,6 +98,13 @@ class EditPage { $text = $this->mArticle->getContent(); + if ($undo > 0 && $undoafter > 0 && $undo < $undoafter) { + # If they got undoafter and undo round the wrong way, switch them + $temp = $undoafter; + $undoafter = $undo; + $undo = $temp; + } + if ( $undo > 0 && $undo > $undoafter ) { # Undoing a specific edit overrides section editing; section-editing # doesn't work with undoing. diff --git a/includes/PageHistory.php b/includes/PageHistory.php index d7f3170c66..7c21ed4bcc 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -247,6 +247,14 @@ class PageHistory { if( $wgUser->isAllowed( 'rollback' ) && $latest ) { $s .= ' '.$this->mSkin->generateRollback( $rev ); } + + if ( $wgUser->isAllowed( 'rollback' ) && !is_null($next)) { + $undolink = $this->mSkin->makeKnownLinkObj( + $this->mTitle, '('.htmlspecialchars( wfMsg( 'editundo' ) ).')', + 'action=edit&undoafter=' . $next->rev_id . '&undo=' . $rev->getId(), + '', '', '', null ); + $s .= ' '."$undolink "; + } wfRunHooks( 'PageHistoryLineEnding', array( &$row , &$s ) ); -- 2.20.1