2 // @codingStandardsIgnoreFile
4 * Html form for account creation (since 1.22 with VForm appearance).
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
25 class UsercreateTemplate
extends BaseTemplate
{
27 * Extensions (AntiSpoof and TitleBlacklist) call this in response to
28 * UserCreateForm hook to add checkboxes to the create account form.
30 function addInputItem( $name, $value, $type, $msg, $helptext = false ) {
31 $this->data
['extraInput'][] = array(
36 'helptext' => $helptext,
42 <div
class="mw-ui-container">
43 <?php
if ( $this->haveData( 'languages' ) ) { ?
>
44 <div id
="languagelinks">
45 <p
><?php
$this->html( 'languages' ); ?
></p
>
48 if ( !wfMessage( 'signupstart' )->isDisabled() ) { ?
>
49 <div id
="signupstart"><?php
$this->msgWiki( 'signupstart' ); ?
></div
>
51 <div id
="userloginForm">
52 <form name
="userlogin2" id
="userlogin2" class="mw-ui-vform" method
="post" action
="<?php $this->text( 'action' ); ?>">
53 <section
class="mw-form-header">
54 <?php
$this->html( 'header' ); ?
>
56 <!-- This element is used by the mediawiki
.special
.userlogin
.signup
.js module
. -->
58 id
="mw-createacct-status-area"
59 <?php
if ( $this->data
['message'] ) { ?
>
60 class="<?php echo $this->data['messagetype']; ?>box"
62 style
="display: none;"
65 <?php
if ( $this->data
['message'] ) { ?
>
66 <?php
if ( $this->data
['messagetype'] == 'error' ) { ?
>
67 <strong
><?php
$this->msg( 'createacct-error' ); ?
></strong
>
70 <?php
$this->html( 'message' ); ?
>
74 <?php
if ( $this->data
['formheader'] ) { ?
>
75 <div
class="mw-form-formheader">
76 <?php
$this->html( 'formheader' ); /* extensions such as MobileFrontend add html here */ ?
>
80 <div
class="mw-ui-vform-field">
82 <?php
$this->msg( 'userlogin-yourname' ); ?
>
84 <span
class="mw-ui-flush-right"><?php
echo $this->getMsg( 'createacct-helpusername' )->parse(); ?
></span
>
87 echo Html
::input( 'wpName', $this->data
['name'], 'text', array(
88 'class' => 'mw-ui-input loginText',
93 'placeholder' => $this->getMsg( $this->data
['loggedin'] ?
94 'createacct-another-username-ph' : 'userlogin-yourname-ph' )->text(),
99 <div
class="mw-ui-vform-field">
100 <?php
if ( $this->data
['createemail'] ) { ?
>
101 <div
class="mw-ui-checkbox">
102 <input name
="wpCreateaccountMail" type
="checkbox" value
="1" id
="wpCreateaccountMail" tabindex
="2"
103 <?php
if ( $this->data
['createemailset'] ) {
104 echo 'checked="checked"';
106 ><label
for="wpCreateaccountMail">
107 <?php
$this->msg( 'createaccountmail' ); ?
>
113 <div
class="mw-ui-vform-field mw-row-password">
114 <label
for='wpPassword2'><?php
$this->msg( 'userlogin-yourpassword' ); ?
></label
>
116 echo Html
::input( 'wpPassword', null, 'password', array(
117 'class' => 'mw-ui-input loginPassword',
118 'id' => 'wpPassword2',
122 'placeholder' => $this->getMsg( 'createacct-yourpassword-ph' )->text()
123 ) + User
::passwordChangeInputAttribs() );
128 if ( $this->data
['usedomain'] ) {
129 $select = new XmlSelect( 'wpDomain', false, $this->data
['domain'] );
130 $select->setAttribute( 'tabindex', 4 );
131 foreach ( $this->data
['domainnames'] as $dom ) {
132 $select->addOption( $dom );
135 <div
class="mw-ui-vform-field" id
="mw-user-domain-section">
136 <label
for="wpDomain"><?php
$this->msg( 'yourdomainname' ); ?
></label
>
138 <?php
echo $select->getHTML(); ?
>
143 <div
class="mw-ui-vform-field mw-row-password">
144 <label
for='wpRetype'><?php
$this->msg( 'createacct-yourpasswordagain' ); ?
></label
>
146 echo Html
::input( 'wpRetype', null, 'password', array(
147 'class' => 'mw-ui-input loginPassword',
152 'placeholder' => $this->getMsg( 'createacct-yourpasswordagain-ph' )->text()
153 ) + User
::passwordChangeInputAttribs() );
157 <div
class="mw-ui-vform-field">
158 <?php
if ( $this->data
['useemail'] ) { ?
>
159 <label
for='wpEmail'>
161 $this->msg( $this->data
['emailrequired'] ?
162 'createacct-emailrequired' :
163 'createacct-emailoptional'
168 echo Html
::input( 'wpEmail', $this->data
['email'], 'email', array(
169 'class' => 'mw-ui-input loginText',
173 'required' => $this->data
['emailrequired'],
174 'placeholder' => $this->getMsg( $this->data
['loggedin'] ?
175 'createacct-another-email-ph' : 'createacct-email-ph' )->text()
181 <?php
if ( $this->data
['userealname'] ) { ?
>
182 <div
class="mw-ui-vform-field">
183 <label
for='wpRealName'><?php
$this->msg( 'createacct-realname' ); ?
></label
>
184 <input type
='text' class='mw-ui-input loginText' name
="wpRealName" id
="wpRealName"
186 value
="<?php $this->text( 'realname' ); ?>" size
='20' />
187 <div
class="prefsectiontip">
188 <?php
$this->msgWiki( $this->data
['loggedin'] ?
'createacct-another-realname-tip' : 'prefs-help-realname' ); ?
>
193 <?php
if ( $this->data
['usereason'] ) { ?
>
194 <div
class="mw-ui-vform-field">
195 <label
for='wpReason'><?php
$this->msg( 'createacct-reason' ); ?
></label
>
196 <?php
echo Html
::input( 'wpReason', $this->data
['reason'], 'text', array(
197 'class' => 'mw-ui-input loginText',
201 'placeholder' => $this->getMsg( 'createacct-reason-ph' )->text()
208 if ( isset( $this->data
['extraInput'] ) && is_array( $this->data
['extraInput'] ) ) {
209 foreach ( $this->data
['extraInput'] as $inputItem ) { ?
>
210 <div
class="mw-ui-vform-field">
212 // If it's a checkbox, output the whole thing (assume it has a msg).
213 if ( $inputItem['type'] == 'checkbox' ) {
215 <div
class="mw-ui-checkbox">
217 name
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
218 id
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
219 type
="checkbox" value
="1"
220 tabindex
="<?php echo $tabIndex++; ?>"
221 <?php
if ( !empty( $inputItem['value'] ) ) {
222 echo 'checked="checked"';
224 ><label
for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>">
225 <?php
$this->msg( $inputItem['msg'] ); ?
>
231 // TODO (bug 31909) support other input types, e.g. select boxes.
233 <?php
if ( !empty( $inputItem['msg'] ) ) { ?
>
234 <label
for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>">
235 <?php
$this->msgWiki( $inputItem['msg'] ); ?
>
239 type
="<?php echo htmlspecialchars( $inputItem['type'] ); ?>"
241 name
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
242 tabindex
="<?php echo $tabIndex++; ?>"
243 value
="<?php echo htmlspecialchars( $inputItem['value'] ); ?>"
244 id
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
247 <?php
if ( $inputItem['helptext'] !== false ) { ?
>
248 <div
class="prefsectiontip">
249 <?php
$this->msgWiki( $inputItem['helptext'] ); ?
>
257 // A separate placeholder for any inserting any extrafields, e.g used by ConfirmEdit extension
258 if ( $this->haveData( 'extrafields' ) ) {
259 echo $this->data
['extrafields'];
264 <div
class="mw-ui-vform-field mw-submit">
266 echo Html
::submitButton(
267 $this->getMsg( $this->data
['loggedin'] ?
'createacct-another-submit' : 'createacct-submit' ),
269 'id' => 'wpCreateaccount',
270 'name' => 'wpCreateaccount',
271 'tabindex' => $tabIndex++
275 'mw-ui-constructive',
280 <?php
if ( $this->haveData( 'uselang' ) ) { ?
><input type
="hidden" name
="uselang" value
="<?php $this->text( 'uselang' ); ?>" /><?php
} ?
>
281 <?php
if ( $this->haveData( 'token' ) ) { ?
><input type
="hidden" name
="wpCreateaccountToken" value
="<?php $this->text( 'token' ); ?>" /><?php
} ?
>
283 <?php
if ( !wfMessage( 'signupend' )->isDisabled() ) { ?
>
284 <div id
="signupend"><?php
$this->html( 'signupend' ); ?
></div
>
287 <div
class="mw-createacct-benefits-container">
288 <h2
><?php
$this->msg( 'createacct-benefit-heading' ); ?
></h2
>
289 <div
class="mw-createacct-benefits-list">
291 for ( $benefitIdx = 1; $benefitIdx <= $this->data
['benefitCount']; $benefitIdx++
) {
292 // Pass each benefit's head text (by default a number) as a parameter to the body's message for PLURAL handling.
293 $headUnescaped = $this->getMsg( "createacct-benefit-head$benefitIdx" )->text();
295 <div
class="mw-number-text <?php $this->msg( "createacct
-benefit
-icon
$benefitIdx" ); ?>">
296 <h3
><?php
$this->msg( "createacct-benefit-head$benefitIdx" ); ?
></h3
>
297 <p
><?php
echo $this->getMsg( "createacct-benefit-body$benefitIdx" )->params( $headUnescaped )->escaped(); ?
></p
>