Prevent accidental deletion during page move.
authorTim Starling <tstarling@users.mediawiki.org>
Fri, 6 Jan 2006 12:50:37 +0000 (12:50 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Fri, 6 Jan 2006 12:50:37 +0000 (12:50 +0000)
includes/SpecialMovepage.php
languages/Language.php

index 3c9d326..746f571 100644 (file)
@@ -50,7 +50,7 @@ class MovePageForm {
                $this->newTitle = $wgRequest->getText( 'wpNewTitle' );
                $this->reason = $wgRequest->getText( 'wpReason' );
                $this->moveTalk = $wgRequest->getBool( 'wpMovetalk', true );
-               $this->deleteAndMove = $wgRequest->getBool( 'wpDeleteAndMove' );
+               $this->deleteAndMove = $wgRequest->getBool( 'wpDeleteAndMove' ) && $wgRequest->getBool( 'wpConfirm' );
        }
        
        function showForm( $err ) {
@@ -90,12 +90,21 @@ class MovePageForm {
                if ( $err == 'articleexists' && $wgUser->isAllowed( 'delete' ) ) {
                        $wgOut->addWikiText( wfMsg( 'delete_and_move_text', $encNewTitle ) );
                        $movepagebtn = wfMsgHtml( 'delete_and_move' );
+                       $confirmText = wfMsgHtml( 'delete_and_move_confirm' );
                        $submitVar = 'wpDeleteAndMove';
+                       $confirm = "
+                               <tr>
+                                       <td align='right'>
+                                               <input type='checkbox' name='wpConfirm' id='wpConfirm' value=\"true\" />
+                                       </td>
+                                       <td align='left'><label for='wpConfirm'>{$confirmText}</label></td>
+                               </tr>";
                        $err = '';
                } else {
                        $wgOut->addWikiText( wfMsg( 'movepagetext' ) );
                        $movepagebtn = wfMsgHtml( 'movepagebtn' );
                        $submitVar = 'wpMove';
+                       $confirm = false;
                }
 
                if ( !$ot->isTalkPage() ) {
@@ -149,6 +158,7 @@ class MovePageForm {
                </tr>" );
                }
                $wgOut->addHTML( "
+               {$confirm}
                <tr>
                        <td>&nbsp;</td>
                        <td align='left'>
index 998485f..727ccd2 100644 (file)
@@ -1593,6 +1593,7 @@ title. Please merge them manually.'''",
 '==Deletion required==
 
 The destination article "[[$1]]" already exists. Do you want to delete it to make way for the move?',
+'delete_and_move_confirm' => 'Yes, delete the page',
 'delete_and_move_reason' => 'Deleted to make way for move',
 'selfmove' => "Source and destination titles are the same; can't move a page over itself.",
 'immobile_namespace' => "Destination title is of a special type; cannot move pages into that namespace.",