Code

Added subtree search to selectUserToPrinter
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 May 2007 07:00:45 +0000 (07:00 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 May 2007 07:00:45 +0000 (07:00 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6442 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_selectUserToPrinterDialog.inc
plugins/admin/systems/selectUserToPrinterDialog.tpl

index e601e8745a87e54587882b86aefcfaeb9b4943e7..3469979c2761a6df6805de93636ca4543593f552 100644 (file)
@@ -8,6 +8,7 @@ class selectUserToPrinterDialog extends plugin
   var $attributes           = array();
   var $objectclasses        = array("whatever");
   var $regex                = "*";
+  var $subtree              = FALSE;
   var $depselect            = "/";
   var $deplist              = "/";
 
@@ -65,6 +66,7 @@ class selectUserToPrinterDialog extends plugin
       $this->regex=$_POST['regexPrinter'];
       $this->depselect = $_POST['depselectPrinter'];
     }
+    $this->subtree= isset($_POST['SubSearch']);
 
     if((isset($_GET['search']))&&(!empty($_GET['search']))){
       $this->regex=$_GET['search']."*";
@@ -85,6 +87,7 @@ class selectUserToPrinterDialog extends plugin
     $smarty->assign("infoimage"           , get_template_path('images/info.png'));
     $smarty->assign("launchimage"         , get_template_path('images/small_filter.png'));
     $smarty->assign("deplist"             , $this->config->idepartments);
+    $smarty->assign("subtree", $this->subtree?"checked":"");
 
     $display.= $smarty->fetch(get_template_path('selectUserToPrinterDialog.tpl', TRUE,dirname(__FILE__)));
     return($display);
@@ -120,8 +123,11 @@ class selectUserToPrinterDialog extends plugin
     $a_return=array();
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->depselect);
-    #$ldap->search("(&".$this->searchObjects."(cn=".$this->regex."))", $this->depselect, $this->searchAttrs);
-    $ldap->ls("(&".$this->searchObjects."(cn=".$this->regex."))", $this->baseAddition.$this->depselect, $this->searchAttrs);
+    if ($this->subtree){
+      $ldap->search("(&".$this->searchObjects."(cn=".$this->regex."))", $this->searchAttrs);
+    } else {
+      $ldap->ls("(&".$this->searchObjects."(cn=".$this->regex."))", $this->baseAddition.$this->depselect, $this->searchAttrs);
+    }
     while($printer = $ldap->fetch()){
       if(($detailed ==true)){
         if(isset($printer[$this->searchAppend])){
index 0d387ef4d3defb1292176638bc0e184dbe5146ab..5cd8e152ab1554b44a4c2f52900fd6b031b5037f 100644 (file)
                                <table summary="" style="width:100%;border-top:1px solid #B0B0B0;background-color:#F8F8F8">
                                {$alphabet}
                                </table>
+                                       <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                                               <tr>
+                                                       <td>
+                                                               <input type='checkbox' name='SubSearch' value='1' title='{t}Select to search within subtrees{/t}' onClick='document.mainform.submit();' {$subtree}>&nbsp;{t}Ignore subtrees{/t}
+                                                       </td>
+                                               </tr>
+                                       </table>
                                <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
                                        <tr>
                                                <td>