#11386 Fix sound alert modal

This commit is contained in:
miguel angel rasteu 2023-07-24 12:25:06 +02:00
parent 5084c0490b
commit a1965de2ea
6 changed files with 117 additions and 70 deletions

View File

@ -951,17 +951,7 @@ function openSoundEventsDialog(settings) {
$("#modal-sound").hasClass("ui-dialog-content") &&
$("#modal-sound").dialog("isOpen")
) {
if ($("#minimize_arrow_event_sound").hasClass("arrow_menu_up")) {
console.log("arrow_menu_up");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_up");
$("#minimize_arrow_event_sound").addClass("arrow_menu_down");
$(".ui-dialog-titlebar-minimize").trigger("click");
} else if ($("#minimize_arrow_event_sound").hasClass("arrow_menu_down")) {
console.log("arrow_menu_down");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_down");
$("#minimize_arrow_event_sound").addClass("arrow_menu_up");
$(".ui-dialog-titlebar-minimize").trigger("click");
}
$(".ui-dialog-titlebar-minimize").trigger("click");
return;
}
//Modify button
@ -1434,15 +1424,26 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
// Define the minimize button functionality;
function hidden_dialog() {
setTimeout(function() {
dialog.hide();
dialog.css("z-index", "-1");
}, 200);
}
function show_dialog() {
setTimeout(function() {
dialog.show();
dialog.css("z-index", "1115");
}, 50);
}
minimizeButton.click(function(e) {
console.log("here");
if ($("#minimize_arrow_event_sound").hasClass("arrow_menu_up")) {
console.log("arrow_menu_up");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_up");
$("#minimize_arrow_event_sound").addClass("arrow_menu_down");
} else if ($("#minimize_arrow_event_sound").hasClass("arrow_menu_down")) {
console.log("arrow_menu_down");
$("#minimize_arrow_event_sound").removeClass("arrow_menu_down");
$("#minimize_arrow_event_sound").addClass("arrow_menu_up");
}
if (!dialog.data("isMinimized")) {
$(".ui-widget-overlay").hide();
console.log("Minimize Window");
@ -1465,11 +1466,11 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
);
dialog.css({ height: "" });
dialog.find(".ui-dialog-content").hide();
//dialog.find(".ui-dialog-content").hide();
} else {
console.log("Restore Window");
$(".ui-widget-overlay").show();
dialog.find(".ui-dialog-content").show();
//dialog.find(".ui-dialog-content").show();
dialog.data("isMinimized", false);
dialog.animate(
{
@ -1496,7 +1497,7 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
for (var i = 0; i < addedNodes.length; i++) {
if (addedNodes[i].nodeName.toLowerCase() === "li") {
console.log("The dialog content contains an <li> tag.");
if (dialog.data("isMinimized")) {
/*if (dialog.data("isMinimized")) {
console.log("Restore Window");
$(".ui-widget-overlay").show();
dialog.data("isMinimized", false);
@ -1507,7 +1508,7 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
},
200
);
}
}*/
/*
var $el = $('[aria-describedby="modal-sound"]').find(
".ui-dialog-title"

View File

@ -12339,66 +12339,86 @@ tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input {
-moz-animation: glowing 1500ms infinite;
-o-animation: glowing 1500ms infinite;
animation: glowing 1500ms infinite;
background: #b20000 !important;
border-color: #ff0000 !important;
background: #14524f !important;
border-color: #14524f !important;
}
@-webkit-keyframes glowing {
0% {
background-color: #b20000;
-webkit-box-shadow: 0 0 3px #b20000;
background: #14524f !important;
-webkit-box-shadow: 0 0 3px #14524f;
}
50% {
background-color: #ff0000;
-webkit-box-shadow: 0 0 40px #ff0000;
background: #1d7873 !important;
-webkit-box-shadow: 0 0 40px #1d7873;
}
100% {
background-color: #b20000;
-webkit-box-shadow: 0 0 3px #b20000;
background: #14524f !important;
-webkit-box-shadow: 0 0 3px #14524f;
}
}
@-moz-keyframes glowing {
0% {
background-color: #b20000;
-moz-box-shadow: 0 0 3px #b20000;
background: #14524f !important;
-moz-box-shadow: 0 0 3px #14524f;
}
50% {
background-color: #ff0000;
-moz-box-shadow: 0 0 40px #ff0000;
background: #1d7873 !important;
-moz-box-shadow: 0 0 40px #1d7873;
}
100% {
background-color: #b20000;
-moz-box-shadow: 0 0 3px #b20000;
background: #14524f !important;
-moz-box-shadow: 0 0 3px #14524f;
}
}
@-o-keyframes glowing {
0% {
background-color: #b20000;
box-shadow: 0 0 3px #b20000;
background: #14524f !important;
box-shadow: 0 0 3px #14524f;
}
50% {
background-color: #ff0000;
box-shadow: 0 0 40px #ff0000;
background: #1d7873 !important;
box-shadow: 0 0 40px #1d7873;
}
100% {
background-color: #b20000;
box-shadow: 0 0 3px #b20000;
background: #14524f !important;
box-shadow: 0 0 3px #14524f;
}
}
@keyframes glowing {
0% {
background-color: #b20000;
box-shadow: 0 0 3px #b20000;
background: #14524f !important;
box-shadow: 0 0 3px #14524f;
}
50% {
background-color: #ff0000;
box-shadow: 0 0 40px #ff0000;
background: #1d7873 !important;
box-shadow: 0 0 40px #1d7873;
}
100% {
background-color: #b20000;
box-shadow: 0 0 3px #b20000;
background: #14524f !important;
box-shadow: 0 0 3px #14524f;
}
}
.actions-sound-modal .buttons-sound-modal button.play,
.actions-sound-modal .buttons-sound-modal input[type="button"].play {
background: url(../../images/play-white.png), transparent !important;
background-repeat: no-repeat !important;
background-position: 82px 14px !important;
color: #ffffff;
padding-left: 20px;
border: 0;
}
.actions-sound-modal .buttons-sound-modal button.stop,
.actions-sound-modal .buttons-sound-modal input[type="button"].stop {
background: url(../../images/stop.png), var(--primary-color);
background-repeat: no-repeat;
background-position: 82px 14px;
color: #ffffff;
padding-left: 20px;
border: 0;
}

View File

@ -214,11 +214,12 @@ div.container-button-play > button#button-start-search {
text-align: left;
}
.actions-sound-modal .buttons-sound-modal button.play {
.actions-sound-modal .buttons-sound-modal button.play,
.actions-sound-modal .buttons-sound-modal input[type="button"].play {
background: url(../../images/play-white.png), transparent !important;
background-repeat: no-repeat !important;
background-position: 82px 14px !important;
color: #ffffff;
color: #ffffff !important;
padding-left: 20px;
border: 0;
}

View File

@ -1594,6 +1594,11 @@ if ($pure) {
// Acoustic console.
$sound_event['active'] = false;
if (is_metaconsole() === true) {
$urlSound = '../../include/sounds/';
} else {
$urlSound = 'include/sounds/';
}
// Sound Events.
$data_sound = base64_encode(
@ -1606,7 +1611,7 @@ if ($pure) {
'silenceAlarm' => __('Silence alarm'),
'url' => ui_get_full_url('ajax.php'),
'page' => 'include/ajax/events',
'urlSound' => 'include/sounds/',
'urlSound' => $urlSound,
]
)
);
@ -2676,6 +2681,11 @@ if (check_acl(
false,
false
);
if (is_metaconsole() === true) {
$urlSound = '../../include/sounds/';
} else {
$urlSound = 'include/sounds/';
}
// Acoustic console.
$data_sound = base64_encode(
@ -2688,7 +2698,7 @@ if (check_acl(
'silenceAlarm' => __('Silence alarm'),
'url' => ui_get_full_url('ajax.php'),
'page' => 'include/ajax/events',
'urlSound' => 'include/sounds/',
'urlSound' => $urlSound,
]
)
);
@ -2702,6 +2712,7 @@ if (check_acl(
'icon' => 'sound',
'style' => 'margin-right: 25% !important',
'minimize-arrow' => true,
'span_style' => 'width: 100%',
],
true
);

View File

@ -26,6 +26,7 @@
* ============================================================================
*/
require_once '../../include/config.php';
require_once '../../include/functions.php';
require_once '../../include/functions_db.php';
@ -55,29 +56,34 @@ if (check_acl($config['id_user'], 0, 'ER') === false
return;
}
if (is_metaconsole() === true) {
$redirect_metaconsole = '../../';
} else {
$redirect_metaconsole = '';
}
echo '<html>';
echo '<head>';
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo __('Acoustic console'); ?></title>
<link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" />
<link rel="stylesheet" href="../../include/styles/js/jquery-ui.min.css" type="text/css" />
<link rel="stylesheet" href="../../include/styles/js/jquery-ui_custom.css" type="text/css" />
<link rel="stylesheet" href="../../include/styles/select2.min.css" type="text/css" />
<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css" />
<?php
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
echo '<title>'.__('Acoustic console').'</title>';
echo '<link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" />';
echo '<link rel="stylesheet" href="../../include/styles/js/jquery-ui.min.css" type="text/css" />';
echo '<link rel="stylesheet" href="../../include/styles/js/jquery-ui_custom.css" type="text/css" />';
echo '<link rel="stylesheet" href="../../include/styles/select2.min.css" type="text/css" />';
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css" />';
echo ui_require_css_file('wizard', 'include/styles/', true);
echo ui_require_css_file('discovery', 'include/styles/', true);
echo ui_require_css_file('sound_events', 'include/styles/', true);
?>
<script type='text/javascript' src='../../include/javascript/jquery.current.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery.pandora.js'></script>
<script type='text/javascript' src='../../include/javascript/jquery-ui.min.js'></script>
<script type='text/javascript' src='../../include/javascript/select2.min.js'></script>
<script type='text/javascript' src='../../include/javascript/pandora.js'></script>
<script type='text/javascript' src='../../include/javascript/pandora_ui.js'></script>
<?php
echo '<script type="text/javascript" src="../../include/javascript/jquery.current.js"></script>';
echo '<script type="text/javascript" src="../../include/javascript/jquery.pandora.js"></script>';
echo '<script type="text/javascript" src="../../include/javascript/jquery-ui.min.js"></script>';
echo '<script type="text/javascript" src="../../include/javascript/select2.min.js"></script>';
echo '<script type="text/javascript" src="../../include/javascript/pandora.js"></script>';
echo '<script type="text/javascript" src="../../include/javascript/pandora_ui.js"></script>';
echo '<link rel="icon" href="../../'.ui_get_favicon().'" type="image/ico" />';
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
echo '<link rel="stylesheet" href="../../include/styles/pandora_black.css" type="text/css" />';
@ -110,6 +116,7 @@ $output = '<div id="tabs-sound-modal">';
[
'title' => __('Events list'),
'class' => 'invert_filter',
'div_sty'
]
);
$output .= '</a>';
@ -242,7 +249,7 @@ $output = '<div id="tabs-sound-modal">';
);
$output .= '</div>';
$output .= '<div id="tabs-sound-modal-2">';
$output .= '<div id="tabs-sound-modal-2" style="height: 290px;">';
$output .= '<h3 class="title-discovered-alerts">';
$output .= __('Discovered alerts');
$output .= '</h3>';
@ -259,7 +266,7 @@ $output = '<div id="tabs-sound-modal">';
$output .= __('Congrats! theres nothing to show');
$output .= '</span>';
$output .= '</div>';
$output .= '<div class="elements-discovered-alerts"><ul></ul></div>';
$output .= '<div class="elements-discovered-alerts" style="max-height:250px !important;"><ul></ul></div>';
$output .= html_print_input_hidden(
'ajax_file_sound_console',
ui_get_full_url('ajax.php', false, false, false),
@ -368,7 +375,7 @@ function action_events_sound(mode) {
// Change img button.
$("#button-start-search")
.removeClass("stop")
.addClass("play");
//.addClass("play");
// Change value button.
$("#button-start-search").val("Start");
$("#button-start-search > span").text("Start");
@ -405,7 +412,7 @@ function add_audio(urlSound) {
function remove_audio() {
$(".actions-sound-modal audio").remove();
buttonBlink();
//buttonBlink();
}
function listen_event_sound() {
@ -450,6 +457,7 @@ function check_event_sound() {
// Remove audio.
remove_audio();
var urlSound = '../../include/sounds/'+$('#sound_id :selected').val();
console.log(urlSound)
// Apend audio.
add_audio(urlSound);
@ -505,7 +513,7 @@ $(document).ready(function(){
sound = true;
}
var urlSound = '../../include/sounds/'+$('#sound_id :selected').val();
urlSound
test_sound_button(sound, urlSound);
});

View File

@ -563,6 +563,12 @@ if ($access_console_node === true) {
$sub['operation/events/events_rss.php?user='.$config['id_user'].'&amp;hashup='.$hashup.'&fb64='.$fb64]['type'] = 'direct';
}
if (is_metaconsole() === true) {
$urlSound = '../../include/sounds/';
} else {
$urlSound = 'include/sounds/';
}
// Acoustic console.
$data_sound = base64_encode(
json_encode(
@ -574,7 +580,7 @@ if ($access_console_node === true) {
'silenceAlarm' => __('Silence alarm'),
'url' => ui_get_full_url('ajax.php'),
'page' => 'include/ajax/events',
'urlSound' => 'include/sounds/',
'urlSound' => $urlSound,
]
)
);