Merge "TableSorter: Fix column order when collecting headers"
[lhc/web/wiklou.git] / includes / templates / Userlogin.php
1 <?php
2 /**
3 * Html form for user login (since 1.22 with VForm appearance).
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 class UserloginTemplate extends BaseTemplate {
25
26 function execute() {
27 global $wgCookieExpiration;
28 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
29 ?>
30 <div class="mw-ui-container">
31 <?php if ( $this->haveData( 'languages' ) ) { ?>
32 <div id="languagelinks">
33 <p><?php $this->html( 'languages' ); ?></p>
34 </div>
35 <?php } ?>
36 <div id="userloginForm">
37 <form name="userlogin" class="mw-ui-vform" method="post" action="<?php $this->text( 'action' ); ?>">
38 <?php if ( $this->data['loggedin'] ) { ?>
39 <div class="warningbox">
40 <?php echo $this->getMsg( 'userlogin-loggedin' )->params( $this->data['loggedinuser'] )->parse(); ?>
41 </div>
42 <?php } ?>
43 <section class="mw-form-header">
44 <?php $this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?>
45 </section>
46
47 <?php if ( $this->data['message'] ) { ?>
48 <div class="<?php $this->text( 'messagetype' ); ?>box">
49 <?php if ( $this->data['messagetype'] == 'error' ) { ?>
50 <strong><?php $this->msg( 'loginerror' ); ?></strong>
51 <br />
52 <?php } ?>
53 <?php $this->html( 'message' ); ?>
54 </div>
55 <?php } ?>
56
57 <div>
58 <label for='wpName1'>
59 <?php
60 $this->msg( 'userlogin-yourname' );
61
62 if ( $this->data['secureLoginUrl'] ) {
63 echo Html::element( 'a', array(
64 'href' => $this->data['secureLoginUrl'],
65 'class' => 'mw-ui-flush-right mw-secure',
66 ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
67 }
68 ?>
69 </label>
70 <?php
71 $extraAttrs = array();
72 echo Html::input( 'wpName', $this->data['name'], 'text', array(
73 'class' => 'loginText',
74 'id' => 'wpName1',
75 'tabindex' => '1',
76 'size' => '20',
77 // 'required' is blacklisted for now in Html.php due to browser issues.
78 // Keeping here in case that changes.
79 'required' => true,
80 // Set focus to this field if it's blank.
81 'autofocus' => !$this->data['name'],
82 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
83 ) );
84 ?>
85 </div>
86
87 <div>
88 <label for='wpPassword1'>
89 <?php
90 $this->msg( 'userlogin-yourpassword' );
91
92 if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) {
93 echo ' ' . Linker::link(
94 SpecialPage::getTitleFor( 'PasswordReset' ),
95 $this->getMsg( 'userlogin-resetpassword-link' )->parse(),
96 array( 'class' => 'mw-ui-flush-right' )
97 );
98 }
99 ?>
100 </label>
101 <?php
102 echo Html::input( 'wpPassword', null, 'password', array(
103 'class' => 'loginPassword',
104 'id' => 'wpPassword1',
105 'tabindex' => '2',
106 'size' => '20',
107 // Set focus to this field if username is filled in.
108 'autofocus' => (bool)$this->data['name'],
109 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
110 ) );
111 ?>
112 </div>
113
114 <?php
115 if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
116 $select = new XmlSelect( 'wpDomain', false, $this->data['domain'] );
117 $select->setAttribute( 'tabindex', 3 );
118 foreach ( $this->data['domainnames'] as $dom ) {
119 $select->addOption( $dom );
120 }
121 ?>
122 <div id="mw-user-domain-section">
123 <label for='wpDomain'><?php $this->msg( 'yourdomainname' ); ?></label>
124 <?php echo $select->getHTML(); ?>
125 </div>
126 <?php } ?>
127
128 <?php
129 if ( $this->haveData( 'extrafields' ) ) {
130 echo $this->data['extrafields'];
131 }
132 ?>
133
134 <div>
135 <?php if ( $this->data['canremember'] ) { ?>
136 <label class="mw-ui-checkbox-label">
137 <input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="4"
138 <?php if ( $this->data['remember'] ) {
139 echo 'checked="checked"';
140 } ?>
141 >
142 <?php echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?>
143 </label>
144 <?php } ?>
145 </div>
146
147 <div>
148 <?php
149 echo Html::input( 'wpLoginAttempt', $this->getMsg( 'pt-login' )->text(), 'submit', array(
150 'id' => 'wpLoginAttempt',
151 'tabindex' => '6',
152 'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-constructive'
153 ) );
154 ?>
155 </div>
156
157 <div id="mw-userlogin-help">
158 <?php echo $this->getMsg( 'userlogin-helplink' )->parse(); ?>
159 </div>
160 <?php if ( $this->haveData( 'createOrLoginHref' ) ) { ?>
161 <?php if ( $this->data['loggedin'] ) { ?>
162 <div id="mw-createaccount-another">
163 <a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7" class="mw-ui-button"><?php $this->msg( 'userlogin-createanother' ); ?></a>
164 </div>
165 <?php } else { ?>
166 <div id="mw-createaccount-cta">
167 <?php $this->msg( 'userlogin-noaccount' ); ?><a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7" class="mw-ui-button mw-ui-progressive"><?php $this->msg( 'userlogin-joinproject' ); ?></a>
168 </div>
169 <?php } ?>
170 <?php } ?>
171 <?php if ( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
172 <?php if ( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
173 <?php if ( $this->data['cansecurelogin'] ) {?><input type="hidden" name="wpForceHttps" value="<?php $this->text( 'stickhttps' ); ?>" /><?php } ?>
174 </form>
175 </div>
176 </div>
177 <?php
178
179 }
180 }