Merge "Set initial focus on some special pages"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sun, 30 Jun 2013 17:07:01 +0000 (17:07 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 30 Jun 2013 17:07:01 +0000 (17:07 +0000)
1  2 
includes/specials/SpecialUndelete.php
includes/specials/SpecialUserrights.php

@@@ -760,7 -760,7 +760,7 @@@ class SpecialUndelete extends SpecialPa
  
                if ( $this->mTimestamp !== '' ) {
                        $this->showRevision( $this->mTimestamp );
 -              } elseif ( $this->mFilename !== null ) {
 +              } elseif ( $this->mFilename !== null && $this->mTargetObj->inNamespace( NS_FILE ) ) {
                        $file = new ArchivedFile( $this->mTargetObj, '', $this->mFilename );
                        // Check if user is allowed to see this file
                        if ( !$file->exists() ) {
                                        'prefix',
                                        'prefix',
                                        20,
-                                       $this->mSearchPrefix
+                                       $this->mSearchPrefix,
+                                       array( 'autofocus' => true )
                                ) . ' ' .
                                Xml::submitButton( $this->msg( 'undelete-search-submit' )->text() ) .
                                Xml::closeElement( 'fieldset' ) .
                                        Xml::label( $this->msg( 'undeletecomment' )->text(), 'wpComment' ) .
                                        "</td>
                                        <td class='mw-input'>" .
-                                       Xml::input( 'wpComment', 50, $this->mComment, array( 'id' => 'wpComment' ) ) .
+                                       Xml::input( 'wpComment', 50, $this->mComment, array( 'id' => 'wpComment', 'autofocus' => true ) ) .
                                        "</td>
                                </tr>
                                <tr>
@@@ -110,17 -110,6 +110,17 @@@ class UserrightsPage extends SpecialPag
                }
  
                if ( !$this->userCanChangeRights( $user, true ) ) {
 +                      if ( $this->isself && $request->getCheck( 'success' ) ) {
 +                              // bug 48609: if the user just removed its own rights, this would
 +                              // leads it in a "permissions error" page. In that case, show a
 +                              // message that it can't anymore use this page instead of an error
 +                              $this->setHeaders();
 +                              $out = $this->getOutput();
 +                              $out->wrapWikiMsg( "<div class=\"successbox\">\n$1\n</div>", 'userrights-removed-self' );
 +                              $out->returnToMain();
 +                              return;
 +                      }
 +
                        // @todo FIXME: There may be intermediate groups we can mention.
                        $msg = $user->isAnon() ? 'userrights-nologin' : 'userrights-notallowed';
                        throw new PermissionsError( null, array( array( $msg ) ) );
        }
  
        function getSuccessURL() {
 -              return $this->getTitle( $this->mTarget )->getFullURL();
 +              return $this->getTitle( $this->mTarget )->getFullURL( array( 'success' => 1 ) );
        }
  
        /**
                        Html::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'name' => 'uluser', 'id' => 'mw-userrights-form1' ) ) .
                        Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
                        Xml::fieldset( $this->msg( 'userrights-lookup-user' )->text() ) .
-                       Xml::inputLabel( $this->msg( 'userrights-user-editname' )->text(), 'user', 'username', 30, str_replace( '_', ' ', $this->mTarget ) ) . ' ' .
+                       Xml::inputLabel( $this->msg( 'userrights-user-editname' )->text(), 'user', 'username', 30, str_replace( '_', ' ', $this->mTarget ), array( 'autofocus' => true ) ) . ' ' .
                        Xml::submitButton( $this->msg( 'editusergroup' )->text() ) .
                        Html::closeElement( 'fieldset' ) .
                        Html::closeElement( 'form' ) . "\n"