Merge branch 'ent-11386-post-alertas-sonoras-integradas-en-consola-y-metaconsola' into 'develop'
Ent 11386 post alertas sonoras integradas en consola y metaconsola See merge request artica/pandorafms!6217
This commit is contained in:
commit
c26d721ecb
|
@ -90,6 +90,8 @@ $get_comments = (bool) get_parameter('get_comments', false);
|
|||
$get_events_fired = (bool) get_parameter('get_events_fired');
|
||||
$get_id_source_event = get_parameter('get_id_source_event');
|
||||
$node_id = (int) get_parameter('node_id', 0);
|
||||
$settings_modal = get_parameter('settings', 0);
|
||||
$parameters_modal = get_parameter('parameters', 0);
|
||||
|
||||
if ($get_comments === true) {
|
||||
$event = get_parameter('event', false);
|
||||
|
@ -562,8 +564,13 @@ if ($load_filter_modal) {
|
|||
false
|
||||
);
|
||||
|
||||
$action = 'index.php?sec=eventos&sec2=operation/events/events&pure=';
|
||||
if ($settings_modal !== 0 && $parameters_modal !== 0) {
|
||||
$action .= '&settings='.$settings_modal.'¶meters='.$parameters_modal;
|
||||
}
|
||||
|
||||
echo '<div id="load-filter-select" class="load-filter-modal">';
|
||||
echo '<form method="post" id="form_load_filter" action="index.php?sec=eventos&sec2=operation/events/events&pure=">';
|
||||
echo '<form method="post" id="form_load_filter" action="'.$action.'">';
|
||||
|
||||
$table = new StdClass;
|
||||
$table->id = 'load_filter_form';
|
||||
|
@ -1003,7 +1010,7 @@ function save_new_filter() {
|
|||
}
|
||||
else {
|
||||
id_filter_save = data;
|
||||
|
||||
|
||||
$("#info_box").filter(function(i, item) {
|
||||
if ($(item).data('type_info_box') == "success_create_filter") {
|
||||
return true;
|
||||
|
@ -2525,7 +2532,7 @@ if ($drawConsoleSound === true) {
|
|||
'label' => __('Start'),
|
||||
'type' => 'button',
|
||||
'name' => 'start-search',
|
||||
'attributes' => [ 'class' => 'play' ],
|
||||
'attributes' => [ 'class' => 'play secondary' ],
|
||||
'return' => true,
|
||||
],
|
||||
'div',
|
||||
|
@ -2651,23 +2658,24 @@ if ($get_events_fired) {
|
|||
$return[] = array_merge(
|
||||
$event,
|
||||
[
|
||||
'fired' => $event['id_evento'],
|
||||
'message' => ui_print_string_substr(
|
||||
'fired' => $event['id_evento'],
|
||||
'message' => ui_print_string_substr(
|
||||
strip_tags(io_safe_output($event['evento'])),
|
||||
75,
|
||||
true,
|
||||
'9'
|
||||
),
|
||||
'priority' => ui_print_event_priority($event['criticity'], true, true),
|
||||
'type' => events_print_type_img(
|
||||
'priority' => ui_print_event_priority($event['criticity'], true, true),
|
||||
'type' => events_print_type_img(
|
||||
$event['event_type'],
|
||||
true
|
||||
),
|
||||
'timestamp' => ui_print_timestamp(
|
||||
'timestamp' => ui_print_timestamp(
|
||||
$event['timestamp'],
|
||||
true,
|
||||
['style' => 'font-size: 9pt; letter-spacing: 0.3pt;']
|
||||
),
|
||||
'event_timestamp' => $event['timestamp'],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -3618,6 +3618,7 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
|
|||
$classes = '';
|
||||
$fixedId = '';
|
||||
$iconStyle = '';
|
||||
$minimize_arrow = false;
|
||||
// $spanStyle = 'margin-top: 4px;';
|
||||
$spanStyle = '';
|
||||
if (empty($name) === true) {
|
||||
|
@ -3655,6 +3656,8 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
|
|||
$buttonType = ($attr_array['type'] ?? 'button');
|
||||
$buttonAttributes = $value;
|
||||
break;
|
||||
} else if ($attribute === 'minimize-arrow') {
|
||||
$minimize_arrow = true;
|
||||
} else {
|
||||
$attributes .= $attribute.'="'.$value.'" ';
|
||||
}
|
||||
|
@ -3679,15 +3682,30 @@ function html_print_button($label='OK', $name='', $disabled=false, $script='', $
|
|||
$iconDiv = '';
|
||||
}
|
||||
|
||||
if ($minimize_arrow === true) {
|
||||
$minimezeDiv = html_print_div(
|
||||
[
|
||||
'id' => 'minimize_arrow_event_sound',
|
||||
'style' => 'background-color:transparent; right: 1em; margin-left:0.5em; position:relative; display:none;',
|
||||
'class' => 'arrow_menu_down w30p',
|
||||
],
|
||||
true
|
||||
);
|
||||
} else {
|
||||
$minimezeDiv = '';
|
||||
}
|
||||
|
||||
// Defined id. Is usable for span and button.
|
||||
// TODO. Check if will be proper use button or submit when where appropiate.
|
||||
$mainId = ((empty($fixedId) === false) ? $fixedId : 'button-'.$name);
|
||||
|
||||
if ($imageButton === false) {
|
||||
$content = '<span id="span-'.$mainId.'" style="'.$spanStyle.'" class="font_11">'.$label.'</span>';
|
||||
$content = $minimezeDiv;
|
||||
$content .= '<span id="span-'.$mainId.'" style="'.$spanStyle.'" class="font_11">'.$label.'</span>';
|
||||
$content .= $iconDiv;
|
||||
} else {
|
||||
$content = $iconDiv;
|
||||
$content = $minimezeDiv;
|
||||
$content .= $iconDiv;
|
||||
}
|
||||
|
||||
// In case of not selected button type, in this case, will be normal button.
|
||||
|
|
|
@ -55,7 +55,7 @@ function show_event_dialog(event, dialog_page) {
|
|||
title: event.evento,
|
||||
resizable: true,
|
||||
draggable: true,
|
||||
modal: true,
|
||||
modal: false,
|
||||
minWidth: 875,
|
||||
minHeight: 600,
|
||||
close: function() {
|
||||
|
@ -943,6 +943,185 @@ function process_buffers(buffers) {
|
|||
}
|
||||
}
|
||||
|
||||
function openSoundEventsDialogModal(settings, dialog_parameters, reload) {
|
||||
let mode = $("#hidden-mode_alert").val();
|
||||
if (reload != false) {
|
||||
if (mode == 0) {
|
||||
let filter_id = $("#filter_id option:selected").val();
|
||||
let interval = $("#interval option:selected").val();
|
||||
let time_sound = $("#time_sound option:selected").val();
|
||||
let sound_id = $("#sound_id option:selected").val();
|
||||
let parameters = {
|
||||
filter_id: filter_id,
|
||||
interval: interval,
|
||||
time_sound: time_sound,
|
||||
sound_id: sound_id,
|
||||
mode: mode
|
||||
};
|
||||
parameters = JSON.stringify(parameters);
|
||||
parameters = btoa(parameters);
|
||||
let url =
|
||||
window.location + "&settings=" + settings + "¶meters=" + parameters;
|
||||
$(location).attr("href", url);
|
||||
} else {
|
||||
let url = window.location + "&settings=" + settings;
|
||||
$(location).attr("href", url);
|
||||
}
|
||||
} else {
|
||||
openSoundEventsDialog(settings, dialog_parameters, reload);
|
||||
}
|
||||
}
|
||||
|
||||
function openSoundEventsDialog(settings, dialog_parameters, reload) {
|
||||
let encode_settings = settings;
|
||||
if (reload == undefined) {
|
||||
reload = true;
|
||||
}
|
||||
if (dialog_parameters != undefined) {
|
||||
dialog_parameters = JSON.parse(atob(dialog_parameters));
|
||||
}
|
||||
settings = JSON.parse(atob(settings));
|
||||
// Check modal exists and is open.
|
||||
if (
|
||||
$("#modal-sound").hasClass("ui-dialog-content") &&
|
||||
$("#modal-sound").dialog("isOpen")
|
||||
) {
|
||||
$(".ui-dialog-titlebar-minimize").trigger("click");
|
||||
return;
|
||||
}
|
||||
//Modify button
|
||||
$("#minimize_arrow_event_sound").removeClass("arrow_menu_up");
|
||||
$("#minimize_arrow_event_sound").addClass("arrow_menu_down");
|
||||
$("#minimize_arrow_event_sound").show();
|
||||
|
||||
// Initialize modal.
|
||||
$("#modal-sound")
|
||||
.empty()
|
||||
.dialog({
|
||||
title: settings.title,
|
||||
resizable: false,
|
||||
modal: false,
|
||||
width: 600,
|
||||
height: 600,
|
||||
open: function() {
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
data: {
|
||||
page: settings.page,
|
||||
drawConsoleSound: 1
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#modal-sound").append(data);
|
||||
$("#tabs-sound-modal").tabs({
|
||||
disabled: [1]
|
||||
});
|
||||
|
||||
// Test sound.
|
||||
$("#button-melody_sound").click(function() {
|
||||
var sound = false;
|
||||
if ($("#id_sound_event").length == 0) {
|
||||
sound = true;
|
||||
}
|
||||
|
||||
test_sound_button(sound, settings.urlSound);
|
||||
});
|
||||
|
||||
// Play Stop.
|
||||
$("#button-start-search").click(function() {
|
||||
if (reload == true) {
|
||||
openSoundEventsDialogModal(encode_settings, 0, reload);
|
||||
}
|
||||
var mode = $("#hidden-mode_alert").val();
|
||||
var action = false;
|
||||
if (mode == 0) {
|
||||
action = true;
|
||||
}
|
||||
if ($("#button-start-search").hasClass("play")) {
|
||||
$("#modal-sound").css({
|
||||
height: "500px"
|
||||
});
|
||||
$("#modal-sound")
|
||||
.parent()
|
||||
.css({
|
||||
height: "550px"
|
||||
});
|
||||
} else {
|
||||
$("#modal-sound").css({
|
||||
height: "450px"
|
||||
});
|
||||
$("#modal-sound")
|
||||
.parent()
|
||||
.css({
|
||||
height: "500px"
|
||||
});
|
||||
}
|
||||
|
||||
action_events_sound(action, settings);
|
||||
});
|
||||
|
||||
if (reload == false && dialog_parameters != undefined) {
|
||||
if ($("#button-start-search").hasClass("play")) {
|
||||
$("#filter_id").val(dialog_parameters["filter_id"]);
|
||||
$("#interval").val(dialog_parameters["interval"]);
|
||||
$("#time_sound").val(dialog_parameters["time_sound"]);
|
||||
$("#sound_id").val(dialog_parameters["sound_id"]);
|
||||
|
||||
$("#filter_id").trigger("change");
|
||||
$("#interval").trigger("change");
|
||||
$("#time_sound").trigger("change");
|
||||
$("#sound_id").trigger("change");
|
||||
|
||||
$("#button-start-search").trigger("click");
|
||||
}
|
||||
}
|
||||
|
||||
// Silence Alert.
|
||||
$("#button-no-alerts").click(function() {
|
||||
if ($("#button-no-alerts").hasClass("silence-alerts") === true) {
|
||||
// Remove audio.
|
||||
remove_audio();
|
||||
|
||||
// Clean events.
|
||||
$("#tabs-sound-modal .elements-discovered-alerts ul").empty();
|
||||
$("#tabs-sound-modal .empty-discovered-alerts").removeClass(
|
||||
"invisible_important"
|
||||
);
|
||||
|
||||
// Clean progress.
|
||||
$("#progressbar_time").empty();
|
||||
|
||||
// Change img button.
|
||||
$("#button-no-alerts")
|
||||
.removeClass("silence-alerts")
|
||||
.addClass("alerts");
|
||||
// Change value button.
|
||||
$("#button-no-alerts").val(settings.noAlert);
|
||||
$("#button-no-alerts > span").text(settings.noAlert);
|
||||
|
||||
// Background button.
|
||||
$(".container-button-alert").removeClass("fired");
|
||||
|
||||
// New progress.
|
||||
listen_event_sound(settings);
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
},
|
||||
close: function() {
|
||||
$("#minimize_arrow_event_sound").hide();
|
||||
remove_audio();
|
||||
$(this).dialog("destroy");
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
function openSoundEventModal(settings) {
|
||||
if ($("#hidden-metaconsole_activated").val() === "1") {
|
||||
var win = open(
|
||||
|
@ -966,6 +1145,7 @@ function openSoundEventModal(settings) {
|
|||
}
|
||||
|
||||
settings = JSON.parse(atob(settings));
|
||||
|
||||
// Check modal exists and is open.
|
||||
if (
|
||||
$("#modal-sound").hasClass("ui-dialog-content") &&
|
||||
|
@ -1045,10 +1225,12 @@ function add_audio(urlSound) {
|
|||
sound +
|
||||
"' autoplay='true' hidden='true' loop='false'>"
|
||||
);
|
||||
$("#button-sound_events_button").addClass("animation-blink");
|
||||
}
|
||||
|
||||
function remove_audio() {
|
||||
$(".actions-sound-modal audio").remove();
|
||||
$("#button-sound_events_button").removeClass("animation-blink");
|
||||
}
|
||||
|
||||
function listen_event_sound(settings) {
|
||||
|
@ -1064,6 +1246,37 @@ function listen_event_sound(settings) {
|
|||
}
|
||||
|
||||
function check_event_sound(settings) {
|
||||
// Update elements time.
|
||||
$(".elements-discovered-alerts ul li").each(function() {
|
||||
let element_time = $(this)
|
||||
.children(".li-hidden")
|
||||
.val();
|
||||
let obj_time = new Date(element_time);
|
||||
let current_dt = new Date();
|
||||
let timestamp = current_dt.getTime() - obj_time.getTime();
|
||||
timestamp = timestamp / 1000;
|
||||
if (timestamp <= 60) {
|
||||
timestamp = Math.round(timestamp) + " seconds";
|
||||
} else if (timestamp <= 3600) {
|
||||
let minute = Math.floor((timestamp / 60) % 60);
|
||||
minute = minute < 10 ? "0" + minute : minute;
|
||||
let second = Math.floor(timestamp % 60);
|
||||
second = second < 10 ? "0" + second : second;
|
||||
timestamp = minute + " minutes " + second + " seconds";
|
||||
} else {
|
||||
let hour = Math.floor(timestamp / 3600);
|
||||
hour = hour < 10 ? "0" + hour : hour;
|
||||
let minute = Math.floor((timestamp / 60) % 60);
|
||||
minute = minute < 10 ? "0" + minute : minute;
|
||||
let second = Math.round(timestamp % 60);
|
||||
second = second < 10 ? "0" + second : second;
|
||||
timestamp = hour + " hours " + minute + " minutes " + second + " seconds";
|
||||
}
|
||||
$(this)
|
||||
.children(".li-time")
|
||||
.children("span")
|
||||
.html(timestamp);
|
||||
});
|
||||
jQuery.post(
|
||||
settings.url,
|
||||
{
|
||||
|
@ -1117,7 +1330,13 @@ function check_event_sound(settings) {
|
|||
"beforeend",
|
||||
'<div class="li-time">' + element.timestamp + "</div>"
|
||||
);
|
||||
$("#tabs-sound-modal .elements-discovered-alerts ul").append(li);
|
||||
li.insertAdjacentHTML(
|
||||
"beforeend",
|
||||
'<input type="hidden" value="' +
|
||||
element.event_timestamp +
|
||||
'" class="li-hidden"/>'
|
||||
);
|
||||
$("#tabs-sound-modal .elements-discovered-alerts ul").prepend(li);
|
||||
});
|
||||
|
||||
// -100 delay sound.
|
||||
|
@ -1229,3 +1448,266 @@ function removeElement(name_select, id_modal) {
|
|||
.append(option);
|
||||
});
|
||||
}
|
||||
// Define the minimize button functionality;
|
||||
function hidden_dialog(dialog) {
|
||||
setTimeout(function() {
|
||||
$("#modal-sound").css("visibility", "hidden");
|
||||
dialog.css("z-index", "-1");
|
||||
}, 200);
|
||||
}
|
||||
|
||||
function show_dialog(dialog) {
|
||||
setTimeout(function() {
|
||||
$("#modal-sound").css("visibility", "visible");
|
||||
dialog.css("z-index", "1115");
|
||||
}, 50);
|
||||
}
|
||||
|
||||
/*
|
||||
#############################################################################
|
||||
##
|
||||
## + Compacts the Modal Sound Dialog to a tiny toolbar
|
||||
## + Dynamically adds a button which can reduce/reapply the dialog size
|
||||
## + If alarm gets raised & minimized, the dialog window maximizes and the toolbar flashes red for 10 seconds.
|
||||
## - Works fine until a link/action gets clicked. The Toolbar shifts to the bottom of the Modal-Sound Dialog.
|
||||
##
|
||||
#############################################################################
|
||||
*/
|
||||
|
||||
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
|
||||
const requestBody = ajaxOptions.data;
|
||||
try {
|
||||
if (requestBody && requestBody.includes("drawConsoleSound=1")) {
|
||||
console.log(
|
||||
"AJAX request sent with drawConsoleSound=1:",
|
||||
ajaxOptions.url
|
||||
);
|
||||
|
||||
// Find the dialog element by the aria-describedby attribute
|
||||
var dialog = $('[aria-describedby="modal-sound"]');
|
||||
|
||||
// Select the close button within the dialog
|
||||
var closeButton = dialog.find(".ui-dialog-titlebar-close");
|
||||
|
||||
// Add the minimize button before the close button
|
||||
var minimizeButton = $("<button>", {
|
||||
class:
|
||||
"ui-corner-all ui-widget ui-button-icon-only ui-window-minimize ui-dialog-titlebar-minimize",
|
||||
type: "button",
|
||||
title: "Minimize",
|
||||
style: "float: right;margin-right: 1.5em;"
|
||||
}).insertBefore(closeButton);
|
||||
|
||||
// Add the minimize icon to the minimize button
|
||||
$("<span>", {
|
||||
class: "ui-button-icon ui-icon ui-icon-minusthick",
|
||||
style: "background-color: #fff;"
|
||||
}).appendTo(minimizeButton);
|
||||
|
||||
$("<span>", {
|
||||
class: "ui-button-icon-space"
|
||||
})
|
||||
.html(" ")
|
||||
.appendTo(minimizeButton);
|
||||
|
||||
// Add the disengage button before the minimize button
|
||||
var disengageButton = $("<button>", {
|
||||
class:
|
||||
"ui-corner-all ui-widget ui-button-icon-only ui-dialog-titlebar-disengage",
|
||||
type: "button",
|
||||
title: "Disengage",
|
||||
style: "float: right;margin-right: 0.5em; position:relative;"
|
||||
}).insertBefore(minimizeButton);
|
||||
|
||||
// Add the disengage icon to the disengage button
|
||||
$("<span>", {
|
||||
class: "ui-button-icon ui-icon ui-icon-circle-triangle-n",
|
||||
style: "background-color: #fff;"
|
||||
}).appendTo(disengageButton);
|
||||
|
||||
$("<span>", {
|
||||
class: "ui-button-icon-space"
|
||||
})
|
||||
.html(" ")
|
||||
.appendTo(disengageButton);
|
||||
|
||||
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");
|
||||
dialog.data("originalPos", dialog.position());
|
||||
dialog.data("originalSize", {
|
||||
width: dialog.width(),
|
||||
height: dialog.height()
|
||||
});
|
||||
dialog.data("isMinimized", true);
|
||||
|
||||
dialog.animate(
|
||||
{
|
||||
height: "40px",
|
||||
top: 0,
|
||||
top: $(window).height() - 100
|
||||
},
|
||||
200,
|
||||
"linear",
|
||||
hidden_dialog(dialog)
|
||||
);
|
||||
dialog.css({ height: "" });
|
||||
dialog.animate(
|
||||
{
|
||||
height: dialog.data("originalSize").height + "px",
|
||||
top: dialog.data("originalPos").top + "px"
|
||||
},
|
||||
5
|
||||
);
|
||||
//dialog.find(".ui-dialog-content").hide();
|
||||
} else {
|
||||
console.log("Restore Window");
|
||||
$(".ui-widget-overlay").show();
|
||||
//dialog.find(".ui-dialog-content").show();
|
||||
dialog.data("isMinimized", false);
|
||||
|
||||
dialog.animate(
|
||||
{
|
||||
height: "40px",
|
||||
top: 0,
|
||||
top: $(window).height() - 100
|
||||
},
|
||||
5
|
||||
);
|
||||
dialog.animate(
|
||||
{
|
||||
height: dialog.data("originalSize").height + "px",
|
||||
top: dialog.data("originalPos").top + "px"
|
||||
},
|
||||
200,
|
||||
"linear",
|
||||
show_dialog(dialog)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
disengageButton.click(function() {
|
||||
$(".ui-dialog-titlebar-close").trigger("click");
|
||||
$("#button-sound_events_button_hidden").trigger("click");
|
||||
});
|
||||
|
||||
// Listener to check if the dialog content contains <li> elements
|
||||
var dialogContent = dialog.find(".ui-dialog-content");
|
||||
var observer = new MutationObserver(function(mutations) {
|
||||
mutations.forEach(function(mutation) {
|
||||
var addedNodes = mutation.addedNodes;
|
||||
for (var i = 0; i < addedNodes.length; i++) {
|
||||
if (addedNodes[i].nodeName.toLowerCase() === "li") {
|
||||
console.log("The dialog content contains an <li> tag.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Configure and start observing the dialog content for changes
|
||||
var config = { childList: true, subtree: true };
|
||||
observer.observe(dialogContent[0], config);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
#############################################################################
|
||||
##
|
||||
## + Compacts the Modal Sound Dialog popup and removes the widget-overlay
|
||||
##
|
||||
##
|
||||
#############################################################################
|
||||
*/
|
||||
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
|
||||
const requestBody = ajaxOptions.data;
|
||||
try {
|
||||
if (requestBody && requestBody.includes("drawConsoleSound=1")) {
|
||||
console.log(
|
||||
"AJAX request sent with drawConsoleSound=1:",
|
||||
ajaxOptions.url
|
||||
);
|
||||
|
||||
// Find the dialog element by the aria-describedby attribute
|
||||
var dialog = $('[aria-describedby="modal-sound"]');
|
||||
dialog.css({
|
||||
// "backgroundColor":"black",
|
||||
// "color":"white"
|
||||
});
|
||||
|
||||
// Set CSS properties for #modal-sound
|
||||
$("#modal-sound").css({
|
||||
height: "450px",
|
||||
margin: "0px"
|
||||
});
|
||||
|
||||
// Set CSS properties for #tabs-sound-modal
|
||||
$("#tabs-sound-modal").css({
|
||||
"margin-top": "0px",
|
||||
padding: "0px",
|
||||
"font-weight": "bolder"
|
||||
});
|
||||
|
||||
// Set CSS properties for #actions-sound-modal
|
||||
$("#actions-sound-modal").css({
|
||||
"margin-bottom": "0px"
|
||||
});
|
||||
|
||||
// Hide the overlay with specific class and z-index
|
||||
$('.ui-widget-overlay.ui-front[style="z-index: 10000;"]').css(
|
||||
"display",
|
||||
"none"
|
||||
);
|
||||
|
||||
// Handle the 'change' event for #modal-sound, simply to compact the size of the img "No alerts discovered"
|
||||
// An image should always have a size assigned!!!
|
||||
$("#modal-sound").on("change", function() {
|
||||
// Find the image within the specific div
|
||||
var image = $(this).find(
|
||||
'img.invert_filter.forced_title[data-title="No alerts discovered"][alt="No alerts discovered"]'
|
||||
);
|
||||
|
||||
// Set the desired width and height
|
||||
var width = 48;
|
||||
var height = 48;
|
||||
|
||||
// Resize the image
|
||||
image.width(width);
|
||||
image.height(height);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
|
||||
function loadModal() {
|
||||
const urlSearch = window.location.search;
|
||||
const urlParams = new URLSearchParams(urlSearch);
|
||||
if (urlParams.has("settings")) {
|
||||
let modal_parameters = "";
|
||||
if (urlParams.has("parameters")) {
|
||||
modal_parameters = urlParams.get("parameters");
|
||||
}
|
||||
let settings = urlParams.get("settings");
|
||||
openSoundEventsDialogModal(settings, modal_parameters, false);
|
||||
}
|
||||
}
|
||||
window.onload = loadModal;
|
||||
|
|
|
@ -45,16 +45,41 @@
|
|||
font-size: 11pt;
|
||||
top: 2px;
|
||||
}
|
||||
.ui-dialog .ui-dialog-titlebar-close {
|
||||
|
||||
.ui-dialog .ui-dialog-titlebar-minimize {
|
||||
position: absolute;
|
||||
right: 1em;
|
||||
right: 1.5em;
|
||||
width: 21px;
|
||||
margin: 0px 0 0 0;
|
||||
padding: 1px;
|
||||
height: 20px;
|
||||
bottom: 30%;
|
||||
top: 20%;
|
||||
top: 2em;
|
||||
background-color: #fff !important;
|
||||
}
|
||||
|
||||
.ui-dialog .ui-dialog-titlebar-minimize:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ui-dialog .ui-dialog-titlebar-disengage {
|
||||
position: relative;
|
||||
right: 1.5em;
|
||||
width: 21px;
|
||||
margin: 0px 0 0 0;
|
||||
padding: 1px;
|
||||
height: 20px;
|
||||
bottom: 30%;
|
||||
background-color: #fff !important;
|
||||
-ms-transform: scale(1.2);
|
||||
-webkit-transform: scale(1.2);
|
||||
transform: scale(1.2);
|
||||
}
|
||||
|
||||
.ui-dialog .ui-dialog-titlebar-disengage:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ui-dialog .ui-dialog-content {
|
||||
position: relative;
|
||||
border: 0;
|
||||
|
|
|
@ -2306,7 +2306,7 @@ div#main_pure {
|
|||
position: static;
|
||||
}
|
||||
|
||||
.ui-draggable {
|
||||
.ui-draggable-handle {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
|
@ -12325,6 +12325,113 @@ tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input {
|
|||
width: 100% !important;
|
||||
}
|
||||
|
||||
.animation-blink {
|
||||
-webkit-animation: glowing 1500ms infinite;
|
||||
-moz-animation: glowing 1500ms infinite;
|
||||
-o-animation: glowing 1500ms infinite;
|
||||
animation: glowing 1500ms infinite;
|
||||
background: #14524f !important;
|
||||
border-color: #14524f !important;
|
||||
}
|
||||
|
||||
@-webkit-keyframes glowing {
|
||||
0% {
|
||||
background: #14524f !important;
|
||||
-webkit-box-shadow: 0 0 3px #14524f;
|
||||
}
|
||||
50% {
|
||||
background: #1d7873 !important;
|
||||
-webkit-box-shadow: 0 0 40px #1d7873;
|
||||
}
|
||||
100% {
|
||||
background: #14524f !important;
|
||||
-webkit-box-shadow: 0 0 3px #14524f;
|
||||
}
|
||||
}
|
||||
|
||||
@-moz-keyframes glowing {
|
||||
0% {
|
||||
background: #14524f !important;
|
||||
-moz-box-shadow: 0 0 3px #14524f;
|
||||
}
|
||||
50% {
|
||||
background: #1d7873 !important;
|
||||
-moz-box-shadow: 0 0 40px #1d7873;
|
||||
}
|
||||
100% {
|
||||
background: #14524f !important;
|
||||
-moz-box-shadow: 0 0 3px #14524f;
|
||||
}
|
||||
}
|
||||
|
||||
@-o-keyframes glowing {
|
||||
0% {
|
||||
background: #14524f !important;
|
||||
box-shadow: 0 0 3px #14524f;
|
||||
}
|
||||
50% {
|
||||
background: #1d7873 !important;
|
||||
box-shadow: 0 0 40px #1d7873;
|
||||
}
|
||||
100% {
|
||||
background: #14524f !important;
|
||||
box-shadow: 0 0 3px #14524f;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes glowing {
|
||||
0% {
|
||||
background: #14524f !important;
|
||||
box-shadow: 0 0 3px #14524f;
|
||||
}
|
||||
50% {
|
||||
background: #1d7873 !important;
|
||||
box-shadow: 0 0 40px #1d7873;
|
||||
}
|
||||
100% {
|
||||
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 div.play {
|
||||
background: url(../../images/play-white.png), transparent !important;
|
||||
background-repeat: no-repeat !important;
|
||||
background-position: 20px 5px !important;
|
||||
color: #ffffff !important;
|
||||
padding-left: 20px !important;
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
|
||||
.actions-sound-modal .buttons-sound-modal div.stop {
|
||||
background: url(../../images/stop.png), transparent !important;
|
||||
background-repeat: no-repeat !important;
|
||||
background-position: 20px 5px !important;
|
||||
color: #ffffff !important;
|
||||
padding-left: 20px !important;
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
.start-end-date-log-viewer {
|
||||
display: flex;
|
||||
flex-direction: row !important;
|
||||
|
|
|
@ -216,10 +216,10 @@ div.container-button-play > button#button-start-search {
|
|||
|
||||
.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;
|
||||
background-repeat: no-repeat;
|
||||
background-position: 82px 14px;
|
||||
color: #ffffff;
|
||||
background: url(../../images/play-white.png), transparent !important;
|
||||
background-repeat: no-repeat !important;
|
||||
background-position: 82px 14px !important;
|
||||
color: #ffffff !important;
|
||||
padding-left: 20px;
|
||||
border: 0;
|
||||
}
|
||||
|
|
|
@ -1610,7 +1610,7 @@ require 'include/php_to_js_values.php';
|
|||
|
||||
$(".ui-widget-overlay").css("background", "#000");
|
||||
$(".ui-widget-overlay").css("opacity", 0.6);
|
||||
$(".ui-draggable").css("cursor", "inherit");
|
||||
//$(".ui-draggable").css("cursor", "inherit");
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
|
|
@ -104,6 +104,9 @@ if (isset($fb64) === true) {
|
|||
);
|
||||
}
|
||||
|
||||
$settings_modal = get_parameter('settings', 0);
|
||||
$parameters_modal = get_parameter('parameters', 0);
|
||||
|
||||
$id_group_filter = get_parameter(
|
||||
'filter[id_group_filter]',
|
||||
($filter['id_group_filter'] ?? '')
|
||||
|
@ -1717,6 +1720,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(
|
||||
|
@ -1729,7 +1737,7 @@ if ($pure) {
|
|||
'silenceAlarm' => __('Silence alarm'),
|
||||
'url' => ui_get_full_url('ajax.php'),
|
||||
'page' => 'include/ajax/events',
|
||||
'urlSound' => 'include/sounds/',
|
||||
'urlSound' => $urlSound,
|
||||
]
|
||||
)
|
||||
);
|
||||
|
@ -1743,6 +1751,8 @@ if ($pure) {
|
|||
]
|
||||
).'</a>';
|
||||
|
||||
echo '<input type="hidden" id="open_sound_event_modal" value="0" /> ';
|
||||
|
||||
// If the user has administrator permission display manage tab.
|
||||
if ($event_w === true || $event_m === true) {
|
||||
// Manage events.
|
||||
|
@ -2795,7 +2805,7 @@ if (check_acl(
|
|||
'submit_event_response',
|
||||
false,
|
||||
'execute_event_response(true);',
|
||||
[ 'icon' => 'cog' ],
|
||||
[ 'icon' => 'cog'],
|
||||
true
|
||||
);
|
||||
|
||||
|
@ -2810,6 +2820,50 @@ if (check_acl(
|
|||
false,
|
||||
false
|
||||
);
|
||||
if (is_metaconsole() === true) {
|
||||
$urlSound = '../../include/sounds/';
|
||||
} else {
|
||||
$urlSound = 'include/sounds/';
|
||||
}
|
||||
|
||||
// Acoustic console.
|
||||
$data_sound = base64_encode(
|
||||
json_encode(
|
||||
[
|
||||
'title' => __('Acoustic console'),
|
||||
'start' => __('Start'),
|
||||
'stop' => __('Stop'),
|
||||
'noAlert' => __('No alert'),
|
||||
'silenceAlarm' => __('Silence alarm'),
|
||||
'url' => ui_get_full_url('ajax.php'),
|
||||
'page' => 'include/ajax/events',
|
||||
'urlSound' => $urlSound,
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
$elements .= html_print_button(
|
||||
__('Sound Events'),
|
||||
'sound_events_button',
|
||||
false,
|
||||
'openSoundEventsDialog("'.$data_sound.'")',
|
||||
[
|
||||
'icon' => 'sound',
|
||||
'style' => 'margin-right: 25% !important',
|
||||
'minimize-arrow' => true,
|
||||
'span_style' => 'width: 100%',
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
$elements .= html_print_button(
|
||||
'hidden',
|
||||
'sound_events_button_hidden',
|
||||
false,
|
||||
'openSoundEventModal("'.$data_sound.'")',
|
||||
['style' => 'display:none'],
|
||||
true
|
||||
);
|
||||
|
||||
html_print_action_buttons(
|
||||
$elements,
|
||||
|
@ -3284,7 +3338,9 @@ $(document).ready( function() {
|
|||
url: '<?php echo ui_get_full_url('ajax.php'); ?>',
|
||||
data: {
|
||||
page: 'include/ajax/events',
|
||||
load_filter_modal: 1
|
||||
load_filter_modal: 1,
|
||||
settings: '<?php echo $settings_modal; ?>',
|
||||
parameters: '<?php echo $parameters_modal; ?>',
|
||||
},
|
||||
success: function (data){
|
||||
$('#load-modal-filter')
|
||||
|
|
|
@ -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 '<html>';
|
||||
echo '<head>';
|
||||
?>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title><?php echo __('Acoustic console'); ?></title>
|
||||
<link rel="stylesheet" href="<?php echo $config['homeurl']; ?>include/styles/pandora_minimal.css" type="text/css" />
|
||||
<link rel="stylesheet" href="<?php echo $config['homeurl']; ?>include/styles/js/jquery-ui.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="<?php echo $config['homeurl']; ?>include/styles/js/jquery-ui_custom.css" type="text/css" />
|
||||
<link rel="stylesheet" href="<?php echo $config['homeurl']; ?>include/styles/select2.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="<?php echo $config['homeurl']; ?>include/styles/pandora.css" type="text/css" />
|
||||
<?php
|
||||
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
|
||||
echo '<title>'.__('Acoustic console').'</title>';
|
||||
echo '<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" />';
|
||||
echo '<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" />';
|
||||
echo '<link rel="stylesheet" href="../../include/styles/pandora.css" type="text/css" />';
|
||||
|
||||
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);
|
||||
?>
|
||||
<script type='text/javascript' src='<?php echo $config['homeurl']; ?>include/javascript/jquery.current.js'></script>
|
||||
<script type='text/javascript' src='<?php echo $config['homeurl']; ?>include/javascript/jquery.pandora.js'></script>
|
||||
<script type='text/javascript' src='<?php echo $config['homeurl']; ?>include/javascript/jquery-ui.min.js'></script>
|
||||
<script type='text/javascript' src='<?php echo $config['homeurl']; ?>include/javascript/select2.min.js'></script>
|
||||
<script type='text/javascript' src='<?php echo $config['homeurl']; ?>include/javascript/pandora.js'></script>
|
||||
<script type='text/javascript' src='<?php echo $config['homeurl']; ?>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" />';
|
||||
if ($config['style'] === 'pandora_black' && !is_metaconsole()) {
|
||||
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'),
|
||||
'class' => 'invert_filter',
|
||||
'div_sty'
|
||||
]
|
||||
);
|
||||
$output .= '</a>';
|
||||
|
@ -242,7 +249,7 @@ $output = '<div id="tabs-sound-modal">';
|
|||
);
|
||||
$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 .= __('Discovered alerts');
|
||||
$output .= '</h3>';
|
||||
|
@ -259,7 +266,7 @@ $output = '<div id="tabs-sound-modal">';
|
|||
$output .= __('Congrats! there’s nothing to show');
|
||||
$output .= '</span>';
|
||||
$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(
|
||||
'ajax_file_sound_console',
|
||||
ui_get_full_url('ajax.php', false, false, false),
|
||||
|
@ -284,7 +291,7 @@ $output = '<div id="tabs-sound-modal">';
|
|||
false,
|
||||
'',
|
||||
[
|
||||
'icon' => 'cog',
|
||||
'icon' => 'play',
|
||||
'class' => 'mrgn_lft_20px',
|
||||
],
|
||||
true
|
||||
|
@ -350,9 +357,9 @@ function action_events_sound(mode) {
|
|||
// Change mode.
|
||||
$("#hidden-mode_alert").val(1);
|
||||
// Change img button.
|
||||
$("#button-start-search")
|
||||
.removeClass("play")
|
||||
.addClass("stop");
|
||||
$("#button-start-search").children("div").removeClass("play")
|
||||
$("#button-start-search").children("div").addClass("stop");
|
||||
|
||||
// Change value button.
|
||||
$("#button-start-search").val("Stop");
|
||||
$("#button-start-search > span").text("Stop");
|
||||
|
@ -366,9 +373,8 @@ function action_events_sound(mode) {
|
|||
// Change mode.
|
||||
$("#hidden-mode_alert").val(0);
|
||||
// Change img button.
|
||||
$("#button-start-search")
|
||||
.removeClass("stop")
|
||||
.addClass("play");
|
||||
$("#button-start-search").children("div").removeClass("stop")
|
||||
$("#button-start-search").children("div").addClass("play")
|
||||
// Change value button.
|
||||
$("#button-start-search").val("Start");
|
||||
$("#button-start-search > span").text("Start");
|
||||
|
@ -405,6 +411,7 @@ function add_audio(urlSound) {
|
|||
|
||||
function remove_audio() {
|
||||
$(".actions-sound-modal audio").remove();
|
||||
//buttonBlink();
|
||||
}
|
||||
|
||||
function listen_event_sound() {
|
||||
|
@ -435,7 +442,6 @@ function check_event_sound() {
|
|||
$("#tabs-sound-modal .empty-discovered-alerts").addClass(
|
||||
"invisible_important"
|
||||
);
|
||||
|
||||
// Change img button.
|
||||
$("#button-no-alerts")
|
||||
.removeClass("alerts")
|
||||
|
@ -446,10 +452,11 @@ function check_event_sound() {
|
|||
|
||||
// Background button.
|
||||
$(".container-button-alert").addClass("fired");
|
||||
|
||||
|
||||
// Remove audio.
|
||||
remove_audio();
|
||||
var urlSound = '../../include/sounds/'+$('#sound_id :selected').val();
|
||||
console.log(urlSound)
|
||||
// Apend audio.
|
||||
add_audio(urlSound);
|
||||
|
||||
|
@ -505,7 +512,7 @@ $(document).ready(function(){
|
|||
sound = true;
|
||||
}
|
||||
var urlSound = '../../include/sounds/'+$('#sound_id :selected').val();
|
||||
|
||||
urlSound
|
||||
test_sound_button(sound, urlSound);
|
||||
});
|
||||
|
||||
|
@ -516,7 +523,18 @@ $(document).ready(function(){
|
|||
if (mode == 0) {
|
||||
action = true;
|
||||
}
|
||||
|
||||
if ($("#button-start-search").hasClass("play")){
|
||||
$("#modal-sound").css({
|
||||
height: "500px"
|
||||
});
|
||||
$("#modal-sound").parent().css({
|
||||
height: "800px"
|
||||
});
|
||||
} else {
|
||||
$("#modal-sound").css({
|
||||
height: "450px"
|
||||
});
|
||||
}
|
||||
action_events_sound(action);
|
||||
});
|
||||
|
||||
|
|
|
@ -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,
|
||||
]
|
||||
)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue