Code

Updated focus handling
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Jun 2007 08:07:42 +0000 (08:07 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Jun 2007 08:07:42 +0000 (08:07 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6688 594d385d-05f5-0310-b6e9-bd551577e9d8

html/index.php
html/main.php
ihtml/themes/default/framework.tpl
ihtml/themes/default/login.tpl
include/functions.inc

index 4ace274aa5653e116629c7174fbd5f39069dffca..b7f1ae83ae8f5e79290d66e38ef82b44a4d5725c 100644 (file)
@@ -378,14 +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'] != ""){
-  echo '<script language="JavaScript" type="text/javascript">';
-  echo 'document.forms[0].error_accept.focus();';
-  echo '</script>';
+  $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:
 ?>
index fd5afa99b898c36ed4fcfb82aa702a6a931cf713..ffb834262b423289f2d2e5e4d0a3d836d0fef5f3 100644 (file)
@@ -379,6 +379,16 @@ if ($error_collector != ""){
 } else {
   $smarty->assign("php_errors", "");
 }
+
+/* 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);
+
 $display= $header.$smarty->fetch(get_template_path('framework.tpl'));
 
 if ((isset($config->data['MAIN']['W3CTEST']) && preg_match('/true/i', $config->data['MAIN']['W3CTEST']))&&(!empty($display))&&(is_callable("tidy_parse_string"))) {
@@ -396,13 +406,6 @@ if ((isset($config->data['MAIN']['W3CTEST']) && preg_match('/true/i', $config->d
 /* Show page... */
 echo $display;
 
-/* Set focus to the error button if we've an error message */
-if (isset($_SESSION['errors']) && $_SESSION['errors'] != ""){
-  echo '<script language="JavaScript" type="text/javascript">';
-  echo 'document.forms[0].error_accept.focus();';
-  echo '</script>';
-}
-
 /* Save plist and config */
 $_SESSION['plist']= $plist;
 $_SESSION['config']= $config;
index a8a4f579e34b4cf08b58dcd79335ca9bb23aaf26..dfe3a107c6542fc0f1ec2f7f72bd5f582518660c 100644 (file)
@@ -65,4 +65,4 @@
      </table>
     </td>
   </tr>
-</table></form></body></html>
+</table>{$focus}</form></body></html>
index 90278b39018070401518cf8bacba8b631a01d00f..e6c20cde7cf77cfa01bbdf322c4d4b9b0c04c22a 100644 (file)
@@ -58,6 +58,7 @@
       </tr>
      </table>
                <input type='hidden' name='javascript' value='false'/>          
+               {$focus}
     </form>
 
     <!-- Display error message on demand -->
index 52cf1a824606ef0b7036c3454703a199cec78f99..5ee56ebfcd37be5e75f0a07d520cf4bd08a7a0ff 100644 (file)
@@ -1152,7 +1152,7 @@ function print_red()
             get_template_path($img)."'></td>".
             "<td style='width:100%'><h1>"._("An error occurred while processing your request").
             "</h1><b>$string</b><br><br>$addmsg</td></tr><tr><td colspan='2' align='center'><br><button ".
-            (($_SESSION['js']==FALSE)?"type='submit'":"type='button'").
+            (($_SESSION['js']==FALSE)?"type='submit'":"type='button' name='error_accept'").
             " style='width:80px' onClick='hide(\"e_layer\");hide(\"e_layer2\");'>".
             _("OK")."</button></td></tr></table></div>";
         }