Code

Updated printer Selection
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Jan 2010 11:18:17 +0000 (11:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Jan 2010 11:18:17 +0000 (11:18 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15366 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/personal/environment/class_environment.inc
gosa-plugins/goto/personal/environment/printerSelect/class_printerSelect.inc

index b72ced3ce70b2584673ccef8f447eb45cba48c2d..b7a3198164cdce9f8adc56d390c1c9cecd377d95 100644 (file)
@@ -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']))){
index f832cb8fc4540f348090d53a716597e6d89819fb..0d355684efe5b7a89b6edb3a696f85f9c9016a14 100644 (file)
@@ -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()