Code

Removed a couple of print_red calls
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sun, 16 Mar 2008 13:20:35 +0000 (13:20 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sun, 16 Mar 2008 13:20:35 +0000 (13:20 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9880 594d385d-05f5-0310-b6e9-bd551577e9d8

12 files changed:
gosa-plugins/goto/admin/applications/class_applicationManagement.inc
gosa-plugins/goto/admin/devices/class_deviceGeneric.inc
gosa-plugins/goto/admin/devices/class_deviceManagement.inc
gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc
gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc
gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc
gosa-plugins/goto/admin/systems/goto/class_terminalInfo.inc
gosa-plugins/goto/admin/systems/goto/class_terminalService.inc
gosa-plugins/goto/admin/systems/goto/class_terminalStartup.inc
gosa-plugins/goto/admin/systems/goto/class_workstationService.inc
gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc
gosa-plugins/goto/admin/systems/ppd/class_printerPPDDialog.inc

index 9cecb11035cfaa0fa37c2979af4531b881be1f93..f30035e8955d68a8ece0807463282df2627cfcc0 100644 (file)
@@ -334,7 +334,7 @@ class applicationManagement extends plugin
         } else {
           /* Normally this shouldn't be reached, send some extra
              logs to notify the administrator */
-          print_red (msgPool::permDelete());
+          msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
           new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
         }
         /* Remove lock file after successfull deletion */
@@ -388,7 +388,7 @@ class applicationManagement extends plugin
 
         /* Obviously the user isn't allowed to delete. Show message and
            clean session. */
-        print_red(msgPool::permDelete());
+        msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
       }
     }
 
@@ -418,7 +418,7 @@ class applicationManagement extends plugin
 
         /* Normally this shouldn't be reached, send some extra
            logs to notify the administrator */
-        print_red(msgPool::permDelete());
+        msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
         new log("security","application/".get_class($this),$dn,array(),"Tried to trick deletion.");
       }
 
index 6ce15fb9cb99868159b8b91bcceb354db1c57709..e929f51552de9c964d870605dfea90d2f883eac2 100644 (file)
@@ -143,19 +143,13 @@ class deviceGeneric extends plugin
 
     $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDeviceDN=".$this->dn."))",array("cn","gotoHotplugDeviceDN"));
     $skip = FALSE;
-    $str ="";
-    $cnt = 3;
+    $obj = array();
     while($cnt && $attrs = $ldap->fetch()){
+      $obj[$ldap->getDN()]= $attrs['cn'][0];
       $skip =TRUE;
-      $str .= $attrs['cn'][0].", ";
-      $cnt --;
     }
     if($skip){
-      $str  = preg_replace("/, $/","",$str);
-      if($cnt == 0){
-        $str .= "...";
-      }
-      print_red(sprintf(_("Can't remove the device '%s' it is still in use be this user(s) : %s"),$this->cn,$str));
+      msg_dialog::display(_("Error"), msgPool::stillInUse(_("Device"), $obj), INFO_DIALOG);
     }else{
       $ldap->rmdir_recursive($this->dn);
     }
index 59ce69d895962bdcdc0d79464292fe32495de229..9d216aa6a555f8d6ac43ce58ab259e00cf4a93bf 100644 (file)
@@ -269,7 +269,7 @@ class deviceManagement extends plugin
         } else {
           /* Normally this shouldn't be reached, send some extra
              logs to notify the administrator */
-          print_red (msgPool::permDelete());
+          msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
           new log("security","devices/".get_class($this),$dn,array(),"Tried to trick deletion.");
         }
         /* Remove lock file after successfull deletion */
@@ -324,7 +324,7 @@ class deviceManagement extends plugin
 
         /* Obviously the user isn't allowed to delete. Show message and
            clean session. */
-          print_red (msgPool::permDelete());
+          msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
       }
     }
 
@@ -353,7 +353,7 @@ class deviceManagement extends plugin
 
         /* Normally this shouldn't be reached, send some extra
            logs to notify the administrator */
-        print_red (msgPool::permDelete());
+        msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
         new log("security","devices/".get_class($this),$dn,array(),"Tried to trick deletion.");
       }
 
index 72ef0a03e0d1f41c15738b199fb1cf1e2232b222..3fb57bebaabb1398f54e5f114ec2707e48591d6a 100644 (file)
@@ -334,7 +334,7 @@ class mimetypeManagement extends plugin
         } else {
           /* Normally this shouldn't be reached, send some extra
              logs to notify the administrator */
-          print_red (msgPool::deleteInfo());
+          msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
           new log("security","mimetypes/".get_class($this),$dn,array(),"Tried to trick deletion.");
         }
         /* Remove lock file after successfull deletion */
@@ -389,7 +389,7 @@ class mimetypeManagement extends plugin
 
         /* Obviously the user isn't allowed to delete. Show message and
            clean session. */
