Code

Added subsearch filter
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 17 Oct 2006 05:18:40 +0000 (05:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 17 Oct 2006 05:18:40 +0000 (05:18 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4886 594d385d-05f5-0310-b6e9-bd551577e9d8

Changelog
plugins/admin/ogroups/class_ogroup.inc
plugins/admin/ogroups/ogroup_objects.tpl

index be8449c2606591446d91a9245457941fa5dac7f0..13644928eb9b67031b815aa9a11fb9efe3e7efb0 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,7 @@
 GOsa2 changelog
 ===============
 * gosa 2.5.5
+  - Added subsearch checkbox to ogroup->add filter
   - Fixed missing ppd configuration error, for newly created printer.
   - Fixed object group saving, the base was sometimes broken.
   - Fixed saving of terminal attribute gotoLpdEnable
index b500e73f64bd08cb74cd2973b20ea4550239d511..7da3f528285d7113c49321c97c3782fb7f7773df 100644 (file)
@@ -71,6 +71,7 @@ class ogroup extends plugin
           "W" => "workstations",
           "T" => "terminals",
           "F" => "phones",
+          "_" => "subtrees",
           "P" => "printers") as $key => $val){
 
       if (preg_match("/$key/", $this->gosaGroupObjects)){
@@ -228,7 +229,7 @@ class ogroup extends plugin
       }
       if (isset($_POST['dselect'])){
         foreach( array("accounts", "groups", "applications", "departments",
-              "servers", "workstations", "terminals", "printers",
+              "servers", "workstations", "terminals", "printers","subtrees",
               "phones") as $type){
 
           if (isset($_POST[$type])) {
@@ -258,7 +259,7 @@ class ogroup extends plugin
       $smarty->assign("deplist", $this->config->idepartments);
       $smarty->assign("alphabet", generate_alphabet());
       foreach( array("dselect", "regex", "accounts", "groups", "applications",
-            "departments", "servers", "workstations", "terminals",
+            "departments", "servers", "workstations", "terminals","subtrees",
             "printers", "phones") as $type){
         $smarty->assign("$type", $ogfilter[$type]);
       }
@@ -412,8 +413,15 @@ class ogroup extends plugin
 
     /* Perform search for selected objectClasses */
     foreach($objectClasses as $class=> $basedn){
-      $ldap->ls("(&(objectClass=".$class.")(|(uid=$regex)(cn=$regex)(ou=$regex)))",$basedn.$ogfilter['dselect'] ,
-          array("dn", "cn", "description", "objectClass", "sn", "givenName", "uid","ou"));
+
+      if($ogfilter['subtrees'] == "checked"){
+        $ldap->cd($ogfilter['dselect']);
+        $ldap->search("(&(objectClass=".$class.")(|(uid=$regex)(cn=$regex)(ou=$regex)))",
+            array("dn", "cn", "description", "objectClass", "sn", "givenName", "uid","ou"));
+      }else{
+        $ldap->ls("(&(objectClass=".$class.")(|(uid=$regex)(cn=$regex)(ou=$regex)))",$basedn.$ogfilter['dselect'] ,
+            array("dn", "cn", "description", "objectClass", "sn", "givenName", "uid","ou"));
+      }
       
       /* fetch results and append them to the list */
       while($attrs = $ldap->fetch()){
index cf248fe7819a6334b28956d0f69d8a1d38d2a695..fc5f158a16e062611d8246e40592af7b3c581f42 100644 (file)
     <input type=checkbox name="printers" value="1" {$printers} onClick="mainform.submit()" title="{t}Select to see printers{/t}">{t}Show printers{/t}<br>
     <input type=checkbox name="phones" value="1" {$phones} onClick="mainform.submit()" title="{t}Select to see phones{/t}">{t}Show phones{/t}<br>
  </p>
+ <p class="contentboxb" style="border-top:1px solid #B0B0B0; background-color:#F8F8F8">
+    <input type=checkbox name="subtrees" value="1" {$subtrees} onClick="mainform.submit()" title="{t}Select to search within subtrees{/t}">{t}Ignore subtrees{/t}<br>
+ </p>
+
     <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8"><tr><td width="50%"><img alt="" src="{$tree_image}" align=middle title="{t}Display objects of department{/t}">&nbsp;
     <select name="dselect" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based on{/t}">
       {html_options options=$deplist selected=$dselect}