From: hickert Date: Mon, 27 Oct 2008 12:42:24 +0000 (+0000) Subject: Updated printer user/group selection X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9984187a31eb6b9f4cac8be36f9b39fcfbbbafa3;p=gosa.git Updated printer user/group selection -Do not display already assigned objects. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12782 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc b/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc index 847da3ac3..4041548a1 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc @@ -393,16 +393,16 @@ class printgeneric extends plugin } if(isset($_POST['AddUser'])){ - $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddUser"); + $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddUser",$this->member); } if(isset($_POST['AddGroup'])){ - $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddGroup"); + $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddGroup",$this->member); } if(isset($_POST['AddAdminUser'])){ - $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminUser"); + $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminUser",$this->member); } if(isset($_POST['AddAdminGroup'])){ - $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminGroup"); + $this->dialog = new selectUserToPrinterDialog($this->config, NULL,"AddAdminGroup",$this->member); } /* Display ppd configure/select dialog */ diff --git a/gosa-plugins/goto/admin/systems/goto/class_selectUserToPrinterDialog.inc b/gosa-plugins/goto/admin/systems/goto/class_selectUserToPrinterDialog.inc index 333fab3a7..246f21516 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_selectUserToPrinterDialog.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_selectUserToPrinterDialog.inc @@ -17,8 +17,10 @@ class selectUserToPrinterDialog extends plugin var $baseAddition = ""; var $type = ""; var $search_cat = ""; + + var $dns_used = array(); - function selectUserToPrinterDialog (&$config, $dn= NULL,$type=false ) + function selectUserToPrinterDialog (&$config, $dn= NULL,$type=false,$already_assigned ) { plugin::plugin ($config, $dn); $this->depselect = $this->config->current['BASE']; @@ -55,6 +57,13 @@ class selectUserToPrinterDialog extends plugin } $this->type = $type; + /* Collect already assigned object dns */ + $this->dns_used = array(); + if(isset($already_assigned[$type])){ + foreach($already_assigned[$type] as $entry){ + $this->dns_used[] = $entry['dn']; + } + } } function execute() @@ -170,6 +179,12 @@ class selectUserToPrinterDialog extends plugin $res= get_list($filter,$cat,$base,$attrs); } foreach($res as $printer){ + + /* Skip already used entries */ + if(in_array($printer['dn'],$this->dns_used)) { + continue; + } + if(($detailed ==true)){ if(isset($printer[$this->searchAppend])){ $a_return[$printer[$this->searchAppend][0]] = $printer;