From a1965de2eae542686b54e4655d7785e34dce6cd4 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 24 Jul 2023 12:25:06 +0200 Subject: [PATCH] #11386 Fix sound alert modal --- .../include/javascript/pandora_events.js | 35 ++++----- pandora_console/include/styles/pandora.css | 72 ++++++++++++------- .../include/styles/sound_events.css | 5 +- pandora_console/operation/events/events.php | 15 +++- .../operation/events/sound_events.php | 52 ++++++++------ pandora_console/operation/menu.php | 8 ++- 6 files changed, 117 insertions(+), 70 deletions(-) diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index 84e0c9eafd..8e600c024b 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -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
  • 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" diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index ec98b1dab2..085dd97ebc 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -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; +} diff --git a/pandora_console/include/styles/sound_events.css b/pandora_console/include/styles/sound_events.css index d7bea5c305..b5d309e5bb 100644 --- a/pandora_console/include/styles/sound_events.css +++ b/pandora_console/include/styles/sound_events.css @@ -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; } diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 7fbdcfb3b7..29e186bb63 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -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 ); diff --git a/pandora_console/operation/events/sound_events.php b/pandora_console/operation/events/sound_events.php index 5489a24c92..3de5a574b1 100644 --- a/pandora_console/operation/events/sound_events.php +++ b/pandora_console/operation/events/sound_events.php @@ -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 ''; echo ''; -?> - -<?php echo __('Acoustic console'); ?> - - - - - -'; +echo ''.__('Acoustic console').''; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; + 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); -?> - - - - - - -'; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; + + echo ''; if ($config['style'] === 'pandora_black' && !is_metaconsole()) { echo ''; @@ -110,6 +116,7 @@ $output = '
    '; [ 'title' => __('Events list'), 'class' => 'invert_filter', + 'div_sty' ] ); $output .= ''; @@ -242,7 +249,7 @@ $output = '
    '; ); $output .= '
    '; - $output .= '
    '; + $output .= '
    '; $output .= '

    '; $output .= __('Discovered alerts'); $output .= '

    '; @@ -259,7 +266,7 @@ $output = '
    '; $output .= __('Congrats! there’s nothing to show'); $output .= ''; $output .= '
    '; - $output .= '
      '; + $output .= '
        '; $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); }); diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index f79a4a611a..43d8b3402d 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -563,6 +563,12 @@ if ($access_console_node === true) { $sub['operation/events/events_rss.php?user='.$config['id_user'].'&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, ] ) );