Code

Fixed ppd selection
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 12 Jan 2006 08:42:57 +0000 (08:42 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 12 Jan 2006 08:42:57 +0000 (08:42 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2454 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_printerPPDDialog.inc

index 516f95ad0ca8a086ab093dca5d996d459426a1bb..2f0c18f9db0913411bafb808f641e76c9495ed3f 100644 (file)
@@ -30,7 +30,7 @@ class printerPPDDialog extends plugin
 
     if(isset($_SESSION['config']->data['MAIN']['PPD_PATH'])){
       $this->pathToPPD = $_SESSION['config']->data['MAIN']['PPD_PATH'];
-       $this->pathToPPD= preg_replace("/\/*$/", "/", $this->pathToPPD);
+      $this->pathToPPD= preg_replace("/\/\//", "/", $this->pathToPPD);
     }else{
       $this->pathToPPD = "";
     }
@@ -151,8 +151,6 @@ class printerPPDDialog extends plugin
                   $tmp3['link']   =$ppdname;
                   $tmp3['ppd']    =$res;
 
-                  print_a($tmp3);
-
                   $this->selectedPPD = $tmp3;
                   $this->getPrinterReload(); 
                 }
@@ -204,11 +202,14 @@ class printerPPDDialog extends plugin
               $hit = true;
             }
           }
-        } 
-        $this->selectedPPD['link'] = $_GET['id'];
-        $this->ppdConfig   = false;
+        }
+        if($hit == true){
+          $this->selectedPPD['link'] = str_replace($this->pathToPPD,"",$_GET['id']);
+          $this->ppdConfig   = false;
+        }
         unset($this->dialog);
         $this->dialog=NULL;
+        
       }
 
       /* if a dialog is open, print the dialog instead of this class
@@ -257,7 +258,9 @@ class printerPPDDialog extends plugin
   }
 
   function save_ppd(){
-    $this->ppdManager->saveProperties($this->pathToPPD.$this->selectedPPD['link'],$this->ppdConfig);
+    if($this->ppdManager){
+      $this->ppdManager->saveProperties($this->pathToPPD.$this->selectedPPD['link'],$this->ppdConfig);
+    }
   }
 
   /* Save to LDAP */
@@ -274,7 +277,7 @@ class printerPPDDialog extends plugin
      */
     $str = "none";
     if(!empty($this->selectedPPD)){
-      $str = $this->ppdManager->loadDescription($this->pathToPPD.$this->selectedPPD['link']);
+      $str = $this->ppdManager->loadDescription($this->pathToPPD."/".$this->selectedPPD['link']);
     }
     return($str) ; 
   }