From e28bfe9f3f472dbbc8ecc0a855ad472034d0af02 Mon Sep 17 00:00:00 2001 From: Daniel Barbero Martin Date: Thu, 30 Jun 2022 17:17:05 +0200 Subject: [PATCH] modal sound events pandora_enterprise#9095 --- pandora_console/include/ajax/events.php | 7 +++ .../include/javascript/pandora_events.js | 48 +++++++++++++++++++ .../operation/events/sound_events.php | 3 +- pandora_console/operation/menu.php | 19 +++++++- 4 files changed, 75 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 77d9647a4b..2f55052f93 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -55,6 +55,7 @@ if (! check_acl($config['id_user'], 0, 'ER') return; } +$drawConsoleSound = (bool) get_parameter('drawConsoleSound', false); $process_buffers = (bool) get_parameter('process_buffers', false); $get_extended_event = (bool) get_parameter('get_extended_event'); $change_status = (bool) get_parameter('change_status'); @@ -2225,6 +2226,12 @@ if ($process_buffers === true) { return; } +if ($drawConsoleSound === true) { + $output = 'WIP'; + echo $output; + return; +} + if ($get_events_fired) { global $config; $filter_id = (int) get_parameter('filter_id', 0); diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index ab276cda9e..d5d09d112a 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -1028,3 +1028,51 @@ function process_buffers(buffers) { }); } } + +function openSoundEventModal(settings) { + settings = JSON.parse(atob(settings)); + + // Check modal exists and is open. + if ( + $("#modal-sound").hasClass("ui-dialog-content") && + $("#modal-sound").dialog("isOpen") + ) { + return; + } + + // Initialize modal. + $("#modal-sound") + .dialog({ + title: settings.title, + resizable: false, + modal: true, + position: { my: "right top", at: "right bottom", of: window }, + overlay: { + opacity: 0.5, + background: "black" + }, + width: 600, + height: 600, + open: function() { + $.ajax({ + method: "post", + url: settings.url, + data: { + page: settings.page, + drawConsoleSound: 1 + }, + dataType: "html", + success: function(data) { + console.log(data); + }, + error: function(error) { + console.error(error); + } + }); + }, + close: function() { + $(this).dialog("destroy"); + } + }) + .show(); +} diff --git a/pandora_console/operation/events/sound_events.php b/pandora_console/operation/events/sound_events.php index ac80788a7f..adbb82890f 100644 --- a/pandora_console/operation/events/sound_events.php +++ b/pandora_console/operation/events/sound_events.php @@ -342,7 +342,8 @@ var test_sound = false; function test_sound_button() { if (!test_sound) { $("#button_try").attr('src', '../../images/icono_test.png'); - $('body').append("