-        print_red (msgPool::permDelete());
+        msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
       }
     }
 
@@ -418,7 +418,7 @@ class mimetypeManagement extends plugin
 
         /* Normally this shouldn't be reached, send some extra
            logs to notify the administrator */
-        print_red (msgPool::permDelete());
+        msg_dialog::display(_("Permission error"), msgPool::permDelete(), INFO_DIALOG);
         new log("security","mimetypes/".get_class($this),$dn,array(),"Tried to trick deletion.");
       }
 
index 2fb30ffaa36ccaee8938a8e9ddc9d6a447517f68..91acd6c97702060de9693cfe3cec2609e305e56e 100644 (file)
@@ -194,57 +194,7 @@ class termgroup extends plugin
         $macaddresses[]= $macAddress;
       }
 
-      print_red("trigger action is missing");
-      #gosaSupportDaemon::send("gosa_trigger_action_".$_POST['saction'], "255.255.255.255", $macaddresses);
-
-      /* Update members fai state */
-      $this->update_term_member_FAIstate(trim($_POST['saction']));
-
-      $this->didAction= TRUE;
-
-      /* Get dns from member objects. Create ldap object  */
-      $member = $this->parent->by_object['ogroup']->member;
-      $ldap = $this->config->get_ldap_link();
-      $ldap->cd($this->config->current['BASE']);
-
-      /* walk trough members and add FAIstate */ 
-      if ($_POST['saction'] != "wake"){
-        foreach($member as $dn =>  $object){
-
-          /* Get object */
-          $ldap->cat($dn,array("objectClass"));
-          $res                = $ldap->fetch();
-          $attrs              = array();
-
-          /* Add FAI state */
-          $attrs['FAIstate']  = "";
-          if(isset($this->mapActions[$_POST['saction']])){
-            $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
-          }
-
-          /* Fix objectClass index */
-          for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
-            $attrs['objectClass'][] = $res['objectClass'][$i];
-          }
-
-          /* Check if we must add the objectClass */
-          if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
-            $attrs['objectClass'][] = "FAIobject";
-          }
-
-          if($attrs['FAIstate'] == ""){
-            $attrs['FAIstate'] = array();
-          }
-
-          $ldap->cd($dn);
-          $ldap->modify($attrs);
-
-          if (!$ldap->success()){
-            msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $dn, LDAP_MOD, get_class()));
-          }
-        }
-      }
-
+      gosaSupportDaemon::send("gosa_trigger_action_".$_POST['saction'], "255.255.255.255", $macaddresses);
     }
 
 
index 1c974684ecd3e7323135651725079f2a91a8e491..01c9c349cd0339bcd1d5efc92c97a8d455486e0a 100644 (file)
@@ -101,7 +101,7 @@ class printgeneric extends plugin
       }
 
       if(!isset($this->config->idepartments[$this->base])){
-        print_red(_("Can't extract a valid base out of object dn, setting base to '%s'."),session::get('CurrentMainBase'));
+        msg_dialog::display(_("Internal error"), sprintf(_("Cannot determine a valid department for this object. Setting base to '%s'!"), session::get('CurrentMainBase')) , WARNING_DIALOG);
         $this->base  = session::get('CurrentMainBase');
       }
     }
