From c24598e48ca7415e92e57c6a12199f9d8a1a0cac Mon Sep 17 00:00:00 2001 From: cajus Date: Fri, 22 Jun 2007 14:45:14 +0000 Subject: [PATCH] Added subsearch for printers git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6667 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../environment/class_selectPrinterDialog.inc | 17 +++++++++++++++-- .../environment/selectPrinterDialog.tpl | 5 +++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/plugins/personal/environment/class_selectPrinterDialog.inc b/plugins/personal/environment/class_selectPrinterDialog.inc index 748077215..ec6f875d4 100644 --- a/plugins/personal/environment/class_selectPrinterDialog.inc +++ b/plugins/personal/environment/class_selectPrinterDialog.inc @@ -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; diff --git a/plugins/personal/environment/selectPrinterDialog.tpl b/plugins/personal/environment/selectPrinterDialog.tpl index d30845c97..e58f71465 100644 --- a/plugins/personal/environment/selectPrinterDialog.tpl +++ b/plugins/personal/environment/selectPrinterDialog.tpl @@ -37,6 +37,11 @@ + + +
+ {t}Ignore subtrees{/t} +
-- 2.30.2