Code

Udpated JS focus,
[gosa.git] / html / index.php
index c33e7bbcd51c8dd10d7c658ff7ef9b39166db3a0..756d503782033ee7c98f871ab4e123477114ae3c 100644 (file)
@@ -70,7 +70,7 @@ function displayLogin()
       $smarty->assign("errors", $_SESSION['errors']);
     }
     if ($error_collector != ""){
-      $smarty->assign("php_errors", $error_collector."</div>");
+      $smarty->assign("php_errors", preg_replace("/%BUGBODY%/",$error_collector_mailto,$error_collector)."</div>");
     } else {
       $smarty->assign("php_errors", "");
     }
@@ -378,8 +378,16 @@ if ($error_collector != ""){
 } else {
   $smarty->assign("php_errors", "");
 }
-displayLogin();
 
+/* Set focus to the error button if we've an error message */
+$focus= "";
+if (isset($_SESSION['errors']) && $_SESSION['errors'] != ""){
+  $focus= '<script language="JavaScript" type="text/javascript">';
+  $focus.= 'document.forms[0].error_accept.focus();';
+  $focus.= '</script>';
+}
+$smarty->assign("focus", $focus);
+displayLogin();
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>