(bug 10323) Special:Undelete should have "inverse selection" button
authorHuji <huji@users.mediawiki.org>
Sat, 4 Oct 2008 18:10:15 +0000 (18:10 +0000)
committerHuji <huji@users.mediawiki.org>
Sat, 4 Oct 2008 18:10:15 +0000 (18:10 +0000)
RELEASE-NOTES
includes/specials/SpecialUndelete.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index bbfd5e3..39e513e 100644 (file)
@@ -239,6 +239,7 @@ The following extensions are migrated into MediaWiki 1.14:
 * (bug 15196) Free external links should be numbered in a localised manner
 * (bug 15388) Title of Special:PrefixIndex
 * Links with no title but a curid parameter now use the curid to pick a page
+* (bug 10323) Special:Undelete should have "inverse selection" button
 
 === API changes in 1.14 ===
 
index 810b007..5b7ed52 100644 (file)
@@ -576,7 +576,7 @@ class PageArchive {
  * @ingroup SpecialPage
  */
 class UndeleteForm {
-       var $mAction, $mTarget, $mTimestamp, $mRestore, $mTargetObj;
+       var $mAction, $mTarget, $mTimestamp, $mRestore, $mInvert, $mTargetObj;
        var $mTargetTimestamp, $mAllowed, $mComment;
 
        function UndeleteForm( $request, $par = "" ) {
@@ -591,6 +591,7 @@ class UndeleteForm {
                $posted = $request->wasPosted() &&
                        $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) );
                $this->mRestore = $request->getCheck( 'restore' ) && $posted;
+               $this->mInvert = $request->getCheck( 'invert' ) && $posted;
                $this->mPreview = $request->getCheck( 'preview' ) && $posted;
                $this->mDiff = $request->getCheck( 'diff' );
                $this->mComment = $request->getText( 'wpComment' );
@@ -611,7 +612,7 @@ class UndeleteForm {
                } else {
                        $this->mTargetObj = NULL;
                }
-               if( $this->mRestore ) {
+               if( $this->mRestore || $this->mInvert ) {
                        $timestamps = array();
                        $this->mFileVersions = array();
                        foreach( $_REQUEST as $key => $val ) {
@@ -668,6 +669,9 @@ class UndeleteForm {
                if( $this->mRestore && $this->mAction == "submit" ) {
                        return $this->undelete();
                }
+               if( $this->mInvert && $this->mAction == "submit" ) {
+                       return $this->showHistory( );
+               }
                return $this->showHistory();
        }
 
@@ -909,7 +913,7 @@ class UndeleteForm {
                $store->stream( $key );
        }
 
-       private function showHistory() {
+       private function showHistory( ) {
                global $wgLang, $wgUser, $wgOut;
 
                $sk = $wgUser->getSkin();
@@ -1012,6 +1016,7 @@ class UndeleteForm {
                                                <td class='mw-submit'>" .
                                                        Xml::submitButton( wfMsg( 'undeletebtn' ), array( 'name' => 'restore', 'id' => 'mw-undelete-submit' ) ) .
                                                        Xml::element( 'input', array( 'type' => 'reset', 'value' => wfMsg( 'undeletereset' ), 'id' => 'mw-undelete-reset' ) ) .
+                                                       Xml::submitButton( wfMsg( 'undeleteinvert' ), array( 'name' => 'invert', 'id' => 'mw-undelete-invert' ) ) .
                                                "</td>
                                        </tr>" .
                                        $unsuppressBox .
@@ -1077,7 +1082,15 @@ class UndeleteForm {
                $stxt = '';
                $ts = wfTimestamp( TS_MW, $row->ar_timestamp );
                if( $this->mAllowed ) {
-                       $checkBox = Xml::check( "ts$ts" );
+                       if( $this->mInvert){
+                               if( in_array( $ts, $this->mTargetTimestamp ) ) {
+                                       $checkBox = Xml::check( "ts$ts");
+                               } else {
+                                       $checkBox = Xml::check( "ts$ts", true );
+                               }
+                       } else {
+                               $checkBox = Xml::check( "ts$ts" );
+                       }
                        $titleObj = SpecialPage::getTitleFor( "Undelete" );
                        $pageLink = $this->getPageLink( $rev, $titleObj, $ts, $sk );
                        # Last link
index 300c52b..7c81fff 100644 (file)
@@ -2403,6 +2403,7 @@ You may have a bad link, or the revision may have been restored or removed from
 'undeletebtn'                  => 'Restore',
 'undeletelink'                 => 'restore',
 'undeletereset'                => 'Reset',
+'undeleteinvert'               => 'Invert selection',
 'undeletecomment'              => 'Comment:',
 'undeletedarticle'             => 'restored "[[$1]]"',
 'undeletedrevisions'           => '{{PLURAL:$1|1 revision|$1 revisions}} restored',
index 86c354f..60933a8 100644 (file)
@@ -1613,6 +1613,7 @@ $wgMessageStructure = array(
                'undeletebtn',
                'undeletelink',
                'undeletereset',
+               'undeleteinvert',
                'undeletecomment',
                'undeletedarticle',
                'undeletedrevisions',