Disabled, unticked "Leave redirect" checkbox when redirect impossible
authorJared <jaredflores2000@gmail.com>
Tue, 24 Dec 2013 08:43:42 +0000 (00:43 -0800)
committerBartosz Dziewoński <matma.rex@gmail.com>
Thu, 26 Dec 2013 14:55:18 +0000 (14:55 +0000)
Disabled the "Leave redirect" checkbox on Special:MovePage when redirect
is impossible because of the content model.

Bug: 58017
Change-Id: Ibbc5caace749662d51b9ebd4554234d79b7a887c

includes/specials/SpecialMovepage.php

index 253e6cc..9193b5d 100644 (file)
@@ -351,7 +351,16 @@ class MovePageForm extends UnlistedSpecialPage {
                        );
                }
 
-               if ( $user->isAllowed( 'suppressredirect' ) && $handler->supportsRedirects() ) {
+               if ( $user->isAllowed( 'suppressredirect' ) ) {
+                       if ( $handler->supportsRedirects() ) {
+                               $isChecked = $this->leaveRedirect;
+                               $options = array();
+                       } else {
+                               $isChecked = false;
+                               $options = array(
+                                       'disabled' => 'disabled'
+                               );
+                       }
                        $out->addHTML( "
                                <tr>
                                        <td></td>
@@ -360,7 +369,8 @@ class MovePageForm extends UnlistedSpecialPage {
                                                $this->msg( 'move-leave-redirect' )->text(),
                                                'wpLeaveRedirect',
                                                'wpLeaveRedirect',
-                                               $this->leaveRedirect
+                                               $isChecked,
+                                               $options
                                        ) .
                                        "</td>
                                </tr>"