* Allow extensions to modify the user creation form by calling addInputItem();
[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 <h2><?php $this->msg('loginerror') ?>:</h2>
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 <input type='text' class='loginText' name="wpName" id="wpName1"
39 tabindex="1"
40 value="<?php $this->text('name') ?>" size='20' />
41 </td>
42 </tr>
43 <tr>
44 <td class="mw-label"><label for='wpPassword1'><?php $this->msg('yourpassword') ?></label></td>
45 <td class="mw-input">
46 <input type='password' class='loginPassword' name="wpPassword" id="wpPassword1"
47 tabindex="2"
48 value="" size='20' />
49 </td>
50 </tr>
51 <?php if( $this->data['usedomain'] ) {
52 $doms = "";
53 foreach( $this->data['domainnames'] as $dom ) {
54 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
55 }
56 ?>
57 <tr>
58 <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
59 <td class="mw-input">
60 <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
61 tabindex="3">
62 <?php echo $doms ?>
63 </select>
64 </td>
65 </tr>
66 <?php } ?>
67 <tr>
68 <td></td>
69 <td class="mw-input">
70 <input type='checkbox' name="wpRemember"
71 tabindex="4"
72 value="1" id="wpRemember"
73 <?php if( $this->data['remember'] ) { ?>checked="checked"<?php } ?>
74 /> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
75 </td>
76 </tr>
77 <tr>
78 <td></td>
79 <td class="mw-submit">
80 <input type='submit' name="wpLoginattempt" id="wpLoginattempt" tabindex="5" value="<?php $this->msg('login') ?>" />&nbsp;<?php if( $this->data['useemail'] && $this->data['canreset']) { ?><input type='submit' name="wpMailmypassword" id="wpMailmypassword"
81 tabindex="6"
82 value="<?php $this->msg('mailmypassword') ?>" />
83 <?php } ?>
84 </td>
85 </tr>
86 </table>
87 <?php if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
88 </form>
89 </div>
90 <div id="loginend"><?php $this->msgWiki( 'loginend' ); ?></div>
91 <?php
92
93 }
94 }
95
96 /**
97 * @ingroup Templates
98 */
99 class UsercreateTemplate extends QuickTemplate {
100 function addInputItem( $name, $value, $type, $msg ) {
101 $this->data['extraInput'][] = array(
102 'name' => $name,
103 'value' => $value,
104 'type' => $type,
105 'msg' => $msg,
106 );
107 }
108
109 function execute() {
110 if( $this->data['message'] ) {
111 ?>
112 <div class="<?php $this->text('messagetype') ?>box">
113 <?php if ( $this->data['messagetype'] == 'error' ) { ?>
114 <h2><?php $this->msg('loginerror') ?>:</h2>
115 <?php } ?>
116 <?php $this->html('message') ?>
117 </div>
118 <div class="visualClear"></div>
119 <?php } ?>
120 <div id="userlogin">
121
122 <form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text('action') ?>">
123 <h2><?php $this->msg('createaccount') ?></h2>
124 <p id="userloginlink"><?php $this->html('link') ?></p>
125 <?php $this->html('header'); /* pre-table point for form plugins... */ ?>
126 <?php if( @$this->haveData( 'languages' ) ) { ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php } ?>
127 <table>
128 <tr>
129 <td class="mw-label"><label for='wpName2'><?php $this->msg('yourname') ?></label></td>
130 <td class="mw-input">
131 <input type='text' class='loginText' name="wpName" id="wpName2"
132 tabindex="1"
133 value="<?php $this->text('name') ?>" size='20' />
134 </td>
135 </tr>
136 <tr>
137 <td class="mw-label"><label for='wpPassword2'><?php $this->msg('yourpassword') ?></label></td>
138 <td class="mw-input">
139 <input type='password' class='loginPassword' name="wpPassword" id="wpPassword2"
140 tabindex="2"
141 value="" size='20' />
142 </td>
143 </tr>
144 <?php if( $this->data['usedomain'] ) {
145 $doms = "";
146 foreach( $this->data['domainnames'] as $dom ) {
147 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
148 }
149 ?>
150 <tr>
151 <td class="mw-label"><?php $this->msg( 'yourdomainname' ) ?></td>
152 <td class="mw-input">
153 <select name="wpDomain" value="<?php $this->text( 'domain' ) ?>"
154 tabindex="3">
155 <?php echo $doms ?>
156 </select>
157 </td>
158 </tr>
159 <?php } ?>
160 <tr>
161 <td class="mw-label"><label for='wpRetype'><?php $this->msg('yourpasswordagain') ?></label></td>
162 <td class="mw-input">
163 <input type='password' class='loginPassword' name="wpRetype" id="wpRetype"
164 tabindex="4"
165 value=""
166 size='20' />
167 </td>
168 </tr>
169 <tr>
170 <?php if( $this->data['useemail'] ) { ?>
171 <td class="mw-label"><label for='wpEmail'><?php $this->msg('youremail') ?></label></td>
172 <td class="mw-input">
173 <input type='text' class='loginText' name="wpEmail" id="wpEmail"
174 tabindex="5"
175 value="<?php $this->text('email') ?>" size='20' />
176 <div class="prefsectiontip">
177 <?php if( $this->data['emailrequired'] ) {
178 $this->msgWiki('prefs-help-email-required');
179 } else {
180 $this->msgWiki('prefs-help-email');
181 } ?>
182 </div>
183 </td>
184 <?php } ?>
185 <?php if( $this->data['userealname'] ) { ?>
186 </tr>
187 <tr>
188 <td class="mw-label"><label for='wpRealName'><?php $this->msg('yourrealname') ?></label></td>
189 <td class="mw-input">
190 <input type='text' class='loginText' name="wpRealName" id="wpRealName"
191 tabindex="6"
192 value="<?php $this->text('realname') ?>" size='20' />
193 <div class="prefsectiontip">
194 <?php $this->msgWiki('prefs-help-realname'); ?>
195 </div>
196 </td>
197 <?php } ?>
198 </tr>
199 <tr>
200 <td></td>
201 <td class="mw-input">
202 <input type='checkbox' name="wpRemember"
203 tabindex="7"
204 value="1" id="wpRemember"
205 <?php if( $this->data['remember'] ) { ?>checked="checked"<?php } ?>
206 /> <label for="wpRemember"><?php $this->msg('remembermypassword') ?></label>
207 </td>
208 </tr>
209 <?php
210 $tabIndex = 8;
211 if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
212 foreach ( $this->data['extraInput'] as $inputItem ) { ?>
213 <tr>
214 <?php
215 if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
216 ?><td class="mw-label"><label for="<?php
217 echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
218 $this->msgWiki( $inputItem['msg'] ) ?></label><?php
219 } else {
220 ?><td><?php
221 }
222 ?></td>
223 <td class="mw-input">
224 <input type="<?php echo htmlspecialchars( $inputItem['type'] ) ?>" name="<?php
225 echo htmlspecialchars( $inputItem['name'] ); ?>"
226 tabindex="<?php echo $tabIndex++; ?>"
227 value="<?php
228 if ( $inputItem['type'] != 'checkbox' ) {
229 echo htmlspecialchars( $inputItem['value'] );
230 } else {
231 echo '1';
232 }
233 ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
234 <?php
235 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) )
236 echo 'checked="checked"';
237 ?> /> <?php
238 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
239 ?>
240 <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
241 $this->msg( $inputItem['msg'] ) ?></label><?php
242 }
243 ?>
244 </td>
245 </tr>
246 <?php
247
248 }
249 }
250 ?>
251 <tr>
252 <td></td>
253 <td class="mw-submit">
254 <input type='submit' name="wpCreateaccount" id="wpCreateaccount"
255 tabindex="<?php echo $tabIndex++; ?>"
256 value="<?php $this->msg('createaccount') ?>" />
257 <?php if( $this->data['createemail'] ) { ?>
258 <input type='submit' name="wpCreateaccountMail" id="wpCreateaccountMail"
259 tabindex="<?php echo $tabIndex++; ?>"
260 value="<?php $this->msg('createaccountmail') ?>" />
261 <?php } ?>
262 </td>
263 </tr>
264 </table>
265 <?php if( @$this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
266 </form>
267 </div>
268 <div id="signupend"><?php $this->msgWiki( 'signupend' ); ?></div>
269 <?php
270
271 }
272 }