Code

Added subsearch for printers
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Jun 2007 14:45:14 +0000 (14:45 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Jun 2007 14:45:14 +0000 (14:45 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6667 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_selectPrinterDialog.inc
plugins/personal/environment/selectPrinterDialog.tpl

index 7480772150c6d827b408c14e1c1c9b01a315e0e8..ec6f875d4ef187ad017a03990e838aeccc11b2a1 100644 (file)
@@ -10,6 +10,7 @@ class selectPrinterDialog extends plugin
   var $regex                = "*";
   var $depselect            = "/";
   var $deplist              = "/";
+  var $subtreesearch        = FALSE;
 
   function selectPrinterDialog ($config, $dn= NULL,$alreadyused=array() )
   {
@@ -32,6 +33,12 @@ class selectPrinterDialog extends plugin
       $this->depselect = $_POST['depselectPrinter'];
     }
 
+    if(isset($_POST['subtrees'])){
+      $this->subtreesearch= TRUE;
+    } else {
+      $this->subtreesearch= FALSE;
+    }
+
     if((isset($_GET['search']))&&(!empty($_GET['search']))){
       $this->regex=$_GET['search']."*";
       $this->regex=preg_replace("/\*\*/","*",$this->regex);
@@ -46,6 +53,7 @@ class selectPrinterDialog extends plugin
     $smarty->assign("gotoPrinterKeys",array_flip($this->getPrinter()));
     $smarty->assign("apply", apply_filter());
     $smarty->assign("alphabet", generate_alphabet());
+    $smarty->assign("subtrees", $this->subtreesearch?"checked":"");
     $smarty->assign("search_image", get_template_path('images/search.png'));
     $smarty->assign("tree_image", get_template_path('images/tree.png'));
     $smarty->assign("infoimage", get_template_path('images/info.png'));
@@ -79,7 +87,6 @@ class selectPrinterDialog extends plugin
   {
     $a_return=array();
     $ldap = $this->config->get_ldap_link();
-    $ldap->cd($this->depselect);
 
     /* Set tag attribute if we've tagging activated */
     $tag= "";
@@ -89,7 +96,13 @@ class selectPrinterDialog extends plugin
       $tag= "(gosaUnitTag=".$ui->gosaUnitTag.")";
     }
 
-    $ldap->search("(&(objectClass=gotoPrinter)$tag(cn=".$this->regex."))",array("*"));
+    if ($this->subtreesearch){
+      $ldap->cd($this->depselect);
+      $ldap->search("(&(objectClass=gotoPrinter)$tag(cn=".$this->regex."))",array("*"));
+    } else {
+      $ldap->cd("ou=printers,ou=systems,".$this->depselect);
+      $ldap->search("(&(objectClass=gotoPrinter)$tag(cn=".$this->regex."))",array("*"));
+    }
     while($printer = $ldap->fetch()){
 
       if(isset($this->AlreadyAssigned[$printer['cn'][0]])) continue;
index d30845c97f869ac30182d7a067798b071b3fb827..e58f71465fbe0b378e6c48ab165f6451f1b53408 100644 (file)
                                                </td>
                                        </tr>
                                </table>
+                               <table summary="" style="width:100%;border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                               <tr><td>
+                               <input type=checkbox name="subtrees" value="1" {$subtrees} onClick="mainform.submit()" title="{t}Select to search within subtrees{/t}">{t}Ignore subtrees{/t}
+                               </tr></td>
+                               </table>
                                        <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
                                                        <tr>
                                                                <td>