Merge "Add fastcgi_finish_request where appropriate"
[lhc/web/wiklou.git] / includes / templates / Userlogin.php
index f5ae353..38e071c 100644 (file)
@@ -69,10 +69,6 @@ class UserloginTemplate extends BaseTemplate {
                                </label>
                                <?php
                                $extraAttrs = array();
-                               // Set focus to this field if it's blank.
-                               if ( !$this->data['name'] ) {
-                                       $extraAttrs['autofocus'] = '';
-                               }
                                echo Html::input( 'wpName', $this->data['name'], 'text', array(
                                        'class' => 'loginText',
                                        'id' => 'wpName1',
@@ -80,9 +76,11 @@ class UserloginTemplate extends BaseTemplate {
                                        'size' => '20',
                                        // 'required' is blacklisted for now in Html.php due to browser issues.
                                        // Keeping here in case that changes.
-                                       'required',
+                                       'required' => true,
+                                       // Set focus to this field if it's blank.
+                                       'autofocus' => !$this->data['name'],
                                        'placeholder' => $this->getMsg( 'userlogin-yourname-ph' )->text()
-                               ) + $extraAttrs );
+                               ) );
                                ?>
                        </div>
 
@@ -101,33 +99,29 @@ class UserloginTemplate extends BaseTemplate {
                                        ?>
                                </label>
                                <?php
-                               $extraAttrs = array();
-                               // Set focus to this field if username is filled in.
-                               if ( $this->data['name'] ) {
-                                       $extraAttrs['autofocus'] = '';
-                               }
                                echo Html::input( 'wpPassword', null, 'password', array(
                                        'class' => 'loginPassword',
                                        'id' => 'wpPassword1',
                                        'tabindex' => '2',
                                        'size' => '20',
+                                       // Set focus to this field if username is filled in.
+                                       'autofocus' => (bool)$this->data['name'],
                                        'placeholder' => $this->getMsg( 'userlogin-yourpassword-ph' )->text()
-                               ) + $extraAttrs );
+                               ) );
                                ?>
                        </div>
 
                        <?php
                        if ( isset( $this->data['usedomain'] ) && $this->data['usedomain'] ) {
-                               $doms = "";
+                               $select = new XmlSelect( 'wpDomain', false, $this->data['domain'] );
+                               $select->setAttribute( 'tabindex', 3 );
                                foreach ( $this->data['domainnames'] as $dom ) {
-                                       $doms .= "<option>" . htmlspecialchars( $dom ) . "</option>";
+                                       $select->addOption( $dom );
                                }
                        ?>
                                <div id="mw-user-domain-section">
                                        <label for='wpDomain'><?php $this->msg( 'yourdomainname' ); ?></label>
-                                       <select name="wpDomain" value="<?php $this->text( 'domain' ); ?>" tabindex="3">
-                                               <?php echo $doms; ?>
-                                       </select>
+                                       <?php echo $select->getHTML(); ?>
                                </div>
                        <?php } ?>