Code

Save current base and filter options in a cookie on client side
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 Sep 2007 09:51:21 +0000 (09:51 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 17 Sep 2007 09:51:21 +0000 (09:51 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7303 594d385d-05f5-0310-b6e9-bd551577e9d8

html/index.php
html/main.php

index 77c375bc909e773937b1a4bef44171ac5cfd5cf4..f525d267cfc09398d6467fceec4ce2e7ad3f6bbc 100644 (file)
@@ -280,6 +280,17 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){
         $_SESSION['PHP4COMPATIBLE']= TRUE;
       }
 
+      /* Restore filter settings from cookie, if available 
+       */
+      $cookie_vars= array("MultiDialogFilters","CurrentMainBase");
+      foreach($cookie_vars as $var){
+        if(isset($_COOKIE[$var])){
+          $_SESSION[$var] = unserialize(base64_decode($_COOKIE[$var]));
+        }elseif(isset($HTTP_COOKIE_VARS[$var])){
+          $_SESSION[$var] = unserialize(base64_decode($HTTP_COOKIE_VARS[$var]));
+        }
+      }
+
       /* are we using accountexpiration */
       if((isset($config->data['MAIN']['ACCOUNT_EXPIRATION'])) && 
           preg_match('/true/i', $config->data['MAIN']['ACCOUNT_EXPIRATION'])){
index 4dfe7477e5e2e70a343dd43b4799adb91b292c8a..a2db883ebd2a9557158a695b2826565421b75a25 100644 (file)
@@ -383,6 +383,16 @@ $smarty->assign("focus", $focus);
 
 $display= $header.$smarty->fetch(get_template_path('framework.tpl'));
 
+/* Save dialog filters and selected base in a cookie. 
+   So we may be able to restore the filter an base settings on reload.
+*/
+$cookie_vars = array("MultiDialogFilters","CurrentMainBase");
+foreach($cookie_vars as $var){
+  if(isset($_SESSION[$var])){
+    setcookie($var,base64_encode(serialize($_SESSION[$var])),time()+ 60*60*24*30);
+  }
+}
+
 /* Show page... */
 echo $display;