Code

Udpated fai acls
[gosa.git] / plugins / admin / acl / class_divListACL.inc
index 2e0e3c1c6897e0c50eb02f1433f06af19ebb8d44..446fd3e0be73caf4c3e80d465e7bc435a3f198b6 100644 (file)
@@ -18,6 +18,8 @@ class divListACL extends MultiSelectWindow
   var $parent             ;
   var $ui                 ;
 
+  
+
   function divListACL ($config,$parent)
   {
     MultiSelectWindow::MultiSelectWindow($config,"ACLs");
@@ -46,11 +48,15 @@ class divListACL extends MultiSelectWindow
     $this->AddHeader(array("string"=>" ",          "attach"=>"style='width:20px;'"));
     $this->AddHeader(array("string"=>_("Summary")));
     $this->AddHeader(array("string"=>_("Actions"),      "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
-    
+
+    /* Set dynamically filter checkboxes */
+    $this->set_filter_objectclasses();   
     /* Add SubSearch checkbox */
-//    $this->AddCheckBox(SEPERATOR);
+    $this->AddCheckBox(SEPERATOR);
     $this->AddCheckBox("SubSearch",  _("Select to search within subtrees"), _("Ignore subtrees"), false);
 
+
     /*                  Name                 ,Text                              ,Default  , Connect with alphabet  */
     $this->AddRegex   ("Regex",     _("Display acls matching"),"Not implemented yet" , true);
   }
@@ -101,18 +107,29 @@ class divListACL extends MultiSelectWindow
   function setEntries($list)
   {
     $list_left_icon = "<img src='images/select_acl.png' alt='"._("Acl")."'>";
+    $editlink = "<a href='?plug=".$_GET['plug']."&amp;id=%s&amp;act=edit_entry'>%s</a>";
 
     foreach($list as $key => $acl_entry){
 
-      $action = "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     name='acl_edit_%KEY%' title='"._("Edit system")."'>";
-      $action.= $this->GetSnapShotActions($acl_entry['dn']);
-      $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='acl_del_%KEY%' title='"._("Delete system")."'>";
-
-      $field1 = array("string" => $list_left_icon, "attach"=> "style='text-align:center;width:20px;'");
-      $field2 = array("string" => htmlentities(utf8_decode($acl_entry['dn'])),"attach" => "");
-      $field3 = array("string" => preg_replace("/%KEY%/",$key,$action), "attach"=> "style='text-align:center;width:80px;border-right:0px;'");
+      $skip = true;
+      foreach($this->get_filter_objectclasses() as $oc){
+        if(in_array($oc,$acl_entry['objectClass']) && $this->$oc){
+          $skip = false;
+        }
+      }
     
-      $this->AddElement(array($field1,$field2,$field3));
+      if(!$skip){
+        $action = "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."'     
+                    name='acl_edit_%KEY%' title='"._("Edit system")."'>";
+        $action.= $this->GetSnapShotActions($acl_entry['dn']);
+        $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' 
+                    name='acl_del_%KEY%' title='"._("Delete system")."'>";
+
+        $field1 = array("string" => $list_left_icon, "attach"=> "style='text-align:center;width:20px;'");
+        $field2 = array("string" => sprintf($editlink,$key,htmlentities(utf8_decode($acl_entry['dn'])))."&nbsp;","attach" => "");
+        $field3 = array("string" => preg_replace("/%KEY%/",$key,$action), "attach"=> "style='text-align:center;width:80px;border-right:0px;'");
+        $this->AddElement(array($field1,$field2,$field3));
+      }
     }
   }
 
@@ -126,6 +143,25 @@ class divListACL extends MultiSelectWindow
     /* Save automatic created POSTs like regex, checkboxes */
     MultiSelectWindow::save_object();   
   }
+
+
+  /* Add some additional checkboxes to the filter part, this should be generated dynamically. */
+  function set_filter_objectclasses()
+  { 
+    #FIXME This should be created dynamically 
+    $this->gosaAccount = true;
+    $this->AddCheckBox("gosaAccount",     _("Select to display users"),       _("Display user")       , true);
+    $this->gosaDepartment = true;
+    $this->AddCheckBox("gosaDepartment",  _("Select to display departments"), _("Display departments"), true);
+  }
+
+  
+  /* Return objectClass names used in filter part */  
+  function get_filter_objectclasses()
+  {
+    return(array("gosaAccount","gosaDepartment"));
+  }
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>