From 85c205c9dc9d94364a915e88ed378aa4d0a63683 Mon Sep 17 00:00:00 2001
From: mdtrooper <tres.14159@gmail.com>
Date: Wed, 16 Sep 2009 15:38:44 +0000
Subject: [PATCH] 2009-09-16  Miguel de Dios  <miguel.dedios@artica.es>

	* operation/agentes/estado_agente.php, godmode/alerts/alert_list.php: fix
	bug when there aren't not defined or attach action in template alert. Before
	it was showing the loading ajax gif, now it show the select box with none.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1950 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                     |  6 +++++
 pandora_console/godmode/alerts/alert_list.php | 23 +++++++++++--------
 .../operation/agentes/estado_agente.php       |  7 +++---
 3 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index 046eb7f8d1..a2607e812a 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-16  Miguel de Dios  <miguel.dedios@artica.es>
+
+	* operation/agentes/estado_agente.php, godmode/alerts/alert_list.php: fix
+	bug when there aren't not defined or attach action in template alert. Before
+	it was showing the loading ajax gif, now it show the select box with none.
+
 2009-09-16  Miguel de Dios  <miguel.dedios@artica.es>
 
 	* include/functions_reporting.php, include/functions_agents.php: cleanup
diff --git a/pandora_console/godmode/alerts/alert_list.php b/pandora_console/godmode/alerts/alert_list.php
index f04123cfa5..9428a44cef 100644
--- a/pandora_console/godmode/alerts/alert_list.php
+++ b/pandora_console/godmode/alerts/alert_list.php
@@ -724,22 +724,27 @@ $(document).ready (function () {
 			"id_template" : this.value
 			},
 			function (data, status) {
-				 if (data != '') {
-					jQuery.each (data, function (i, val) {
-						option = $("<option></option>")
-							.attr ("value", val["id"])
-							.append (val["name"]);
-						$("#action_select").append (option);
-					});
-				}
 				option = $("<option></option>")
 					.attr ("value", '0')
 					.append ('<?php echo __('None'); ?>');
 				$("#action_select").append (option);
 				
+				if (data == false) {
+					//There aren't any action
+				}
+				else {
+					 if (data != '') {
+						jQuery.each (data, function (i, val) {
+							option = $("<option></option>")
+								.attr ("value", val["id"])
+								.append (val["name"]);
+							$("#action_select").append (option);
+						});
+					}	
+					$('#advanced_action').show();
+				}
 				$("#action_loading").hide ();
 				$("#action_select").show();
-				$('#advanced_action').show();
 			},
 			"json"
 		);
diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php
index 9b4e640e3e..aa6f3a0848 100644
--- a/pandora_console/operation/agentes/estado_agente.php
+++ b/pandora_console/operation/agentes/estado_agente.php
@@ -42,9 +42,10 @@ if (is_ajax ()) {
 			ORDER BY sort_order DESC");
 		
 		
-		if ($rows !== false) {
-			echo json_encode($rows);	
-		}
+		if ($rows !== false)
+			echo json_encode($rows);
+		else
+			echo "false";
 		
 		return;
 	}