Code

Fixed remove.tpl
[gosa.git] / plugins / admin / groups / class_groupManagement.inc
index c238ed8b0539911baf944e8dc335da65d01f0cc7..6efef3fee959924ce01956b0d645fc225c5ab864 100644 (file)
@@ -389,7 +389,7 @@ class groupManagement extends plugin
 
 
     $divlist->SetSummary(_("This table displays all groups, in the selected tree."));
-    $divlist->SetEntriesPerPage(20);
+    $divlist->SetEntriesPerPage(0);
 
     foreach($this->departments as $key=> $val){
 
@@ -445,7 +445,7 @@ class groupManagement extends plugin
     /* Show main page */
     $smarty->assign("grouplisthead", $listhead);
     $smarty->assign("grouplist", $divlist->DrawList());
-    $smarty->assign("searchg_image", get_template_path('images/search_group.png'));
+    $smarty->assign("search_image", get_template_path('images/search.png'));
     $smarty->assign("searchu_image", get_template_path('images/search_user.png'));
     $smarty->assign("tree_image", get_template_path('images/tree.png'));
     $smarty->assign("infoimage", get_template_path('images/info.png'));
@@ -463,7 +463,7 @@ class groupManagement extends plugin
     return($smarty->fetch(get_template_path('headpage.tpl', TRUE)));
   }
 
-  function reload()
+  function reload($CreatePosixsList=false)
   {
     /* Get config */
     $groupfilter= get_global('groupfilter');
@@ -525,22 +525,27 @@ class groupManagement extends plugin
      * We also need to search for the departments
      * So we are able to navigate like in konquerer
      */
-    $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
-                              FALSE, $base, array("ou", "description"), TRUE);
-
-    $this->departments= array();
-    $tmp = array();
-    foreach ($res3 as $value){
-      $tmp[strtolower($value['dn']).$value['dn']]=$value;
-    }
-    ksort($tmp);
-    foreach($tmp as $value){
-      if($value["description"][0]!=".."){
-        $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
-      }else{
-        $this->departments[$value['dn']]=$value["description"][0];
+
+    /* Only needed if we are in GroupManagement */
+    if(!$CreatePosixsList){
+      $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
+          FALSE, $base, array("ou", "description"), TRUE);
+      $this->departments= array();
+      $tmp = array();
+      foreach ($res3 as $value){
+        $tmp[strtolower($value['dn']).$value['dn']]=$value;
+      }
+      ksort($tmp);
+      foreach($tmp as $value){
+        if($value["description"][0]!=".."){
+          $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+        }else{
+          $this->departments[$value['dn']]=$value["description"][0];
+        }
       }
     }
+    /*  Ende department generation
+     */
 
     /* Generate grouplist */
     if ($filter != ""){
@@ -549,6 +554,9 @@ class groupManagement extends plugin
         $filter= "(&(|(memberUID=" . $groupfilter['guser'] . ")(cn=" . $groupfilter['guser'] . "))$filter)";
       }
     }
+
+    /* Depending on $CreatePosixsList we have to create different lists */
+
     if ($groupfilter['subsearch'] == "checked"){
       $res= get_list($this->ui->subtreeACL, "$filter", FALSE, $base, array("cn", "description", "gidNumber"), TRUE);
     } else {
@@ -573,15 +581,40 @@ class groupManagement extends plugin
     }
 
     $tmp=array();
-    foreach($this->grouplist as $tkey => $val ){
-      $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
-    }
-    ksort($tmp);
-    $this->grouplist=array();
-    foreach($tmp as $val){
-      $this->grouplist[]=$val;
+
+    /* If true ; this result is used for posix tab, group membership selection. */
+    if($CreatePosixsList){
+
+      /* Addd to array */
+      foreach($this->grouplist as $tkey => $val ){
+        $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+      }
+      
+      /* Sort index */
+      ksort($tmp);
+
+      /* Recreate index array[dn]=cn[description]*/
+      $this->grouplist=array();
+      foreach($tmp as $val){
+        if(isset($val['description'])){
+          $this->grouplist[$val['dn']]=$val['cn'][0]." [".$val['description'][0]."]";
+        }else{
+          $this->grouplist[$val['dn']]=$val['cn'][0];
+        }
+      }
+    }else{
+  
+      /* Create result for group management listbox*/
+      foreach($this->grouplist as $tkey => $val ){
+        $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+      }
+      ksort($tmp);
+      $this->grouplist=array();
+      foreach($tmp as $val){
+        $this->grouplist[]=$val;
+      }
+      reset ($this->grouplist);
     }
-    reset ($this->grouplist);
   }
 
   function remove_from_parent()