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 49251d7..226ccd8 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 177eeee..3b39015 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 a18ff18..b89fe04 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>