From: hickert Date: Wed, 27 Jan 2010 11:18:17 +0000 (+0000) Subject: Updated printer Selection X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5b56f2bb68a279624bf468cfecb769efca17c855;p=gosa.git Updated printer Selection git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15366 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/personal/environment/class_environment.inc b/gosa-plugins/goto/personal/environment/class_environment.inc index b72ced3ce..b7a319816 100644 --- a/gosa-plugins/goto/personal/environment/class_environment.inc +++ b/gosa-plugins/goto/personal/environment/class_environment.inc @@ -874,34 +874,27 @@ class environment extends plugin /* First handle Add Post. Open a dialog that allows us to select a printer or two */ if(isset($_POST['gotoPrinterAdd'])){ - + $this->dialog = new printerSelect($this->config,get_userinfo()); $this->is_dialog=true; - $this->dialog = new selectPrinterDialog($this->config,$this->dn,$this->gotoPrinter); } - if(isset($_POST['PrinterCancel'])){ + if(isset($_POST['selectPrinter_cancel']) && $this->dialog instanceOf printerSelect){ $this->is_dialog=false; - unset($this->dialog); $this->dialog=FALSE; } - if(isset($_POST['PrinterSave'])){ - if(count($this->dialog->check())!=0){ - $tmp = $this->dialog->check(); - foreach($tmp as $msg){ - msg_dialog::display(_("Error"), $msg, ERROR_DIALOG); - } - }else{ - $this->dialog->save_object(); - $tmp = $this->dialog->save(); - $tmp2= $this->dialog->getPrinter(true); + if(isset($_POST['selectPrinter_save']) && $this->dialog instanceOf printerSelect){ - foreach($tmp as $pname){ - $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer"); - $printerObj->set_acl_base($tmp2[$pname]['dn']); + $res = $this->dialog->save(); + foreach($res as $printer){ + + $pname = $printer['cn'][0]; + $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'], $printer['dn'],"printer"); + $printerObj->set_acl_base($printer['dn']); $type = false; + if($this->is_group){ if($this->dn == "new"){ $type = "AddGroup"; @@ -921,7 +914,7 @@ class environment extends plugin } if($type){ - $this->gotoPrinter[$pname]=$tmp2[$pname]; + $this->gotoPrinter[$pname]=$printer; $this->gotoPrinter[$pname]['mode']="user"; $this->add_del_printer_member_was_called = true; @@ -935,7 +928,6 @@ class environment extends plugin $this->is_dialog=false; unset($this->dialog); $this->dialog =FALSE; - } } if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){ diff --git a/gosa-plugins/goto/personal/environment/printerSelect/class_printerSelect.inc b/gosa-plugins/goto/personal/environment/printerSelect/class_printerSelect.inc index f832cb8fc..0d355684e 100644 --- a/gosa-plugins/goto/personal/environment/printerSelect/class_printerSelect.inc +++ b/gosa-plugins/goto/personal/environment/printerSelect/class_printerSelect.inc @@ -37,15 +37,15 @@ class printerSelect extends management # if (session::global_is_set(get_class($this)."_filter")){ # $filter= session::global_get(get_class($this)."_filter"); # } else { - $filter = new filter(get_template_path("selectPrinter-filter.xml", true, dirname(__FILE__))); - $filter->setObjectStorage($this->storagePoints); + $filter = new filter(get_template_path("selectPrinter-filter.xml", true, dirname(__FILE__))); + $filter->setObjectStorage($this->storagePoints); # } - $this->setFilter($filter); + $this->setFilter($filter); - // Build headpage - $headpage = new listing(get_template_path("selectPrinter-list.xml", true, dirname(__FILE__))); - $headpage->setFilter($filter); - parent::__construct($config, $ui, "printer", $headpage); + // Build headpage + $headpage = new listing(get_template_path("selectPrinter-list.xml", true, dirname(__FILE__))); + $headpage->setFilter($filter); + parent::__construct($config, $ui, "printer", $headpage); } function save()