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

View File

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

View File

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

View File

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