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
23 * @deprecated Will be removed when AuthManager lands.
24 * The signup form will be generated via HTMLForm.
27 class UsercreateTemplate
extends BaseTemplate
{
29 * Extensions (AntiSpoof and TitleBlacklist) call this in response to
30 * UserCreateForm hook to add checkboxes to the create account form.
32 function addInputItem( $name, $value, $type, $msg, $helptext = false ) {
33 $this->data
['extraInput'][] = [
38 'helptext' => $helptext,
44 <div
class="mw-ui-container">
45 <?php
if ( $this->haveData( 'languages' ) ) { ?
>
46 <div id
="languagelinks">
47 <p
><?php
$this->html( 'languages' ); ?
></p
>
50 if ( !wfMessage( 'signupstart' )->isDisabled() ) { ?
>
51 <div id
="signupstart"><?php
$this->msgWiki( 'signupstart' ); ?
></div
>
53 <div id
="userloginForm">
54 <form name
="userlogin2" id
="userlogin2" class="mw-ui-vform" method
="post" action
="<?php $this->text( 'action' ); ?>">
55 <section
class="mw-form-header">
56 <?php
$this->html( 'header' ); ?
>
58 <!-- This element is used by the mediawiki
.special
.userlogin
.signup
.js module
. -->
60 id
="mw-createacct-status-area"
61 <?php
if ( $this->data
['message'] ) { ?
>
62 class="<?php echo $this->data['messagetype']; ?>box"
64 style
="display: none;"
67 <?php
if ( $this->data
['message'] ) { ?
>
68 <?php
if ( $this->data
['messagetype'] == 'error' ) { ?
>
69 <strong
><?php
$this->msg( 'createacct-error' ); ?
></strong
>
72 <?php
$this->html( 'message' ); ?
>
76 <?php
if ( $this->data
['formheader'] ) { ?
>
77 <div
class="mw-form-formheader">
78 <?php
$this->html( 'formheader' ); /* extensions such as MobileFrontend add html here */ ?
>
82 <div
class="mw-ui-vform-field">
84 <?php
$this->msg( 'userlogin-yourname' ); ?
>
86 <span
class="mw-ui-flush-right"><?php
echo $this->getMsg( 'createacct-helpusername' )->parse(); ?
></span
>
89 echo Html
::input( 'wpName', $this->data
['name'], 'text', [
90 'class' => 'mw-ui-input loginText',
95 'placeholder' => $this->getMsg( $this->data
['loggedin'] ?
96 'createacct-another-username-ph' : 'userlogin-yourname-ph' )->text(),
101 <div
class="mw-ui-vform-field">
102 <?php
if ( $this->data
['createemail'] ) { ?
>
103 <div
class="mw-ui-checkbox">
104 <input name
="wpCreateaccountMail" type
="checkbox" value
="1" id
="wpCreateaccountMail" tabindex
="2"
105 <?php
if ( $this->data
['createemailset'] ) {
106 echo 'checked="checked"';
108 ><label
for="wpCreateaccountMail">
109 <?php
$this->msg( 'createaccountmail' ); ?
>
115 <div
class="mw-ui-vform-field mw-row-password">
116 <label
for='wpPassword2'><?php
$this->msg( 'userlogin-yourpassword' ); ?
></label
>
118 echo Html
::input( 'wpPassword', null, 'password', [
119 'class' => 'mw-ui-input loginPassword',
120 'id' => 'wpPassword2',
124 'placeholder' => $this->getMsg( 'createacct-yourpassword-ph' )->text()
125 ] + User
::passwordChangeInputAttribs() );
130 if ( $this->data
['usedomain'] ) {
131 $select = new XmlSelect( 'wpDomain', false, $this->data
['domain'] );
132 $select->setAttribute( 'tabindex', 4 );
133 foreach ( $this->data
['domainnames'] as $dom ) {
134 $select->addOption( $dom );
137 <div
class="mw-ui-vform-field" id
="mw-user-domain-section">
138 <label
for="wpDomain"><?php
$this->msg( 'yourdomainname' ); ?
></label
>
140 <?php
echo $select->getHTML(); ?
>
145 <div
class="mw-ui-vform-field mw-row-password">
146 <label
for='wpRetype'><?php
$this->msg( 'createacct-yourpasswordagain' ); ?
></label
>
148 echo Html
::input( 'wpRetype', null, 'password', [
149 'class' => 'mw-ui-input loginPassword',
154 'placeholder' => $this->getMsg( 'createacct-yourpasswordagain-ph' )->text()
155 ] + User
::passwordChangeInputAttribs() );
159 <div
class="mw-ui-vform-field">
160 <?php
if ( $this->data
['useemail'] ) { ?
>
161 <label
for='wpEmail'>
163 $this->msg( $this->data
['emailrequired'] ?
164 'createacct-emailrequired' :
165 'createacct-emailoptional'
170 echo Html
::input( 'wpEmail', $this->data
['email'], 'email', [
171 'class' => 'mw-ui-input loginText',
175 'required' => $this->data
['emailrequired'],
176 'placeholder' => $this->getMsg( $this->data
['loggedin'] ?
177 'createacct-another-email-ph' : 'createacct-email-ph' )->text()
183 <?php
if ( $this->data
['userealname'] ) { ?
>
184 <div
class="mw-ui-vform-field">
185 <label
for='wpRealName'><?php
$this->msg( 'createacct-realname' ); ?
></label
>
186 <input type
='text' class='mw-ui-input loginText' name
="wpRealName" id
="wpRealName"
188 value
="<?php $this->text( 'realname' ); ?>" size
='20' />
189 <div
class="prefsectiontip">
190 <?php
$this->msgWiki( $this->data
['loggedin'] ?
'createacct-another-realname-tip' : 'prefs-help-realname' ); ?
>
195 <?php
if ( $this->data
['usereason'] ) { ?
>
196 <div
class="mw-ui-vform-field">
197 <label
for='wpReason'><?php
$this->msg( 'createacct-reason' ); ?
></label
>
198 <?php
echo Html
::input( 'wpReason', $this->data
['reason'], 'text', [
199 'class' => 'mw-ui-input loginText',
203 'placeholder' => $this->getMsg( 'createacct-reason-ph' )->text()
210 if ( isset( $this->data
['extraInput'] ) && is_array( $this->data
['extraInput'] ) ) {
211 foreach ( $this->data
['extraInput'] as $inputItem ) { ?
>
212 <div
class="mw-ui-vform-field">
214 // If it's a checkbox, output the whole thing (assume it has a msg).
215 if ( $inputItem['type'] == 'checkbox' ) {
217 <div
class="mw-ui-checkbox">
219 name
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
220 id
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
221 type
="checkbox" value
="1"
222 tabindex
="<?php echo $tabIndex++; ?>"
223 <?php
if ( !empty( $inputItem['value'] ) ) {
224 echo 'checked="checked"';
226 ><label
for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>">
227 <?php
$this->msg( $inputItem['msg'] ); ?
>
233 // TODO (bug 31909) support other input types, e.g. select boxes.
235 <?php
if ( !empty( $inputItem['msg'] ) ) { ?
>
236 <label
for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>">
237 <?php
$this->msgWiki( $inputItem['msg'] ); ?
>
241 type
="<?php echo htmlspecialchars( $inputItem['type'] ); ?>"
243 name
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
244 tabindex
="<?php echo $tabIndex++; ?>"
245 value
="<?php echo htmlspecialchars( $inputItem['value'] ); ?>"
246 id
="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
249 <?php
if ( $inputItem['helptext'] !== false ) { ?
>
250 <div
class="prefsectiontip">
251 <?php
$this->msgWiki( $inputItem['helptext'] ); ?
>
259 // A separate placeholder for any inserting any extrafields, e.g used by ConfirmEdit extension
260 if ( $this->haveData( 'extrafields' ) ) {
261 echo $this->data
['extrafields'];
266 <div
class="mw-ui-vform-field mw-submit">
268 echo Html
::submitButton(
269 $this->getMsg( $this->data
['loggedin'] ?
'createacct-another-submit' : 'createacct-submit' ),
271 'id' => 'wpCreateaccount',
272 'name' => 'wpCreateaccount',
273 'tabindex' => $tabIndex++
277 'mw-ui-constructive',
282 <?php
if ( $this->haveData( 'uselang' ) ) { ?
><input type
="hidden" name
="uselang" value
="<?php $this->text( 'uselang' ); ?>" /><?php
} ?
>
283 <?php
if ( $this->haveData( 'token' ) ) { ?
><input type
="hidden" name
="wpCreateaccountToken" value
="<?php $this->text( 'token' ); ?>" /><?php
} ?
>
285 <?php
if ( !wfMessage( 'signupend' )->isDisabled() ) { ?
>
286 <div id
="signupend"><?php
$this->html( 'signupend' ); ?
></div
>
289 <div
class="mw-createacct-benefits-container">
290 <h2
><?php
$this->msg( 'createacct-benefit-heading' ); ?
></h2
>
291 <div
class="mw-createacct-benefits-list">
293 for ( $benefitIdx = 1; $benefitIdx <= $this->data
['benefitCount']; $benefitIdx++
) {
294 // Pass each benefit's head text (by default a number) as a parameter to the body's message for PLURAL handling.
295 $headUnescaped = $this->getMsg( "createacct-benefit-head$benefitIdx" )->text();
297 <div
class="mw-number-text <?php $this->msg( "createacct
-benefit
-icon
$benefitIdx" ); ?>">
298 <h3
><?php
$this->msg( "createacct-benefit-head$benefitIdx" ); ?
></h3
>
299 <p
><?php
echo $this->getMsg( "createacct-benefit-body$benefitIdx" )->params( $headUnescaped )->escaped(); ?
></p
>