Merge "(bug 17602) fix Monobook action tabs not quite touching the page body"
[lhc/web/wiklou.git] / includes / templates / UserloginVForm.php
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 *
18 * @file
19 * @ingroup Templates
20 */
21
22
23 /**
24 * Html form for user login with new VForm appearance.
25 */
26 class UserloginTemplateVForm extends BaseTemplate {
27
28 function execute() {
29 global $wgCookieExpiration;
30 $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
31 ?>
32 <div class="mw-ui-container">
33 <?php
34 if ( $this->haveData( 'languages' ) ) {
35 ?>
36 <div id="languagelinks">
37 <p><?php $this->html( 'languages' ); ?></p>
38 </div>
39 <?php
40 }
41 ?>
42 <div id="userloginForm">
43 <form name="userlogin" class="mw-ui-vform" method="post" action="<?php $this->text( 'action' ); ?>">
44 <section class="mw-form-header">
45 <?php $this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?>
46 </section>
47 <?php
48
49 if ( $this->data['message'] ) {
50 ?>
51 <div class="<?php $this->text( 'messagetype' ); ?>box">
52 <?php
53 if ( $this->data['messagetype'] == 'error' ) {
54 ?>
55 <strong><?php $this->msg( 'loginerror' ) ?></strong><br />
56 <?php
57 }
58 $this->html( 'message' );
59 ?>
60 </div>
61 <?php
62 }
63 ?>
64 <div>
65 <label for='wpName1'>
66 <?php
67 $this->msg( 'userlogin-yourname' );
68 if ( $this->data['secureLoginUrl'] ) {
69 echo Html::element( 'a', array(
70 'href' => $this->data['secureLoginUrl'],
71 'class' => 'mw-ui-flush-right mw-secure',
72 ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
73 } ?>
74 </label>
75 <?php
76 $extraAttrs = array();
77 // Set focus to this field if its blank.
78 if ( !$this->data['name'] ) {
79 $extraAttrs['autofocus'] = '';
80 }
81 echo Html::input( 'wpName', $this->data['name'], 'text', array(
82 'class' => 'loginText',
83 'id' => 'wpName1',
84 'tabindex' => '1',
85 'size' => '20',
86 // 'required' is blacklisted for now in Html.php due to browser issues.
87 // Keeping here in case that changes
88 'required',
89 'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
90 ) + $extraAttrs );
91 ?>
92 </div>
93 <div>
94 <label for='wpPassword1'>
95 <?php
96 $this->msg( 'userlogin-yourpassword' );
97
98 if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) {
99 echo Linker::link(
100 SpecialPage::getTitleFor( 'PasswordReset' ),
101 $this->getMsg( 'userlogin-resetpassword-link' )->parse(),
102 array( 'class' => 'mw-ui-flush-right' )
103 );
104 // TODO: remove the wpMailmypassword code branch from
105 // templates/Userlogin.php as well; it is never executed and
106 // doesn't work.
107 }
108 ?>
109 </label>
110 <?php
111 $extraAttrs = array();
112 // Set focus to this field if username is filled in.
113 if ( $this->data['name'] ) {
114 $extraAttrs['autofocus'] = '';
115 }
116 echo Html::input( 'wpPassword', null, 'password', array(
117 'class' => 'loginPassword',
118 'id' => 'wpPassword1',
119 'tabindex' => '2',
120 'size' => '20',
121 'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
122 ) + $extraAttrs );
123 ?>
124 </div>
125 <?php
126 if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
127 $doms = "";
128 foreach ( $this->data['domainnames'] as $dom ) {
129 $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
130 }
131 ?>
132 <div id="mw-user-domain-section">
133 <label for='wpDomain' class="pos-above"><?php $this->msg( 'yourdomain' ); ?></label>
134 <select name="wpDomain" value="<?php $this->text( 'domain' ); ?>"
135 tabindex="3">
136 <?php echo $doms ?>
137 </select>
138 </div>
139 <?php }
140
141 if ( $this->haveData( 'extrafields' ) ) {
142 echo $this->data['extrafields'];
143 } ?>
144
145 <div>
146
147 <?php if ( $this->data['canremember'] ) { ?>
148 <label class="mw-ui-checkbox-label">
149 <input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="4"
150 <?php if ( $this->data['remember'] ) {
151 echo 'checked="checked"';
152 } ?>
153 >
154 <?php echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?>
155 </label>
156 <?php } ?>
157 </div>
158
159 <?php if ( $this->data['cansecurelogin'] ) { ?>
160 <div>
161 <label class="mw-ui-checkbox-label">
162 <input name="wpStickHTTPS" type="checkbox" value="1" id="wpStickHTTPS" tabindex="5"
163 <?php if ( $this->data['stickHTTPS'] ) {
164 echo 'checked="checked"';
165 } ?>
166 >
167 <?php $this->msg( 'securelogin-stick-https' ); ?>
168 </label>
169 </div>
170 <?php } ?>
171 <div>
172 <?php
173 echo Html::input( 'wpLoginAttempt', $this->getMsg( 'login' )->text(), 'submit', array(
174 'id' => 'wpLoginAttempt',
175 'tabindex' => '6',
176 'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-primary'
177 ) );
178 ?>
179 </div>
180 <div id="mw-userlogin-help">
181 <?php echo $this->getMsg( 'userlogin-helplink' )->parse(); ?>
182 </div>
183 <?php if ( $this->haveData( 'createOrLoginHref' ) ) { ?>
184 <div id="mw-createaccount-cta">
185 <h3 id="mw-userloginlink"><?php $this->msg( 'userlogin-noaccount' ); ?><a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7" class="mw-ui-button mw-ui-constructive"><?php $this->msg( 'userlogin-joinproject' ); ?></a></h3>
186 </div>
187 <?php } ?>
188 <input type="hidden" id="mw-useNew" name="useNew" value="1" />
189 <?php if ( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
190 <?php if ( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
191 </form>
192 </div>
193 </div>
194 <?php
195 }
196 }