Code

Fixed typo
[gosa.git] / gosa-plugins / goto / admin / systems / ppd / class_printerPPDDialog.inc
index 142392232230a64a33f3edc91ee7c9dd52e330ac..bfb18cf1cba9e32eeaf5e8523bfcf3786dd31e72 100644 (file)
@@ -2,11 +2,6 @@
 
 class printerPPDDialog extends plugin
 {
-  /* CLI vars */
-  var $cli_summary          = "Manage server basic objects";
-  var $cli_description      = "Some longer text\nfor help";
-  var $cli_parameters       = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
   /* attribute list for save action */
   var $ignore_account       = TRUE;
   var $attributes           = array("cn");
@@ -65,7 +60,7 @@ class printerPPDDialog extends plugin
       if(($ppdfile!== NULL)&&(strlen($ppdfile)>0)){
         $ppdfile = preg_replace("#".$this->pathToModified."#","",$ppdfile);
         if(!file_exists($this->pathToPPD.$this->pathToModified.$ppdfile)){
-          print_red(sprintf(_("Can't open '%s', ppd settings resetted."),$ppdfile));
+          msg_dialog::display(_("PPD error"), sprintf(_("Cannot open PPD '%s'!"), $ppdfile), ERROR_DIALOG);
         }else{
           $res  = $this->ppdManager->loadDescription($this->pathToPPD.$this->pathToModified.$ppdfile);
           if($res){
@@ -102,7 +97,8 @@ class printerPPDDialog extends plugin
       /* Check if path is write/readable*/
       $is_r = @is_readable($path);  
       if(((!is_dir($path))||(empty($path)) || (!$is_r)) && (!@mkdir($path))){
-        print_red(sprintf(_("The specified path '%s' which results from PPD_PATH in your gosa.conf is invalid, can't read/write any ppd informations."),$path));
+        msg_dialog(_("Configuration error"), sprintf(_("Cannot open PPD path '%s' for reading and writing!"), $path), ERROR_DIALOG);
+
         /* Print out template */
         $display.= $smarty->fetch(get_template_path('printerPPDDialog.tpl', TRUE,dirname(__FILE__)));
         return($display);
@@ -119,7 +115,7 @@ class printerPPDDialog extends plugin
           $this->SelectPPD($name); 
         }
       }else{
-        print_red(_("Please specify a valid ppd file."));
+        msg_dialog(_("PPD error"), msgPool::incorrectUpload(_("file is empty")), ERROR_DIALOG);
       }
     }
 
@@ -198,7 +194,7 @@ class printerPPDDialog extends plugin
 
     /* Get PPD informations and set vendor / modell / name */ 
     if((!file_exists($AbsoluteSourceName)) || (!is_readable($AbsoluteSourceName))){
-      print_red(sprintf(_("Can't select PPD file '%s', the file is not readable"),$AbsoluteSourceName));   
+      msg_dialog::display(_("PPD error"), msgPool::cannotReadFile($AbsoluteSourceName), ERROR_DIALOG);
       return;
     }
     $res  = $this->ppdManager->loadDescription($AbsoluteSourceName);
@@ -215,7 +211,7 @@ class printerPPDDialog extends plugin
     /* Create the vendors path, if it doesn't exists already */
     if(!is_dir($AbsoluteDestinationPath.$Vendor)){
       if(!(@mkdir($AbsoluteDestinationPath.$Vendor))){
-        print_red(sprintf(_("Can't create folder '%s' for the uploaded ppd file."),$AbsoluteDestinationPath.$Vendor));
+        msg_dialog::display(_("PPD error"), msgPool::cannotCreateFolder($AbsoluteDestinationPath.$Vendor), ERROR_DIALOG);
         return(false);
       }
     }
@@ -223,7 +219,7 @@ class printerPPDDialog extends plugin
     /* Create destination file handle */
     $fp = @fopen($AbsoluteDestinationPath.$PPDName,"w+");
     if(!$fp){
-      print_red(sprintf(_("Can't create file '%s' to store modifed ppd informations."),$AbsoluteDestinationPath.$PPDName));
+      msg_dialog::display(_("PPD error"), msgPool::cannotWriteFile($AbsoluteDestinationPath.$PPDName), ERROR_DIALOG);
       return(false);
     }
 
@@ -247,7 +243,7 @@ class printerPPDDialog extends plugin
   {
     /* Check if file exists && is readable */
     if((!is_file($_PathOnHdd)) || (!is_readable($_PathOnHdd))){
-      print_red(sprintf(_("Can't add new ppd file, the source file '%s' is not accessible."),$_PathOnHdd));
+      msg_dialog::display(_("PPD error"), msgPool::cannotReadFile($_PathOnHdd), ERROR_DIALOG);
       return(false);
     }
     
@@ -265,7 +261,7 @@ class printerPPDDialog extends plugin
 
     /* Check if parse was successfull */
     if(empty($name) || empty($vendor)){
-      print_red(sprintf(_("The given ppd file '%s' seams to be invalid, can't get any model or vendor informations."),$_PathOnHdd));
+      msg_dialog::display(_("PPD error"), sprintf(_("Cannot parse PPD '%s'!"), $_PathOnHdd), ERROR_DIALOG);
       return(false);
     }
 
@@ -288,7 +284,7 @@ class printerPPDDialog extends plugin
         $found = true;
         if(!$overwrite){
           if(!copy($_PathOnHdd,$_PathOnHdd."_back")){
-            print_red(sprintf(_("Can't add new ppd file, the source file '%s' is not accessible."),$_PathOnHdd));         
+            msg_dialog::display(_("PPD error"), msgPool::cannotReadFile($_PathOnHdd), ERROR_DIALOG);
           }else{
             $this->add_ppd_later = $_PathOnHdd."_back";
             $this->add_later_msg_dialog = new msg_dialog(_("Overwrite existing PPD"),
@@ -302,7 +298,7 @@ class printerPPDDialog extends plugin
     /* Create the vendors path, if it doesn't exists already */
     if(!is_dir($this->pathToPPD.$vendor)){
       if(!(@mkdir($this->pathToPPD.$vendor))){
-        print_red(sprintf(_("Can't create folder '%s' for the uploaded ppd file."),$this->pathToPPD.$vendor));
+        msg_dialog::display(_("PPD error"), msgPool::cannotCreateFolder($this->pathToPPD.$vendor), ERROR_DIALOG);
         return(false);
       }
     }
@@ -312,11 +308,11 @@ class printerPPDDialog extends plugin
 
     /* Check file handle & contents */
     if(!$fp){
-      print_red(sprintf(_("Can't save file '%s'."),$filename));
+      msg_dialog::display(_("PPD error"), msgPool::cannotWriteFile($filename), ERROR_DIALOG);
       return;
     }
     if(empty($contents)){
-      print_red(_("Uploaded ppd file is empty, can't create new ppd file."));
+      msg_dialog::display(_("PPD error"), msgPool::incorrectUpload(_("file is empty")), ERROR_DIALOG);
       return;
     }
     
@@ -502,7 +498,7 @@ class printerPPDDialog extends plugin
             $str  .=  "</select>\n";
 
           }else{
-            print_red(sprintf(_("Unsupported ppd type '%s' used for '%s' "),$type,$name));
+            msg_dialog(_("PPD error"), sprintf(_("PPD type '%s' is not supported!"), $type), ERROR_DIALOG);
           }
           $str .= "</td></tr>\n";
         }
@@ -519,13 +515,13 @@ class printerPPDDialog extends plugin
     if(file_exists($path)){
       if(is_writeable($path)){
         if(!@unlink($path)){
-          print_red(sprintf(_("Removing old ppd file '%s' failed."),$path));
+          msg_dialog(_("PPD error"), msgPool::cannotDeleteFile($path), ERROR_DIALOG);
         }
       }else{
-        print_red(sprintf(_("Removing old ppd file '%s' failed. File is not accessible."),$path));
+        msg_dialog(_("PPD error"), msgPool::cannotDeleteFile($path), ERROR_DIALOG);
       }
     }else{
-      print_red(sprintf(_("Removing old ppd file '%s' failed. File does not exists or is not accessible."),$path));
+      msg_dialog(_("PPD error"), msgPool::cannotDeleteFile($path), ERROR_DIALOG);
     }
   }