Code

Updated ppd edit dialog.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 19 Jun 2009 05:59:28 +0000 (05:59 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 19 Jun 2009 05:59:28 +0000 (05:59 +0000)
-If a printer was new, we weren't able to add a ppd driver.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13735 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc
gosa-plugins/goto/admin/systems/ppd/class_printerPPDDialog.inc

index 117f5ee612e8b00c3ff6d3f87c956c5c0414a635..9473158f32063f23800ca56d54e9ac7478edce18 100644 (file)
@@ -433,7 +433,7 @@ class printgeneric extends plugin
       if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){
         $this->dialog = $this->PPDdialogToSave;
       }else{
-  
         if(is_array($this->gotoPrinterPPD)){
           $this->dialog = new printerPPDDialog($this->config, $this->dn,"");
         }else{
@@ -441,6 +441,16 @@ class printgeneric extends plugin
         }
         $this->dialog->cn= $this->cn;
       }
+
+      // Detect edit acl base
+      $ldap = $this->config->get_ldap_link();
+      if($ldap->dn_exists($this->dn)){
+        $acl_base = $this->dn;
+      }else{
+        $acl_base = $this->base;
+      }
+
+      $this->dialog->set_acl_base($acl_base);
     }
 
     /* remove ppd */
@@ -803,6 +813,7 @@ class printgeneric extends plugin
 
     /* save ppd configuration */
     if($this->PPDdialogToSave && is_object($this->PPDdialogToSave)){
+    
       $this->PPDdialogToSave->save_ppd();
 
       /* Rename the generated ppd to match the gzip ending '.gz', if necessary.
@@ -823,7 +834,7 @@ class printgeneric extends plugin
         }
       }
     }
-    if($this->orig_dn != $this->dn){
+    if($this->orig_dn != $this->dn && $this->orig_dn != "new"){
       if(!empty($this->gotoPrinterPPD)) {
         $this->PPDdialogToSave = new printerPPDDialog($this->config, $this->dn,$this->gotoPrinterPPD);
         $this->PPDdialogToSave->cn = $this->cn;
@@ -841,7 +852,7 @@ class printgeneric extends plugin
     }
 
     /* If no ppd is selected, remove this attribute */
-    if(!empty($this->gotoPrinterPPD) && $this->initially_was_account) {
+    if(!empty($this->gotoPrinterPPD)) {
       $this->gotoPrinterPPD = $this->ppdServerPart.'/'.$this->gotoPrinterPPD;
     }else{
       $this->gotoPrinterPPD = array();
index 8fa944bcd504cafdd2f1abf34f5f112b62e7cd88..be43f441ad5ef534615ef5e9894986012ed2343a 100644 (file)
@@ -96,9 +96,9 @@ class printerPPDDialog extends plugin
     $smarty->assign("ppdString", _("Can't get ppd informations."));
     $smarty->assign("showOptions", "");
     $smarty->assign("path_valid", TRUE);
-    $smarty->assign("acl",$this->ui->get_permissions($this->dn,"printer/printgeneric","gotoPrinterPPD"));
+    $smarty->assign("acl",$this->ui->get_permissions($this->acl_base,"printer/printgeneric","gotoPrinterPPD"));
 
-    $acl = $this->ui->get_permissions($this->dn,"printer/printgeneric","gotoPrinterPPD");
+    $acl = $this->ui->get_permissions($this->acl_base,"printer/printgeneric","gotoPrinterPPD");
 
     if(empty($this->pathToPPD)){
 
@@ -389,7 +389,7 @@ class printerPPDDialog extends plugin
       return;
     }
 
-    if(preg_match("/w/",$this->ui->get_permissions($this->dn,"printer/printgeneric","gotoPrinterPPD"))){
+    if(preg_match("/w/",$this->ui->get_permissions($this->acl_base,"printer/printgeneric","gotoPrinterPPD"))){
       foreach($this->ppdConfig as $cat => $obj){
         foreach($obj as $attr => $attributes){
           if(isset($_POST[base64_encode($attributes['_name'])])){
@@ -493,7 +493,7 @@ class printerPPDDialog extends plugin
           }
 
           $acl ="";
-          if(!preg_match("/w/",$this->ui->get_permissions($this->dn,"printer/printgeneric","gotoPrinterPPD"))){
+          if(!preg_match("/w/",$this->ui->get_permissions($this->acl_base,"printer/printgeneric","gotoPrinterPPD"))){
             $acl = "disabled";
           }