Code

Closes #276 Filter settings will be saved per ui->dn now.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Nov 2007 09:28:08 +0000 (09:28 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Nov 2007 09:28:08 +0000 (09:28 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7884 594d385d-05f5-0310-b6e9-bd551577e9d8

html/index.php
html/main.php

index 50a3d45a29d5a386e5f97df5c115c5dedce3dc80..67d3c08267dc230d6dda57a2c48c82c9bef30bc5 100644 (file)
@@ -295,18 +295,26 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){
       /* Restore filter settings from cookie, if available 
        */
       if(isset($config->data['MAIN']['SAVE_FILTER']) && preg_match("/true/",$config->data['MAIN']['SAVE_FILTER'])){
-        $cookie_vars= array("MultiDialogFilters","CurrentMainBase","plug");
-        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]));
+
+        if(isset($_COOKIE['GOsa_Filter_Settings']) || isset($HTTP_COOKIE_VARS['GOsa_Filter_Settings'])){
+
+          if(isset($_COOKIE['GOsa_Filter_Settings'])){
+            $cookie_all = unserialize(base64_decode($_COOKIE['GOsa_Filter_Settings']));
+          }else{
+            $cookie_all = unserialize(base64_decode($HTTP_COOKIE_VARS['GOsa_Filter_Settings']));
+          }
+          if(isset($cookie_all[$ui->dn])){
+            $cookie = $cookie_all[$ui->dn];
+            $cookie_vars= array("MultiDialogFilters","CurrentMainBase","plug");
+            foreach($cookie_vars as $var){
+              if(isset($cookie[$var])){
+                $_SESSION[$var] = $cookie[$var];
+              }
+            }
+            if(isset($cookie['plug'])){
+              $plug =$cookie['plug'];
+            }
           }
-        }
-        if(isset($_COOKIE['plug'])){
-          $plug = $_COOKIE['plug'];
-        }elseif($HTTP_COOKIE_VARS['plug']){
-          $plug = $HTTP_COOKIE_VARS['plug'];
         }
       }
 
index 1583904f7694bc2cefe594a164f7cc5364ab52ec..d8f643c2ac0e0d989aaceb6138c42efcb3b032cb 100644 (file)
@@ -403,16 +403,24 @@ $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 = array();
+
+if(isset($_COOKIE['GOsa_Filter_Settings'])){
+  $cookie = unserialize(base64_decode($_COOKIE['GOsa_Filter_Settings']));
+}elseif($HTTP_COOKIE_VARS['GOsa_Filter_Settings']){
+  $cookie = unserialize(base64_decode($HTTP_COOKIE_VARS['GOsa_Filter_Settings']));
+}
 if(isset($config->data['MAIN']['SAVE_FILTER']) && preg_match("/true/",$config->data['MAIN']['SAVE_FILTER'])){
   $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);
+      $cookie[$ui->dn][$var] = $_SESSION[$var];
     }
   }
   if(isset($_GET['plug'])){
-    @setcookie("plug", $_GET['plug'],time()+ 60*60*24*30);
+    $cookie[$ui->dn]['plug'] = $_GET['plug'];
   }
+  setcookie("GOsa_Filter_Settings",base64_encode(serialize($cookie)),time() + (60*60*24));
 }
 
 /* Show page... */