summaryrefslogtreecommitdiff
path: root/includes/templates/Userlogin.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
commit4ac9fa081a7c045f6a9f1cfc529d82423f485b2e (patch)
treeaf68743f2f4a47d13f2b0eb05f5c4aaf86d8ea37 /includes/templates/Userlogin.php
parentaf4da56f1ad4d3ef7b06557bae365da2ea27a897 (diff)
Update to MediaWiki 1.22.0
Diffstat (limited to 'includes/templates/Userlogin.php')
-rw-r--r--includes/templates/Userlogin.php278
1 files changed, 141 insertions, 137 deletions
diff --git a/includes/templates/Userlogin.php b/includes/templates/Userlogin.php
index 7bc0241a..5eb60948 100644
--- a/includes/templates/Userlogin.php
+++ b/includes/templates/Userlogin.php
@@ -1,6 +1,6 @@
<?php
/**
- * Html form for user login.
+ * Html form for user login (since 1.22 with VForm appearance).
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -21,156 +21,160 @@
* @ingroup Templates
*/
-/**
- * @defgroup Templates Templates
- */
+class UserloginTemplate extends BaseTemplate {
-/**
- * HTML template for Special:Userlogin form
- * @ingroup Templates
- */
-class UserloginTemplate extends QuickTemplate {
function execute() {
- if( $this->data['message'] ) {
+ global $wgCookieExpiration;
+ $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
?>
- <div class="<?php $this->text('messagetype') ?>box">
- <?php if ( $this->data['messagetype'] == 'error' ) { ?>
- <strong><?php $this->msg( 'loginerror' )?></strong><br />
- <?php } ?>
- <?php $this->html('message') ?>
- </div>
- <div class="visualClear"></div>
-<?php } ?>
+<div class="mw-ui-container">
+ <?php if ( $this->haveData( 'languages' ) ) { ?>
+ <div id="languagelinks">
+ <p><?php $this->html( 'languages' ); ?></p>
+ </div>
+ <?php } ?>
+ <div id="userloginForm">
+ <form name="userlogin" class="mw-ui-vform" method="post" action="<?php $this->text( 'action' ); ?>">
+ <?php if ( $this->data['loggedin'] ) { ?>
+ <div class="warningbox">
+ <?php echo $this->getMsg( 'userlogin-loggedin' )->params( $this->data['loggedinuser'] )->parse(); ?>
+ </div>
+ <?php } ?>
+ <section class="mw-form-header">
+ <?php $this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?>
+ </section>
-<div id="loginstart"><?php $this->msgWiki( 'loginstart' ); ?></div>
-<div id="userloginForm">
-<form name="userlogin" method="post" action="<?php $this->text('action') ?>">
- <h2><?php $this->msg('login') ?></h2>
- <p id="userloginlink"><?php $this->html('link') ?></p>
- <?php $this->html('header'); /* pre-table point for form plugins... */ ?>
- <div id="userloginprompt"><?php $this->msgWiki('loginprompt') ?></div>
- <?php if( $this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
- <table>
- <tr>
- <td class="mw-label"><label for='wpName1'><?php $this->msg('yourname') ?></label></td>
- <td class="mw-input">
- <?php
- echo Html::input( 'wpName', $this->data['name'], 'text', array(
- 'class' => 'loginText',
- 'id' => 'wpName1',
- 'tabindex' => '1',
- 'size' => '20',
- 'required'
- # Can't do + array( 'autofocus' ) because + for arrays in PHP
- # only works right for associative arrays! Thanks, PHP.
- ) + ( $this->data['name'] ? array() : array( 'autofocus' => '' ) ) ); ?>
+ <?php if ( $this->data['message'] ) { ?>
+ <div class="<?php $this->text( 'messagetype' ); ?>box">
+ <?php if ( $this->data['messagetype'] == 'error' ) { ?>
+ <strong><?php $this->msg( 'loginerror' ); ?></strong>
+ <br />
+ <?php } ?>
+ <?php $this->html( 'message' ); ?>
+ </div>
+ <?php } ?>
- </td>
- </tr>
- <tr>
- <td class="mw-label"><label for='wpPassword1'><?php $this->msg('yourpassword') ?></label></td>
- <td class="mw-input">
- <?php
- echo Html::input( 'wpPassword', null, 'password', array(
- 'class' => 'loginPassword',
- 'id' => 'wpPassword1',
- 'tabindex' => '2',
- 'size' => '20'
- ) + ( $this->data['name'] ? array( 'autofocus' ) : array() ) ); ?>
+ <div>
+ <label for='wpName1'>
+ <?php
+ $this->msg( 'userlogin-yourname' );
- </td>
- </tr>
- <?php if( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
- $doms = "";
- foreach( $this->data['domainnames'] as $dom ) {
- $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
- }
- ?>
- <tr id="mw-user-domain-section">
- <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
- <td class="mw-input">
- <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
- tabindex="3">
- <?php echo $doms ?>
- </select>
- </td>
- </tr>
- <?php }
+ if ( $this->data['secureLoginUrl'] ) {
+ echo Html::element( 'a', array(
+ 'href' => $this->data['secureLoginUrl'],
+ 'class' => 'mw-ui-flush-right mw-secure',
+ ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
+ }
+ ?>
+ </label>
+ <?php
+ $extraAttrs = array();
+ echo Html::input( 'wpName', $this->data['name'], 'text', array(
+ 'class' => 'loginText',
+ 'id' => 'wpName1',
+ 'tabindex' => '1',
+ 'size' => '20',
+ // 'required' is blacklisted for now in Html.php due to browser issues.
+ // Keeping here in case that changes.
+ 'required' => true,
+ // Set focus to this field if it's blank.
+ 'autofocus' => !$this->data['name'],
+ 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
+ ) );
+ ?>
+ </div>
- if( $this->haveData( 'extrafields' ) ) {
- echo $this->data['extrafields'];
- }
+ <div>
+ <label for='wpPassword1'>
+ <?php
+ $this->msg( 'userlogin-yourpassword' );
- if( $this->data['canremember'] ) { ?>
- <tr>
- <td></td>
- <td class="mw-input">
+ if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) {
+ echo ' ' . Linker::link(
+ SpecialPage::getTitleFor( 'PasswordReset' ),
+ $this->getMsg( 'userlogin-resetpassword-link' )->parse(),
+ array( 'class' => 'mw-ui-flush-right' )
+ );
+ }
+ ?>
+ </label>
<?php
- global $wgCookieExpiration;
- $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
- echo Xml::checkLabel(
- wfMessage( 'remembermypassword' )->numParams( $expirationDays )->text(),
- 'wpRemember',
- 'wpRemember',
- $this->data['remember'],
- array( 'tabindex' => '8' )
- )
+ echo Html::input( 'wpPassword', null, 'password', array(
+ 'class' => 'loginPassword',
+ 'id' => 'wpPassword1',
+ 'tabindex' => '2',
+ 'size' => '20',
+ // Set focus to this field if username is filled in.
+ 'autofocus' => (bool)$this->data['name'],
+ 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
+ ) );
?>
- </td>
- </tr>
-<?php } ?>
-<?php if( $this->data['cansecurelogin'] ) { ?>
- <tr>
- <td></td>
- <td class="mw-input">
+ </div>
+
<?php
- echo Xml::checkLabel(
- wfMessage( 'securelogin-stick-https' )->text(),
- 'wpStickHTTPS',
- 'wpStickHTTPS',
- $this->data['stickHTTPS'],
- array( 'tabindex' => '9' )
- );
- ?>
- </td>
- </tr>
-<?php } ?>
- <tr>
- <td></td>
- <td class="mw-submit">
- <?php
- echo Html::input( 'wpLoginAttempt', wfMessage( 'login' )->text(), 'submit', array(
- 'id' => 'wpLoginAttempt',
- 'tabindex' => '9'
- ) );
- if ( $this->data['useemail'] && $this->data['canreset'] ) {
- if( $this->data['resetlink'] === true ) {
- echo '&#160;';
- echo Linker::link(
- SpecialPage::getTitleFor( 'PasswordReset' ),
- wfMessage( 'userlogin-resetlink' )
- );
- } elseif( $this->data['resetlink'] === null ) {
- echo '&#160;';
- echo Html::input(
- 'wpMailmypassword',
- wfMessage( 'mailmypassword' )->text(),
- 'submit', array(
- 'id' => 'wpMailmypassword',
- 'tabindex' => '10'
- )
- );
+ if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
+ $doms = "";
+ foreach ( $this->data['domainnames'] as $dom ) {
+ $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
+ }
+ ?>
+ <div id="mw-user-domain-section">
+ <label for='wpDomain'><?php $this->msg( 'yourdomainname' ); ?></label>
+ <select name="wpDomain" value="<?php $this->text( 'domain' ); ?>" tabindex="3">
+ <?php echo $doms; ?>
+ </select>
+ </div>
+ <?php } ?>
+
+ <?php
+ if ( $this->haveData( 'extrafields' ) ) {
+ echo $this->data['extrafields'];
}
- } ?>
+ ?>
- </td>
- </tr>
- </table>
-<?php if( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
-<?php if( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
-</form>
+ <div>
+ <?php if ( $this->data['canremember'] ) { ?>
+ <label class="mw-ui-checkbox-label">
+ <input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="4"
+ <?php if ( $this->data['remember'] ) {
+ echo 'checked="checked"';
+ } ?>
+ >
+ <?php echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?>
+ </label>
+ <?php } ?>
+ </div>
+
+ <div>
+ <?php
+ echo Html::input( 'wpLoginAttempt', $this->getMsg( 'login' )->text(), 'submit', array(
+ 'id' => 'wpLoginAttempt',
+ 'tabindex' => '6',
+ 'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-primary'
+ ) );
+ ?>
+ </div>
+
+ <div id="mw-userlogin-help">
+ <?php echo $this->getMsg( 'userlogin-helplink' )->parse(); ?>
+ </div>
+ <?php if ( $this->haveData( 'createOrLoginHref' ) ) { ?>
+ <?php if ( $this->data['loggedin'] ) { ?>
+ <div id="mw-createaccount-another">
+ <h3 id="mw-userloginlink"><a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7" class="mw-ui-button"><?php $this->msg( 'userlogin-createanother' ); ?></a></h3>
+ </div>
+ <?php } else { ?>
+ <div id="mw-createaccount-cta">
+ <h3 id="mw-userloginlink"><?php $this->msg( 'userlogin-noaccount' ); ?><a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7" class="mw-ui-button mw-ui-constructive"><?php $this->msg( 'userlogin-joinproject' ); ?></a></h3>
+ </div>
+ <?php } ?>
+ <?php } ?>
+ <?php if ( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
+ <?php if ( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
+ <?php if ( $this->data['cansecurelogin'] ) {?><input type="hidden" name="wpForceHttps" value="<?php $this->text( 'stickhttps' ); ?>" /><?php } ?>
+ </form>
+ </div>
</div>
-<div id="loginend"><?php $this->html( 'loginend' ); ?></div>
<?php
}