Page MenuHomePhabricator

special-undelete-invert-selection-button.patch

Authored By
bzimport
Nov 21 2014, 9:48 PM
Size
3 KB
Referenced Files
None
Subscribers
None

special-undelete-invert-selection-button.patch

Index: includes/SpecialUndelete.php
===================================================================
--- includes/SpecialUndelete.php (revision 27816)
+++ includes/SpecialUndelete.php (working copy)
@@ -522,7 +522,7 @@
* @addtogroup SpecialPage
*/
class UndeleteForm {
- var $mAction, $mTarget, $mTimestamp, $mRestore, $mTargetObj;
+ var $mAction, $mTarget, $mTimestamp, $mRestore, $mInvert, $mTargetObj;
var $mTargetTimestamp, $mAllowed, $mComment;
function UndeleteForm( $request, $par = "" ) {
@@ -537,6 +537,7 @@
$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' );
@@ -556,7 +557,7 @@
} else {
$this->mTargetObj = NULL;
}
- if( $this->mRestore ) {
+ if( $this->mRestore || $this->mInvert ) {
$timestamps = array();
$this->mFileVersions = array();
foreach( $_REQUEST as $key => $val ) {
@@ -602,6 +603,9 @@
if( $this->mRestore && $this->mAction == "submit" ) {
return $this->undelete();
}
+ if( $this->mInvert && $this->mAction == "submit" ) {
+ return $this->showHistory( $this->mTargetTimestamp );
+ }
return $this->showHistory();
}
@@ -821,7 +825,7 @@
$store->stream( $key );
}
- /* private */ function showHistory() {
+ /* private */ function showHistory( $selectedTimeStamps = Array () ) {
global $wgLang, $wgContLang, $wgUser, $wgOut;
$sk = $wgUser->getSkin();
@@ -918,6 +922,7 @@
<td>&nbsp;</td>
<td>" .
Xml::submitButton( wfMsg( 'undeletebtn' ), array( 'name' => 'restore', 'id' => 'mw-undelete-submit' ) ) .
+ Xml::submitButton( wfMsg( 'undeleteinvert' ), array( 'name' => 'invert', 'id' => 'mw-undelete-invert' ) ) .
Xml::element( 'input', array( 'type' => 'reset', 'value' => wfMsg( 'undeletereset' ), 'id' => 'mw-undelete-reset' ) ) .
"</td>
</tr>" .
@@ -940,7 +945,16 @@
$remaining--;
$ts = wfTimestamp( TS_MW, $row->ar_timestamp );
if ( $this->mAllowed ) {
- $checkBox = Xml::check( "ts$ts" );
+ if ( sizeof($selectedTimeStamps) > 0 ) {
+ if ( in_array( $ts, $selectedTimeStamps ) ){
+ $checkBox = Xml::check( "ts$ts" );
+ } else {
+ $checkBox = Xml::check( "ts$ts", true );
+ }
+
+ } else {
+ $checkBox = Xml::check( "ts$ts" );
+ }
$pageLink = $sk->makeKnownLinkObj( $titleObj,
$wgLang->timeanddate( $ts, true ),
"target=$target&timestamp=$ts" );
Index: languages/messages/MessagesEn.php
===================================================================
--- languages/messages/MessagesEn.php (revision 27816)
+++ languages/messages/MessagesEn.php (working copy)
@@ -1950,6 +1950,7 @@
revision may have been restored or removed from the archive.',
'undelete-nodiff' => 'No previous revision found.',
'undeletebtn' => 'Restore',
+'undeleteinvert' => 'Invert selection',
'undeletereset' => 'Reset',
'undeletecomment' => 'Comment:',
'undeletedarticle' => 'restored "[[$1]]"',
Index: maintenance/language/messages.inc
===================================================================
--- maintenance/language/messages.inc (revision 27816)
+++ maintenance/language/messages.inc (working copy)
@@ -1272,6 +1272,7 @@
'undeleterevision-missing',
'undelete-nodiff',
'undeletebtn',
+ 'undeleteinvert',
'undeletereset',
'undeletecomment',
'undeletedarticle',

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3537
Default Alt Text
special-undelete-invert-selection-button.patch (3 KB)

Event Timeline