diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 423dbcce32..c5b9ae1a57 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2008-04-10 Sancho Lerena + + * godmode/agentes/alert_manager.php, godmode/agentes/configurar_agente.php, + godmode/agentes/alert_manager_editor.php: Fixed problem with combined alert + editor. Tested and works fine for me. + 2008-04-10 Jorge Gonzalez * include/functions_db.php: Added a new function solving the bug diff --git a/pandora_console/godmode/agentes/alert_manager.php b/pandora_console/godmode/agentes/alert_manager.php index 5c5213fed7..fd9ead549b 100644 --- a/pandora_console/godmode/agentes/alert_manager.php +++ b/pandora_console/godmode/agentes/alert_manager.php @@ -130,70 +130,71 @@ echo "

".lang_string("combined alerts")."

"; $sql1='SELECT * FROM talerta_agente_modulo WHERE id_agent = '.$id_agente; $result=mysql_query($sql1); - if ($row=mysql_num_rows($result)){ - $color = 1; - $string = ''; - while ($row=mysql_fetch_array($result)){ // All modules of this agent - // Show data for this combined alert - $string = ""; - $string .= lang_string("Combined")." #".$row["id_aam"]; - $string .= show_alert_row_edit ($row, "datos3", 0, 1); - $string .= ''; // action - if (give_acl($id_user, $id_grupo, "LW")==1){ - $string .= " ".$lang_label["delete"]."   "; - $string .= " - ".$lang_label["update"].""; +if (mysql_num_rows($result) == 0){ + echo "
".$lang_label["no_modules"]."
"; + +} else { + $color = 1; + $string = ""; + while ($row=mysql_fetch_array($result)){ + // Show data for this combined alert + $string .= ""; + $string .= lang_string("Combined")." #".$row["id_aam"]; + $string .= show_alert_row_edit ($row, "datos3", 0, 1); + $string .= ''; // action + if (give_acl($id_user, $id_grupo, "LW")==1){ + $string .= " ".$lang_label["delete"]."   "; + $string .= " + ".$lang_label["update"].""; + } + $id_aam = $row["id_aam"]; + $sql2 = "SELECT * FROM tcompound_alert, talerta_agente_modulo WHERE tcompound_alert.id = $id_aam AND talerta_agente_modulo.id_aam = tcompound_alert.id_aam"; + $result2=mysql_query($sql2); + while ($row2=mysql_fetch_array($result2)){ + // Show data for each component of this combined alert + if ($color == 1){ + $tdcolor="datos"; + $color =0; + } else { + $tdcolor="datos2"; + $color =1; } - $id_aam = $row["id_aam"]; - $sql2 = "SELECT * FROM tcompound_alert, talerta_agente_modulo WHERE tcompound_alert.id = $id_aam AND talerta_agente_modulo.id_aam = tcompound_alert.id_aam"; - $result2=mysql_query($sql2); - while ($row2=mysql_fetch_array($result2)){ - // Show data for each component of this combined alert - if ($color == 1){ - $tdcolor="datos"; - $color =0; - } else { - $tdcolor="datos2"; - $color =1; - } - $module = get_db_row ("tagente_modulo", "id_agente_modulo", $row2["id_agente_modulo"]); - $description = $row2["descripcion"]; - $alert_mode = $row2["operation"]; - $id_agente_name = get_db_value ("nombre", "tagente", "id_agente", $module["id_agente"]); - $string = $string."".$id_agente_name." - ".substr($module["nombre"],0,15).""; - - $string .= show_alert_row_edit ($row2, $tdcolor, $module["id_tipo_modulo"],1); + $module = get_db_row ("tagente_modulo", "id_agente_modulo", $row2["id_agente_modulo"]); + $description = $row2["descripcion"]; + $alert_mode = $row2["operation"]; + $id_agente_name = get_db_value ("nombre", "tagente", "id_agente", $module["id_agente"]); + $string .= "".$id_agente_name." - ".substr($module["nombre"],0,15).""; + + $string .= show_alert_row_edit ($row2, $tdcolor, $module["id_tipo_modulo"],1); - $string = $string.""; - $id_grupo = dame_id_grupo($id_agente); - if (give_acl($id_user, $id_grupo, "LW")==1){ - $string = $string." ".$lang_label["delete"]."   "; - $string = $string." - ".$lang_label["update"].""; - } - $string = $string.""; + $string .= ""; + $id_grupo = dame_id_grupo($id_agente); + if (give_acl($id_user, $id_grupo, "LW")==1){ + $string .= " ".$lang_label["delete"]."   "; + $string .= " + ".$lang_label["update"].""; } + $string .= ""; } - if (isset($string) & $string!='') { - echo " - - - - - - - - - - "; - echo $string; - echo "
".$lang_label["name"]."".$lang_label["type"]."".lang_string ("Oper")."".$lang_label["threshold"]."".$lang_label["min."]."".$lang_label["max."]."".$lang_label["time"]."".$lang_label["description"]."".lang_string ("info")."".$lang_label["action"]."
"; - } else { - echo "
".$lang_label["no_alerts"]."
"; - } - } else { - echo "
".$lang_label["no_modules"]."
"; } + if (isset($string) & $string != "") { + echo " + + + + + + + + + + "; + echo $string; + echo "
".$lang_label["name"]."".$lang_label["type"]."".lang_string ("Oper")."".$lang_label["threshold"]."".$lang_label["min."]."".$lang_label["max."]."".$lang_label["time"]."".$lang_label["description"]."".lang_string ("info")."".$lang_label["action"]."
"; + } else { + echo "
".$lang_label["no_alerts"]."
"; + } +} ?> diff --git a/pandora_console/godmode/agentes/alert_manager_editor.php b/pandora_console/godmode/agentes/alert_manager_editor.php index 023b9202b7..5b049e0878 100644 --- a/pandora_console/godmode/agentes/alert_manager_editor.php +++ b/pandora_console/godmode/agentes/alert_manager_editor.php @@ -60,8 +60,7 @@ if ($form_alerttype != "combined"){ } echo ""; } else { - $agentmodule_name = give_db_value ("nombre", "tagente_modulo", "id_agente_modulo", $alerta_id_agentemodulo); -echo "DEBUG $alerta_id_agentemodulo"; + $agentmodule_name = get_db_sql ("SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = $alerta_id_agentemodulo"); echo $agentmodule_name; } } else { @@ -267,11 +266,11 @@ echo lang_string ("Alert recovery"); echo ""; echo '"; diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 4975a0d3c4..c1593da4ef 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -263,6 +263,8 @@ if (isset($_GET["delete_alert_comp"])){ // if modified some parameter // ============= if (isset($_POST["insert_alert"])){ // if created alert + + $combined = get_parameter ("combined",0); $id_agente_modulo = get_parameter ("agente_modulo",0); $maximo = get_parameter ("maximo",0); $minimo = get_parameter ("minimo",0); @@ -291,7 +293,7 @@ if (isset($_POST["insert_alert"])){ // if created alert $campo2_rec = get_parameter ("campo_2_rec",""); $campo3_rec = get_parameter ("campo_3_rec",""); - if ((isset($combined)) AND ($combined == 1)) + if ($combined == 1) $alert_id_agent = $id_agente; else $alert_id_agent = 0; diff --git a/pandora_console/include/config.php b/pandora_console/include/config.php index e91fd10a85..58ecfc80e8 100644 --- a/pandora_console/include/config.php +++ b/pandora_console/include/config.php @@ -2,10 +2,10 @@ // Begin of automatic config file $config["dbname"]="pandora"; // MySQL DataBase name $config["dbuser"]="pandora"; // DB User -$config["dbpass"]="iysukzjq"; // DB Password +$config["dbpass"]="pandora"; // DB Password $config["dbhost"]="localhost"; // DB Host -$config["homedir"]="/var/www/pandora/"; // Config homedir -$config["homeurl"]="http://localhost/pandora"; // Base URL +$config["homedir"]="/var/www/pandora_console/"; // Config homedir +$config["homeurl"]="http://localhost/pandora_console"; // Base URL // End of automatic config file ?> -
+