Merge "jquery.tablesorter: Reset unaffected columns' sort counts when sorting"
[lhc/web/wiklou.git] / includes / templates / Usercreate.php
1 <?php
2 /**
3 * Html form for account creation.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup Templates
22 */
23
24 /**
25 * @defgroup Templates Templates
26 */
27
28 if ( !defined( 'MEDIAWIKI' ) ) {
29 die( -1 );
30 }
31
32 /**
33 * @ingroup Templates
34 */
35 class UsercreateTemplate extends QuickTemplate {
36 function addInputItem( $name, $value, $type, $msg, $helptext = false ) {
37 $this->data['extraInput'][] = array(
38 'name' => $name,
39 'value' => $value,
40 'type' => $type,
41 'msg' => $msg,
42 'helptext' => $helptext,
43 );
44 }
45
46 function execute() {
47 if ( $this->data['message'] ) {
48 ?>
49 <div class="<?php $this->text( 'messagetype' ); ?>box">
50 <?php
51 if ( $this->data['messagetype'] == 'error' ) {
52 ?><strong><?php $this->msg( 'loginerror' ); ?></strong><br /><?php
53 }
54 $this->html( 'message' );
55 ?>
56 </div>
57 <div class="visualClear"></div>
58 <?php
59 }
60 ?>
61
62 <div id="signupstart"><?php $this->msgWiki( 'signupstart' ); ?></div>
63 <div id="userlogin">
64
65 <form name="userlogin2" id="userlogin2" method="post" action="<?php $this->text( 'action' ); ?>">
66 <h2><?php $this->msg( 'createaccount' ); ?></h2>
67 <p id="userloginlink"><?php $this->html( 'link' ); ?></p>
68 <?php $this->html( 'header' ); /* pre-table point for form plugins... */ ?>
69 <?php
70 if ( $this->haveData( 'languages' ) ) {
71 ?><div id="languagelinks"><p><?php $this->html( 'languages' ); ?></p></div><?php
72 }
73 ?>
74 <table>
75 <tr>
76 <td class="mw-label"><label for='wpName2'><?php $this->msg( 'yourname' ); ?></label></td>
77 <td class="mw-input">
78 <?php
79 echo Html::input( 'wpName', $this->data['name'], 'text', array(
80 'class' => 'loginText',
81 'id' => 'wpName2',
82 'tabindex' => '1',
83 'size' => '20',
84 'required',
85 'autofocus'
86 ) ); ?>
87 </td>
88 </tr>
89 <tr>
90 <td></td>
91 <td class="mw-input">
92 <?php
93 if ( $this->data['createemail'] ) {
94 echo Xml::checkLabel(
95 wfMessage( 'createaccountmail' )->text(),
96 'wpCreateaccountMail',
97 'wpCreateaccountMail',
98 $this->data['createemailset'],
99 array( 'tabindex' => '2' )
100 );
101 }
102 ?>
103 </td>
104 </tr>
105 <tr class="mw-row-password">
106 <td class="mw-label"><label for='wpPassword2'><?php $this->msg( 'yourpassword' ); ?></label></td>
107 <td class="mw-input">
108 <?php
109 echo Html::input( 'wpPassword', null, 'password', array(
110 'class' => 'loginPassword',
111 'id' => 'wpPassword2',
112 'tabindex' => '3',
113 'size' => '20'
114 ) + User::passwordChangeInputAttribs() ); ?>
115 </td>
116 </tr>
117 <?php
118 if ( $this->data['usedomain'] ) {
119 $doms = "";
120 foreach ( $this->data['domainnames'] as $dom ) {
121 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
122 }
123 ?>
124 <tr id="mw-user-domain-section">
125 <td class="mw-label"><?php $this->msg( 'yourdomainname' ); ?></td>
126 <td class="mw-input">
127 <select name="wpDomain" value="<?php $this->text( 'domain' ); ?>"
128 tabindex="4">
129 <?php echo $doms ?>
130 </select>
131 </td>
132 </tr>
133 <?php
134 }
135 ?>
136 <tr class="mw-row-password">
137 <td class="mw-label"><label for='wpRetype'><?php $this->msg( 'yourpasswordagain' ); ?></label></td>
138 <td class="mw-input">
139 <?php
140 echo Html::input( 'wpRetype', null, 'password', array(
141 'class' => 'loginPassword',
142 'id' => 'wpRetype',
143 'tabindex' => '5',
144 'size' => '20'
145 ) + User::passwordChangeInputAttribs() ); ?>
146 </td>
147 </tr>
148 <tr>
149 <?php
150 if ( $this->data['useemail'] ) {
151 ?>
152 <td class="mw-label"><label for='wpEmail'><?php $this->msg( 'youremail' ); ?></label></td>
153 <td class="mw-input">
154 <?php
155 echo Html::input( 'wpEmail', $this->data['email'], 'email', array(
156 'class' => 'loginText',
157 'id' => 'wpEmail',
158 'tabindex' => '6',
159 'size' => '20'
160 ) ); ?>
161 <div class="prefsectiontip">
162 <?php // duplicated in Preferences.php profilePreferences()
163 if ( $this->data['emailrequired'] ) {
164 $this->msgWiki( 'prefs-help-email-required' );
165 } else {
166 $this->msgWiki( 'prefs-help-email' );
167 }
168 if ( $this->data['emailothers'] ) {
169 $this->msgWiki( 'prefs-help-email-others' );
170 } ?>
171 </div>
172 </td>
173 <?php
174 }
175
176 if ( $this->data['userealname'] ) {
177 ?>
178 </tr>
179 <tr>
180 <td class="mw-label"><label for='wpRealName'><?php $this->msg( 'yourrealname' ); ?></label></td>
181 <td class="mw-input">
182 <input type='text' class='loginText' name="wpRealName" id="wpRealName"
183 tabindex="7"
184 value="<?php $this->text( 'realname' ); ?>" size='20' />
185 <div class="prefsectiontip">
186 <?php $this->msgWiki( 'prefs-help-realname' ); ?>
187 </div>
188 </td>
189 <?php
190 }
191
192 if ( $this->data['usereason'] ) {
193 ?>
194 </tr>
195 <tr>
196 <td class="mw-label"><label for='wpReason'><?php $this->msg( 'createaccountreason' ); ?></label></td>
197 <td class="mw-input">
198 <input type='text' class='loginText' name="wpReason" id="wpReason"
199 tabindex="8"
200 value="<?php $this->text( 'reason' ); ?>" size='20' />
201 </td>
202 <?php
203 }
204 ?>
205 </tr>
206 <?php
207 if ( $this->data['canremember'] ) {
208 ?>
209 <tr>
210 <td></td>
211 <td class="mw-input">
212 <?php
213 global $wgCookieExpiration;
214 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
215 echo Xml::checkLabel(
216 wfMessage( 'remembermypassword' )->numParams( $expirationDays )->text(),
217 'wpRemember',
218 'wpRemember',
219 $this->data['remember'],
220 array( 'tabindex' => '9' )
221 )
222 ?>
223 </td>
224 </tr>
225 <?php
226 }
227
228 $tabIndex = 10;
229 if ( isset( $this->data['extraInput'] ) && is_array( $this->data['extraInput'] ) ) {
230 foreach ( $this->data['extraInput'] as $inputItem ) { ?>
231 <tr>
232 <?php
233 if ( !empty( $inputItem['msg'] ) && $inputItem['type'] != 'checkbox' ) {
234 ?><td class="mw-label"><label for="<?php
235 echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
236 $this->msgWiki( $inputItem['msg'] ); ?></label><?php
237 } else {
238 ?><td><?php
239 }
240 ?></td>
241 <td class="mw-input">
242 <input type="<?php echo htmlspecialchars( $inputItem['type'] ); ?>" name="<?php
243 echo htmlspecialchars( $inputItem['name'] ); ?>"
244 tabindex="<?php echo $tabIndex++; ?>"
245 value="<?php
246 if ( $inputItem['type'] != 'checkbox' ) {
247 echo htmlspecialchars( $inputItem['value'] );
248 } else {
249 echo '1';
250 }
251 ?>" id="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"
252 <?php
253 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['value'] ) ) {
254 echo 'checked="checked"';
255 }
256 ?> /> <?php
257 if ( $inputItem['type'] == 'checkbox' && !empty( $inputItem['msg'] ) ) {
258 ?>
259 <label for="<?php echo htmlspecialchars( $inputItem['name'] ); ?>"><?php
260 $this->msgHtml( $inputItem['msg'] ); ?></label><?php
261 }
262 if ( $inputItem['helptext'] !== false ) {
263 ?>
264 <div class="prefsectiontip">
265 <?php $this->msgWiki( $inputItem['helptext'] ); ?>
266 </div><?php
267 }
268 ?>
269 </td>
270 </tr>
271 <?php
272 }
273 }
274 ?>
275 <tr>
276 <td></td>
277 <td class="mw-submit">
278 <input type='submit' name="wpCreateaccount" id="wpCreateaccount"
279 tabindex="<?php echo $tabIndex++; ?>"
280 value="<?php $this->msg( 'createaccount' ); ?>" />
281 </td>
282 </tr>
283 </table>
284 <?php
285 if ( $this->haveData( 'uselang' ) ) {
286 ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php
287 }
288 if ( $this->haveData( 'token' ) ) {
289 ?><input type="hidden" name="wpCreateaccountToken" value="<?php $this->text( 'token' ); ?>" /><?php
290 }
291 ?>
292 </form>
293 </div>
294 <div id="signupend"><?php $this->html( 'signupend' ); ?></div>
295 <?php
296
297 }
298 }