MediaWiki  REL1_22
Userlogin.php
Go to the documentation of this file.
00001 <?php
00024 class UserloginTemplate extends BaseTemplate {
00025 
00026     function execute() {
00027         global $wgCookieExpiration;
00028         $expirationDays = ceil( $wgCookieExpiration / ( 3600 * 24 ) );
00029 ?>
00030 <div class="mw-ui-container">
00031     <?php if ( $this->haveData( 'languages' ) ) { ?>
00032         <div id="languagelinks">
00033             <p><?php $this->html( 'languages' ); ?></p>
00034         </div>
00035     <?php } ?>
00036     <div id="userloginForm">
00037         <form name="userlogin" class="mw-ui-vform" method="post" action="<?php $this->text( 'action' ); ?>">
00038             <?php if ( $this->data['loggedin'] ) { ?>
00039                 <div class="warningbox">
00040                     <?php echo $this->getMsg( 'userlogin-loggedin' )->params( $this->data['loggedinuser'] )->parse(); ?>
00041                 </div>
00042             <?php } ?>
00043             <section class="mw-form-header">
00044                 <?php $this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?>
00045             </section>
00046 
00047             <?php if ( $this->data['message'] ) { ?>
00048                 <div class="<?php $this->text( 'messagetype' ); ?>box">
00049                     <?php if ( $this->data['messagetype'] == 'error' ) { ?>
00050                         <strong><?php $this->msg( 'loginerror' ); ?></strong>
00051                         <br />
00052                     <?php } ?>
00053                     <?php $this->html( 'message' ); ?>
00054                 </div>
00055             <?php } ?>
00056 
00057             <div>
00058                 <label for='wpName1'>
00059                     <?php
00060                     $this->msg( 'userlogin-yourname' );
00061 
00062                     if ( $this->data['secureLoginUrl'] ) {
00063                         echo Html::element( 'a', array(
00064                             'href' => $this->data['secureLoginUrl'],
00065                             'class' => 'mw-ui-flush-right mw-secure',
00066                         ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
00067                     }
00068                     ?>
00069                 </label>
00070                 <?php
00071                 $extraAttrs = array();
00072                 echo Html::input( 'wpName', $this->data['name'], 'text', array(
00073                     'class' => 'loginText',
00074                     'id' => 'wpName1',
00075                     'tabindex' => '1',
00076                     'size' => '20',
00077                     // 'required' is blacklisted for now in Html.php due to browser issues.
00078                     // Keeping here in case that changes.
00079                     'required' => true,
00080                     // Set focus to this field if it's blank.
00081                     'autofocus' => !$this->data['name'],
00082                     'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
00083                 ) );
00084                 ?>
00085             </div>
00086 
00087             <div>
00088                 <label for='wpPassword1'>
00089                     <?php
00090                     $this->msg( 'userlogin-yourpassword' );
00091 
00092                     if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) {
00093                         echo ' ' . Linker::link(
00094                             SpecialPage::getTitleFor( 'PasswordReset' ),
00095                             $this->getMsg( 'userlogin-resetpassword-link' )->parse(),
00096                             array( 'class' => 'mw-ui-flush-right' )
00097                         );
00098                     }
00099                     ?>
00100                 </label>
00101                 <?php
00102                 echo Html::input( 'wpPassword', null, 'password', array(
00103                     'class' => 'loginPassword',
00104                     'id' => 'wpPassword1',
00105                     'tabindex' => '2',
00106                     'size' => '20',
00107                     // Set focus to this field if username is filled in.
00108                     'autofocus' => (bool)$this->data['name'],
00109                     'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
00110                 ) );
00111                 ?>
00112             </div>
00113 
00114             <?php
00115             if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
00116                 $doms = "";
00117                 foreach ( $this->data['domainnames'] as $dom ) {
00118                     $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
00119                 }
00120             ?>
00121                 <div id="mw-user-domain-section">
00122                     <label for='wpDomain'><?php $this->msg( 'yourdomainname' ); ?></label>
00123                     <select name="wpDomain" value="<?php $this->text( 'domain' ); ?>" tabindex="3">
00124                         <?php echo $doms; ?>
00125                     </select>
00126                 </div>
00127             <?php } ?>
00128 
00129             <?php
00130             if ( $this->haveData( 'extrafields' ) ) {
00131                 echo $this->data['extrafields'];
00132             }
00133             ?>
00134 
00135             <div>
00136                 <?php if ( $this->data['canremember'] ) { ?>
00137                     <label class="mw-ui-checkbox-label">
00138                         <input name="wpRemember" type="checkbox" value="1" id="wpRemember" tabindex="4"
00139                             <?php if ( $this->data['remember'] ) {
00140                                 echo 'checked="checked"';
00141                             } ?>
00142                         >
00143                         <?php echo $this->getMsg( 'userlogin-remembermypassword' )->numParams( $expirationDays )->escaped(); ?>
00144                     </label>
00145                 <?php } ?>
00146             </div>
00147 
00148             <div>
00149                 <?php
00150                 echo Html::input( 'wpLoginAttempt', $this->getMsg( 'login' )->text(), 'submit', array(
00151                     'id' => 'wpLoginAttempt',
00152                     'tabindex' => '6',
00153                     'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-primary'
00154                 ) );
00155                 ?>
00156             </div>
00157             <div id="mw-userlogin-help">
00158                 <?php
00159                 echo Html::element(
00160                     'a',
00161                     array(
00162                         'href' => Skin::makeInternalOrExternalUrl(
00163                             wfMessage( 'helplogin-url' )->inContentLanguage()->text()
00164                         ),
00165                     ),
00166                     $this->getMsg( 'userlogin-helplink2' )->text()
00167                 );
00168                 ?>
00169             </div>
00170             <?php if ( $this->haveData( 'createOrLoginHref' ) ) { ?>
00171                 <?php if ( $this->data['loggedin'] ) { ?>
00172                     <div id="mw-createaccount-another">
00173                         <h3 id="mw-userloginlink"><a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7"  class="mw-ui-button"><?php $this->msg( 'userlogin-createanother' ); ?></a></h3>
00174                     </div>
00175                 <?php } else { ?>
00176                     <div id="mw-createaccount-cta">
00177                         <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>
00178                     </div>
00179                 <?php } ?>
00180             <?php } ?>
00181             <?php if ( $this->haveData( 'uselang' ) ) { ?><input type="hidden" name="uselang" value="<?php $this->text( 'uselang' ); ?>" /><?php } ?>
00182             <?php if ( $this->haveData( 'token' ) ) { ?><input type="hidden" name="wpLoginToken" value="<?php $this->text( 'token' ); ?>" /><?php } ?>
00183             <?php if ( $this->data['cansecurelogin'] ) {?><input type="hidden" name="wpForceHttps" value="<?php $this->text( 'stickhttps' ); ?>" /><?php } ?>
00184         </form>
00185     </div>
00186 </div>
00187 <?php
00188 
00189     }
00190 }