3 * Html form for account creation with new VForm appearance.
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
24 if ( !defined( 'MEDIAWIKI' ) ) {
29 * Html form for create account with new VForm appearance.
33 class UsercreateTemplateVForm
extends BaseTemplate
{
36 * Extensions (AntiSpoof and TitleBlacklist) call this in response to
37 * UserCreateForm hook to add checkboxes to the create account form.
39 function addInputItem( $name, $value, $type, $msg, $helptext = false ) {
40 $this->data
['extraInput'][] = array(
45 'helptext' => $helptext,
50 global $wgCookieExpiration;
51 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
53 <div
class="mw-ui-container">
55 if ( $this->haveData( 'languages' ) ) {
57 <div id
="languagelinks">
58 <p
><?php
$this->html( 'languages' ); ?
></p
>
63 <div id
="userloginForm">
64 <h2
class="createaccount-join"><?php
$this->msg( 'createacct-join' ); ?
></h2
>
65 <form name
="userlogin2" id
="userlogin2" class="mw-ui-vform" method
="post" action
="<?php $this->text( 'action' ); ?>">
66 <section
class="mw-form-header">
67 <?php
$this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?
>
70 if ( $this->data
['message'] ) {
72 <div
class="<?php $this->text( 'messagetype' ); ?>box">
73 <?php
if ( $this->data
['messagetype'] == 'error' ) { ?
>
74 <strong
><?php
$this->msg( 'createacct-error' ); ?
></strong
><br
/>
76 <?php
$this->html( 'message' ); ?
>
81 <?php
$this->msg( 'userlogin-yourname' ); ?
>
83 <span
class="mw-ui-flush-right"><?php
echo $this->getMsg( 'createacct-helpusername' )->parse(); ?
></span
>
85 <?php
echo Html
::input( 'wpName', $this->data
['name'], 'text', array(
86 'class' => 'mw-input loginText',
91 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text(),
96 <?php
if ( $this->data
['createemail'] ) { ?
>
97 <label
class="mw-ui-checkbox-label">
98 <input name
="wpCreateaccountMail" type
="checkbox" value
="1" id
="wpCreateaccountMail" tabindex
="2"
99 <?php
if ( $this->data
['createemailset'] ) {
100 echo 'checked="checked"';
103 <?php
$this->msg( 'createaccountmail' ); ?
>
107 <div
class="mw-row-password">
108 <label
for='wpPassword2'><?php
$this->msg( 'userlogin-yourpassword' ); ?
></label
>
109 <?php
echo Html
::input( 'wpPassword', null, 'password', array(
110 'class' => 'mw-input loginPassword',
111 'id' => 'wpPassword2',
115 'placeholder' => $this->getMsg( 'createacct-yourpassword-ph' )->text()
116 ) + User
::passwordChangeInputAttribs() ); ?
>
118 <?php
if ( $this->data
['usedomain'] ) {
120 foreach ( $this->data
['domainnames'] as $dom ) {
121 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
125 <label
><?php
$this->msg( 'yourdomainname' ); ?
></label
>
126 <div
class="mw-input">
127 <select name
="wpDomain" value
="<?php $this->text( 'domain' ); ?>"
134 <div
class="mw-row-password">
135 <label
for='wpRetype'><?php
$this->msg( 'createacct-yourpasswordagain' ); ?
></label
>
137 echo Html
::input( 'wpRetype', null, 'password', array(
138 'class' => 'mw-input loginPassword',
143 'placeholder' => $this->getMsg( 'createacct-yourpasswordagain-ph' )->text()
144 ) + User
::passwordChangeInputAttribs() );
148 <?php
if ( $this->data
['useemail'] ) { ?
>
149 <label
for='wpEmail'>
151 $this->msg( $this->data
['emailrequired'] ?
152 'createacct-emailrequired' :
153 'createacct-emailoptional'
158 echo Html
::input( 'wpEmail', $this->data
['email'], 'email', array(
159 'class' => 'mw-input loginText',
163 'placeholder' => $this->getMsg( 'createacct-email-ph' )->text()
164 ) +
( $this->data
['emailrequired'] ?
array() : array( 'required' => '' ) ) );
167 // VForm eliminates the prefsectiontip div tip:
168 // prefs-help-email-required is redundant with the placeholder text
169 // Doesn't show the wordy prefs-help-email
170 // Doesn't show the wordy prefs-help-email-others
174 <?php
if ( $this->data
['userealname'] ) { ?
>
176 <label
for='wpRealName'><?php
$this->msg( 'createacct-realname' ); ?
></label
>
177 <input type
='text' class='mw-input loginText' name
="wpRealName" id
="wpRealName"
179 value
="<?php $this->text( 'realname' ); ?>" size
='20' />
180 <div
class="prefsectiontip">
181 <?php
$this->msgWiki( 'prefs-help-realname' ); ?
>
185 if ( $this->data
['usereason'] ) { ?
>
187 <label
for='wpReason'><?php
$this->msg( 'createacct-reason' ); ?
></label
>
188 <?php
echo Html
::input( 'wpReason', $this->data
['reason'], 'text', array(
189 'class' => 'mw-input loginText',
193 'placeholder' => $this->getMsg( 'createacct-reason-ph' )->text()
198 if ( isset( $this->data
['extraInput'] ) && is_array( $this->data
['extraInput'] ) ) {
199 foreach ( $this->data
['extraInput'] as $inputItem ) { ?
>
202 // If it's a checkbox, output the whole thing (assume it has a msg).
203 if ( $inputItem['type'] == 'checkbox' ) {
205 <label
class="mw-ui-checkbox-label">
207 name
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
208 id
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
209 type
="checkbox" value
="1"
210 tabindex
="<?php echo $tabIndex++; ?>"
211 <?php
if ( !empty( $inputItem['value'] ) ) {
212 echo 'checked="checked"';
215 <?php
$this->msg( $inputItem['msg'] ); ?
>
220 if ( !empty( $inputItem['msg'] ) ) {
221 // Output the message label
223 <label
for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>">
224 <?php
$this->msgWiki( $inputItem['msg'] ); ?
>
230 type
="<?php echo htmlspecialchars( $inputItem['type'] ); ?>"
232 name
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
233 tabindex
="<?php echo $tabIndex++; ?>"
234 value
="<?php echo htmlspecialchars( $inputItem['value'] ); ?>"
235 id
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
239 if ( $inputItem['helptext'] !== false ) {
241 <div
class="prefsectiontip">
242 <?php
$this->msgWiki( $inputItem['helptext'] ); ?
>
251 // JS attempts to move the image CAPTCHA below this part of the form,
252 // so skip one index.
255 <div
class="mw-submit">
256 <input type
='submit' class="mw-ui-button mw-ui-big mw-ui-block mw-ui-primary" name
="wpCreateaccount" id
="wpCreateaccount"
257 tabindex
="<?php echo $tabIndex++; ?>"
258 value
="<?php $this->msg( 'createacct-submit' ); ?>" />
260 <input type
="hidden" id
="useNew" name
="useNew" value
="1" />
261 <?php
if ( $this->haveData( 'uselang' ) ) { ?
><input type
="hidden" name
="uselang" value
="<?php $this->text( 'uselang' ); ?>" /><?php
} ?
>
262 <?php
if ( $this->haveData( 'token' ) ) { ?
><input type
="hidden" name
="wpCreateaccountToken" value
="<?php $this->text( 'token' ); ?>" /><?php
} ?
>
265 <div
class="mw-createacct-benefits-container">
266 <h2
><?php
$this->msg( 'createacct-benefit-heading' ); ?
></h2
>
267 <div
class="mw-createacct-benefits-list">
269 for ( $benefitIdx = 1; $benefitIdx <= $this->data
['benefitCount']; $benefitIdx++
) {
270 // Pass each benefit's head text (by default a number) as a parameter to the body's message for PLURAL handling.
271 $headUnescaped = $this->getMsg( "createacct-benefit-head$benefitIdx" )->text();
274 <div
class="mw-benefits-icon <?php $this->msg( "createacct
-benefit
-icon
$benefitIdx" ); ?>"></div
>
275 <div
class="mw-number-text">
276 <h3
><?php
$this->msg( "createacct-benefit-head$benefitIdx" ); ?
></h3
>
277 <p
><?php
echo $this->getMsg( "createacct-benefit-body$benefitIdx" )->params( $headUnescaped )->escaped(); ?
></p
>