From c05a46fcbc32a3f378524bf589f43d1cda589316 Mon Sep 17 00:00:00 2001 From: cajus Date: Fri, 29 Feb 2008 19:15:58 +0000 Subject: [PATCH] Updated print_red stuff git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9219 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/ogroups/gofon/class_phonequeue.inc | 29 +++++------ .../systems/gofon/class_phoneGeneric.inc | 19 ++++--- .../class_phoneConferenceGeneric.inc | 49 +++++++++---------- .../class_phoneConferenceManagment.inc | 4 +- .../gofon/fonreports/class_fonreport.inc | 10 ++-- .../gofon/gofon/macro/class_gofonMacro.inc | 45 +++++++++-------- .../macro/class_gofonMacroManagement.inc | 8 +-- .../macro/class_gofonMacroParameters.inc | 6 +-- 8 files changed, 80 insertions(+), 90 deletions(-) diff --git a/gosa-plugins/gofon/admin/ogroups/gofon/class_phonequeue.inc b/gosa-plugins/gofon/admin/ogroups/gofon/class_phonequeue.inc index 05cd92780..0dd77e3f6 100644 --- a/gosa-plugins/gofon/admin/ogroups/gofon/class_phonequeue.inc +++ b/gosa-plugins/gofon/admin/ogroups/gofon/class_phonequeue.inc @@ -88,7 +88,7 @@ class phonequeue extends plugin /* get config */ if(!isset($this->goFonHomeServers[$this->goFonHomeServer])){ - print_red(sprintf(_("The specified home server '%s' is not available in GOsa server configuration. Saving this account will create a new entry on the server '%s'. Use cancel if you do not want to create a new entry while ignoring old accounts."), preg_replace("/,/",", ",$this->goFonHomeServer), preg_replace("/,/",", ",$this->goFonHomeServers[0]['DN']))); + msg_dialog::display(_("Obsolete entry"), sprintf(_("The current home server is not available anymore. It will be moved to '%s' if you save this entry!"), preg_replace("/,/",", ",$this->goFonHomeServers[0]['DN'])), ERROR_DIALOG); $this->goFonHomeServer = $this->goFonHomeServers[0]['DN']; $this->init_HomeServer = $this->goFonHomeServers[0]['DN']; } @@ -144,7 +144,7 @@ class phonequeue extends plugin { /* Check if mysql extension is available */ if(!is_callable("mysql_pconnect")){ - return(_("Can't save any changes to asterisk database, there is currently no mysql extension available in your php setup.")); + return(sprintf(_("Missing %s PHP extension!"), "mysql")); } /******************** @@ -155,14 +155,13 @@ class phonequeue extends plugin $r_current = @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']); if(!$r_current){ new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_current)); - return(sprintf(_("The MySQL home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), - $cfg_Current['SERVER'],$cfg_Current['LOGIN'])); + return(sprintf(_("Cannot connect to %s database on server '%s'!"), "GOfon", $cfg_Current['SERVER'])); } $db_current = @mysql_select_db($cfg_Current['DB'],$r_current); if(!$db_current){ new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_current)); mysql_close($r_current); - return( sprintf(_("Can't select database '%s' on home server '%s'."),$cfg_Current['DB'],$cfg_Current['SERVER'])); + return(sprintf(_("Cannot select %s database on server '%s'!"), "GOfon", $cfg_Current['SERVER'])); } /******************** @@ -174,14 +173,13 @@ class phonequeue extends plugin $r_init = @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']); if(!$r_init){ new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_init)); - return(sprintf(_("The MySQL initial home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), - $cfg_Init['SERVER'],$cfg_Init['LOGIN'])); + return(sprintf(_("Cannot connect to %s database on server '%s'!"), "GOfon", $cfg_Init['SERVER'])); } $db_init = @mysql_select_db($cfg_Init['DB'],$r_init); if(!$db_init){ new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_init)); mysql_close($r_init); - return( sprintf(_("Can't select database '%s' on initial home server '%s'."),$cfg_Init['DB'],$cfg_Init['SERVER'])); + return(sprintf(_("Cannot select %s database on server '%s'!"), "GOfon", $cfg_Init['SERVER'])); } } } @@ -345,7 +343,7 @@ class phonequeue extends plugin /* Check if there is at least on server configuration */ if(!count($this->goFonHomeServers)){ - return( _("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database.")); + return( _("There is currently no asterisk server defined!")); } /******************** @@ -377,8 +375,7 @@ class phonequeue extends plugin $res = @mysql_query($sql,$res_cur); if(!$res){ new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($r_current)); - return(_("Error while removing old queue entries from database."). - " "._("Please have a look a the gosa logfiles.")); + return(_("Cannot remove queue entries from database!")); } } } @@ -394,7 +391,7 @@ class phonequeue extends plugin { /* Check if there is at least on server configuration */ if(!count($this->goFonHomeServers)){ - return( _("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database.")); + return( _("There is currently no asterisk server defined!")); } /******************** @@ -437,7 +434,7 @@ class phonequeue extends plugin $res = mysql_query($query,$res_cur); if(!$res){ new log("debug","ogroups/".get_class($this),"",array(),@mysql_error($res_cur)); - return(_("Could not detect old queue entry, query failed.")." "._("Please have a look a the gosa logfiles.")); + return(_("Cannot find old queue entry!")); } $cnt = mysql_affected_rows($res_cur); @@ -523,7 +520,7 @@ class phonequeue extends plugin $SQL[] = $query; } }else{ - return(sprintf(_("More than one entry in queue table found, that uses the name ('%s'). Please fix this issue manually first."),$this->cn)); + return(sprintf(_("Found more than one entry named '%s' in queue table. Please inform your system administrator!"),$this->cn)); } @@ -823,7 +820,7 @@ class phonequeue extends plugin /* Add database entry, display error and abort if this fails */ $str = $this->add_to_database(true); if(!empty($str)){ - print_red($str); + msg_dialog::display(_("Error"), $str, ERROR_DIALOG); } /* Save data to LDAP */ @@ -863,7 +860,7 @@ class phonequeue extends plugin */ $str = $this->remove_from_database(true); if(!empty($str)){ - print_red($str); + msg_dialog::display(_("Error"), $str, ERROR_DIALOG); return false; } diff --git a/gosa-plugins/gofon/admin/systems/gofon/class_phoneGeneric.inc b/gosa-plugins/gofon/admin/systems/gofon/class_phoneGeneric.inc index be2f95de9..d74a60760 100644 --- a/gosa-plugins/gofon/admin/systems/gofon/class_phoneGeneric.inc +++ b/gosa-plugins/gofon/admin/systems/gofon/class_phoneGeneric.inc @@ -269,8 +269,7 @@ class phoneGeneric extends plugin $ldap->search ("(&(objectClass=goFonAccount)(goFonHardware=".$this->cn."))", array("uid","cn")); while ($attr = $ldap->fetch()){ - print_red(sprintf(_("Can't delete because there are users which are depending on this phone. One of them is user '%s'."), - ($attr['uid'][0]." - ".$attr['cn'][0]))); + msg_dialog::display(_("Error"), sprintf(_("Cannot delete entry because it is still in use by '%s'!"), $attr['cn'][0]), ERROR_DIALOG); return; } @@ -279,7 +278,7 @@ class phoneGeneric extends plugin new log("remove","phone/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of system phone/generic with dn '%s' failed."),$this->dn)); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of system phone/generic with dn '%s' failed!"),$this->dn)); $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); /* Delete references to object groups */ @@ -327,23 +326,23 @@ class phoneGeneric extends plugin /* To check for valid ip*/ if($this->netConfigDNS->ipHostNumber == ""){ - $message[]= _("The required field IP address is empty."); + $message[]= _("IP address is not set!"); } else { if (!tests::is_ip($this->netConfigDNS->ipHostNumber)){ - $message[]= _("The field IP address contains an invalid address."); + $message[]= _("IP address is not valid!"); } } /* Check if given name is a valid host/dns name */ if(!tests::is_dns_name($this->cn) ){ - $message[] = _("Please specify a valid name for this object."); + $message[] = _("Name is not valid!"); } if ($this->cn == ""){ - $message[]= _("The required field 'Phone name' is not set."); + $message[]= _("Name is not set!"); } if ($this->cn == "0"){ - $message[]= _("The 'Phone name' '0' is reserved and cannot be used."); + $message[]= _("'0' is a reserved name and cannot be used!"); } if ($this->orig_dn != $this->dn){ @@ -358,7 +357,7 @@ class phoneGeneric extends plugin } if ($attrs['dn'] != $this->orig_dn){ - $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); + $message[]= _("Name is already in use!"); break; } } @@ -440,7 +439,7 @@ class phoneGeneric extends plugin } $this->netConfigDNS->cn = $this->cn; $this->netConfigDNS->save(); - show_ldap_error($ldap->get_error(), sprintf(_("Saving of system phone/generic with dn '%s' failed."),$this->dn)); + show_ldap_error($ldap->get_error(), sprintf(_("Saving of phone/generic with dn '%s' failed!"),$this->dn)); } diff --git a/gosa-plugins/gofon/gofon/conference/class_phoneConferenceGeneric.inc b/gosa-plugins/gofon/gofon/conference/class_phoneConferenceGeneric.inc index cd6c84aa9..216233deb 100644 --- a/gosa-plugins/gofon/gofon/conference/class_phoneConferenceGeneric.inc +++ b/gosa-plugins/gofon/gofon/conference/class_phoneConferenceGeneric.inc @@ -97,7 +97,7 @@ class conference extends plugin /* get config */ if(!isset($this->goFonHomeServers[$this->goFonHomeServer])){ - print_red(sprintf(_("The specified home server '%s' is not available in GOsa server configuration. Saving this account will create a new entry on the server '%s'. Use cancel if you do not want to create a new entry while ignoring old accounts."),$this->goFonHomeServer, $this->goFonHomeServers[0]['DN'])); + msg_dialog::display(_("Obsolete entry"), sprintf(_("The current home server is not available anymore. It will be moved to '%s' if you save this entry!"), preg_replace("/,/",", ",$this->goFonHomeServers[0]['DN'])), ERROR_DIALOG); $this->goFonHomeServer = $this->goFonHomeServers[0]['DN']; $this->init_HomeServer = $this->goFonHomeServers[0]['DN']; @@ -251,11 +251,11 @@ class conference extends plugin if(isset($this->goFonHomeServers[$this->goFonHomeServer])){ $str = $this->SQL_remove_me(true); if($str){ - print_red($str); + msg_dialog::display(_("Error"), $str, ERROR_DIALOG); return false; } }else{ - print_red(_("Could not remove the conference entry from database on home server (%s). Please check your asterisk database configuration.")); + msg_dialog::display(_("Error"), sprintf(_("Cannot delete entry from server '%s' because it seems to be removed!"), preg_replace("/,/",", ",$this->goFonHomeServer), ERROR_DIALOG); return false; } @@ -318,7 +318,7 @@ class conference extends plugin { /* Check if mysql extension is available */ if(!is_callable("mysql_pconnect")){ - return(_("Can't save any changes to asterisk database, there is currently no mysql extension available in your php setup.")); + return(sprintf(_("Missing %s PHP extension!"), "mysql")); } /******************** @@ -330,14 +330,13 @@ class conference extends plugin if(!$r_current){ new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_current)); - return(sprintf(_("The MySQL home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), - $cfg_Current['SERVER'],$cfg_Current['LOGIN'])); + return(sprintf(_("Cannot connect to %s database on server '%s'!"), "GOfon", $cfg_Current['SERVER'])); } $db_current = @mysql_select_db($cfg_Current['DB'],$r_current); if(!$db_current){ new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_current)); mysql_close($r_current); - return( sprintf(_("Can't select database '%s' on home server '%s'."),$cfg_Current['DB'],$cfg_Current['SERVER'])); + return(sprintf(_("Cannot select %s database on server '%s'!"), "GOfon", $cfg_Current['SERVER'])); } /******************** @@ -349,15 +348,13 @@ class conference extends plugin $r_init = @mysql_pconnect($cfg_Init['SERVER'],$cfg_Init['LOGIN'],$cfg_Init['PASSWORD']); if(!$r_init){ new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init)); - - return(sprintf(_("The MySQL initial home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), - $cfg_Init['SERVER'],$cfg_Init['LOGIN'])); + return(sprintf(_("Cannot connect to %s database on server '%s'!"), "GOfon", $cfg_Init['SERVER'])); } $db_init = @mysql_select_db($cfg_Init['DB'],$r_init); if(!$db_init){ new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init)); mysql_close($r_init); - return( sprintf(_("Can't select database '%s' on initial home server '%s'."),$cfg_Init['DB'],$cfg_Init['SERVER'])); + return(sprintf(_("Cannot select %s database on server '%s'!"), "GOfon", $cfg_Init['SERVER'])); } } } @@ -374,24 +371,24 @@ class conference extends plugin /* Check if previously selected server is still available */ if($this->initially_was_account && !isset($this->goFonHomeServers[$this->goFonHomeServer])){ - $message[]= sprintf(_("The previously selected asterisk home server (%s) is no longer available."),preg_replace("/,/",", ",$this->goFonHomeServer)); + $message[]= sprintf(_("The previously selected asterisk home server '%s' is no longer available!"),preg_replace("/,/",", ",$this->goFonHomeServer)); return($message); } if((empty($this->goFonPIN))&&($this->goFonConferenceOption_P=="P")&&($this->goFonConferenceOption_D=="D")){ - $message[]= _("Please enter a PIN."); + $message[]= _("PIN is not set!"); } if(empty($this->cn)){ - $message[] =_("Please enter a name for the conference."); + $message[] =_("Name is not set!"); } if(!is_numeric($this->telephoneNumber)){ - $message[] =_("Only numeric chars are allowed in Number field."); + $message[] =_("Number is not valid!"); } if(!((is_numeric($this->goFonConferenceOptionLifetime))||(empty($this->goFonConferenceOptionLifetime)))){ - $message[] =_("Only numbers are allowed in Lifetime."); + $message[] =_("Lifetime is not valid!"); } /* Check if add could be successful */ @@ -405,7 +402,7 @@ class conference extends plugin $ldap->cd(get_ou('conferenceou').$this->base); $ldap->search("(&(objectClass=goFonConference)(cn=".$this->cn."))",array("cn")); if($ldap->count()){ - $message[] =_("There is already a conference with this name in the current tree."); + $message[] =_("Name is already in use!"); } } return $message; @@ -416,7 +413,7 @@ class conference extends plugin { /* Check if there is at least on server configuration */ if(!count($this->goFonHomeServers)){ - return( _("There is currently no asterisk server defined. Possibly you are missing a server that handles the asterisk management (goFonServer). Your settings can't be saved to asterisk database.")); + return( _("There is currently no asterisk server defined!")); } /******************** @@ -454,8 +451,7 @@ class conference extends plugin @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query"); if(!$res){ new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($res_cur)); - return(_("Can not check if there are already some entries with given telephone number and/or cn in the destination home server."). - " "._("Please have a look a the gosa logfiles.")); + return(sprintf(_("Cannot query %s database on server '%s'!"), "GOfon", $cfg_Current['SERVER'])); } if($save && mysql_affected_rows($res_cur)) { $SQL = "DELETE FROM ".$cfg_Current['EXT_TABLE']." @@ -467,8 +463,7 @@ class conference extends plugin @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$SQL, "Database query"); if(!$res){ new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($res_cur)); - return(_("Can not remove entries with some telephone number and/or cn from destination home server."). - " "._("Please have a look a the gosa logfiles.")); + return(sprintf(_("Cannot query %s database on server '%s'!"), "GOfon", $cfg_Current['SERVER'])); } } } @@ -587,7 +582,7 @@ class conference extends plugin @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query"); if(!$res){ new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init)); - return(_("Can not check if entry exists in old database. Please have a look a the gosa logfiles.")); + return(sprintf(_("Cannot query %s database on server '%s'!"), "GOfon", $cfg_Init['SERVER'])); } /* There are entries using this cn and/or phone number */ @@ -601,7 +596,7 @@ class conference extends plugin @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$SQL, "Database query"); if(!$res){ new log("debug","gofonconference/".get_class($this),"",array(),@mysql_error($r_init)); - return(_("Can not remove old entries from initial home server. Please have a look a the gosa logfiles.")); + return(sprintf(_("Cannot query %s database on server '%s'!"), "GOfon", $cfg_Init['SERVER'])); } }//ENDE old num availiable ... @@ -629,9 +624,9 @@ class conference extends plugin $num = $this->telephoneNumber; if((isset($numbers[$num]))&&(($numbers[$num]['cn'][0]!=$this->old_cn))){ if(isset($numbers[$num]['uid'][0])){ - return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['uid'][0]); + return sprintf(_("'%s' is already assigned to '%s'!"),$num,$numbers[$num]['uid'][0]); }else{ - return sprintf(_("The specified telephonenumber '%s' is already assigned to '%s'."),$num,$numbers[$num]['cn'][0]); + return sprintf(_("'%s' is already assigned to '%s'!"),$num,$numbers[$num]['cn'][0]); } } } @@ -705,7 +700,7 @@ class conference extends plugin new log("create","gofonconference/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); } - show_ldap_error($ldap->get_error(), sprintf(_("Saving of goFonConference/generic with dn '%s' failed."),$this->dn)); + show_ldap_error($ldap->get_error(), sprintf(_("Saving of goFonConference/generic with dn '%s' failed!"),$this->dn)); /* Optionally execute a command after we're done */ $this->postcreate(); diff --git a/gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc b/gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc index 50b4b241b..55bdfda21 100644 --- a/gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc +++ b/gosa-plugins/gofon/gofon/conference/class_phoneConferenceManagment.inc @@ -213,7 +213,7 @@ class phoneConferenceManagment extends plugin if(preg_match("/d/",$acl)){ $this->remove_from_parent(); } else { - print_red (_("You have no permission to remove this department.")); + msg_dialog::display(_("Permission error"), _("You have not permission to delete this entry!"), ERROR_DIALOG); } /* Remove lock file after successfull deletion */ del_lock ($dn); @@ -275,7 +275,7 @@ class phoneConferenceManagment extends plugin if(preg_match("/d/",$acl)){ $this->remove_from_parent(); } else { - print_red (_("You have no permission to remove this department.")); + msg_dialog::display(_("Permission error"), _("You have not permission to delete this entry!"), ERROR_DIALOG); } } diff --git a/gosa-plugins/gofon/gofon/fonreports/class_fonreport.inc b/gosa-plugins/gofon/gofon/fonreports/class_fonreport.inc index a67ff28e8..8e1e01304 100644 --- a/gosa-plugins/gofon/gofon/fonreports/class_fonreport.inc +++ b/gosa-plugins/gofon/gofon/fonreports/class_fonreport.inc @@ -162,21 +162,21 @@ class fonreport extends plugin /* Connecting, selecting database */ if (!isset($this->config->data['SERVERS']['FON'][0])){ - print_red(_("Can't connect to phone database, no reports can be shown!")); + msg_dialog::display(_("Configuration error"), _("There is currently no asterisk server defined!"), WARNING_DIALOG); return($smarty->fetch(get_template_path('contents.tpl', TRUE))); }elseif(!is_callable("mysql_connect")){ - print_red(_("There is no mysql extension available, please check your php setup.")); + msg_dialog::display(_("Configuration error"), sprintf(_("Missing %s PHP extension!"), "mysql"), WARNING_DIALOG); return($smarty->fetch(get_template_path('contents.tpl', TRUE))); }else{ $cfg= $this->config->data['SERVERS']['FON'][0]; $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']); if ($link === FALSE){ - print_red(_("Can't connect to phone database, no reports can be shown!")); + msg_dialog::display(_("Error"), sprintf(_("Cannot connect to %s database!"), "GOfon"), ERROR_DIALOG); return($smarty->fetch(get_template_path('contents.tpl', TRUE))); } if (! @mysql_select_db("gophone")){ - print_red(_("Can't select phone database for report generation!")); + msg_dialog::display(_("Error"), sprintf(_("Cannot select %s database!"), "GOfon"), ERROR_DIALOG); return($smarty->fetch(get_template_path('contents.tpl', TRUE))); } } @@ -194,7 +194,7 @@ class fonreport extends plugin $result = @mysql_query($query); if ($result === false){ - print_red(_("Query for phone database failed!")); + msg_dialog::display(_("Error"), sprintf(_("Cannot query %s database!"), "GOfon"), ERROR_DIALOG); return($smarty->fetch(get_template_path('contents.tpl', TRUE))); } diff --git a/gosa-plugins/gofon/gofon/macro/class_gofonMacro.inc b/gosa-plugins/gofon/gofon/macro/class_gofonMacro.inc index 1e250dd46..c4d22b417 100644 --- a/gosa-plugins/gofon/gofon/macro/class_gofonMacro.inc +++ b/gosa-plugins/gofon/gofon/macro/class_gofonMacro.inc @@ -188,7 +188,7 @@ class macro extends plugin { /* Check if mysql extension is available */ if(!is_callable("mysql_pconnect")){ - return(_("Can't save any changes to asterisk database, there is currently no mysql extension available in your php setup.")); + return(sprintf(_("Missing %s PHP extension!"), "mysql")); } /******************** @@ -198,14 +198,13 @@ class macro extends plugin $r_current = @mysql_pconnect($cfg_Current['SERVER'],$cfg_Current['LOGIN'],$cfg_Current['PASSWORD']); if(!$r_current){ new log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_current)); - return(sprintf(_("The MySQL home server '%s' isn't reachable as user '%s', check GOsa log for mysql error."), - $cfg_Current['SERVER'],$cfg_Current['LOGIN'])); + return (sprintf(_("Cannot connect to %s database on server '%s'!"), "GOfon", $cfg_Current['SERVER'])); } $db_current = @mysql_select_db($cfg_Current['DB'],$r_current); if(!$db_current){ new log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_current)); mysql_close($r_current); - return( sprintf(_("Can't select database '%s' on home server '%s'."),$cfg_Current['DB'],$cfg_Current['SERVER'])); + return (sprintf(_("Cannot select %s database on server '%s'!"), "GOfon", $cfg_Current['SERVER'])); } } } @@ -236,7 +235,7 @@ class macro extends plugin @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query"); if(!$res){ new log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_current)); - return(sprintf(_("Removing macro from '%s' failed. Check GOsa log for mysql error."),$Server['SERVER'])); + return(sprintf(_("Cannot remove macro from '%s'!"),$Server['SERVER'])); } @mysql_close($r_current); } @@ -304,18 +303,18 @@ class macro extends plugin # } /* Multiple () are not supproted currently ... */ if(substr_count($s_linestr,"(") >1 ){ - return(sprintf(_("More than one '(' is currently not supported. Line : '%s'."),$i_linenum)); + return(sprintf(_("Not supported multiple brace in line %s!"),$i_linenum)); } if(substr_count($s_linestr,")") >1 ){ - return(sprintf(_("More than one ')' is currently not supported. Line : '%s'."),$i_linenum)); + return(sprintf(_("Not supported multiple brace in line %s!"),$i_linenum)); } /* Check if there is an application given */ if(empty($tmp[1])){ - return(sprintf(_("There is no application given in line : '%s'."),$i_linenum)); + return(sprintf(_("Application missing in line %s!"),$i_linenum)); } /* Check if there is an extension given */ if(empty($tmp[0])){ - return(sprintf(_("There is no extension type given in line : '%s'."),$i_linenum)); + return(sprintf(_("Extension missing in line %s!"),$i_linenum)); } /* Create extension entry for current line @@ -345,7 +344,7 @@ class macro extends plugin @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__,$query, "Database query"); if(!$res){ new log("debug","gofonmacro/".get_class($this),"",array(),@mysql_error($r_con)); - return(sprintf(_("Insert of new macro failed for server '%s'."),$cfg['SERVER'])); + return(sprintf(_("Cannot insert new macro on server '%s'!"),$cfg['SERVER'])); } @mysql_close($r_con); } @@ -405,7 +404,7 @@ class macro extends plugin $message= plugin::check(); if(!count($this->goFonHomeServers)){ - $message[] = _("There must be at least one server with an asterisk database to save this phone macro."); + $message[] = _("There is currently no asterisk server defined!"); } /* Check if insert/replace is possible and all servers are available */ @@ -419,17 +418,17 @@ class macro extends plugin $ldap = $this->config->get_ldap_link(); $ldap->search("(&(objectClass=goFonMacro)(cn=".$this->cn."))",array("cn")); if($ldap->count()>0){ - $message[]=sprintf(_("The given cn '%s' already exists."),$this->cn); + $message[]= _("Name is already in use!"); } } /* Check if display name is set */ if(empty($this->displayName)){ - $message[] = _("You must specify the 'Display Name' in order to save this macro"); + $message[] = _("Display name is not set!"); } /* CN is restricted to 20 chars */ if(strlen("Makro-".$this->cn)>20 ){ - $message[]=_("The given cn is too long, to create a Makro entry, maximum 20 chars."); + $message[]=_("Name can be 20 characters at maximum!"); } /* If this macro is still in use we should not change the visible for user flag to invisible */ @@ -438,14 +437,14 @@ class macro extends plugin $res = $ldap->search("(&(objectClass=goFonAccount)(objectClass=gosaAccount)(goFonMacro=*))", array("goFonMacro")); while ($val = $ldap->fetch()){ if(strstr($val['goFonMacro'][0],$this->dn)){ - $message[] = _("This macro is still in use. It is necessary to mark this macro as visible for users."); + $message[] = _("Macro is still in use!"); return($message); } } } if(empty($this->goFonMacroContent)){ - $message[] = _("You can't save an empty macro."); + $message[] = _("Macro is empty!"); } return $message; } @@ -459,10 +458,10 @@ class macro extends plugin $ldap= $this->config->get_ldap_link(); /* Skip remove if this macro is still in use */ - $res = $ldap->search("(&(objectClass=goFonAccount)(objectClass=gosaAccount)(goFonMacro=*))", array("goFonMacro")); + $res = $ldap->search("(&(objectClass=goFonAccount)(objectClass=gosaAccount)(goFonMacro=*))", array("goFonMacro", "cn")); while ($val = $ldap->fetch()){ if(strstr($val['goFonMacro'][0],$this->dn)){ - print_red(_("This macro is still in use. To delete this Macro ensure that nobody has selected it.")); + msg_dialog::display(_("Error"), sprintf(_("Cannot delete entry because it is still in use by '%s'!"), $val['cn'][0]), ERROR_DIALOG); return false; } } @@ -471,18 +470,18 @@ class macro extends plugin if(count($this->goFonHomeServers)){ $str = $this->remove_from_database(true); if($str){ - print_red($str); + msg_dialog::display(_("Error"), $str, ERROR_DIALOG); return false; } }else{ - print_red(_("Could not remove the macro entry from asterisk databases. Please check your asterisk database configurations.")); + msg_dialog::display(_("Configuration error"), _("There is currently no asterisk server defined!"), WARNING_DIALOG); return false; } /* Remove phone macro */ $ldap->rmDir($this->dn); new log("remove","gofonmacro/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error()); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of goFonMacro/generic account with dn '%s' failed."),$this->dn)); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of goFonMacro/generic account with dn '%s' failed!"),$this->dn)); /* Delete references to object groups */ $ldap->cd ($this->config->current['BASE']); @@ -491,7 +490,7 @@ class macro extends plugin $og= new ogroup($this->config, $ldap->getDN()); unset($og->member[$this->dn]); $og->save (); - show_ldap_error($ldap->get_error(), sprintf(_("Removing of goFonMacro/generic account with dn '%s' failed."),$this->dn)); + show_ldap_error($ldap->get_error(), sprintf(_("Removing of goFonMacro/generic account with dn '%s' failed!"),$this->dn)); } } @@ -505,7 +504,7 @@ class macro extends plugin /* Try to add entries to databases */ $str = $this->add_to_database(true); if($str){ - print_red($str); + msg_dialog::display(_("Error"), $str, ERROR_DIALOG); }else{ /* Write back to ldap */ $ldap= $this->config->get_ldap_link(); diff --git a/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc b/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc index 9d552be2a..2fd564009 100644 --- a/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc +++ b/gosa-plugins/gofon/gofon/macro/class_gofonMacroManagement.inc @@ -260,7 +260,7 @@ class goFonMacro extends plugin $dns_names .=""; /* Lock the current entry, so nobody will edit it during deletion */ - $smarty->assign("intro", sprintf(_("You're about to delete the following user(s) %s"), @LDAP::fix($dns_names))); + $smarty->assign("intro", sprintf(_("You're about to delete the following macro(s) %s"), @LDAP::fix($dns_names))); $smarty->assign("multiple", true); return($smarty->fetch(get_template_path('remove.tpl', TRUE))); } @@ -287,7 +287,7 @@ class goFonMacro extends plugin $this->macrotabs= NULL; } else { - print_red (_("You are not allowed to delete this macro!")); + msg_dialog::display(_("Permission error"), _("You have not permission to delete this entry!"), ERROR_DIALOG); } /* Remove lock file after successfull deletion */ @@ -341,7 +341,7 @@ class goFonMacro extends plugin /* Obviously the user isn't allowed to delete. Show message and clean session. */ - print_red (_("You are not allowed to delete this macro!")); + msg_dialog::display(_("Permission error"), _("You have not permission to delete this entry!"), ERROR_DIALOG); } } @@ -365,7 +365,7 @@ class goFonMacro extends plugin } else { /* Normally this shouldn't be reached, send some extra logs to notify the administrator */ - print_red (_("You are not allowed to delete this macro!")); + msg_dialog::display(_("Permission error"), _("You have not permission to delete this entry!"), ERROR_DIALOG); new log("security","gofonmacro/".get_class($this),$this->dn,array(),"Tried to trick deletion."); } /* Remove lock file after successfull deletion */ diff --git a/gosa-plugins/gofon/gofon/macro/class_gofonMacroParameters.inc b/gosa-plugins/gofon/gofon/macro/class_gofonMacroParameters.inc index 935321e0f..ef7866e33 100644 --- a/gosa-plugins/gofon/gofon/macro/class_gofonMacroParameters.inc +++ b/gosa-plugins/gofon/gofon/macro/class_gofonMacroParameters.inc @@ -340,12 +340,12 @@ class macroParameter extends plugin foreach($this->goFonMacroParameter as $key=>$val){ if((strstr($val['default'],"!"))||(strstr($val['default'],"#"))) { - $message[] = sprintf(_("The parameter %s contains invalid char. '!,#' is used as delimiter"),$val['name']); + $message[] = sprintf(_("Parameter %s contains invalid character. '!,#' is used as delimiter!"),$val['name']); } switch($val['type']){ case 'bool' : $possible = array("","0","1"); if(!in_array($val['default'],$possible)) { - $message[] = sprintf(_("The parameter %s has incorrect value for type bool."),$val['name']); + $message[] = sprintf(_("Parameter %s is invalid!"),$val['name']); };break; case 'string' : case 'combo' : @@ -374,7 +374,7 @@ class macroParameter extends plugin } if($this->para_count != count($this->attrs['goFonMacroParameter'])){ - print_red(_("Parameter count of the macro changed, you must update each user which are using this macro '%s'."),$this->dn); + msg_dialog::display(_("Information"), _("Number of parameters for this macro has changed. Please update all users using it!"), INFO_DIALOG); } unset($this->attrs['base']); -- 2.30.2