From ed4a33b3ffe88c34a4c0954436fd4d56d2b0fbb0 Mon Sep 17 00:00:00 2001 From: cajus Date: Sun, 16 Mar 2008 13:20:35 +0000 Subject: [PATCH] Removed a couple of print_red calls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9880 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_applicationManagement.inc | 6 +-- .../admin/devices/class_deviceGeneric.inc | 12 ++--- .../admin/devices/class_deviceManagement.inc | 6 +-- .../mimetypes/class_mimetypeManagement.inc | 6 +-- .../admin/ogroups/goto/class_termgroup.inc | 52 +------------------ .../admin/systems/goto/class_printGeneric.inc | 20 +++---- .../admin/systems/goto/class_terminalInfo.inc | 2 +- .../systems/goto/class_terminalService.inc | 6 +-- .../systems/goto/class_terminalStartup.inc | 2 +- .../systems/goto/class_workstationService.inc | 6 +-- .../systems/goto/class_workstationStartup.inc | 16 +++--- .../systems/ppd/class_printerPPDDialog.inc | 7 +-- 12 files changed, 42 insertions(+), 99 deletions(-) diff --git a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc index 9cecb1103..f30035e89 100644 --- a/gosa-plugins/goto/admin/applications/class_applicationManagement.inc +++ b/gosa-plugins/goto/admin/applications/class_applicationManagement.inc @@ -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."); } diff --git a/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc b/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc index 6ce15fb9c..e929f5155 100644 --- a/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc +++ b/gosa-plugins/goto/admin/devices/class_deviceGeneric.inc @@ -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); } diff --git a/gosa-plugins/goto/admin/devices/class_deviceManagement.inc b/gosa-plugins/goto/admin/devices/class_deviceManagement.inc index 59ce69d89..9d216aa6a 100644 --- a/gosa-plugins/goto/admin/devices/class_deviceManagement.inc +++ b/gosa-plugins/goto/admin/devices/class_deviceManagement.inc @@ -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."); } diff --git a/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc b/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc index 72ef0a03e..3fb57beba 100644 --- a/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc +++ b/gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc @@ -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."); } diff --git a/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc b/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc index 2fb30ffaa..91acd6c97 100644 --- a/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc +++ b/gosa-plugins/goto/admin/ogroups/goto/class_termgroup.inc @@ -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); } diff --git a/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc b/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc index 1c974684e..01c9c349c 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc @@ -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); diff --git a/gosa-plugins/goto/admin/systems/goto/class_terminalInfo.inc b/gosa-plugins/goto/admin/systems/goto/class_terminalInfo.inc index 64096c4f6..ebab65764 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_terminalInfo.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_terminalInfo.inc @@ -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)); diff --git a/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc b/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc index fbeee7c1c..a055adb9e 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_terminalService.inc @@ -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); } } diff --git a/gosa-plugins/goto/admin/systems/goto/class_terminalStartup.inc b/gosa-plugins/goto/admin/systems/goto/class_terminalStartup.inc index bf72ed2e8..e989a480c 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_terminalStartup.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_terminalStartup.inc @@ -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']; diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc index 5da717a4c..38a1bd9f8 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_workstationService.inc @@ -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); } } diff --git a/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc b/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc index a994a1781..5064c9603 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc @@ -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){ diff --git a/gosa-plugins/goto/admin/systems/ppd/class_printerPPDDialog.inc b/gosa-plugins/goto/admin/systems/ppd/class_printerPPDDialog.inc index 08c007d09..08e8feceb 100644 --- a/gosa-plugins/goto/admin/systems/ppd/class_printerPPDDialog.inc +++ b/gosa-plugins/goto/admin/systems/ppd/class_printerPPDDialog.inc @@ -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); } } -- 2.30.2