Code

Added a first set of reference changes - nearly untested
[gosa.git] / html / main.php
index 8a250fd0d005657412bd9ec31045fac178517ee5..4dfe7477e5e2e70a343dd43b4799adb91b292c8a 100644 (file)
@@ -125,25 +125,20 @@ if((!isset($_SESSION['Last_init_lang']))){
   $_SESSION['Last_init_lang'] = get_browser_language();
 }
 
-/* Language setup */
-if ($config->data['MAIN']['LANG'] == ""){
-  
-  /* If last language != current force navi reload */
-  if($_SESSION['Last_init_lang'] != get_browser_language()){
-    $reload_navigation = true;
-  }
-  $lang= get_browser_language();
-  $_SESSION['Last_init_lang'] = $lang;
-} else {
-  $lang= $config->data['MAIN']['LANG'];
+/* If last language != current force navi reload */
+$lang= get_browser_language();
+if($_SESSION['Last_init_lang'] != $lang){
+  $reload_navigation = true;
 }
 
+/* Language setup */
+$_SESSION['Last_init_lang'] = $lang;
+
 /* Preset current main base */
 if(!isset($_SESSION['CurrentMainBase'])){
   $_SESSION['CurrentMainBase']= get_base_from_people($ui->dn);
 }
 
-$lang.=".UTF-8";
 putenv("LANGUAGE=");
 putenv("LANG=$lang");
 setlocale(LC_ALL, $lang);
@@ -364,7 +359,6 @@ if (is_file("$plugin_dir/main.inc")){
 
 
 /* Print_out last ErrorMessage repeated string. */
-print_red(NULL);
 
 $smarty->assign("contents", $display);
 
@@ -373,10 +367,20 @@ if (isset($_SESSION['errors'])){
   $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", "");
 }
+
+/* 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'));
 
 /* Show page... */
@@ -387,7 +391,7 @@ $_SESSION['plist']= $plist;
 $_SESSION['config']= $config;
 
 /* Echo compilation time */
-//echo "<p align='right'>".get_MicroTimeDiff($start,microtime())."</p>";
+#echo "<p align='right'>".get_MicroTimeDiff($start,microtime())."</p>";
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>