mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Changed events sound styles and added new filters. Ticket #109 Gitlab
This commit is contained in:
parent
9e5fe175a0
commit
e9eb60a718
@ -132,7 +132,7 @@ function alerts_get_alerts($id_group = 0, $free_search = "", $status = "all", $s
|
|||||||
*
|
*
|
||||||
* @return mixed Return id if the group have any alert is fired or false is not.
|
* @return mixed Return id if the group have any alert is fired or false is not.
|
||||||
*/
|
*/
|
||||||
function alerts_get_event_status_group($idGroup, $type = "alert_fired", $query = 'AND 1=1') {
|
function alerts_get_event_status_group($idGroup, $type = "alert_fired", $query = 'AND 1=1', $agents = null) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$return = false;
|
$return = false;
|
||||||
@ -151,9 +151,14 @@ function alerts_get_event_status_group($idGroup, $type = "alert_fired", $query =
|
|||||||
$typeWhere = ' AND event_type IN (' . implode(',', $temp) . ')';
|
$typeWhere = ' AND event_type IN (' . implode(',', $temp) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
$agents = agents_get_group_agents($idGroup, false, "lower", false);
|
if ($agents == null) {
|
||||||
|
$agents = agents_get_group_agents($idGroup, false, "lower", false);
|
||||||
$idAgents = array_keys($agents);
|
|
||||||
|
$idAgents = array_keys($agents);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$idAgents = array_values($agents);
|
||||||
|
}
|
||||||
|
|
||||||
$result = db_get_all_rows_sql('SELECT id_evento
|
$result = db_get_all_rows_sql('SELECT id_evento
|
||||||
FROM tevento
|
FROM tevento
|
||||||
|
@ -3509,6 +3509,17 @@ div.simple_value > a > span.text p
|
|||||||
font-size:13pt;
|
font-size:13pt;
|
||||||
top:8px;
|
top:8px;
|
||||||
}
|
}
|
||||||
|
.modalheaderh1{
|
||||||
|
text-align:center;
|
||||||
|
width:100%;
|
||||||
|
height:37px;
|
||||||
|
left:0px;
|
||||||
|
background-color:#82b92e;
|
||||||
|
color:white;
|
||||||
|
position:relative;
|
||||||
|
font-family:Nunito;
|
||||||
|
font-size:13pt;
|
||||||
|
}
|
||||||
.modalclosex{
|
.modalclosex{
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
display:inline;
|
display:inline;
|
||||||
|
@ -133,24 +133,30 @@ if (is_ajax ()) {
|
|||||||
|
|
||||||
$id = get_parameter('id_row');
|
$id = get_parameter('id_row');
|
||||||
$idGroup = get_parameter('id_group');
|
$idGroup = get_parameter('id_group');
|
||||||
|
$agents = get_parameter('agents', null);
|
||||||
|
|
||||||
$query = ' AND id_evento > ' . $id;
|
$query = ' AND id_evento > ' . $id;
|
||||||
|
|
||||||
$type = array();
|
$type = array();
|
||||||
$alert = get_parameter('alert_fired');
|
$alert = get_parameter('alert_fired');
|
||||||
if ($alert == 'true') {
|
if ($alert == 'true') {
|
||||||
$resultAlert = alerts_get_event_status_group($idGroup,
|
$resultAlert = alerts_get_event_status_group($idGroup,
|
||||||
'alert_fired', $query);
|
'alert_fired', $query, $agents);
|
||||||
}
|
}
|
||||||
$critical = get_parameter('critical');
|
$critical = get_parameter('critical');
|
||||||
if ($critical == 'true') {
|
if ($critical == 'true') {
|
||||||
$resultCritical = alerts_get_event_status_group($idGroup,
|
$resultCritical = alerts_get_event_status_group($idGroup,
|
||||||
'going_up_critical', $query);
|
'going_up_critical', $query, $agents);
|
||||||
}
|
}
|
||||||
$warning = get_parameter('warning');
|
$warning = get_parameter('warning');
|
||||||
if ($warning == 'true') {
|
if ($warning == 'true') {
|
||||||
$resultWarning = alerts_get_event_status_group($idGroup,
|
$resultWarning = alerts_get_event_status_group($idGroup,
|
||||||
'going_up_warning', $query);
|
'going_up_warning', $query, $agents);
|
||||||
|
}
|
||||||
|
$unknown = get_parameter('unknown');
|
||||||
|
if ($unknown == 'true') {
|
||||||
|
$resultUnknown = alerts_get_event_status_group($idGroup,
|
||||||
|
'going_unknown', $query, $agents);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($resultAlert) {
|
if ($resultAlert) {
|
||||||
@ -165,6 +171,10 @@ if (is_ajax ()) {
|
|||||||
$return = array('fired' => $resultWarning,
|
$return = array('fired' => $resultWarning,
|
||||||
'sound' => $config['sound_warning']);
|
'sound' => $config['sound_warning']);
|
||||||
}
|
}
|
||||||
|
else if ($resultUnknown) {
|
||||||
|
$return = array('fired' => $resultWarning,
|
||||||
|
'sound' => $config['sound_alert']);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$return = array('fired' => 0);
|
$return = array('fired' => 0);
|
||||||
}
|
}
|
||||||
@ -427,7 +437,7 @@ if ($config["pure"] == 0 || $meta) {
|
|||||||
echo ui_get_full_url('operation/events/sound_events.php');
|
echo ui_get_full_url('operation/events/sound_events.php');
|
||||||
?>';
|
?>';
|
||||||
|
|
||||||
window.open(url, '<?php __('Sound Alerts'); ?>','width=300, height=300, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=yes');
|
window.open(url, '<?php __('Sound Alerts'); ?>','width=400, height=380, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
@ -44,6 +44,8 @@ if (! check_acl ($config['id_user'], 0, "ER") && ! check_acl ($config['id_user']
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$agents = agents_get_group_agents(0, false, "none", false, true);
|
||||||
|
|
||||||
echo "<html>";
|
echo "<html>";
|
||||||
echo "<head>";
|
echo "<head>";
|
||||||
echo "<title>" . __("Sound Events") . "</title>";
|
echo "<title>" . __("Sound Events") . "</title>";
|
||||||
@ -62,32 +64,40 @@ echo "<title>" . __("Sound Events") . "</title>";
|
|||||||
echo '<link rel="icon" href="../../images/pandora.ico" type="image/ico" />';
|
echo '<link rel="icon" href="../../images/pandora.ico" type="image/ico" />';
|
||||||
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css" />';
|
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css" />';
|
||||||
echo "</head>";
|
echo "</head>";
|
||||||
echo "<body>";
|
echo "<body style='max-width: 400px; max-height: 400px;'>";
|
||||||
echo html_print_image('images/pandora_logo_head.png', true);
|
echo "<h1 class='modalheaderh1'>" . __("Sound console"). "</h1>";
|
||||||
echo "<h1 style='background: #66AA44; color: #fff;'>" . __("Sound console"). "</h1>";
|
|
||||||
|
|
||||||
$table = null;
|
$table = null;
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
|
|
||||||
$table->size[0] = '10%';
|
$table->size[0] = '10%';
|
||||||
$table->size[1] = '90%';
|
|
||||||
$table->style[0] = 'font-weight: bold; vertical-align: top;';
|
$table->style[0] = 'font-weight: bold; vertical-align: top;';
|
||||||
|
$table->style[1] = 'font-weight: bold; vertical-align: top;';
|
||||||
|
|
||||||
$table->data[0][0] = __('Group');
|
$table->data[0][0] = __('Group');
|
||||||
$table->data[0][1] = html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true);
|
$table->data[0][0] .= html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true) . '<br />' . '<br />';
|
||||||
$table->data[1][0] = __('Type');
|
$table->data[0][0] .= __('Agent');
|
||||||
$table->data[1][1] = html_print_checkbox('alert_fired', 'alert_fired', true, true, false, 'changeType();') . __('Alert fired') . '<br />' .
|
$table->data[0][0] .= html_print_select($agents, 'id_agents[]', true, false, '', '', true, true);
|
||||||
|
$table->data[0][1] = __('Type');
|
||||||
|
$table->data[0][1] .= '<br />' . 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('critical', 'critical', true, true, false, 'changeType();') . __('Monitor critical') . '<br />' .
|
||||||
html_print_checkbox('warning', 'warning', true, true, false, 'changeType();') . __('Monitor warning') . '<br />' .
|
html_print_checkbox('unknown', 'unknown', true, true, false, 'changeType();') . __('Monitor unknown') . '<br />' .
|
||||||
$table->data[2][0] = '';
|
html_print_checkbox('warning', 'warning', true, true, false, 'changeType();') . __('Monitor warning') . '<br />';
|
||||||
$table->data[2][1] = '<a href="javascript: toggleButton();">' .
|
|
||||||
html_print_image("images/play.button.png", true, array("id" => "button")) .
|
|
||||||
'</a>';
|
|
||||||
$table->data[2][1] .= '<a href="javascript: ok();">' .
|
|
||||||
html_print_image("images/ok.button.png", true,
|
|
||||||
array("style" => "margin-left: 10px;")) . '</a>';
|
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
|
|
||||||
|
echo '<br />';
|
||||||
|
|
||||||
|
echo '<a href="javascript: toggleButton();">' .
|
||||||
|
html_print_image("images/icono_play.png", true, array("id" => "button")) .
|
||||||
|
'</a>';
|
||||||
|
echo '<a href="javascript: ok();">' .
|
||||||
|
html_print_image("images/icono_ok.png", true, array("style" => "margin-left: 15px;")) .
|
||||||
|
'</a>';
|
||||||
|
echo '<a href="javascript: test_sound_button();">' .
|
||||||
|
html_print_image("images/icono_altavoz.png", true, array("id" => "button_try", "style" => "margin-left: 15px;")) .
|
||||||
|
'</a>';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<script src="../../include/javascript/jquery.js" type="text/javascript"></script>
|
<script src="../../include/javascript/jquery.js" type="text/javascript"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -95,6 +105,7 @@ var group = 0;
|
|||||||
var alert_fired = true;
|
var alert_fired = true;
|
||||||
var critical = true;
|
var critical = true;
|
||||||
var warning = true;
|
var warning = true;
|
||||||
|
var unknown = true;
|
||||||
|
|
||||||
var running = false;
|
var running = false;
|
||||||
var fired = false;
|
var fired = false;
|
||||||
@ -105,14 +116,48 @@ var redBackground = false;
|
|||||||
|
|
||||||
var button_play_status = "play";
|
var button_play_status = "play";
|
||||||
|
|
||||||
|
var test_sound = false;
|
||||||
|
|
||||||
|
function test_sound_button() {
|
||||||
|
if (!test_sound) {
|
||||||
|
$("#button_try").attr('src', '../../images/icono_try.png');
|
||||||
|
$('body').append("<audio src='../../include/sounds/Star_Trek_emergency_simulation.wav' autoplay='true' hidden='true' loop='false'>");
|
||||||
|
test_sound = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#button_try").attr('src', '../../images/icono_altavoz.png');
|
||||||
|
$('body audio').remove();
|
||||||
|
test_sound = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function changeGroup() {
|
function changeGroup() {
|
||||||
group = $("#group").val();
|
group = $("#group").val();
|
||||||
|
|
||||||
|
jQuery.post ("../../ajax.php",
|
||||||
|
{"page" : "include/ajax/agent",
|
||||||
|
"get_agents_group": 1,
|
||||||
|
"id_group": group
|
||||||
|
},
|
||||||
|
function (data) {
|
||||||
|
$("#id_agents").empty();
|
||||||
|
$("#id_agents").style("size", 0);
|
||||||
|
|
||||||
|
jQuery.each (data, function (id, value) {
|
||||||
|
if (value != "") {
|
||||||
|
$("#id_agents").append('<option value="' + id + '">' + value + '</option>');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
"json"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeType() {
|
function changeType() {
|
||||||
alert_fired = $("input[name=alert_fired]").attr('checked');
|
alert_fired = $("input[name=alert_fired]").attr('checked');
|
||||||
critical = $("input[name=critical]").attr('checked');
|
critical = $("input[name=critical]").attr('checked');
|
||||||
warning = $("input[name=warning]").attr('checked');
|
warning = $("input[name=warning]").attr('checked');
|
||||||
|
unknown = $("input[name=unknown]").attr('checked');
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleButton() {
|
function toggleButton() {
|
||||||
@ -120,14 +165,14 @@ function toggleButton() {
|
|||||||
if (button_play_status == 'pause') {
|
if (button_play_status == 'pause') {
|
||||||
//~ if ($("#button").attr('src') == '../../images/pause.button.png') {
|
//~ if ($("#button").attr('src') == '../../images/pause.button.png') {
|
||||||
|
|
||||||
$("#button").attr('src', '../../images/play.button.png');
|
$("#button").attr('src', '../../images/icono_play.png');
|
||||||
stopSound();
|
stopSound();
|
||||||
|
|
||||||
button_play_status = 'play';
|
button_play_status = 'play';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
$("#button").attr('src', '../../images/pause.button.png');
|
$("#button").attr('src', '../../images/icono_pausa.png');
|
||||||
forgetPreviousEvents();
|
forgetPreviousEvents();
|
||||||
startSound();
|
startSound();
|
||||||
|
|
||||||
@ -152,17 +197,21 @@ function stopSound() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startSound() {
|
function startSound() {
|
||||||
//running = true;
|
running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function forgetPreviousEvents() {
|
function forgetPreviousEvents() {
|
||||||
|
var agents = $("#id_agents").val();
|
||||||
|
|
||||||
jQuery.post ("../../ajax.php",
|
jQuery.post ("../../ajax.php",
|
||||||
{"page" : "operation/events/events",
|
{"page" : "operation/events/events",
|
||||||
"get_events_fired": 1,
|
"get_events_fired": 1,
|
||||||
"id_group": group,
|
"id_group": group,
|
||||||
|
"agents[]" : agents,
|
||||||
"alert_fired": alert_fired,
|
"alert_fired": alert_fired,
|
||||||
"critical": critical,
|
"critical": critical,
|
||||||
"warning": warning,
|
"warning": warning,
|
||||||
|
"unknown": unknown,
|
||||||
"id_row": id_row
|
"id_row": id_row
|
||||||
},
|
},
|
||||||
function (data) {
|
function (data) {
|
||||||
@ -177,15 +226,19 @@ function forgetPreviousEvents() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function check_event() {
|
function check_event() {
|
||||||
|
var agents = $("#id_agents").val();
|
||||||
|
|
||||||
if (running) {
|
if (running) {
|
||||||
if (!fired) {
|
if (!fired) {
|
||||||
jQuery.post ("../../ajax.php",
|
jQuery.post ("../../ajax.php",
|
||||||
{"page" : "operation/events/events",
|
{"page" : "operation/events/events",
|
||||||
"get_events_fired": 1,
|
"get_events_fired": 1,
|
||||||
"id_group": group,
|
"id_group": group,
|
||||||
|
"agents[]" : agents,
|
||||||
"alert_fired": alert_fired,
|
"alert_fired": alert_fired,
|
||||||
"critical": critical,
|
"critical": critical,
|
||||||
"warning": warning,
|
"warning": warning,
|
||||||
|
"unknown": unknown,
|
||||||
"id_row": id_row
|
"id_row": id_row
|
||||||
},
|
},
|
||||||
function (data) {
|
function (data) {
|
||||||
|
@ -317,7 +317,7 @@ if (check_acl ($config['id_user'], 0, "ER")
|
|||||||
|
|
||||||
window.open(url,
|
window.open(url,
|
||||||
'<?php __('Sound Alerts'); ?>',
|
'<?php __('Sound Alerts'); ?>',
|
||||||
'width=400, height=350, resizable=yes, toolbar=no, location=no, directories=no, status=no, menubar=no');
|
'width=400, height=380, resizable=no, toolbar=no, location=no, directories=no, status=no, menubar=no');
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
Loading…
x
Reference in New Issue
Block a user