Code

Added checkboxes to filter
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 12 Jul 2006 04:35:20 +0000 (04:35 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 12 Jul 2006 04:35:20 +0000 (04:35 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4108 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/acl/class_aclManagement.inc
plugins/admin/acl/class_divListACL.inc

index 0dcc48b7e3def3a537d6a4be51fcaedd539cc269..a0d33319675a97f906e344ddce52e5650d5c50ca 100644 (file)
@@ -227,15 +227,6 @@ class aclManagement extends plugin
       /* Save, or display error message? */
       if (count($message) == 0){
 
-        /* No errors. Go ahead and prepare to ask for a password
-           in case we're creating a new acl. 'dn' will be 'new'
-           in this case. It is set to the correct value later. */
-        if ($this->dn == "new"){
-          $set_pass= 1;
-        } else {
-          $set_pass= 0;
-        }
-
         /* Save acl data to ldap */
         if($this->acltabs->save() == 1){
           gosa_log ("ACL object '".$this->dn."' saving failed.");
index 2e0e3c1c6897e0c50eb02f1433f06af19ebb8d44..d320d2e29f29907eb3c9e503a1506060285cf3c3 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"=>"&nbsp;",          "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);
   }
@@ -104,15 +110,25 @@ class divListACL extends MultiSelectWindow
 
     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" => 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 +142,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:
 ?>