<?php
/**
- * @package MediaWiki
- * @subpackage Templates
+ * Html forms for user login and account creation
+ *
+ * @file
+ * @ingroup Templates
+ */
+
+/**
+ * @defgroup Templates Templates
*/
-if( !defined( 'MEDIAWIKI' ) ) die( -1 );
-/** */
-require_once( 'includes/SkinTemplate.php' );
+if( !defined( 'MEDIAWIKI' ) ) die( -1 );
/**
* HTML template for Special:Userlogin form
- * @package MediaWiki
- * @subpackage Templates
+ * @ingroup Templates
*/
class UserloginTemplate extends QuickTemplate {
function execute() {
?>
<div class="<?php $this->text('messagetype') ?>box">
<?php if ( $this->data['messagetype'] == 'error' ) { ?>
- <h2><?php $this->msg('loginerror') ?>:</h2>
+ <strong><?php $this->msg( 'loginerror' )?></strong><br />
<?php } ?>
<?php $this->html('message') ?>
</div>
<div class="visualClear"></div>
<?php } ?>
+<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 align='right'><label for='wpName1'><?php $this->msg('yourname') ?>:</label></td>
- <td align='left'>
- <input type='text' class='loginText' name="wpName" id="wpName1"
- value="<?php $this->text('name') ?>" size='20' />
+ <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' => '' ) ) ); ?>
+
</td>
</tr>
<tr>
- <td align='right'><label for='wpPassword1'><?php $this->msg('yourpassword') ?>:</label></td>
- <td align='left'>
- <input type='password' class='loginPassword' name="wpPassword" id="wpPassword1"
- value="<?php $this->text('password') ?>" size='20' />
+ <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() ) ); ?>
+
</td>
</tr>
- <?php if( $this->data['usedomain'] ) {
+ <?php if( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
$doms = "";
foreach( $this->data['domainnames'] as $dom ) {
$doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
}
?>
- <tr>
- <td align='right'><?php $this->msg( 'yourdomainname' ) ?>:</td>
- <td align='left'>
- <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>">
+ <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 } ?>
+ <?php }
+
+ if( $this->haveData( 'extrafields' ) ) {
+ echo $this->data['extrafields'];
+ }
+
+ if( $this->data['canremember'] ) { ?>
<tr>
<td></td>
- <td align='left'>
- <input type='checkbox' name="wpRemember"
- value="1" id="wpRemember"
- <?php if( $this->data['remember'] ) { ?>checked="checked"<?php } ?>
- /> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
+ <td class="mw-input">
+ <?php
+ global $wgCookieExpiration, $wgLang;
+ echo Xml::checkLabel(
+ wfMsgExt( 'remembermypassword', 'parsemag', $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ),
+ 'wpRemember',
+ 'wpRemember',
+ $this->data['remember'],
+ array( 'tabindex' => '8' )
+ )
+ ?>
</td>
</tr>
+<?php } ?>
+<?php if( $this->data['cansecurelogin'] ) { ?>
<tr>
<td></td>
- <td align='left' style="white-space:nowrap">
- <input type='submit' name="wpLoginattempt" id="wpLoginattempt" value="<?php $this->msg('login') ?>" /> <?php if( $this->data['useemail'] ) { ?><input type='submit' name="wpMailmypassword" id="wpMailmypassword"
- value="<?php $this->msg('mailmypassword') ?>" />
- <?php } ?>
+ <td class="mw-input">
+ <?php
+ echo Xml::checkLabel(
+ wfMsg( 'securelogin-stick-https' ),
+ 'wpStickHTTPS',
+ 'wpStickHTTPS',
+ $this->data['stickHTTPS'],
+ array( 'tabindex' => '9' )
+ );
+ ?>
+ </td>
+ </tr>
+<?php } ?>
+ <tr>
+ <td></td>
+ <td class="mw-submit">
+ <?php
+ echo Html::input( 'wpLoginAttempt', wfMsg( 'login' ), 'submit', array(
+ 'id' => 'wpLoginAttempt',
+ 'tabindex' => '9'
+ ) );
+ if ( $this->data['useemail'] && $this->data['canreset'] ) {
+ echo ' ';
+ echo Html::input( 'wpMailmypassword', wfMsg( 'mailmypassword' ), 'submit', array(
+ 'id' => 'wpMailmypassword',
+ 'tabindex' => '10'
+ ) );
+ } ?>
+
</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>
<div id="loginend"><?php $this->msgWiki( 'loginend' ); ?></div>
}
}
+/**
+ * @ingroup Templates
+ */
class UsercreateTemplate extends QuickTemplate {
+ function addInputItem( $name, $value, $type, $msg, $helptext = false ) {
+ $this->data['extraInput'][] = array(
+ 'name' => $name,
+ 'value' => $value,
+ 'type' => $type,
+ 'msg' => $msg,
+ 'helptext' => $helptext,
+ );
+ }
+
function execute() {
if( $this->data['message'] ) {
?>
<div class="<?php $this->text('messagetype') ?>box">
<?php if ( $this->data['messagetype'] == 'error' ) { ?>
- <h2><?php $this->msg('loginerror') ?>:</h2>
+ <strong><?php $this->msg( 'loginerror' )?></strong><br />
<?php } ?>
<?php $this->html('message') ?>
</div>
<div class="visualClear"></div>
<?php } ?>
+
+<div id="signupstart"><?php $this->msgWiki( 'signupstart' ); ?></div>
<div id="userlogin">
-<?php if( $this->data['create'] ) { ?>
<form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text('action') ?>">
<h2><?php $this->msg('createaccount') ?></h2>
<p id="userloginlink"><?php $this->html('link') ?></p>
+ <?php $this->html('header'); /* pre-table point for form plugins... */ ?>
+ <?php if( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
<table>
<tr>
- <td align='right'><label for='wpName2'><?php $this->msg('yourname') ?>:</label></td>
- <td align='left'>
- <input type='text' class='loginText' name="wpName" id="wpName2"
- value="<?php $this->text('name') ?>" size='20' />
+ <td class="mw-label"><label for='wpName2'><?php $this->msg('yourname') ?></label></td>
+ <td class="mw-input">
+ <?php
+ echo Html::input( 'wpName', $this->data['name'], 'text', array(
+ 'class' => 'loginText',
+ 'id' => 'wpName2',
+ 'tabindex' => '1',
+ 'size' => '20',
+ 'required',
+ 'autofocus'
+ ) ); ?>
</td>
+ <td></td>
</tr>
<tr>
- <td align='right'><label for='wpPassword2'><?php $this->msg('yourpassword') ?>:</label></td>
- <td align='left'>
- <input type='password' class='loginPassword' name="wpPassword" id="wpPassword2"
- value="<?php $this->text('password') ?>" size='20' />
+ <td class="mw-label"><label for='wpPassword2'><?php $this->msg('yourpassword') ?></label></td>
+ <td class="mw-input">
+<?php
+ echo Html::input( 'wpPassword', null, 'password', array(
+ 'class' => 'loginPassword',
+ 'id' => 'wpPassword2',
+ 'tabindex' => '2',
+ 'size' => '20'
+ ) + User::passwordChangeInputAttribs() ); ?>
</td>
+ <td><div id="password-strength"></div></td>
</tr>
<?php if( $this->data['usedomain'] ) {
$doms = "";
}
?>
<tr>
- <td align='right'><?php $this->msg( 'yourdomainname' ) ?>:</td>
- <td align='left'>
- <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>">
+ <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>
+ <td></td>
</tr>
<?php } ?>
<tr>
- <td align='right'><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?>:</label></td>
- <td align='left'>
- <input type='password' class='loginPassword' name="wpRetype" id="wpRetype"
- value="<?php $this->text('retype') ?>"
- size='20' />
+ <td class="mw-label"><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?></label></td>
+ <td class="mw-input">
+ <?php
+ echo Html::input( 'wpRetype', null, 'password', array(
+ 'class' => 'loginPassword',
+ 'id' => 'wpRetype',
+ 'tabindex' => '4',
+ 'size' => '20'
+ ) + User::passwordChangeInputAttribs() ); ?>
</td>
+ <td><div id="password-retype"></div></td>
</tr>
<tr>
<?php if( $this->data['useemail'] ) { ?>
- <td align='right'><label for='wpEmail'><?php $this->msg('youremail') ?>:</label></td>
- <td align='left'>
- <input type='text' class='loginText' name="wpEmail" id="wpEmail"
- value="<?php $this->text('email') ?>" size='20' />
+ <td class="mw-label"><label for='wpEmail'><?php $this->msg('youremail') ?></label></td>
+ <td class="mw-input">
+ <?php
+ echo Html::input( 'wpEmail', $this->data['email'], 'email', array(
+ 'class' => 'loginText',
+ 'id' => 'wpEmail',
+ 'tabindex' => '5',
+ 'size' => '20'
+ ) ); ?>
+ <div class="prefsectiontip">
+ <?php // duplicated in Preferences.php profilePreferences()
+ if( $this->data['emailrequired'] ) {
+ $this->msgWiki('prefs-help-email-required');
+ } else {
+ $this->msgWiki('prefs-help-email');
+ }
+ if( $this->data['emailothers'] ) {
+ $this->msgWiki('prefs-help-email-others');
+ } ?>
+ </div>
</td>
+ <td></td>
<?php } ?>
<?php if( $this->data['userealname'] ) { ?>
</tr>
<tr>
- <td align='right'><label for='wpRealName'><?php $this->msg('yourrealname') ?>:</label></td>
- <td align='left'>
+ <td class="mw-label"><label for='wpRealName'><?php $this->msg('yourrealname') ?></label></td>
+ <td class="mw-input" colspan="2">
<input type='text' class='loginText' name="wpRealName" id="wpRealName"
+ tabindex="6"
value="<?php $this->text('realname') ?>" size='20' />
+ <div class="prefsectiontip">
+ <?php $this->msgWiki('prefs-help-realname'); ?>
+ </div>
+ </td>
+ <td></td>
+ <?php } ?>
+ <?php if( $this->data['usereason'] ) { ?>
+ </tr>
+ <tr>
+ <td class="mw-label"><label for='wpReason'><?php $this->msg('createaccountreason') ?></label></td>
+ <td class="mw-input" colspan="2">
+ <input type='text' class='loginText' name="wpReason" id="wpReason"
+ tabindex="7"
+ value="<?php $this->text('reason') ?>" size='20' />
</td>
<?php } ?>
</tr>
+ <?php if( $this->data['canremember'] ) { ?>
<tr>
<td></td>
- <td align='left'>
- <input type='checkbox' name="wpRemember"
- value="1" id="wpRemember"
- <?php if( $this->data['remember'] ) { ?>checked="checked"<?php } ?>
- /> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
+ <td class="mw-input" colspan="2">
+ <?php
+ global $wgCookieExpiration, $wgLang;
+ echo Xml::checkLabel(
+ wfMsgExt( 'remembermypassword', 'parsemag', $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ),
+ 'wpRemember',
+ 'wpRemember',
+ $this->data['remember'],
+ array( 'tabindex' => '8' )
+ )
+ ?>
</td>
</tr>
+<?php }
+
+ $tabIndex = 9;
+ if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
+ foreach ( $this->data['extraInput'] as $inputItem ) { ?>
+ <tr>
+ <?php
+ if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
+ ?><td class="mw-label"><label for="<?php
+ echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
+ $this->msgWiki( $inputItem['msg'] ) ?></label><?php
+ } else {
+ ?><td><?php
+ }
+ ?></td>
+ <td class="mw-input" colspan="2">
+ <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php
+ echo htmlspecialchars( $inputItem['name'] ); ?>"
+ tabindex="<?php echo $tabIndex++; ?>"
+ value="<?php
+ if ( $inputItem['type'] != 'checkbox' ) {
+ echo htmlspecialchars( $inputItem['value'] );
+ } else {
+ echo '1';
+ }
+ ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
+ <?php
+ if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
+ echo 'checked="checked"';
+ ?> /> <?php
+ if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
+ ?>
+ <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
+ $this->msgHtml( $inputItem['msg'] ) ?></label><?php
+ }
+ if( $inputItem['helptext'] !== false ) {
+ ?>
+ <div class="prefsectiontip">
+ <?php $this->msgWiki( $inputItem['helptext'] ); ?>
+ </div>
+ <?php } ?>
+ </td>
+ </tr>
+<?php
+
+ }
+ }
+?>
<tr>
<td></td>
- <td align='left'>
+ <td class="mw-submit" colspan="2">
<input type='submit' name="wpCreateaccount" id="wpCreateaccount"
+ tabindex="<?php echo $tabIndex++; ?>"
value="<?php $this->msg('createaccount') ?>" />
<?php if( $this->data['createemail'] ) { ?>
<input type='submit' name="wpCreateaccountMail" id="wpCreateaccountMail"
+ tabindex="<?php echo $tabIndex++; ?>"
value="<?php $this->msg('createaccountmail') ?>" />
<?php } ?>
</td>
</tr>
- <?php } ?>
</table>
- <?php
-
- if( $this->data['useemail'] ) {
- echo '<div id="login-emailforlost">';
- $this->msgHtml( 'emailforlost' );
- echo '</div>';
- }
-
- ?>
+<?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="wpCreateaccountToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
</form>
</div>
<div id="signupend"><?php $this->msgWiki( 'signupend' ); ?></div>
}
}
-
-?>