Code

Some changes repository plugin
[gosa.git] / plugins / admin / systems / class_printerPPDDialog.inc
index dc359d9fb7cbd9ec5e5ef5e50a7d5abc8dea262c..516f95ad0ca8a086ab093dca5d996d459426a1bb 100644 (file)
@@ -30,6 +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);
     }else{
       $this->pathToPPD = "";
     }
@@ -135,6 +136,7 @@ class printerPPDDialog extends plugin
                 }
               }// Foreach
               if(!$found){
+                $ppdname = $vendor."/".$vendor."-".preg_replace("/^[^ ]/","",str_replace("-","",$model)).".ppd";
                 $filename = $this->pathToPPD.$vendor."/".$vendor."-".preg_replace("/^[^ ]/","",str_replace("-","",$model)).".ppd";
                 $fp = @fopen($filename,"w+");
                 if(!$fp){
@@ -146,8 +148,11 @@ class printerPPDDialog extends plugin
 
                   $tmp2= split("\n", $res);
                   $tmp3['name']   =preg_replace("/^ -/","",$tmp2[1]);
-                  $tmp3['link']   =$filename;
+                  $tmp3['link']   =$ppdname;
                   $tmp3['ppd']    =$res;
+
+                  print_a($tmp3);
+
                   $this->selectedPPD = $tmp3;
                   $this->getPrinterReload(); 
                 }
@@ -190,6 +195,22 @@ class printerPPDDialog extends plugin
         }
       }
 
+      /* Div Selection */ 
+      if((isset($_GET['act']))&&($_GET['act']=="use")){
+        $hit = false;
+        foreach($this->ppdList as $vendor => $ppds ){
+          foreach($ppds as $name => $ppd){
+            if($ppd['link']==$_GET['id']){
+              $hit = true;
+            }
+          }
+        } 
+        $this->selectedPPD['link'] = $_GET['id'];
+        $this->ppdConfig   = false;
+        unset($this->dialog);
+        $this->dialog=NULL;
+      }
+
       /* if a dialog is open, print the dialog instead of this class
        */
       if($this->dialog!=NULL){