Code

Change navigationmenu language if browser language changed
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 12 Aug 2005 08:10:21 +0000 (08:10 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 12 Aug 2005 08:10:21 +0000 (08:10 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1117 594d385d-05f5-0310-b6e9-bd551577e9d8

html/main.php

index 859e8d1239915cd387f49eec9f8495f23e123104..ba8d8e8e24fe5cd0065854b48d2cfbe5d8600a23 100644 (file)
@@ -66,12 +66,28 @@ if (isset ($config->data['MAIN']['COMPILE'])){
   $smarty->compile_dir= '/var/spool/gosa/';
 }
 
+/* Set default */
+$reload_navigation = false;
+
+/* Set last initialised language to current, browser settings */
+if((!isset($_SESSION['Last_init_lang']))){
+  $reload_navigation = true;
+  $_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'];
 }
+
 $lang.=".UTF-8";
 putenv("LANGUAGE=");
 putenv("LANG=$lang");
@@ -220,6 +236,11 @@ $smarty->assign ("go_top", get_template_path('images/go_top.png'));
 $smarty->assign ("go_corner", get_template_path('images/go_corner.png'));
 $smarty->assign ("go_left", get_template_path('images/go_left.png'));
 $smarty->assign ("go_help", get_template_path('images/help.png'));
+
+/* reload navigation if language changed*/  
+if($reload_navigation){
+  $plist->menu="";;
+}
 $plist->gen_menu();
 $smarty->assign ("menu", $plist->menu);
 $smarty->assign ("plug", "$plug");