3 * Html form for account creation.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
25 * @defgroup Templates Templates
28 if( !defined( 'MEDIAWIKI' ) ) die( -1 );
33 class UsercreateTemplate
extends QuickTemplate
{
34 function addInputItem( $name, $value, $type, $msg, $helptext = false ) {
35 $this->data
['extraInput'][] = array(
40 'helptext' => $helptext,
45 if( $this->data
['message'] ) {
47 <div
class="<?php $this->text('messagetype') ?>box">
48 <?php
if ( $this->data
['messagetype'] == 'error' ) { ?
>
49 <strong
><?php
$this->msg( 'loginerror' )?
></strong
><br
/>
51 <?php
$this->html('message') ?
>
53 <div
class="visualClear"></div
>
56 <div id
="signupstart"><?php
$this->msgWiki( 'signupstart' ); ?
></div
>
59 <form name
="userlogin2" id
="userlogin2" method
="post" action
="<?php $this->text('action') ?>">
60 <h2
><?php
$this->msg('createaccount') ?
></h2
>
61 <p id
="userloginlink"><?php
$this->html('link') ?
></p
>
62 <?php
$this->html('header'); /* pre-table point for form plugins... */ ?
>
63 <?php
if( $this->haveData( 'languages' ) ) { ?
><div id
="languagelinks"><p
><?php
$this->html( 'languages' ); ?
></p
></div
><?php
} ?
>
66 <td
class="mw-label"><label
for='wpName2'><?php
$this->msg('yourname') ?
></label
></td
>
69 echo Html
::input( 'wpName', $this->data
['name'], 'text', array(
70 'class' => 'loginText',
80 <td
class="mw-label"><label
for='wpPassword2'><?php
$this->msg('yourpassword') ?
></label
></td
>
83 echo Html
::input( 'wpPassword', null, 'password', array(
84 'class' => 'loginPassword',
85 'id' => 'wpPassword2',
88 ) + User
::passwordChangeInputAttribs() ); ?
>
91 <?php
if( $this->data
['usedomain'] ) {
93 foreach( $this->data
['domainnames'] as $dom ) {
94 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
98 <td
class="mw-label"><?php
$this->msg( 'yourdomainname' ) ?
></td
>
100 <select name
="wpDomain" value
="<?php $this->text( 'domain' ) ?>"
108 <td
class="mw-label"><label
for='wpRetype'><?php
$this->msg('yourpasswordagain') ?
></label
></td
>
109 <td
class="mw-input">
111 echo Html
::input( 'wpRetype', null, 'password', array(
112 'class' => 'loginPassword',
116 ) + User
::passwordChangeInputAttribs() ); ?
>
120 <?php
if( $this->data
['useemail'] ) { ?
>
121 <td
class="mw-label"><label
for='wpEmail'><?php
$this->msg('youremail') ?
></label
></td
>
122 <td
class="mw-input">
124 echo Html
::input( 'wpEmail', $this->data
['email'], 'email', array(
125 'class' => 'loginText',
130 <div
class="prefsectiontip">
131 <?php
// duplicated in Preferences.php profilePreferences()
132 if( $this->data
['emailrequired'] ) {
133 $this->msgWiki('prefs-help-email-required');
135 $this->msgWiki('prefs-help-email');
137 if( $this->data
['emailothers'] ) {
138 $this->msgWiki('prefs-help-email-others');
143 <?php
if( $this->data
['userealname'] ) { ?
>
146 <td
class="mw-label"><label
for='wpRealName'><?php
$this->msg('yourrealname') ?
></label
></td
>
147 <td
class="mw-input">
148 <input type
='text' class='loginText' name
="wpRealName" id
="wpRealName"
150 value
="<?php $this->text('realname') ?>" size
='20' />
151 <div
class="prefsectiontip">
152 <?php
$this->msgWiki('prefs-help-realname'); ?
>
156 <?php
if( $this->data
['usereason'] ) { ?
>
159 <td
class="mw-label"><label
for='wpReason'><?php
$this->msg('createaccountreason') ?
></label
></td
>
160 <td
class="mw-input">
161 <input type
='text' class='loginText' name
="wpReason" id
="wpReason"
163 value
="<?php $this->text('reason') ?>" size
='20' />
167 <?php
if( $this->data
['canremember'] ) { ?
>
170 <td
class="mw-input">
172 global $wgCookieExpiration;
173 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
174 echo Xml
::checkLabel(
175 wfMessage( 'remembermypassword' )->numParams( $expirationDays )->text(),
178 $this->data
['remember'],
179 array( 'tabindex' => '8' )
187 if ( isset( $this->data
['extraInput'] ) && is_array( $this->data
['extraInput'] ) ) {
188 foreach ( $this->data
['extraInput'] as $inputItem ) { ?
>
191 if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
192 ?
><td
class="mw-label"><label
for="<?php
193 echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
194 $this->msgWiki( $inputItem['msg'] ) ?
></label
><?php
199 <td
class="mw-input">
200 <input type
="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name
="<?php
201 echo htmlspecialchars( $inputItem['name'] ); ?>"
202 tabindex
="<?php echo $tabIndex++; ?>"
204 if ( $inputItem['type'] != 'checkbox' ) {
205 echo htmlspecialchars( $inputItem['value'] );
209 ?>" id
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
211 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
212 echo 'checked="checked"';
214 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
216 <label
for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
217 $this->msgHtml( $inputItem['msg'] ) ?
></label
><?php
219 if( $inputItem['helptext'] !== false ) {
221 <div
class="prefsectiontip">
222 <?php
$this->msgWiki( $inputItem['helptext'] ); ?
>
234 <td
class="mw-submit">
235 <input type
='submit' name
="wpCreateaccount" id
="wpCreateaccount"
236 tabindex
="<?php echo $tabIndex++; ?>"
237 value
="<?php $this->msg('createaccount') ?>" />
238 <?php
if( $this->data
['createemail'] ) { ?
>
239 <input type
='submit' name
="wpCreateaccountMail" id
="wpCreateaccountMail"
240 tabindex
="<?php echo $tabIndex++; ?>"
241 value
="<?php $this->msg('createaccountmail') ?>" />
246 <?php
if( $this->haveData( 'uselang' ) ) { ?
><input type
="hidden" name
="uselang" value
="<?php $this->text( 'uselang' ); ?>" /><?php
} ?
>
247 <?php
if( $this->haveData( 'token' ) ) { ?
><input type
="hidden" name
="wpCreateaccountToken" value
="<?php $this->text( 'token' ); ?>" /><?php
} ?
>
250 <div id
="signupend"><?php
$this->html( 'signupend' ); ?
></div
>