Code

Added global base
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 Apr 2006 05:41:50 +0000 (05:41 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 Apr 2006 05:41:50 +0000 (05:41 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3023 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/groups/class_groupGeneric.inc
plugins/admin/groups/class_groupManagement.inc
plugins/personal/posix/class_posixAccount.inc

index b52fc2e1fbc9e520dd94edda0cf5a4c77004b087..92f87d265ef5a3d06a1f6cd2bd2481b38d367adf 100644 (file)
@@ -155,8 +155,8 @@ class group extends plugin
   
       /* Bases / Departments */
       
-    if(isset($_SESSION['groupfilter']['depselect'])){
-      $this->base = $_SESSION['groupfilter']['depselect'];
+    if(isset($_SESSION['CurrentMainBase'])){
+      $this->base = $_SESSION['CurrentMainBase'];
     }else{
       if ($this->dn == "new"){
         $ui= get_userinfo();
index cffb0b77ba042a81e2f158f979045fc547b71430..80bc11446e62288c69d4ebee9ca096c05ae2285b 100644 (file)
@@ -56,10 +56,13 @@ class groupManagement extends plugin
           "functionalgroups" => "checked",
           "guser" => "*",
           "subsearch" => "",
-          "depselect" => $base,
           "regex" => "*");
       register_global("groupfilter", $groupfilter);
     }
+    if(!isset($_SESSION['CurrentMainBase'])){
+      $base = get_base_from_people($ui->dn);
+      $_SESSION['CurrentMainBase'] = $base; 
+    }
   }
 
   function execute()
@@ -75,11 +78,14 @@ class groupManagement extends plugin
     $s_entry    = "";
 
     if (!isset($this->grouptab)){
-      foreach( array("depselect", "guser", "regex") as $type){
+      foreach( array( "guser", "regex") as $type){
         if (isset($_POST[$type])){
           $groupfilter[$type]= $_POST[$type];
         } 
       }
+      if(isset($_POST['CurrentMainBase'])){
+        $_SESSION['CurrentMainBase'] = $_POST['CurrentMainBase'];
+      }
       if (isset($_POST['regex'])){
         foreach( array("primarygroups", "sambagroups", "mailgroups", "appgroups",
               "functionalgroups", "subsearch") as $type){
@@ -147,7 +153,7 @@ class groupManagement extends plugin
     if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
       $s_action="open";
       $s_entry = base64_decode($_GET['dep_id']);
-      $groupfilter['depselect']= "".$this->config->departments[trim($s_entry)];
+      $_SESSION['CurrentMainBase']= "".$this->config->departments[trim($s_entry)];
     }
 
     // Edit if
@@ -157,29 +163,29 @@ class groupManagement extends plugin
     }
 
     /* Department changed? */
-    if(isset($_POST['depselect']) && $_POST['depselect']){
-      $groupfilter['depselect']= $_POST['depselect'];
+    if(isset($_POST['CurrentMainBase']) && $_POST['CurrentMainBase']){
+      $_SESSION['CurrentMainBase']= $_POST['CurrentMainBase'];
     }
 
     /* Homebutton is posted */
     if($s_action=="home"){
-      $groupfilter['depselect']= (preg_replace("/^[^,]+,/","",$this->ui->dn));
-      $groupfilter['depselect']= (preg_replace("/^[^,]+,/","",$groupfilter['depselect']));
+      $_SESSION['CurrentMainBase']= (preg_replace("/^[^,]+,/","",$this->ui->dn));
+      $_SESSION['CurrentMainBase']= (preg_replace("/^[^,]+,/","",$_SESSION['CurrentMainBase']));
     }
 
     if($s_action=="root"){
-      $groupfilter['depselect']=($this->config->current['BASE']);
+      $_SESSION['CurrentMainBase']=($this->config->current['BASE']);
     }
 
     /* If Backbutton is Posted */
     if($s_action == "back"){
-      $base_back= preg_replace("/^[^,]+,/","",$groupfilter['depselect']);
+      $base_back= preg_replace("/^[^,]+,/","",$_SESSION['CurrentMainBase']);
       $base_back= convert_department_dn($base_back);
 
       if(isset($this->config->departments[trim($base_back)])){
-        $groupfilter['depselect']= $this->config->departments[trim($base_back)];
+        $_SESSION['CurrentMainBase']= $this->config->departments[trim($base_back)];
       }else{
-        $groupfilter['depselect']= $this->config->departments["/"];
+        $_SESSION['CurrentMainBase']= $this->config->departments["/"];
       }
     }
     register_global("groupfilter", $groupfilter);
@@ -202,7 +208,7 @@ class groupManagement extends plugin
        */
       if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
         $this->CopyPasteHandler->save_object();
-        $this->CopyPasteHandler->SetVar("base",$groupfilter['depselect']);
+        $this->CopyPasteHandler->SetVar("base",$_SESSION['CurrentMainBase']);
         return($this->CopyPasteHandler->execute());
       }
 
@@ -259,7 +265,7 @@ class groupManagement extends plugin
       $this->grouptab= new grouptabs($this->config,
           $this->config->data['TABS']['GROUPTABS'], $this->dn);
       /* Set up the users ACL's for this 'dn' */
-      $acl= get_permissions ($groupfilter['depselect'], $this->ui->subtreeACL);
+      $acl= get_permissions ($_SESSION['CurrentMainBase'], $this->ui->subtreeACL);
       $this->grouptab->set_acl($acl);
     }
 
@@ -420,7 +426,7 @@ class groupManagement extends plugin
     /* Prepare departments */
     $options= "";
     foreach ($this->config->idepartments as $key => $value){
-            if ($groupfilter['depselect'] == $key){
+            if ($_SESSION['CurrentMainBase'] == $key){
                     $options.= "<option selected value='$key'>$value</option>";
             } else {
                     $options.= "<option value='$key'>$value</option>";
@@ -456,7 +462,7 @@ class groupManagement extends plugin
       " <input type='image' class='center' src='images/list_new_group.png' title='"._("Create new group")."' alt='"._("New")."' name='group_new'>&nbsp;".
       $Copy_Paste.
       " <img class='center' src='images/list_seperator.png' alt='' height='16' width='1'>&nbsp;".
-      _("Base")."&nbsp;<select name='depselect' onChange='mainform.submit()' class='center'>$options</select>".
+      _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
        " <input type='image' class='center' src='images/list_submit.png' title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
       "</div>";
 
@@ -589,7 +595,7 @@ class groupManagement extends plugin
     $smarty->assign("infoimage", get_template_path('images/info.png'));
     $smarty->assign("launchimage", get_template_path('images/launch.png'));
     $smarty->assign("deplist", $this->config->idepartments);
-    foreach( array("depselect", "guser", "regex", "primarygroups", "mailgroups","appgroups", "sambagroups", "functionalgroups", "subsearch") as $type){
+    foreach( array("guser", "regex", "primarygroups", "mailgroups","appgroups", "sambagroups", "functionalgroups", "subsearch") as $type){
       $smarty->assign("$type", $groupfilter[$type]);
     }
 
@@ -612,7 +618,7 @@ class groupManagement extends plugin
     $groupfilter= get_global('groupfilter');
 
     /* Set base for all searches */
-    $base= $groupfilter['depselect'];
+    $base= $_SESSION['CurrentMainBase'];
 
     /* Regex filter? */
     if ($groupfilter['regex'] != ""){
index 864ec87b5d22e2e0fe5454f161b022cdccfc5a17..aec06401fca9421f4b3c4ec928f5537e2a2443ce 100644 (file)
@@ -388,7 +388,7 @@ class posixAccount extends plugin
             "functionalgroups" => "checked",
             "guser" => "*",
             "subsearch" => "",
-            "depselect" => $base,
+            "depselect" => $_SESSION['CurrentMainBase'],
             "regex" => "*");
         register_global("groupfilter", $groupfilter);
       }