Add "alreadyFocused" functionality to login page
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 30 Jan 2008 20:18:33 +0000 (20:18 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 30 Jan 2008 20:18:33 +0000 (20:18 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12910 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/login.php
templates/default/login.tpl
templates/default_advanced/login.tpl

index 49251d7ed022cc62c5ea67dcd0750952b5e80475..226ccd8a2d9c17c2a01699419da1e0a1bbe6d57c 100644 (file)
@@ -67,7 +67,9 @@ $loginname_value = (sqGetGlobalVar('loginname', $loginname) ? htmlspecialchars($
 /* Output the javascript onload function. */
 $header = "<script type=\"text/javascript\">\n" .
           "<!--\n".
+          "  var alreadyFocused = false;\n".
           "  function squirrelmail_loginpage_onload() {\n".
+          "    if (alreadyFocused) return;\n".
           "    var textElements = 0; var i = 0;\n".
           "    for (i = 0; i < document.forms[0].elements.length; i++) {\n".
           "      if (document.forms[0].elements[i].type == \"text\" || document.forms[0].elements[i].type == \"password\") {\n".
index 177eeee86b6b84a938b2a1c859171f2ed58a02a8..3b3901592b11fabf5faa7b789764c647eb10b025 100644 (file)
@@ -49,7 +49,7 @@ extract($t);
    <?php echo _("Name:"); ?>
   </td>
   <td class="sqm_loginFieldInput">
-   <input type="text" name="login_username" value="<?php echo $login_field_value; ?>" id="login_username" />
+   <input type="text" name="login_username" value="<?php echo $login_field_value; ?>" id="login_username" onfocus="alreadyFocused=true;" />
   </td>
  </tr>
  <tr>
@@ -57,7 +57,7 @@ extract($t);
    <?php echo _("Password:"); ?>
   </td>
   <td class="sqm_loginFieldInput">
-   <input type="password" name="secretkey" value="" id="secretkey" />
+   <input type="password" name="secretkey" value="" id="secretkey" onfocus="alreadyFocused=true;" />
    <?php echo $login_extra; ?>
   </td>
  </tr>
index a18ff183a150a555b02599d5391d976a78aa1b6d..b89fe0425a23c545477879c098efcd96d05c1a07 100644 (file)
@@ -59,7 +59,7 @@ extract($t);
       <?php echo _("Name:"); ?>
      </td>
      <td class="fieldInput">
-      <input type="text" name="login_username" value="<?php echo $login_field_value; ?>" id="login_username" class="input" />
+      <input type="text" name="login_username" value="<?php echo $login_field_value; ?>" id="login_username" class="input" onfocus="alreadyFocused=true;" />
      </td>
     </tr>
     <tr>
@@ -67,7 +67,7 @@ extract($t);
       <?php echo _("Password:"); ?>
      </td>
      <td class="fieldInput">
-      <input type="password" name="secretkey" value="" id="secretkey" class="input" />
+      <input type="password" name="secretkey" value="" id="secretkey" class="input" onfocus="alreadyFocused=true;" />
       <?php echo $login_extra; ?>
      </td>
     </tr>