Added default event filter. Ticket #3930.
This commit is contained in:
parent
88d46448ca
commit
58f0ccae77
|
@ -62,3 +62,9 @@ UPDATE `tlink` SET `link` = 'https://github.com/pandorafms/pandorafms/issues' WH
|
|||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tevent_filter ADD COLUMN `date_from` date DEFAULT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN `date_to` date DEFAULT NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tusuario`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tusuario ADD (`id_filter` int(10) unsigned NULL default NULL);
|
||||
ALTER TABLE tusuario ADD CONSTRAINT fk_id_filter FOREIGN KEY (id_filter) REFERENCES tevent_filter(id_filter) ON DELETE SET NULL;
|
||||
|
|
|
@ -61,3 +61,9 @@ UPDATE tlink SET link = 'https://github.com/pandorafms/pandorafms/issues' WHERE
|
|||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tevent_filter ADD COLUMN date_from date DEFAULT NULL;
|
||||
ALTER TABLE tevent_filter ADD COLUMN date_to date DEFAULT NULL;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tusuario`
|
||||
-- ---------------------------------------------------------------------
|
||||
ALTER TABLE tusuario ADD (id_filter int(10) unsigned NULL default NULL);
|
||||
ALTER TABLE tusuario ADD CONSTRAINT fk_id_filter FOREIGN KEY (id_filter) REFERENCES tevent_filter(id_filter) ON DELETE SET NULL;
|
||||
|
|
|
@ -35,6 +35,7 @@ if (! check_acl ($config["id_user"], 0, "ER")) {
|
|||
return;
|
||||
}
|
||||
|
||||
$is_filter = db_get_value('id_filter', 'tusuario', 'id_user', $config['id_user']);
|
||||
|
||||
$jump = ' ';
|
||||
|
||||
|
@ -863,6 +864,7 @@ html_print_input_hidden('ajax_file',
|
|||
ui_get_full_url("ajax.php", false, false, false));
|
||||
html_print_input_hidden('meta', (int)$meta);
|
||||
html_print_input_hidden('history', (int)$history);
|
||||
html_print_input_hidden('filterid', $is_filter);
|
||||
|
||||
ui_require_jquery_file('json');
|
||||
ui_include_time_picker();
|
||||
|
@ -898,7 +900,65 @@ $(document).ready( function() {
|
|||
$("#row_name").css('visibility', '');
|
||||
$("#submit-update_filter").css('visibility', '');
|
||||
}
|
||||
|
||||
|
||||
if ($("#hidden-id_name").val() == ''){
|
||||
if($("#hidden-filterid").val() != ''){
|
||||
$('#row_name').css('visibility', '');
|
||||
$("#submit-update_filter").css('visibility', '');
|
||||
jQuery.post ("<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
|
||||
{"page" : "operation/events/events_list",
|
||||
"get_filter_values" : 1,
|
||||
"id" : $('#hidden-filterid').val()
|
||||
},
|
||||
function (data) {
|
||||
jQuery.each (data, function (i, val) {
|
||||
if (i == 'id_name')
|
||||
$("#hidden-id_name").val(val);
|
||||
if (i == 'id_group')
|
||||
$("#id_group").val(val);
|
||||
if (i == 'event_type')
|
||||
$("#event_type").val(val);
|
||||
if (i == 'severity')
|
||||
$("#severity").val(val);
|
||||
if (i == 'status')
|
||||
$("#status").val(val);
|
||||
if (i == 'search')
|
||||
$("#text-search").val(val);
|
||||
if (i == 'text_agent')
|
||||
$("#text_id_agent").val(val);
|
||||
if (i == 'id_agent')
|
||||
$('input:hidden[name=id_agent]').val(val);
|
||||
if (i == 'id_agent_module')
|
||||
$('input:hidden[name=module_search_hidden]').val(val);
|
||||
if (i == 'pagination')
|
||||
$("#pagination").val(val);
|
||||
if (i == 'event_view_hr')
|
||||
$("#text-event_view_hr").val(val);
|
||||
if (i == 'id_user_ack')
|
||||
$("#id_user_ack").val(val);
|
||||
if (i == 'group_rep')
|
||||
$("#group_rep").val(val);
|
||||
if (i == 'tag_with')
|
||||
$("#hidden-tag_with").val(val);
|
||||
if (i == 'tag_without')
|
||||
$("#hidden-tag_without").val(val);
|
||||
if (i == 'filter_only_alert')
|
||||
$("#filter_only_alert").val(val);
|
||||
if (i == 'id_group_filter')
|
||||
$("#id_group_filter").val(val);
|
||||
});
|
||||
reorder_tags_inputs();
|
||||
// Update the info with the loaded filter
|
||||
$('#filter_loaded_span').html($('#filter_loaded_text').html() + ': ' + $("#hidden-id_name").val());
|
||||
|
||||
// Update the view with the loaded filter
|
||||
$('#submit-update').trigger('click');
|
||||
},
|
||||
"json"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$("#submit-load_filter").click(function () {
|
||||
// If selected 'none' flush filter
|
||||
if ( $("#filter_id").val() == 0 ) {
|
||||
|
|
|
@ -101,6 +101,7 @@ if (isset ($_GET["modified"]) && !$view_mode) {
|
|||
$upd_info["comments"] = get_parameter_post ("comments", $user_info["comments"]);
|
||||
$upd_info["language"] = get_parameter_post ("language", $user_info["language"]);
|
||||
$upd_info["id_skin"] = get_parameter ("skin", $user_info["id_skin"]);
|
||||
$upd_info["id_filter"] = get_parameter ("event_filter",NULL);
|
||||
$upd_info["block_size"] = get_parameter ("block_size", $config["block_size"]);
|
||||
$upd_info["firstname"] = get_parameter ("newsletter_reminder", $user_info["first_name"]);
|
||||
$default_block_size = get_parameter ("default_block_size", 0);
|
||||
|
@ -357,8 +358,12 @@ if ($double_auth_enabled) {
|
|||
// Dialog
|
||||
$data[0] .= "<div id=\"dialog-double_auth\"><div id=\"dialog-double_auth-container\"></div></div>";
|
||||
|
||||
// Newsletter
|
||||
if (license_free()) {
|
||||
if (check_acl ($config['id_user'], 0, "ER")){
|
||||
$data[1] = __('Event filter');
|
||||
$data[1] .= $jump . html_print_select_from_sql ('SELECT id_filter, id_name FROM tevent_filter',
|
||||
'event_filter', $user_info["id_filter"], '', __('None'), NULL, true);
|
||||
}// Newsletter
|
||||
else if (license_free()) {
|
||||
$data[1] = __('Newsletter Subscribed') . ':';
|
||||
if ($user_info["middlename"]) {
|
||||
$data[1] .= $jump . '<span style="font-weight:initial;">' . __('Already subscribed to Pandora FMS newsletter') . "</span>";
|
||||
|
|
|
@ -1006,6 +1006,8 @@ CREATE TABLE IF NOT EXISTS `tusuario` (
|
|||
`metaconsole_assigned_server` int(10) unsigned NOT NULL default 0,
|
||||
`metaconsole_access_node` tinyint(1) unsigned NOT NULL default 0,
|
||||
`strict_acl` tinyint(1) unsigned NOT NULL DEFAULT 0,
|
||||
`id_filter` int(10) unsigned NULL default NULL,
|
||||
CONSTRAINT `fk_id_filter` FOREIGN KEY (`id_filter`) REFERENCES tevent_filter (`id_filter`) ON DELETE SET NULL,
|
||||
UNIQUE KEY `id_user` (`id_user`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
Loading…
Reference in New Issue