From 8fc2d2a09fdfabc67f200c9987ff8904c3f2cf60 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Wed, 3 Mar 2010 13:13:11 +0000 Subject: [PATCH] 2010-03-03 Ramon Novoa * include/functions_db.php: Use mysql_fetch_assoc instead of mysql_fetch_array to avoid duplicate results (hash and array). * godmode/alerts/configure_alert_template.php: Added 'matches_value' support to 'onchange' alerts. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2457 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 +++++++ .../alerts/configure_alert_template.php | 23 ++++++++++++++++++- pandora_console/include/functions_db.php | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 0a0995a016..4ba3918969 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2010-03-03 Ramon Novoa + + * include/functions_db.php: Use mysql_fetch_assoc instead of + mysql_fetch_array to avoid duplicate results (hash and array). + + * godmode/alerts/configure_alert_template.php: Added 'matches_value' + support to 'onchange' alerts. + 2010-03-03 Miguel de Dios * include/functions_gis.php: add new parameter to function "addPath" the diff --git a/pandora_console/godmode/alerts/configure_alert_template.php b/pandora_console/godmode/alerts/configure_alert_template.php index 0077320969..566e2c85a6 100644 --- a/pandora_console/godmode/alerts/configure_alert_template.php +++ b/pandora_console/godmode/alerts/configure_alert_template.php @@ -433,6 +433,9 @@ if ($step == 2) { case "min": $table->rowstyle['min'] = ''; break; + case "onchange": + $show_matches = true; + break; } $table->data[0][0] = __('Name'); @@ -525,6 +528,8 @@ var under = "');?>"; var warning = ""; var critical = ""; +var onchange = ""; +var onchange_not = ""; function check_regex () { if ($("#type").attr ('value') != 'regex') { @@ -641,6 +646,16 @@ $(document).ready (function () { /* Show example */ $("span#example").empty ().append (critical); break; + case "onchange": + $("#template-value, #template-max, #template-min").hide (); + $("#template-example, span#matches_value").show (); + + /* Show example */ + if ($("#checkbox-matches_value")[0].checked) + $("span#example").empty ().append (onchange); + else + $("span#example").empty ().append (onchange_not); + break; default: $("#template-value, #template-max, #template-min, #template-example, span#matches_value").hide (); break; @@ -664,7 +679,13 @@ $(document).ready (function () { } else { $("span#example").empty ().append (between_not); } - } + } else if (type == "onchange") { + if (enabled) { + $("span#example").empty ().append (onchange); + } else { + $("span#example").empty ().append (onchange_not); + } + } render_example (); }); diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 204fdcfa19..efc867bb5b 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -2075,7 +2075,7 @@ function process_sql ($sql, $rettype = "affected_rows", $dbconnection = '', $cac else { add_database_debug_trace ($sql, 0, mysql_affected_rows (), array ('time' => $time)); - while ($row = mysql_fetch_array ($result)) { + while ($row = mysql_fetch_assoc ($result)) { array_push ($retval, $row); }