MediaWiki  REL1_23
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     <div id="userloginprompt"><?php $this->msgWiki('loginprompt') ?></div>
00032     <?php if ( $this->haveData( 'languages' ) ) { ?>
00033         <div id="languagelinks">
00034             <p><?php $this->html( 'languages' ); ?></p>
00035         </div>
00036     <?php } ?>
00037     <div id="userloginForm">
00038         <form name="userlogin" class="mw-ui-vform" method="post" action="<?php $this->text( 'action' ); ?>">
00039             <?php if ( $this->data['loggedin'] ) { ?>
00040                 <div class="warningbox">
00041                     <?php echo $this->getMsg( 'userlogin-loggedin' )->params( $this->data['loggedinuser'] )->parse(); ?>
00042                 </div>
00043             <?php } ?>
00044             <section class="mw-form-header">
00045                 <?php $this->html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?>
00046             </section>
00047 
00048             <?php if ( $this->data['message'] ) { ?>
00049                 <div class="<?php $this->text( 'messagetype' ); ?>box">
00050                     <?php if ( $this->data['messagetype'] == 'error' ) { ?>
00051                         <strong><?php $this->msg( 'loginerror' ); ?></strong>
00052                         <br />
00053                     <?php } ?>
00054                     <?php $this->html( 'message' ); ?>
00055                 </div>
00056             <?php } ?>
00057 
00058             <div>
00059                 <label for='wpName1'>
00060                     <?php
00061                     $this->msg( 'userlogin-yourname' );
00062 
00063                     if ( $this->data['secureLoginUrl'] ) {
00064                         echo Html::element( 'a', array(
00065                             'href' => $this->data['secureLoginUrl'],
00066                             'class' => 'mw-ui-flush-right mw-secure',
00067                         ), $this->getMsg( 'userlogin-signwithsecure' )->text() );
00068                     }
00069                     ?>
00070                 </label>
00071                 <?php
00072                 $extraAttrs = array();
00073                 echo Html::input( 'wpName', $this->data['name'], 'text', array(
00074                     'class' => 'loginText',
00075                     'id' => 'wpName1',
00076                     'tabindex' => '1',
00077                     'size' => '20',
00078                     // 'required' is blacklisted for now in Html.php due to browser issues.
00079                     // Keeping here in case that changes.
00080                     'required' => true,
00081                     // Set focus to this field if it's blank.
00082                     'autofocus' => !$this->data['name'],
00083                     'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
00084                 ) );
00085                 ?>
00086             </div>
00087 
00088             <div>
00089                 <label for='wpPassword1'>
00090                     <?php
00091                     $this->msg( 'userlogin-yourpassword' );
00092 
00093                     if ( $this->data['useemail'] && $this->data['canreset'] && $this->data['resetlink'] === true ) {
00094                         echo ' ' . Linker::link(
00095                             SpecialPage::getTitleFor( 'PasswordReset' ),
00096                             $this->getMsg( 'userlogin-resetpassword-link' )->parse(),
00097                             array( 'class' => 'mw-ui-flush-right' )
00098                         );
00099                     }
00100                     ?>
00101                 </label>
00102                 <?php
00103                 echo Html::input( 'wpPassword', null, 'password', array(
00104                     'class' => 'loginPassword',
00105                     'id' => 'wpPassword1',
00106                     'tabindex' => '2',
00107                     'size' => '20',
00108                     // Set focus to this field if username is filled in.
00109                     'autofocus' => (bool)$this->data['name'],
00110                     'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
00111                 ) );
00112                 ?>
00113             </div>
00114 
00115             <?php
00116             if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
00117                 $select = new XmlSelect( 'wpDomain', false, $this->data['domain'] );
00118                 $select->setAttribute( 'tabindex', 3 );
00119                 foreach ( $this->data['domainnames'] as $dom ) {
00120                     $select->addOption( $dom );
00121                 }
00122             ?>
00123                 <div id="mw-user-domain-section">
00124                     <label for='wpDomain'><?php $this->msg( 'yourdomainname' ); ?></label>
00125                     <?php echo $select->getHTML(); ?>
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( 'pt-login-button' )->text(), 'submit', array(
00151                     'id' => 'wpLoginAttempt',
00152                     'tabindex' => '6',
00153                     'class' => 'mw-ui-button mw-ui-big mw-ui-block mw-ui-constructive'
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                         <a href="<?php $this->text( 'createOrLoginHref' ); ?>" id="mw-createaccount-join" tabindex="7"  class="mw-ui-button"><?php $this->msg( 'userlogin-createanother' ); ?></a>
00174                     </div>
00175                 <?php } else { ?>
00176                     <div id="mw-createaccount-cta">
00177                         <?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>
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 }