Add signupstart to Userlogin.php per request of MZMcBride
[lhc/web/wiklou.git] / includes / templates / Userlogin.php
1 <?php
2 /**
3 * @defgroup Templates Templates
4 * @file
5 * @ingroup Templates
6 */
7 if( !defined( 'MEDIAWIKI' ) ) die( -1 );
8
9 /**
10 * HTML template for Special:Userlogin form
11 * @ingroup Templates
12 */
13 class UserloginTemplate extends QuickTemplate {
14 function execute() {
15 if( $this->data['message'] ) {
16 ?>
17 <div class="<?php $this->text('messagetype') ?>box">
18 <?php if ( $this->data['messagetype'] == 'error' ) { ?>
19 <strong><?php $this->msg( 'loginerror' )?></strong><br />
20 <?php } ?>
21 <?php $this->html('message') ?>
22 </div>
23 <div class="visualClear"></div>
24 <?php } ?>
25
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 } ?>
34 <table>
35 <tr>
36 <td class="mw-label"><label for='wpName1'><?php $this->msg('yourname') ?></label></td>
37 <td class="mw-input">
38 <?php
39 echo Html::input( 'wpName', $this->data['name'], 'text', array(
40 'class' => 'loginText',
41 'id' => 'wpName1',
42 'tabindex' => '1',
43 'size' => '20',
44 'required'
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' => '' ) ) ); ?>
48
49 </td>
50 </tr>
51 <tr>
52 <td class="mw-label"><label for='wpPassword1'><?php $this->msg('yourpassword') ?></label></td>
53 <td class="mw-input">
54 <?php
55 echo Html::input( 'wpPassword', null, 'password', array(
56 'class' => 'loginPassword',
57 'id' => 'wpPassword1',
58 'tabindex' => '2',
59 'size' => '20'
60 ) + ( $this->data['name'] ? array( 'autofocus' ) : array() ) ); ?>
61
62 </td>
63 </tr>
64 <?php if( $this->data['usedomain'] ) {
65 $doms = "";
66 foreach( $this->data['domainnames'] as $dom ) {
67 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
68 }
69 ?>
70 <tr id="mw-user-domain-section">
71 <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
72 <td class="mw-input">
73 <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
74 tabindex="3">
75 <?php echo $doms ?>
76 </select>
77 </td>
78 </tr>
79 <?php }
80 if( $this->data['canremember'] ) { ?>
81 <tr>
82 <td></td>
83 <td class="mw-input">
84 <?php
85 global $wgCookieExpiration, $wgLang;
86 echo Xml::checkLabel(
87 wfMsgExt( 'remembermypassword', 'parsemag', $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ),
88 'wpRemember',
89 'wpRemember',
90 $this->data['remember'],
91 array( 'tabindex' => '4' )
92 )
93 ?>
94 </td>
95 </tr>
96 <?php } ?>
97 <tr>
98 <td></td>
99 <td class="mw-submit">
100 <?php
101 echo Html::input( 'wpLoginAttempt', wfMsg( 'login' ), 'submit', array(
102 'id' => 'wpLoginAttempt',
103 'tabindex' => '5'
104 ) );
105 if ( $this->data['useemail'] && $this->data['canreset'] ) {
106 echo '&#160;';
107 echo Html::input( 'wpMailmypassword', wfMsg( 'mailmypassword' ), 'submit', array(
108 'id' => 'wpMailmypassword',
109 'tabindex' => '6'
110 ) );
111 } ?>
112
113 </td>
114 </tr>
115 </table>
116 <?php if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
117 <?php if( @$this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
118 </form>
119 </div>
120 <div id="loginend"><?php $this->msgWiki( 'loginend' ); ?></div>
121 <?php
122
123 }
124 }
125
126 /**
127 * @ingroup Templates
128 */
129 class UsercreateTemplate extends QuickTemplate {
130 function addInputItem( $name, $value, $type, $msg, $helptext = false ) {
131 $this->data['extraInput'][] = array(
132 'name' => $name,
133 'value' => $value,
134 'type' => $type,
135 'msg' => $msg,
136 'helptext' => $helptext,
137 );
138 }
139
140 function execute() {
141 if( $this->data['message'] ) {
142 ?>
143 <div class="<?php $this->text('messagetype') ?>box">
144 <?php if ( $this->data['messagetype'] == 'error' ) { ?>
145 <strong><?php $this->msg( 'loginerror' )?></strong><br />
146 <?php } ?>
147 <?php $this->html('message') ?>
148 </div>
149 <div class="visualClear"></div>
150 <?php } ?>
151
152 <div id="signupstart"><?php $this->msgWiki( 'signupstart' ); ?></div>
153 <div id="userlogin">
154
155 <form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text('action') ?>">
156 <h2><?php $this->msg('createaccount') ?></h2>
157 <p id="userloginlink"><?php $this->html('link') ?></p>
158 <?php $this->html('header'); /* pre-table point for form plugins... */ ?>
159 <?php if( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
160 <table>
161 <tr>
162 <td class="mw-label"><label for='wpName2'><?php $this->msg('yourname') ?></label></td>
163 <td class="mw-input">
164 <?php
165 echo Html::input( 'wpName', $this->data['name'], 'text', array(
166 'class' => 'loginText',
167 'id' => 'wpName2',
168 'tabindex' => '1',
169 'size' => '20',
170 'required',
171 'autofocus'
172 ) ); ?>
173 </td>
174 <td></td>
175 </tr>
176 <tr>
177 <td class="mw-label"><label for='wpPassword2'><?php $this->msg('yourpassword') ?></label></td>
178 <td class="mw-input">
179 <?php
180 echo Html::input( 'wpPassword', null, 'password', array(
181 'class' => 'loginPassword',
182 'id' => 'wpPassword2',
183 'tabindex' => '2',
184 'size' => '20'
185 ) + User::passwordChangeInputAttribs() ); ?>
186 </td>
187 <td><div id="password-strength"></div></td>
188 </tr>
189 <?php if( $this->data['usedomain'] ) {
190 $doms = "";
191 foreach( $this->data['domainnames'] as $dom ) {
192 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
193 }
194 ?>
195 <tr>
196 <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
197 <td class="mw-input">
198 <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
199 tabindex="3">
200 <?php echo $doms ?>
201 </select>
202 </td>
203 <td></td>
204 </tr>
205 <?php } ?>
206 <tr>
207 <td class="mw-label"><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?></label></td>
208 <td class="mw-input">
209 <?php
210 echo Html::input( 'wpRetype', null, 'password', array(
211 'class' => 'loginPassword',
212 'id' => 'wpRetype',
213 'tabindex' => '4',
214 'size' => '20'
215 ) + User::passwordChangeInputAttribs() ); ?>
216 </td>
217 <td><div id="password-retype"></div></td>
218 </tr>
219 <tr>
220 <?php if( $this->data['useemail'] ) { ?>
221 <td class="mw-label"><label for='wpEmail'><?php $this->msg('youremail') ?></label></td>
222 <td class="mw-input">
223 <?php
224 echo Html::input( 'wpEmail', $this->data['email'], 'email', array(
225 'class' => 'loginText',
226 'id' => 'wpEmail',
227 'tabindex' => '5',
228 'size' => '20'
229 ) ); ?>
230 <div class="prefsectiontip">
231 <?php if( $this->data['emailrequired'] ) {
232 $this->msgWiki('prefs-help-email-required');
233 } else {
234 $this->msgWiki('prefs-help-email');
235 } ?>
236 </div>
237 </td>
238 <td></td>
239 <?php } ?>
240 <?php if( $this->data['userealname'] ) { ?>
241 </tr>
242 <tr>
243 <td class="mw-label"><label for='wpRealName'><?php $this->msg('yourrealname') ?></label></td>
244 <td class="mw-input" colspan="2">
245 <input type='text' class='loginText' name="wpRealName" id="wpRealName"
246 tabindex="6"
247 value="<?php $this->text('realname') ?>" size='20' />
248 <div class="prefsectiontip">
249 <?php $this->msgWiki('prefs-help-realname'); ?>
250 </div>
251 </td>
252 <td></td>
253 <?php } ?>
254 <?php if( $this->data['usereason'] ) { ?>
255 </tr>
256 <tr>
257 <td class="mw-label"><label for='wpReason'><?php $this->msg('createaccountreason') ?></label></td>
258 <td class="mw-input" colspan="2">
259 <input type='text' class='loginText' name="wpReason" id="wpReason"
260 tabindex="7"
261 value="<?php $this->text('reason') ?>" size='20' />
262 </td>
263 <?php } ?>
264 </tr>
265 <?php if( $this->data['canremember'] ) { ?>
266 <tr>
267 <td></td>
268 <td class="mw-input" colspan="2">
269 <?php
270 global $wgCookieExpiration, $wgLang;
271 echo Xml::checkLabel(
272 wfMsgExt( 'remembermypassword', 'parsemag', $wgLang->formatNum( ceil( $wgCookieExpiration / ( 3600 * 24 ) ) ) ),
273 'wpRemember',
274 'wpRemember',
275 $this->data['remember'],
276 array( 'tabindex' => '8' )
277 )
278 ?>
279 </td>
280 </tr>
281 <?php }
282
283 $tabIndex = 9;
284 if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
285 foreach ( $this->data['extraInput'] as $inputItem ) { ?>
286 <tr>
287 <?php
288 if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
289 ?><td class="mw-label"><label for="<?php
290 echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
291 $this->msgWiki( $inputItem['msg'] ) ?></label><?php
292 } else {
293 ?><td><?php
294 }
295 ?></td>
296 <td class="mw-input" colspan="2">
297 <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php
298 echo htmlspecialchars( $inputItem['name'] ); ?>"
299 tabindex="<?php echo $tabIndex++; ?>"
300 value="<?php
301 if ( $inputItem['type'] != 'checkbox' ) {
302 echo htmlspecialchars( $inputItem['value'] );
303 } else {
304 echo '1';
305 }
306 ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
307 <?php
308 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
309 echo 'checked="checked"';
310 ?> /> <?php
311 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
312 ?>
313 <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
314 $this->msgHtml( $inputItem['msg'] ) ?></label><?php
315 }
316 if( $inputItem['helptext'] !== false ) {
317 ?>
318 <div class="prefsectiontip">
319 <?php $this->msgWiki( $inputItem['helptext'] ); ?>
320 </div>
321 <?php } ?>
322 </td>
323 </tr>
324 <?php
325
326 }
327 }
328 ?>
329 <tr>
330 <td></td>
331 <td class="mw-submit" colspan="2">
332 <input type='submit' name="wpCreateaccount" id="wpCreateaccount"
333 tabindex="<?php echo $tabIndex++; ?>"
334 value="<?php $this->msg('createaccount') ?>" />
335 <?php if( $this->data['createemail'] ) { ?>
336 <input type='submit' name="wpCreateaccountMail" id="wpCreateaccountMail"
337 tabindex="<?php echo $tabIndex++; ?>"
338 value="<?php $this->msg('createaccountmail') ?>" />
339 <?php } ?>
340 </td>
341 </tr>
342 </table>
343 <?php if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
344 <?php if( @$this->haveData( 'token' ) ) { ?><input type="hidden" name="wpCreateaccountToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
345 </form>
346 </div>
347 <div id="signupend"><?php $this->msgWiki( 'signupend' ); ?></div>
348 <?php
349
350 }
351 }