Code

Added empty lines
[gosa.git] / plugins / admin / ogroups / class_ogroupManagement.inc
index 73fcc95528b4bfb59613fb3a3f6a91305814dea4..4539967ef724b96680d02d0bf8bf4147a5d96a86 100644 (file)
@@ -70,6 +70,9 @@ class ogroupManagement extends plugin
 
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
     /* Prepare template */
     $smarty= get_smarty();
 
@@ -82,7 +85,7 @@ class ogroupManagement extends plugin
         $ogroupfilter[$type]= $_POST[$type];
       }
     }
-    if (isset($_POST['regex'])){
+    if (isset($_POST['Ogroup_dialog_posted'])){
       foreach( array("usergroups", "groupgroups", "appgroups", "depgroups",
             "servergroups", "wsgroups", "prtgroups", "tcgroups", "fongroups") as $type){
 
@@ -132,7 +135,6 @@ class ogroupManagement extends plugin
     /* Department changed? */
     if(isset($_POST['depselect']) && $_POST['depselect']){
       $ogroupfilter['depselect']= $_POST['depselect'];
-      $this->reload();
     }
 
     /* Start for New List Managment */
@@ -140,7 +142,6 @@ class ogroupManagement extends plugin
       $s_action="open";
       $s_entry = base64_decode($_GET['dep_id']);
       $ogroupfilter['depselect']= "".$this->config->departments[trim($s_entry)];
-      $this->reload();
     }
 
     /* If Backbutton is Posted */
@@ -154,20 +155,17 @@ class ogroupManagement extends plugin
         $ogroupfilter['depselect']= $this->config->departments["/"];
       }
       register_global("ogroupfilter", $ogroupfilter);
-      $this->reload();
     }
 
     /* Homebutton is posted */
     if($s_action=="home"){
       $ogroupfilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
       $ogroupfilter['depselect']=(preg_replace("/^[^,]+,/","",$ogroupfilter['depselect']));
-      $this->reload();
     }
 
     /* root posted */ 
     if($s_action=="root"){
       $ogroupfilter['depselect']=($this->config->current['BASE']);
-      $this->reload();
     }
 
     // Edit if
@@ -178,13 +176,7 @@ class ogroupManagement extends plugin
 
     register_global("ogroupfilter", $ogroupfilter);
 
