events sound pandora_enterprise#7960

This commit is contained in:
Daniel Barbero Martin 2022-05-31 10:10:44 +02:00
parent c7088f9f19
commit f6de9fb0a0
4 changed files with 46 additions and 13 deletions

View File

@ -2089,7 +2089,6 @@ if ($get_events_fired) {
foreach ($data as $event) {
$return[] = [
'fired' => $event['id_evento'],
'sound' => 'include/sounds/Star_Trek_emergency_simulation.wav',
'message' => ui_print_string_substr(
strip_tags(io_safe_output($event['evento'])),
75,

View File

@ -962,12 +962,20 @@ if ($pure) {
?>
<script type="text/javascript">
function openSoundEventWindow() {
url = "<?php echo ui_get_full_url('operation/events/sound_events.php'); ?>";
url = '<?php echo ui_get_full_url('operation/events/sound_events.php'); ?>';
// devicePixelRatio knows how much zoom browser applied.
var windowScale = parseFloat(window.devicePixelRatio);
var defaultWidth = 630;
var defaultHeight = 630;
// If the scale is 1, no zoom has been applied.
var windowWidth = windowScale <= 1 ? defaultWidth : windowScale*defaultWidth;
var windowHeight = windowScale <= 1 ? defaultHeight : windowScale*defaultHeight + (defaultHeight*0.1);
window.open(
url,
'<?php __('Sound Alerts'); ?>',
'width=600, height=450, toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no'
);
'width='+windowWidth+', height='+windowHeight+', resizable=yes, toolbar=no, location=no, directories=no, status=no, menubar=no'
);
}
</script>
<?php

View File

@ -109,7 +109,7 @@ ui_require_css_file('discovery');
}
.events_fired li div.flex-time {
flex: 0 1 75px;
flex: 0 1 100px;
text-align: end;
}
@ -238,6 +238,33 @@ $inputs[] = [
],
];
$sounds = [
'aircraftalarm.wav' => 'Air craft alarm',
'air_shock_alarm.wav' => 'Air shock alarm',
'alien_alarm.wav' => 'Alien alarm',
'alien_beacon.wav' => 'Alien beacon',
'bell_school_ringing.wav' => 'Bell school ringing',
'Door_Alarm.wav' => 'Door alarm',
'EAS_beep.wav' => 'EAS beep',
'Firewarner.wav' => 'Fire warner',
'HardPCMAlarm.wav' => 'Hard PCM Alarm',
'negativebeep.wav' => 'Negative beep',
'Star_Trek_emergency_simulation.wav' => 'StarTrek emergency simulation',
];
$inputs[] = [
'label' => \__('Sounds'),
'class' => 'flex-row',
'arguments' => [
'type' => 'select',
'fields' => $sounds,
'name' => 'sound_id',
'selected' => 'Star_Trek_emergency_simulation.wav',
'return' => true,
'class' => 'fullwidth',
],
];
// Print form.
HTML::printForm(
[
@ -375,6 +402,7 @@ function forgetPreviousEvents() {
function check_event() {
if (running) {
var sound = '../../include/sounds/' + $('#sound_id').val();
jQuery.post ("../../ajax.php",
{
"page" : "include/ajax/events",
@ -392,12 +420,11 @@ function check_event() {
'src','../../images/sound_events_console_alert.gif'
);
$('audio').remove();
if(data[0].sound == '') {
data[0].sound = 'include/sounds/Star_Trek_emergency_simulation.wav';
}
$('body')
.append("<audio id='audio-boom' src='../../" + data[0].sound + "' autoplay='true' hidden='true' loop='true' >");
.append(
"<audio id='audio-boom' src='" + sound + "' autoplay='true' hidden='true' loop='true' >"
);
data.forEach(function (element) {
var li = document.createElement('li');

View File

@ -420,7 +420,6 @@ if (check_acl($config['id_user'], 0, 'ER')
// Sound Events.
$javascript = "javascript: window.open('operation/events/sound_events.php');";
$javascript = 'javascript: alert(111);';
$javascript = 'javascript: openSoundEventWindow();';
$sub[$javascript]['text'] = __('Sound Events');
$sub[$javascript]['id'] = 'Sound Events';
@ -432,12 +431,12 @@ if (check_acl($config['id_user'], 0, 'ER')
url = '<?php echo ui_get_full_url('operation/events/sound_events.php'); ?>';
// devicePixelRatio knows how much zoom browser applied.
var windowScale = parseFloat(window.devicePixelRatio);
var defaultWidth = 600;
var defaultHeight = 450;
var defaultWidth = 630;
var defaultHeight = 630;
// If the scale is 1, no zoom has been applied.
var windowWidth = windowScale <= 1 ? defaultWidth : windowScale*defaultWidth;
var windowHeight = windowScale <= 1 ? defaultHeight : windowScale*defaultHeight + (defaultHeight*0.1);
window.open(
url,
'<?php __('Sound Alerts'); ?>',