X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_selectUserToPrinterDialog.inc;h=91d1ca4597e64730796d8a8d6fc2fc7ee4a1583c;hb=96e561f68b807338f5f8923b665eb96376bd2f11;hp=945d6f6b084c2153bba25746942fe592da37eb55;hpb=e9aa26505a1a34608865622f5eed0878a895de96;p=gosa.git diff --git a/plugins/admin/systems/class_selectUserToPrinterDialog.inc b/plugins/admin/systems/class_selectUserToPrinterDialog.inc index 945d6f6b0..91d1ca459 100644 --- a/plugins/admin/systems/class_selectUserToPrinterDialog.inc +++ b/plugins/admin/systems/class_selectUserToPrinterDialog.inc @@ -18,6 +18,7 @@ class selectUserToPrinterDialog extends plugin var $searchObjects = ""; var $searchAttrs = ""; var $searchAppend = ""; + var $baseAddition = ""; var $type = ""; function selectUserToPrinterDialog ($config, $dn= NULL,$type=false ) @@ -27,24 +28,28 @@ class selectUserToPrinterDialog extends plugin switch($type){ case "AddUser" : - $this->searchObjects = "(objectClass=person)(objectClass=inetOrgPerson)"; + $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))"; $this->searchAttrs = array("cn","uid"); $this->searchAppend = "uid"; + $this->baseAddition = get_people_ou(); ;break; case "AddGroup" : $this->searchObjects = "(objectClass=posixGroup)"; $this->searchAttrs = array("cn","description"); $this->searchAppend = "cn"; + $this->baseAddition = get_groups_ou(); ;break; case "AddAdminUser" : - $this->searchObjects = "(objectClass=person)(objectClass=inetOrgPerson)"; + $this->searchObjects = "(objectClass=gosaAccount)(!(uid=*$))"; $this->searchAttrs = array("cn","uid"); $this->searchAppend = "uid"; + $this->baseAddition = get_people_ou(); ;break; case "AddAdminGroup" : $this->searchObjects = "(objectClass=posixGroup)"; $this->searchAttrs = array("cn","description"); $this->searchAppend = "cn"; + $this->baseAddition = get_groups_ou(); ;break; } $this->type = $type; @@ -53,6 +58,9 @@ class selectUserToPrinterDialog extends plugin function execute() { + /* Call parent execute */ + plugin::execute(); + /* Fill templating stuff */ $smarty= get_smarty(); $display= ""; @@ -67,19 +75,19 @@ class selectUserToPrinterDialog extends plugin $this->regex=preg_replace("/\*\*/","*",$this->regex); } - $this->deplist=array_flip($this->config->departments); - + $tmp_printers= $this->getPrinter(); + natcasesort($tmp_printers); $smarty->assign("regexPrinter" , $this->regex); - $smarty->assign("deplistPrinter" , $this->deplist); + $smarty->assign("deplistPrinter" , $this->config->idepartments);//deplist); $smarty->assign("depselectPrinter" , $this->depselect); - $smarty->assign("gotoPrinters" , $this->getPrinter()); - $smarty->assign("gotoPrinterKeys" , array_flip($this->getPrinter())); + $smarty->assign("gotoPrinters" , $tmp_printers); + $smarty->assign("gotoPrinterKeys" , array_flip($tmp_printers)); $smarty->assign("apply" , apply_filter()); $smarty->assign("alphabet" , generate_alphabet()); $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')); - $smarty->assign("launchimage" , get_template_path('images/launch.png')); + $smarty->assign("launchimage" , get_template_path('images/small_filter.png')); $smarty->assign("deplist" , $this->config->idepartments); $display.= $smarty->fetch(get_template_path('selectUserToPrinterDialog.tpl', TRUE,dirname(__FILE__))); @@ -87,7 +95,9 @@ class selectUserToPrinterDialog extends plugin } function check(){ - $message=array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + if(empty($_POST['gotoPrinter'])){ $message[] = _("Please select a printer or press cancel."); } @@ -114,7 +124,8 @@ 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->searchAttrs); + #$ldap->search("(&".$this->searchObjects."(cn=".$this->regex."))", $this->depselect, $this->searchAttrs); + $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])){ @@ -134,9 +145,5 @@ class selectUserToPrinterDialog extends plugin } } - - - - // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>