modal sound events pandora_enterprise#9095

This commit is contained in:
Daniel Barbero Martin 2022-06-30 17:17:05 +02:00
parent ef48206e7f
commit e28bfe9f3f
4 changed files with 75 additions and 2 deletions

View File

@ -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);

View File

@ -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();
}

View File

@ -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("<audio src='../../include/sounds/Star_Trek_emergency_simulation.wav' autoplay='true' hidden='true' loop='false'>");
var sound = '../../include/sounds/' + $('#sound_id').val();
$('body').append("<audio src='"+sound+"' autoplay='true' hidden='true' loop='false'>");
test_sound = true;
} else {
$("#button_try").attr('src', '../../images/icono_test.png');

View File

@ -419,12 +419,29 @@ if (check_acl($config['id_user'], 0, 'ER')
}
// Sound Events.
$javascript = "javascript: window.open('operation/events/sound_events.php');";
$javascript = 'javascript: openSoundEventWindow();';
$sub[$javascript]['text'] = __('Sound Events');
$sub[$javascript]['id'] = 'Sound Events';
$sub[$javascript]['type'] = 'direct';
$data_sound = base64_encode(
json_encode(
[
'title' => __('Sound Console'),
'url' => ui_get_full_url('ajax.php'),
'page' => 'include/ajax/events',
]
)
);
$javascript = 'javascript: openSoundEventModal(\''.$data_sound.'\');';
$sub[$javascript]['text'] = __('Sound Events Modal');
$sub[$javascript]['id'] = 'Sound Events Modal';
$sub[$javascript]['type'] = 'direct';
echo '<div id="modal-sound" style="display:none;"></div>';
?>
<script type="text/javascript">
function openSoundEventWindow() {