3 * @defgroup Templates Templates
7 if( !defined( 'MEDIAWIKI' ) ) die( -1 );
10 * HTML template for Special:Userlogin form
13 class UserloginTemplate extends QuickTemplate {
15 if( $this->data['message'] ) {
17 <div class="<?php $this->text('messagetype') ?>box">
18 <?php if ( $this->data['messagetype'] == 'error' ) { ?>
19 <strong><?php $this->msg( 'loginerror' )?></strong><br />
21 <?php $this->html('message') ?>
23 <div class="visualClear"></div>
26 <div id="loginstart"><?php $this->msgWiki( 'loginstart' ); ?></div>
27 <div id="userloginForm">
28 <form name="userlogin" method="post" action="<?php $this->text('action') ?>">
29 <h2><?php $this->msg('login') ?></h2>
30 <p id="userloginlink"><?php $this->html('link') ?></p>
31 <?php $this->html('header'); /* pre-table point for form plugins... */ ?>
32 <div id="userloginprompt"><?php $this->msgWiki('loginprompt') ?></div>
33 <?php if( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
36 <td class="mw-label"><label for='wpName1'><?php $this->msg('yourname') ?></label></td>
39 echo Html::input( 'wpName', $this->data['name'], 'text', array(
40 'class' => 'loginText',
45 # Can't do + array( 'autofocus' ) because + for arrays in PHP
46 # only works right for associative arrays! Thanks, PHP.
47 ) + ( $this->data['name'] ? array() : array( 'autofocus' => '' ) ) ); ?>
52 <td class="mw-label"><label for='wpPassword1'><?php $this->msg('yourpassword') ?></label></td>
55 echo Html::input( 'wpPassword', null, 'password', array(
56 'class' => 'loginPassword',
57 'id' => 'wpPassword1',
60 ) + ( $this->data['name'] ? array( 'autofocus' ) : array() ) ); ?>
64 <?php if( $this->data['usedomain'] ) {
66 foreach( $this->data['domainnames'] as $dom ) {
67 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
70 <tr id="mw-user-domain-section">
71 <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
73 <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
80 if( $this->data['canremember'] ) { ?>
85 echo Html::input( 'wpRemember', '1', 'checkbox', array(
88 ) + ( $this->data['remember'] ? array( 'checked' ) : array() ) ); ?>
90 <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
96 <td class="mw-submit">
98 echo Html::input( 'wpLoginAttempt', wfMsg( 'login' ), 'submit', array(
99 'id' => 'wpLoginAttempt',
102 if ( $this->data['useemail'] && $this->data['canreset'] ) {
104 echo Html::input( 'wpMailmypassword', wfMsg( 'mailmypassword' ), 'submit', array(
105 'id' => 'wpMailmypassword',
113 <?php if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
114 <?php if( @$this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
117 <div id="loginend"><?php $this->msgWiki( 'loginend' ); ?></div>
126 class UsercreateTemplate extends QuickTemplate {
127 function addInputItem( $name, $value, $type, $msg, $helptext = false ) {
128 $this->data['extraInput'][] = array(
133 'helptext' => $helptext,
138 if( $this->data['message'] ) {
140 <div class="<?php $this->text('messagetype') ?>box">
141 <?php if ( $this->data['messagetype'] == 'error' ) { ?>
142 <strong><?php $this->msg( 'loginerror' )?></strong><br />
144 <?php $this->html('message') ?>
146 <div class="visualClear"></div>
150 <form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text('action') ?>">
151 <h2><?php $this->msg('createaccount') ?></h2>
152 <p id="userloginlink"><?php $this->html('link') ?></p>
153 <?php $this->html('header'); /* pre-table point for form plugins... */ ?>
154 <?php if( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
157 <td class="mw-label"><label for='wpName2'><?php $this->msg('yourname') ?></label></td>
158 <td class="mw-input">
160 echo Html::input( 'wpName', $this->data['name'], 'text', array(
161 'class' => 'loginText',
171 <td class="mw-label"><label for='wpPassword2'><?php $this->msg('yourpassword') ?></label></td>
172 <td class="mw-input">
174 echo Html::input( 'wpPassword', null, 'password', array(
175 'class' => 'loginPassword',
176 'id' => 'wpPassword2',
179 ) + User::passwordChangeInputAttribs() ); ?>
182 <?php if( $this->data['usedomain'] ) {
184 foreach( $this->data['domainnames'] as $dom ) {
185 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
189 <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
190 <td class="mw-input">
191 <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
199 <td class="mw-label"><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?></label></td>
200 <td class="mw-input">
202 echo Html::input( 'wpRetype', null, 'password', array(
203 'class' => 'loginPassword',
207 ) + User::passwordChangeInputAttribs() ); ?>
211 <?php if( $this->data['useemail'] ) { ?>
212 <td class="mw-label"><label for='wpEmail'><?php $this->msg('youremail') ?></label></td>
213 <td class="mw-input">
215 echo Html::input( 'wpEmail', $this->data['email'], 'email', array(
216 'class' => 'loginText',
221 <div class="prefsectiontip">
222 <?php if( $this->data['emailrequired'] ) {
223 $this->msgWiki('prefs-help-email-required');
225 $this->msgWiki('prefs-help-email');
230 <?php if( $this->data['userealname'] ) { ?>
233 <td class="mw-label"><label for='wpRealName'><?php $this->msg('yourrealname') ?></label></td>
234 <td class="mw-input">
235 <input type='text' class='loginText' name="wpRealName" id="wpRealName"
237 value="<?php $this->text('realname') ?>" size='20' />
238 <div class="prefsectiontip">
239 <?php $this->msgWiki('prefs-help-realname'); ?>
244 <?php if( $this->data['canremember'] ) { ?>
247 <td class="mw-input">
248 <input type='checkbox' name="wpRemember"
250 value="1" id="wpRemember"
251 <?php if( $this->data['remember'] ) { ?>checked="checked"<?php } ?>
252 /> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
258 if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
259 foreach ( $this->data['extraInput'] as $inputItem ) { ?>
262 if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
263 ?><td class="mw-label"><label for="<?php
264 echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
265 $this->msgWiki( $inputItem['msg'] ) ?></label><?php
270 <td class="mw-input">
271 <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php
272 echo htmlspecialchars( $inputItem['name'] ); ?>"
273 tabindex="<?php echo $tabIndex++; ?>"
275 if ( $inputItem['type'] != 'checkbox' ) {
276 echo htmlspecialchars( $inputItem['value'] );
280 ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
282 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
283 echo 'checked="checked"';
285 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
287 <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
288 $this->msgHtml( $inputItem['msg'] ) ?></label><?php
290 if( $inputItem['helptext'] !== false ) {
292 <div class="prefsectiontip">
293 <?php $this->msgWiki( $inputItem['helptext'] ); ?>
305 <td class="mw-submit">
306 <input type='submit' name="wpCreateaccount" id="wpCreateaccount"
307 tabindex="<?php echo $tabIndex++; ?>"
308 value="<?php $this->msg('createaccount') ?>" />
309 <?php if( $this->data['createemail'] ) { ?>
310 <input type='submit' name="wpCreateaccountMail" id="wpCreateaccountMail"
311 tabindex="<?php echo $tabIndex++; ?>"
312 value="<?php $this->msg('createaccountmail') ?>" />
317 <?php if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
318 <?php if( @$this->haveData( 'token' ) ) { ?><input type="hidden" name="wpCreateaccountToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
321 <div id="signupend"><?php $this->msgWiki( 'signupend' ); ?></div>