-    /* Prepare formular */
-    if (!isset($this->ogroup) &&
-        !isset($_POST['new_group']) &&
-        !isset($_POST['delete_group']) &&
-        !isset($_POST['select_group'])){
-      $this->reload();
-    }
+    $this->reload();
 
     /* Check for exeeded sizelimit */
     if (($message= check_sizelimit()) != ""){
@@ -394,7 +386,7 @@ name='dep_root' alt='"._("Root")."'> ".
     $empty    = "<img src='images/empty.png' style='width:16px;height:16px;' alt=''>";
 
     // List Setup
-    $divlist = new divlist();
+    $divlist = new divlist("ogroubstab");
     $divlist->SetHeader(array(
           array("string" => "&nbsp;","attach"=>"style='width:20px;'"),
           array("string" => _("Name of object groups")." / "._("Departments")),
@@ -404,11 +396,25 @@ name='dep_root' alt='"._("Root")."'>&nbsp;".
 
 
     $divlist->SetSummary(_("This table displays all groups, in the selected tree."));
-    $divlist->SetEntriesPerPage(20);
+    $divlist->SetEntriesPerPage(0);
 
     foreach($this->departments as $key=> $val){
 
-      $field1 = array("string" => "<img src='images/folder.png' alt='"._("Department")."'>");
+      if(!isset($this->config->departments[trim($key)])){
+        $this->config->departments[trim($key)]="";
+      }
+
+      $non_empty="";
+      $keys= str_replace("/","\/",$key);
+      foreach($this->config->departments as $keyd=>$vald ){
+        if(preg_match("/".$keys."\/.*/",$keyd)){
+          $non_empty="full";
+        }
+      }
+
+
+
+      $field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='"._("Department")."'>");
       $field2 = array("string" => sprintf($linkopen,base64_encode($key),$val));
       $field3 = array("string" => "&nbsp;");
       $field4 = array("string" => "&nbsp;","attach"=>"style='text-align:right;border:none'");
@@ -425,14 +431,14 @@ name='dep_root' alt='"._("Root")."'>&nbsp;".
         $mail = $empty;
       }
 
-      $title = "title='gid : ".$key." - dn : ".$val['dn']."'";
+      $title = "title='dn : ".$val['dn']."'";
 
       if(!isset($val['description'][0])){
         $desc = "";
       }else{
         $desc = " - [ ".$val['description'][0]." ]";
       }
-      $field1 = array("string" => "<img src='images/list_ogroup.png' alt='"._("Object group")."'>");
+      $field1 = array("string" => "<img src='images/list_ogroup.png' alt='"._("Object group")."' ".$title.">");
       $field2 = array("string" => sprintf($editlink,$key,($val['cn']['0'].$desc)),"attach"=>$title);
       $field3 = array("string" => $this->convert_list($val)."&nbsp;".$mail);
       $field4 = array("string" => preg_replace("/%KEY%/", $key, $actions),"attach"=>"style='text-align:right;border:none'");
@@ -472,35 +478,40 @@ name='dep_root' alt='"._("Root")."'>&nbsp;".
     $temp= "";
 
 
-    $conv= array(   "U" => "select_user.png",
-        "G" => "select_groups.png",
-        "A" => "select_application.png",
-        "D" => "select_department.png",
-        "S" => "select_server.png",
-        "F" => "select_phone.png",
-        "W" => "select_workstation.png",
-        "T" => "select_terminal.png",
-        "P" => "select_printer.png");
+    $conv= array(   
+        "U" => array("select_user.png",_("User")),
+        "G" => array("select_groups.png",_("Group")),
+        "A" => array("select_application.png",_("Application")),
+        "D" => array("select_department.png",_("Department")),
+        "S" => array("select_server.png",_("Server")),
+        "F" => array("select_phone.png",_("Phone")),
+        "W" => array("select_workstation.png",_("Workstation")),
+        "T" => array("select_terminal.png",_("Terminal")),
+        "P" => array("select_printer.png",_("Printer")));
 
     /* Assemble picture */
     $type= $input['gosaGroupObjects'][0];
     $type= preg_replace("/[^A-Z]/i","",$type);
     if (isset($type[0])){
-      $p1['pic']= $conv[$type[0]];
+      $p1['pic']= $conv[$type[0]][0];
+      $p1['tit']= $conv[$type[0]][1];
       $p1['alt']= $type[0];
     } else {
       $p1['pic']= "empty.png";
+      $p1['tit']= "";
       $p1['alt']= "";
     }
     if (isset($type[1])){
-      $p2['pic']= $conv[$type[1]];
+      $p2['pic']= $conv[$type[1]][0];
       $p2['alt']= $type[1];
+      $p2['tit']= $conv[$type[1]][1];
     } else {
       $p2['pic']= "empty.png";
       $p2['alt']= "";
+      $p2['tit']= "";
     }
-    $temp = "<img src='images/".$p1['pic']."' alt='".$p1['alt']."'>";
-    $temp.= "<img src='images/".$p2['pic']."' alt='".$p2['alt']."'>";
+    $temp = "<img src='images/".$p1['pic']."' alt='".$p1['alt']."' title='".$p1['tit']."'>";
+    $temp.= "<img src='images/".$p2['pic']."' alt='".$p2['alt']."' title='".$p2['tit']."'>";
     return ($temp);
   }
 
@@ -559,7 +570,10 @@ name='dep_root' alt='"._("Root")."'>&nbsp;".
     } else {
       $filter= "(&(cn=$regex)(objectClass=gosaGroupOfNames))";
     }
-    $res= get_list($this->ui->subtreeACL, "$filter", TRUE, $base, array("*"), TRUE);
+    
+   $groups = ($this->config->current['GROUPS']);
+
+    $res= get_list($this->ui->subtreeACL, "$filter",FALSE, $groups.",".$base, array("*"), TRUE);
     $this->ogrouplist= $res;
     ksort ($this->ogrouplist);
     reset ($this->ogrouplist);
@@ -574,18 +588,34 @@ name='dep_root' alt='"._("Root")."'>&nbsp;".
     $res3 =  get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))",
                               TRUE, $base2, 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]."]";
+        $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
       }else{
         $this->departments[$value['dn']]=$value["description"][0];
       }
     }
-
     /* END NEW LIST MANAGMENT
      */
 
+    $tmp=array();
+    foreach($this->ogrouplist as $tkey => $val ){
+      $tmp[strtolower($val['cn'][0]).$val['cn'][0]]=$val;
+    }
+    ksort($tmp);
+    $this->ogrouplist=array();
+    foreach($tmp as $val){
+      $this->ogrouplist[]=$val;
+    }
+    reset ($this->ogrouplist);