Add (undo) buttons onto page history, for people with rollback privilege only (that...
authorAndrew Garrett <werdna@users.mediawiki.org>
Fri, 6 Jul 2007 06:52:52 +0000 (06:52 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Fri, 6 Jul 2007 06:52:52 +0000 (06:52 +0000)
RELEASE-NOTES
includes/EditPage.php
includes/PageHistory.php

index e193f9b..a9bc70b 100644 (file)
@@ -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 ==
 
index 4b44012..b5d967b 100644 (file)
@@ -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.
index d7f3170..7c21ed4 100644 (file)
@@ -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 .= ' <span class="mw-history-undo"> '."$undolink </span>";
+               }
                
                wfRunHooks( 'PageHistoryLineEnding', array( &$row , &$s ) );