Code

Updated to have subtree search
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Jun 2007 14:53:34 +0000 (14:53 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Jun 2007 14:53:34 +0000 (14:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6668 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 2f2afb95c7b9f3ad06e1ee834c63cf712075f2ca..693e3425b37837cbc4412319d9916b0be8b57435 100644 (file)
@@ -17,6 +17,7 @@ class selectPrinterDialog extends plugin
   var $deplist              = array("/");
   var $module               = array("printer");
   var $ui                   = NULL;
+  var $subtreesearch        = FALSE;
 
   function selectPrinterDialog ($config, $dn= NULL,$alreadyused=array() )
   {
@@ -72,6 +73,12 @@ class selectPrinterDialog extends plugin
       }
     }
 
+    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);
@@ -84,6 +91,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'));
@@ -122,7 +130,12 @@ class selectPrinterDialog extends plugin
     $module = $this->module;
     $base   = $this->depselect;
     $attrs  = array("cn","description");
-    $res    = get_list($filter,$module,$base,$attrs);
+    if ($this->subtreesearch){
+      $res    = get_list($filter,$module,$base,$attrs, GL_SIZELIMIT, GL_SUBSEARCH);
+    } else {
+      $base= "ou=printers,ou=systems,".$base;
+      $res    = get_list($filter,$module,$base,$attrs, GL_SIZELIMIT);
+    }
 
     foreach($res as $printer)  {
 
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>