diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php
index afdd2fc759..4138b048f6 100644
--- a/pandora_console/include/ajax/events.php
+++ b/pandora_console/include/ajax/events.php
@@ -193,25 +193,49 @@ if ($dialogue_event_response) {
$event_id = get_parameter ('event_id');
$response_id = get_parameter ('response_id');
$command = get_parameter ('target');
-
+ $massive = get_parameter ('massive');
+ $end = get_parameter ('end');
+ $show_execute_again_btn = get_parameter ('show_execute_again_btn');
+ $out_iterator = get_parameter ('out_iterator');
$event_response = db_get_row('tevent_response','id',$response_id);
$event = db_get_row('tevento','id_evento',$event_id);
$prompt = "
> ";
-
switch($event_response['type']) {
case 'command':
- echo "
";
- echo $prompt.sprintf(__('Executing command: %s',$command));
- echo "
";
+
- echo "".html_print_image('images/spinner.gif', true)."
";
- echo "
";
-
- echo "
";
- html_print_button(__('Execute again'),'btn_str',false,'perform_response(\''.$command.'\', ' . $response_id . ');', "class='sub next'");
- echo "
";
+ if ($massive) {
+ echo "";
+ echo $prompt.sprintf("(Event #$event_id) ".__('Executing command: %s',$command));
+ echo "
";
+
+ echo "".html_print_image('images/spinner.gif', true)."
";
+ echo "
";
+
+ if ($end) {
+
+ echo "
";
+ html_print_button(__('Execute again'),'btn_str',false,'execute_event_response(false);', "class='sub next'");
+ echo "".html_print_image('images/spinner.gif', true)."";
+ echo "
";
+ }
+ }
+ else {
+
+ echo "";
+ echo $prompt.sprintf(__('Executing command: %s',$command));
+ echo "
";
+
+ echo "".html_print_image('images/spinner.gif', true)."
";
+ echo "
";
+
+ echo "
";
+ html_print_button(__('Execute again'),'btn_str',false,'perform_response(\''.$command.'\', ' . $response_id . ');', "class='sub next'");
+ echo "
";
+ }
+
break;
case 'url':
$command = str_replace("localhost",$_SERVER['SERVER_NAME'],$command);
diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js
index 02eac5553c..5c680a319d 100644
--- a/pandora_console/include/javascript/pandora_events.js
+++ b/pandora_console/include/javascript/pandora_events.js
@@ -158,10 +158,11 @@ function show_response_dialog(event_id, response_id, response) {
var params = [];
params.push("page=include/ajax/events");
params.push("dialogue_event_response=1");
+ params.push("massive=0");
params.push("event_id="+event_id);
params.push("target="+response['target']);
params.push("response_id="+response_id);
-
+
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
@@ -187,6 +188,54 @@ function show_response_dialog(event_id, response_id, response) {
});
}
+//Show the modal window of event responses when multiple events are selected
+function show_massive_response_dialog(event_id, response_id, response, out_iterator, end) {
+ var ajax_file = $('#hidden-ajax_file').val();
+
+ var params = [];
+ params.push("page=include/ajax/events");
+ params.push("dialogue_event_response=1");
+ params.push("massive=1");
+ params.push("end="+end);
+ params.push("out_iterator="+out_iterator);
+ params.push("event_id="+event_id);
+ params.push("target="+response['target']);
+ params.push("response_id="+response_id);
+
+
+ jQuery.ajax ({
+ data: params.join ("&"),
+ response_tg: response['target'],
+ response_id: response_id,
+ out_iterator: out_iterator,
+ type: 'POST',
+ url: action=ajax_file,
+ dataType: 'html',
+ success: function (data) {
+ if (out_iterator === 0)
+ $("#event_response_window").empty();
+
+ $("#event_response_window").hide ()
+ .append (data)
+ .dialog ({
+ title: $('#select_custom_response option:selected').html(),
+ resizable: true,
+ draggable: true,
+ modal: false,
+ open: function(event, ui) {
+ $('#response_loading_dialog').hide();
+ $('#button-submit_event_response').show();
+ },
+ width: response['modal_width'],
+ height: response['modal_height']
+ })
+ .show ();
+
+ perform_response_massive(this.response_tg, this.response_id, this.out_iterator);
+ }
+ });
+}
+
// Get an event response from db
function get_response(response_id) {
var ajax_file = $('#hidden-ajax_file').val();
@@ -371,6 +420,42 @@ function perform_response(target, response_id) {
return false;
}
+// Perform a response and put the output into a div
+function perform_response_massive(target, response_id, out_iterator) {
+ var ajax_file = $('#hidden-ajax_file').val();
+
+ $('#re_exec_command').hide();
+ $('#response_loading_command_'+out_iterator).show();
+ $('#response_out_'+out_iterator).html('');
+
+ var finished = 0;
+ var time = Math.round(+new Date()/1000);
+ var timeout = time + 10;
+
+ var params = [];
+ params.push("page=include/ajax/events");
+ params.push("perform_event_response=1");
+ params.push("target="+target);
+ params.push("response_id="+response_id)
+
+ jQuery.ajax ({
+ data: params.join ("&"),
+ type: 'POST',
+ url: action=ajax_file,
+ async: true,
+ timeout: 10000,
+ dataType: 'html',
+ success: function (data) {
+ var out = data.replace(/[\n|\r]/g, "
");
+ $('#response_out_'+out_iterator).html(out);
+ $('#response_loading_command_'+out_iterator).hide();
+ $('#re_exec_command_'+out_iterator).show();
+ }
+ });
+
+ return false;
+}
+
// Change the status of an event to new, in process or validated
function event_change_status(event_ids) {
var ajax_file = $('#hidden-ajax_file').val();
diff --git a/pandora_console/operation/events/events.build_table.php b/pandora_console/operation/events/events.build_table.php
index 92b7eecad8..881ea4ac32 100644
--- a/pandora_console/operation/events/events.build_table.php
+++ b/pandora_console/operation/events/events.build_table.php
@@ -20,6 +20,8 @@ require_once ($config["homedir"] . "/include/functions_ui.php");
$sort_field = get_parameter("sort_field", "timestamp");
$sort = get_parameter("sort", "down");
+$response_id = get_parameter ("response_id", "");
+
$table = new stdClass();
if(!isset($table->width)) {
$table->width = '100%';
@@ -887,9 +889,8 @@ else {
echo '';
}
echo '';
}
-?>
+?>
\ No newline at end of file