@@ -429,7 +429,7 @@ class printgeneric extends plugin
       $this->dialog->save_object();
       if(count($this->dialog->check())){
         foreach($this->dialog->check() as $msg){
-          print_red($msg);
+          msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
         }
       }else{
         $this->gotoPrinterPPD = array();
@@ -476,7 +476,7 @@ class printgeneric extends plugin
       $this->dialog->save_object();
       if(count($this->dialog->check())){
         foreach($this->dialog->check() as $msg){
-          print_red($msg);
+          msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
         }
       }else{
         $data= $new = $this->dialog->save();
@@ -578,14 +578,14 @@ class printgeneric extends plugin
       $ldap= $this->config->get_ldap_link();
       $ldap->cat($this->dn, array('dn',"objectClass"));
       if(!$ldap->count()){
-        print_red("Trying to remove printer object which isn't a printer. Aborted to avoid data loss.");
+        msg_dialog::display(_("Error"), _("Object is no printer!"), ERROR_DIALOG);
         return;
       }
 
       /* Check if obejct is a printer */
       $CheckPrinter = $ldap->fetch();
       if(!in_array("gotoPrinter",$CheckPrinter['objectClass'])){
-        print_red("Trying to remove printer object which isn't a printer. Aborted to avoid data loss.");
+        msg_dialog::display(_("Error"), _("Object is no printer!"), ERROR_DIALOG);
         return;
       }
 
@@ -920,7 +920,7 @@ class printgeneric extends plugin
     }
   
     if(!$this->acl_is_writeable("gotoUserPrinter")){
-      print_red(sprintf(_("You are not allowed to remove the given object '%s' from the list of members of printer '%s'."),$id,$this->dn));
+      msg_dialog::display(_("Permission error"), msgPool::permDelete(_("printer user"), $id), INFO_DIALOG);
       return(FALSE);
     }
  
@@ -937,12 +937,12 @@ class printgeneric extends plugin
   {
     $types = array("AddUser","AddGroup","AddAdminUser","AddAdminGroup");
     if(!in_array_ics($type, $types)){
-      print_red(sprintf(_("Illegal printer type while adding '%s' to the list of '%s' printers,"),$dn,$type));
+      msg_dialog::display(_("Internal error"), sprintf(_("Illegal member type type '%s'!"), $type), ERROR_DIALOG);
       return(FALSE);
     }
 
     if(!$this->acl_is_writeable("gotoUserPrinter")){
-      print_red(sprintf(_("You are not allowed to add the given object '%s' to the list of members of '%s'."),$dn,$this->dn));
+      msg_dialog::display(_("Permission error"), msgPool::permModify(_("printer user"), $this->dn), INFO_DIALOG);
       return(FALSE);
     }
 
@@ -977,7 +977,7 @@ class printgeneric extends plugin
           }
 
           if(isset(  $this->member[$ctype][$name])){
-            print_red(sprintf(_("Can't add '%s' to the list of members, it is already used."),$attrs[$var][0]));
+            msg_dialog::display(_("Error"), sprintf(_("'%s' is already used!"), $attrs[$var][0]), ERROR_DIALOG);
             return(FALSE);
           }
         }
@@ -988,7 +988,7 @@ class printgeneric extends plugin
         print_a($attrs);
       }
     }else{
-      print_red(sprintf(_("Can't add '%s' to list of members, it is not reachable."),$dn));
+      msg_dialog::display(_("Error"), sprintf(_("'%s' does not exist!"), $dn), ERROR_DIALOG);
       return(FALSE);
     }
     return(TRUE);
index 64096c4f6cae7c0392a48b5f1b5fadc76db98e70..ebab65764301186351f5f2717e25214c0dddebad 100644 (file)
@@ -71,7 +71,7 @@ class terminfo extends plugin
     $smarty= get_smarty();
     $display= "";
     if(!is_callable("snmpget")){
-      print_red(msgPool::missingext("snmp"));
+      msg_dialog::display(_("Configuration error"), msgPool::missingext("snmp"), ERROR_DIALOG);
 
       $smarty->assign("load", progressbar(0,100,15,true));
       $smarty->assign("mem", progressbar(0,100,15,true));
index fbeee7c1c7044bcb6c0ca3d610b9165f929c89be..a055adb9e813c47b018be3c314cdcbc5df9c94f8 100644 (file)
@@ -95,8 +95,8 @@ class termservice extends plugin
           "1400x1050" =>  "1400x1050",
           "1600x1200" =>  "1600x1200");
 
-    if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
-      $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
+    if(isset($this->config->data['MAIN']['RESOLUTIONS'])){
+      $file = $this->config->data['MAIN']['RESOLUTIONS'];
       if(is_readable($file)){
         $str = file_get_contents($file);
         $lines = split("\n",$str);
@@ -107,7 +107,7 @@ class termservice extends plugin
           }
         }
       }else{
-        print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file));
+        msg_dialog(_("Configuration error"), msgPool::cannotReadFile($file), WARNING_DIALOG);
       }
     }
 
index bf72ed2e88da818f08bfd5bf6c70fd1659e129f7..e989a480cb31eb148a42257f31a287c218ab73ff 100644 (file)
@@ -204,7 +204,7 @@ class termstartup extends plugin
     if(isset($_POST['gotoShareAdd']) && $this->acl_is_writeable("gotoShare")){
       /* We assign a share to this user, if we don't know where to mount the share */
       if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
-        print_red(msgPool::invalid(_("Mount point")));
+        msg_dialog(_("Error"), msgPool::invalid(_("Mount point"), WARNING_DIALOG);
       }else{
         $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
         $s_mount = $_POST['gotoShareMountPoint'];
index 5da717a4c8a105dbc996a6692d272ffdaf7e34a0..38a1bd9f8b532175ca340cca3ab9f3428a4d3ccc 100644 (file)
@@ -62,8 +62,8 @@ class workservice extends plugin
         "1400x1050" =>  "1400x1050", 
         "1600x1200" =>  "1600x1200");
 
-    if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
-      $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
+    if(isset($this->config->data['MAIN']['RESOLUTIONS'])){
+      $file = $this->config->data['MAIN']['RESOLUTIONS'];
 
       if(is_readable($file)){
         $str = file_get_contents($file);
@@ -76,7 +76,7 @@ class workservice extends plugin
         }
         //natcasesort($this->gotoXResolutions);
       }else{
-        print_red(sprintf(_("You have specified an external resolution hook which can't be read, please check the permission of the file '%s'."),$file));
+        msg_dialog(_("Configuration error"), msgPool::cannotReadFile($file), WARNING_DIALOG);
       }
     }
 
