From 8e3a816001c60d16fc6397a190ece03d7d099af6 Mon Sep 17 00:00:00 2001
From: zarzuelo <zarzuelo@gmail.com>
Date: Wed, 20 Oct 2010 11:05:26 +0000
Subject: [PATCH] 2010-10-20  Sergio Martin <sergio.martin@artica.es>

	* godmode/alerts/alert_list.list.php: Fixed jquery clone
	function incompatibility with iexplorer for bug 3090389



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3429 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                     |  5 ++
 .../godmode/alerts/alert_list.list.php        | 48 ++++++++++---------
 2 files changed, 31 insertions(+), 22 deletions(-)

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index 16d88e8d41..ca3ca0b275 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,3 +1,8 @@
+2010-10-20  Sergio Martin <sergio.martin@artica.es>
+
+	* godmode/alerts/alert_list.list.php: Fixed jquery clone 
+	function incompatibility with iexplorer for bug 3090389
+
 2010-10-20  Junichi Satoh  <junichi@rworks.jp>
 
 	* godmode/massive/massive_enable_disable_alerts.php: Improved template
diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php
index 96cece7f44..bc2d56da4f 100644
--- a/pandora_console/godmode/alerts/alert_list.list.php
+++ b/pandora_console/godmode/alerts/alert_list.list.php
@@ -343,6 +343,7 @@ $table->data = array ();
 
 $rowPair = true;
 $iterator = 0;
+
 foreach ($simple_alerts as $alert) {
 	if ($alert['disabled']) {
 		 $table->rowstyle[$iterator] = 'font-style: italic; color: #aaaaaa;';
@@ -471,6 +472,25 @@ foreach ($simple_alerts as $alert) {
 		$data[6] .= ' ' . __('Add action');
 	$data[6] .= '</a>';
 	
+	$data[6] .= '<form id="add_action_form-'.$alert['id'].'" method="post" class="invisible">';
+	$data[6] .= print_input_hidden ('add_action', 1, true);
+	$data[6] .= print_input_hidden ('id_alert_module', $alert['id'], true);
+	$actions = get_alert_actions ();
+	$data[6] .= print_select ($actions, 'action', '', '', __('None'), 0, true);
+	$data[6] .= '<br />';
+	$data[6] .= '<span><a href="#" class="show_advanced_actions">'.__('Advanced options').' &raquo; </a></span>';
+	$data[6] .= '<span class="advanced_actions invisible">';
+	$data[6] .= __('Number of alerts match from').' ';
+	$data[6] .= print_input_text ('fires_min', -1, '', 4, 10, true);
+	$data[6] .= ' '.__('to').' ';
+	$data[6] .= print_input_text ('fires_max', -1, '', 4, 10, true);
+	$data[6] .= print_help_icon ("alert-matches", true);
+	$data[6] .= '</span>';
+	$data[6] .= '<div class="right">';
+	$data[6] .= print_submit_button (__('Add'), 'add_action', false, 'class="sub next"', true);
+	$data[6] .= '</div>';
+	$data[6] .= '</form>';
+	
 	$status = STATUS_ALERT_NOT_FIRED;
 	$title = "";
 	
@@ -502,25 +522,6 @@ if (isset($data)){
 	echo "<div class='nf'>".__('No alerts defined')."</div>";
 }
 
-echo '<form id="add_action_form" method="post" class="invisible">';
-print_input_hidden ('add_action', 1);
-print_input_hidden ('id_alert_module', 0);
-$actions = get_alert_actions ();
-print_select ($actions, 'action', '', '', __('None'), 0);
-echo '<br />';
-echo '<span><a href="#" class="show_advanced_actions">'.__('Advanced options').' &raquo; </a></span>';
-echo '<span class="advanced_actions invisible">';
-echo __('Number of alerts match from').' ';
-print_input_text ('fires_min', -1, '', 4, 10);
-echo ' '.__('to').' ';
-print_input_text ('fires_max', -1, '', 4, 10);
-echo print_help_icon ("alert-matches", true);
-echo '</span>';
-echo '<div class="right">';
-print_submit_button (__('Add'), 'add_action', false, 'class="sub next"');
-echo '</div>';
-echo '</form>';
-
 // Create alert button
 echo '<div class="action-buttons" style="width: '.$table->width.'">';
 echo '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=builder">';
@@ -631,9 +632,12 @@ $(document).ready (function () {
 		id = this.id.split ("-").pop ();
 		
 		/* Replace link with a combo with the actions and a form */
-		$form = $('form#add_action_form:last').clone (true).show ();
-		$("input#hidden-id_alert_module", $form).attr ("value", id);
-		$(this).replaceWith ($form);
+		//$form = $('form#add_action_form:last').clone (true).show ();
+		//alert($form);
+		//$("input#hidden-id_alert_module", $form).attr ("value", id);
+		$('#add_action_form-' + id).attr("class", '');
+		$(this).attr("class", 'invisible');
+		//$(this).replaceWith ($form);
 		return false;
 	});