Added new visual styles to event sound console

This commit is contained in:
Arturo Gonzalez 2017-05-25 17:11:35 +02:00
parent d4c635d5f1
commit 2e71af2568
6 changed files with 50 additions and 34 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -3555,13 +3555,14 @@ div.simple_value > a > span.text p
.modalheaderh1{
text-align:center;
width:100%;
height:37px;
height:26px;
left:0px;
padding-top:10px;
background-color:#82b92e;
color:white;
position:relative;
font-family:Nunito;
font-size:13pt;
font-size:11pt;
}
.modalclosex{
cursor:pointer;

View File

@ -160,18 +160,30 @@ if (is_ajax ()) {
if ($resultAlert) {
$return = array('fired' => $resultAlert,
'sound' => $config['sound_alert']);
$event = events_get_event($resultAlert);
$module_name = modules_get_agentmodule_name($event['id_agentmodule']);
$return['message'] = __('Alert fired in module ') . io_safe_output($module_name);
}
else if ($resultCritical) {
$return = array('fired' => $resultCritical,
'sound' => $config['sound_critical']);
$event = events_get_event($resultCritical);
$module_name = modules_get_agentmodule_name($event['id_agentmodule']);
$return['message'] = __('Module ') . io_safe_output($module_name) . __(' is going to critical');
}
else if ($resultWarning) {
$return = array('fired' => $resultWarning,
'sound' => $config['sound_warning']);
$event = events_get_event($resultWarning);
$module_name = modules_get_agentmodule_name($event['id_agentmodule']);
$return['message'] = __('Module ') . io_safe_output($module_name) . __(' is going to warning');
}
else if ($resultUnknown) {
$return = array('fired' => $resultWarning,
$return = array('fired' => $resultUnknown,
'sound' => $config['sound_alert']);
$event = events_get_event($resultUnknown);
$module_name = modules_get_agentmodule_name($event['id_agentmodule']);
$return['message'] = __('Module ') . io_safe_output($module_name) . __(' is going to unknown');
}
else {
$return = array('fired' => 0);
@ -436,7 +448,7 @@ if ($config["pure"] == 0 || $meta) {
echo ui_get_full_url('operation/events/sound_events.php');
?>';
window.open(url, '<?php __('Sound Alerts'); ?>','width=400, height=380, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no');
window.open(url, '<?php __('Sound Alerts'); ?>','width=600, height=450, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no');
}
</script>
<?php

View File

@ -64,11 +64,12 @@ echo "<title>" . __("Sound Events") . "</title>";
echo '<link rel="icon" href="../../images/pandora.ico" type="image/ico" />';
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css" />';
echo "</head>";
echo "<body style='max-width: 400px; max-height: 400px;'>";
echo "<body style='background-color: #494949; max-width: 550px; max-height: 400px; margin-top:40px;'>";
echo "<h1 class='modalheaderh1'>" . __("Sound console"). "</h1>";
$table = null;
$table->width = '100%';
$table->styleTable = 'padding-left:16px; padding-right:16px; padding-top:16px;';
$table->class = ' ';
$table->size[0] = '10%';
$table->style[0] = 'font-weight: bold; vertical-align: top;';
@ -76,22 +77,29 @@ $table->style[1] = 'font-weight: bold; vertical-align: top;';
$table->style[2] = 'font-weight: bold; vertical-align: top;';
$table->data[0][0] = __('Group');
$table->data[0][1] .= html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true) . '<br />' . '<br />';
$table->data[1][0] .= __('Agent');
$table->data[1][1] .= html_print_select($agents, 'id_agents[]', true, false, '', '', true, true,'','','','','',false,'','',true);
$table->data[0][1] = html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true) . '<br />' . '<br />';
$table->data[0][2] = __('Type');
$table->data[0][3] .= html_print_checkbox('alert_fired', 'alert_fired', true, true, false, 'changeType();') . __('Alert fired') . '<br />' .
$table->data[0][3] = html_print_checkbox('alert_fired', 'alert_fired', true, true, false, 'changeType();') . __('Alert fired') . '<br />' .
html_print_checkbox('critical', 'critical', true, true, false, 'changeType();') . __('Monitor critical') . '<br />' .
html_print_checkbox('unknown', 'unknown', true, true, false, 'changeType();') . __('Monitor unknown') . '<br />' .
html_print_checkbox('warning', 'warning', true, true, false, 'changeType();') . __('Monitor warning') . '<br />';
$table->data[1][0] = __('Agent');
$table->data[1][1] = html_print_select($agents, 'id_agents[]', true, false, '', '', true, true,'','','','width:104px; height:60px','',false,'','',true);
$table->data[1][2] = __('Event');
$table->data[1][3] = html_print_textarea ("events_fired", 1, 20, '', 'readonly="readonly" style="background: #ddd; resize:none;"', true);
html_print_table($table);
echo '<br>';
$table = null;
$table->width = '100%';
$table->rowstyle[0] = 'text-align:center;';
$table->styleTable = 'padding-top:16px;padding-bottom:16px;';
$table->class = ' ';
$table->bgcolor = 'white';
$table->data[0][0] = '<a href="javascript: toggleButton();">' .
html_print_image("images/play.button.png", true, array("id" => "button")) .
'</a>';
@ -103,10 +111,15 @@ $table->data[0][1] .= '<a href="javascript: ok();">' .
$table->data[0][2] .= '<a href="javascript: test_sound_button();">' .
html_print_image("images/icono_test.png", true, array("id" => "button_try", "style" => "margin-left: 15px;")) .
'</a>';
$table->data[0][3] .= html_print_image("images/tick_sound_events.png", true, array("id" => "button_status", "style" => "margin-left: 15px;"));
html_print_table($table);
?>
<script src="../../include/javascript/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
var group = 0;
var alert_fired = true;
@ -167,17 +180,13 @@ function changeType() {
}
function toggleButton() {
if (button_play_status == 'pause') {
//~ if ($("#button").attr('src') == '../../images/pause.button.png') {
$("#button").attr('src', '../../images/play.button.png');
stopSound();
button_play_status = 'play';
}
else {
$("#button").attr('src', '../../images/pause.button.png');
forgetPreviousEvents();
startSound();
@ -188,14 +197,15 @@ function toggleButton() {
function ok() {
fired = false;
$('body').css('background', 'white');
$('#button_status').attr('src','../../images/tick_sound_events.png');
$('audio').remove();
$('#textarea_events_fired').val("");
}
function stopSound() {
$('audio').remove();
$('body').css('background', 'white');
$('body').css('background', '#494949');
redBackground = false;
running = false;
@ -252,6 +262,14 @@ function check_event() {
if (firedId != 0) {
id_row = firedId;
fired = true;
var actual_text = $('#textarea_events_fired').val();
if (actual_text == "") {
$('#textarea_events_fired').val(data['message']);
}
else {
$('#textarea_events_fired').val(actual_text + "\n" + data['message']);
}
$('#button_status').attr('src','../../images/sound_events_console_alert.gif');
$('body').append("<audio src='../../" + data['sound'] + "' autoplay='true' hidden='true' loop='true'>");
}
},
@ -261,29 +279,14 @@ function check_event() {
}
}
function animation() {
if (fired) {
window.focus();
if (redBackground) {
redBackground = false;
$('body').css('background', 'white');
//~ window.moveBy(5, 0);
}
else {
redBackground = true;
$('body').css('background-color', 'red');
//~ window.moveBy(-5, 0);
}
}
}
$(document).ready (function () {
setInterval("check_event()", (10 * 1000)); //10 seconds between ajax request
setInterval("animation()", (0.1 * 1000));
$("#table1").css("background-color", "#fff");
$("#table2").css("background-color", "#fff");
});
</script>
<?php
echo "</body>";
echo "</html>";

View File

@ -317,7 +317,7 @@ if (check_acl ($config['id_user'], 0, "ER")
window.open(url,
'<?php __('Sound Alerts'); ?>',
'width=400, height=380, resizable=no, toolbar=no, location=no, directories=no, status=no, menubar=no');
'width=600, height=450, resizable=no, toolbar=no, location=no, directories=no, status=no, menubar=no');
}
</script>
<?php