index a994a17811d1d809701b5fa5d58ad94ed8a7fcff..5064c9603acb6d6cc8a2f03bf6078ed6aab15ad2 100644 (file)
@@ -234,8 +234,7 @@ class workstartup extends plugin
        */
       if(!isset($this->cache['SERVERS'][$this->FAIdebianMirror])){
         if(count($this->FAIclass)){
-          print_red(sprintf(_("The selected FAI mirror '%s' is no longer available, the mirror was set to 'auto'."),
-                $this->FAIdebianMirror));
+          msg_dialog(_("Error"), sprintf(_("FAI mirror '%s' is not available - setting to mirror 'auto'!"), $this->FAIdebianMirror), ERROR_DIALOG);
         }
         $this->FAIdebianMirror = "auto";
         $this->FAIrelease = key($this->cache['SERVERS'][$this->FAIdebianMirror]);
@@ -249,8 +248,7 @@ class workstartup extends plugin
       if(!isset($this->cache['SERVERS'][$this->FAIdebianMirror][$this->FAIrelease])){
         $new_release = key($this->cache['SERVERS'][$this->FAIdebianMirror]); 
         if(count($this->FAIclass)){
-          print_red(sprintf(_("The selected FAI release '%s' is not available for mirror '%s', the release was set to '%s'."),
-                $this->FAIrelease,$this->FAIdebianMirror,$new_release));
+          msg_dialog(_("Error"), sprintf(_("FAI release '%s' is not available on mirror '%s' - setting to release '%s'!"), $this->FAIrelease, $this->FAIdebianmirror), ERROR_DIALOG);
         }
         $this->FAIrelease = $new_release;
         $this->cache =array();
@@ -366,7 +364,7 @@ class workstartup extends plugin
         }
 
         if((isset($this->FAIclassInfo[$_POST['FAIclassesSel']]['FAIpartitionTable']))&&($found>0)){
-          print_red(_("There is already a profile in your selection that contain partition table configurations."));
+          msg_dialog(_("Error"), _("There is already a profile containing a partition table in your configuration!") , ERROR_DIALOG);
         }else{
           $this->FAIclass[$_POST['FAIclassesSel']]=$_POST['FAIclassesSel'];
         }
@@ -474,7 +472,7 @@ class workstartup extends plugin
     if((isset($_POST['gotoShareAdd'])) && ($this->acl_is_writeable("gotoShare"))) {
       /* We assign a share to this user, if we don't know where to mount the share */
       if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
-        print_red(msgPool::required(_("Mount point")));
+        msg_dialog(_("Error"), msgPool::required(_("Mount point"), ERROR_DIALOG);
       }else{
         if(count($this->gotoAvailableShares)){
           $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
@@ -1130,7 +1128,7 @@ class workstartup extends plugin
           }
         }
       }else{
-        print_red(_("Could not load available classes, the fai extension plugin seems not to be installed."));
+        msg_dialog(_("Configuration error"), _("Missing FAI plugin extension!"), ERROR_DIALOG);
       }
 
       /* Add object caught from external hook
@@ -1278,9 +1276,9 @@ class workstartup extends plugin
       $res = shell_exec($cmd);
       $res2 = trim($res);
       if((!$res)){
-        print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s' please check your gosa.conf."),$cmd));
+        msg_dialog(_("Configuration error"), msgPool::cmdexecfailed("REPOSITORY_HOOK", $cmd), ERROR_DIALOG);
       }elseif(empty($res2)){
-        print_red(sprintf(_("The specified REPOSITORY_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd));
+        msg_dialog(_("Configuration error"), _("REPOSITORY_HOOK returned empty result!"), ERROR_DIALOG);
       }else{
         $tmp = split("\n",$res);
         foreach($tmp as $line){
index 08c007d09f75828b2b473cd2d72041e989c1f625..08e8fecebf9464ae1abd66d07c99da00163991d0 100644 (file)
@@ -60,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(_("PPD error"), sprintf(_("Cannot open PPD '%s'!"), $ppdfile), ERROR_DIALOG);
         }else{
           $res  = $this->ppdManager->loadDescription($this->pathToPPD.$this->pathToModified.$ppdfile);
           if($res){
@@ -97,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 wrinting!"), $path), ERROR_DIALOG);
+
         /* Print out template */
         $display.= $smarty->fetch(get_template_path('printerPPDDialog.tpl', TRUE,dirname(__FILE__)));
         return($display);
@@ -114,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);
       }
     }