Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions js/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,10 @@ function initSyslogSavedSearches() {
importSavedSearch();
});

$('#rows').change(function() {
applyFilterSavedSearches();
});

$('#saved_searches').submit(function(event) {
event.preventDefault();
applyFilterSavedSearches();
Expand Down Expand Up @@ -406,6 +410,10 @@ function initSyslogDashboards() {
importDashboard();
});

$('#rows').change(function() {
applyFilterDashboards();
});

$('#dashboards').submit(function(event) {
event.preventDefault();
applyFilterDashboards();
Expand Down Expand Up @@ -1267,6 +1275,20 @@ function initSyslogMain(config) {
$('#export').click(function() {
exportRecords();
});

$('#syslog_search_toggle').click(function() {
toggleSyslogSearch();
});

$('#rows, #refresh, #removal, #grouping').change(function() {
applyFilter();
});

// Delegated so classic/autocomplete dropdowns injected via AJAX keep working
// without an inline per-select script under nonce-enforced CSP.
$(document).off('change.syslogCallback').on('change.syslogCallback', 'select[data-on-change]', function() {
syslogInvokeCallback($(this).attr('data-on-change'));
});
});
}

Expand Down Expand Up @@ -1385,6 +1407,10 @@ function initSyslogRemoval(allowEdits) {
importRemoval();
});

$('#enabled, #rows').change(function() {
applyFilterRemoval();
});

$('#removal').submit(function(event) {
event.preventDefault();
applyFilterRemoval();
Expand Down Expand Up @@ -1440,6 +1466,10 @@ function initSyslogAlerts() {
importAlert();
});

$('#enabled, #rows').change(function() {
applyFilterAlerts();
});

$('#alert').submit(function(event) {
event.preventDefault();
applyFilterAlerts();
Expand Down Expand Up @@ -1495,6 +1525,10 @@ function initSyslogReports() {
importReport();
});

$('#enabled, #rows').change(function() {
applyFilterReports();
});

$('#reports').submit(function(event) {
event.preventDefault();
applyFilterReports();
Expand Down
15 changes: 8 additions & 7 deletions syslog.php
Original file line number Diff line number Diff line change
Expand Up @@ -2051,8 +2051,7 @@ function syslog_filter(string $sql_where, string $tab): void {
aria-label='<?php print __esc('Collapse filters', 'syslog'); ?>'
title='<?php print __esc('Collapse filters', 'syslog'); ?>'
data-hide='<?php print __esc('Collapse filters', 'syslog'); ?>'
data-show='<?php print __esc('Edit filters', 'syslog'); ?>'
onclick='toggleSyslogSearch()'><span><?php print __esc('Collapse filters', 'syslog'); ?></span><i class='fa fa-chevron-up' aria-hidden='true'></i></button>
data-show='<?php print __esc('Edit filters', 'syslog'); ?>'><span><?php print __esc('Collapse filters', 'syslog'); ?></span><i class='fa fa-chevron-up' aria-hidden='true'></i></button>
<input type='hidden' id='search_mode' value='logical'>
</div>
<div class='syslogSearchSavedBar'>
Expand Down Expand Up @@ -2121,7 +2120,7 @@ function syslog_filter(string $sql_where, string $tab): void {
</div>
<div class='syslogSearchOption syslogResultsLimit'>
<label for='rows'><?php print __('Results limit', 'syslog'); ?></label>
<select id='rows' onChange='applyFilter()' title='<?php print __esc('Display Rows', 'syslog'); ?>'>
<select id='rows' title='<?php print __esc('Display Rows', 'syslog'); ?>'>
<option value='-1'<?php if (get_request_var('rows') == '-1') { ?> selected<?php } ?>><?php print __('Default', 'syslog'); ?></option>
<?php
foreach ($item_rows as $rows => $display_text) {
Expand All @@ -2140,7 +2139,7 @@ function syslog_filter(string $sql_where, string $tab): void {
<details id='syslog_view_options' class='syslogMenu'><summary><?php print __esc('View options', 'syslog'); ?></summary><div class='syslogMenuBody syslogSearchOptions'>
<div class='syslogSearchOption'>
<label for='refresh'><?php print __('Refresh', 'syslog'); ?></label>
<select id='refresh' onChange='applyFilter()'>
<select id='refresh'>
<?php
foreach ($page_refresh_interval as $seconds => $display_text) {
print "<option value='" . $seconds . "'";
Expand All @@ -2157,7 +2156,7 @@ function syslog_filter(string $sql_where, string $tab): void {
<?php if (get_nfilter_request_var('tab') == 'syslog') { ?>
<div class='syslogSearchOption'>
<label for='removal'><?php print __('Record Type', 'syslog'); ?></label>
<select id='removal' onChange='applyFilter()' title='<?php print __esc('Removal Handling', 'syslog'); ?>'>
<select id='removal' title='<?php print __esc('Removal Handling', 'syslog'); ?>'>
<option value='1'<?php if (get_request_var('removal') == '1') { ?> selected<?php } ?>><?php print __('All Records', 'syslog'); ?></option>
<option value='-1'<?php if (get_request_var('removal') == '-1') { ?> selected<?php } ?>><?php print __('Main Records', 'syslog'); ?></option>
<option value='2'<?php if (get_request_var('removal') == '2') { ?> selected<?php } ?>><?php print __('Removed Records', 'syslog'); ?></option>
Expand All @@ -2169,7 +2168,7 @@ function syslog_filter(string $sql_where, string $tab): void {
<?php if (get_nfilter_request_var('tab') == 'syslog') { ?>
<div class='syslogSearchOption'>
<label for='grouping'><?php print __('Display', 'syslog'); ?></label>
<select id='grouping' onChange='applyFilter()' title='<?php print __esc('Group Duplicate Messages', 'syslog'); ?>'>
<select id='grouping' title='<?php print __esc('Group Duplicate Messages', 'syslog'); ?>'>
<option value='0'<?php if (get_request_var('grouping') == '0') { ?> selected<?php } ?>><?php print __('Individual Messages', 'syslog'); ?></option>
<option value='1'<?php if (get_request_var('grouping') == '1') { ?> selected<?php } ?>><?php print __('Grouped Messages', 'syslog'); ?></option>
</select>
Expand Down Expand Up @@ -2735,7 +2734,9 @@ function syslog_form_callback(string $form_name, string $classic_sql, string $co
$theme = get_selected_theme();

if ($theme == 'classic' || read_config_option('autocomplete') > 0) {
print "<select id='" . html_escape($form_name) . "' name='" . html_escape($form_name) . "'" . $class . ($on_change != '' ? "onChange='$on_change'" : '') . '>';
$data_on_change = ($on_change != '' ? " data-on-change='" . html_escape($on_change) . "'" : '');

print "<select id='" . html_escape($form_name) . "' name='" . html_escape($form_name) . "'" . $class . $data_on_change . '>';

if (!empty($none_entry)) {
print "<option value='-2'" . (empty($previous_value) ? ' selected' : '') . ">$none_entry</option>";
Expand Down
6 changes: 3 additions & 3 deletions syslog_alerts.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function form_actions(): void {
$title = __esc('Export Syslog Alert Rule(s)', 'syslog');
}

$save_html = "<input type='button' value='" . __esc('Cancel', 'syslog') . "' onClick='cactiReturnTo()'>&nbsp;<input type='submit' value='" . __esc('Continue', 'syslog') . "' title='$title'";
$save_html = "<input type='button' value='" . __esc('Cancel', 'syslog') . "' class='cactiReturnTo'>&nbsp;<input type='submit' value='" . __esc('Continue', 'syslog') . "' title='$title'";
} else {
raise_message(40);
header('Location: syslog_alerts.php?header=false');
Expand Down Expand Up @@ -1053,7 +1053,7 @@ function syslog_alerts_filter(): void {
<?php print __('Enabled', 'syslog'); ?>
</td>
<td>
<select id='enabled' onChange='applyFilterAlerts()'>
<select id='enabled'>
<option value='-1'<?php if (get_request_var('enabled') == '-1') {?> selected<?php }?>><?php print __('All', 'syslog'); ?></option>
<option value='1'<?php if (get_request_var('enabled') == '1') {?> selected<?php }?>><?php print __('Yes', 'syslog'); ?></option>
<option value='0'<?php if (get_request_var('enabled') == '0') {?> selected<?php }?>><?php print __('No', 'syslog'); ?></option>
Expand All @@ -1063,7 +1063,7 @@ function syslog_alerts_filter(): void {
<?php print __('Rows', 'syslog'); ?>
</td>
<td>
<select id='rows' onChange='applyFilterAlerts()'>
<select id='rows'>
<option value='-1'<?php if (get_request_var('rows') == '-1') {?> selected<?php }?>><?php print __('Default', 'syslog'); ?></option>
<?php
if (cacti_sizeof($item_rows)) {
Expand Down
4 changes: 2 additions & 2 deletions syslog_dashboards.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function syslog_dashboard_filter() {
<?php print __('Rows', 'syslog'); ?>
</td>
<td>
<select id='rows' onChange='applyFilterDashboards()'>
<select id='rows'>
<option value='-1'<?php if (get_request_var('rows') == '-1') {?> selected<?php }?>><?php print __('Default', 'syslog'); ?></option>
<?php
if (cacti_sizeof($item_rows)) {
Expand Down Expand Up @@ -423,7 +423,7 @@ function syslog_dashboard_actions() {
$title = __esc('Export Dashboard(s)', 'syslog');
}

$save_html = "<input type='button' value='" . __esc('Cancel', 'syslog') . "' onClick='cactiReturnTo()'>&nbsp;<input type='submit' class='export' value='" . __esc('Continue', 'syslog') . "' title='$title'>";
$save_html = "<input type='button' value='" . __esc('Cancel', 'syslog') . "' class='cactiReturnTo'>&nbsp;<input type='submit' class='export' value='" . __esc('Continue', 'syslog') . "' title='$title'>";
} else {
raise_message(40);
header('Location: syslog_dashboards.php');
Expand Down
2 changes: 1 addition & 1 deletion syslog_device_rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ function device_rule_actions(): void {
}
$verb = [1 => __('Delete', 'syslog'), 2 => __('Disable', 'syslog'), 3 => __('Enable', 'syslog'), 4 => __('Export', 'syslog')][(int) get_request_var('drp_action')];
print '<tr><td class="textArea"><p>' . __esc('Click Continue to %s the following Device Alert Rule(s).', strtolower($verb), 'syslog') . '</p><div class="itemlist"><ul>' . $list . '</ul></div></td></tr>';
print '<tr><td align="right" class="saveRow"><input type="hidden" name="action" value="actions"><input type="hidden" name="selected_items" value="' . html_escape(serialize($items)) . '"><input type="hidden" name="drp_action" value="' . (int) get_request_var('drp_action') . '"><input type="button" value="' . __esc('Cancel', 'syslog') . '" onClick="cactiReturnTo()">&nbsp;<input type="submit" value="' . __esc('Continue', 'syslog') . '"></td></tr>';
print '<tr><td align="right" class="saveRow"><input type="hidden" name="action" value="actions"><input type="hidden" name="selected_items" value="' . html_escape(serialize($items)) . '"><input type="hidden" name="drp_action" value="' . (int) get_request_var('drp_action') . '"><input type="button" value="' . __esc('Cancel', 'syslog') . '" class="cactiReturnTo">&nbsp;<input type="submit" value="' . __esc('Continue', 'syslog') . '"></td></tr>';
html_end_box();
form_end(false);
bottom_footer();
Expand Down
6 changes: 3 additions & 3 deletions syslog_removal.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ function form_actions(): void {
$title = __esc('Export Syslog Removal Rule(s)', 'syslog');
}

$save_html = "<input type='button' value='" . __esc('Cancel', 'syslog') . "' onClick='cactiReturnTo()'>&nbsp;<input type='submit' value='" . __esc('Continue', 'syslog') . "' title='$title'";
$save_html = "<input type='button' value='" . __esc('Cancel', 'syslog') . "' class='cactiReturnTo'>&nbsp;<input type='submit' value='" . __esc('Continue', 'syslog') . "' title='$title'";
} else {
raise_message(40);
header('Location: syslog_removal.php?header=false');
Expand Down Expand Up @@ -825,7 +825,7 @@ function syslog_removal_filter(): void {
<?php print __('Enabled', 'syslog'); ?>
</td>
<td>
<select id='enabled' onChange='applyFilterRemoval()'>
<select id='enabled'>
<option value='-1'<?php if (get_request_var('enabled') == '-1') {?> selected<?php }?>><?php print __('All', 'syslog'); ?></option>
<option value='1'<?php if (get_request_var('enabled') == '1') {?> selected<?php }?>><?php print __('Yes', 'syslog'); ?></option>
<option value='0'<?php if (get_request_var('enabled') == '0') {?> selected<?php }?>><?php print __('No', 'syslog'); ?></option>
Expand All @@ -835,7 +835,7 @@ function syslog_removal_filter(): void {
<?php print __('Rules', 'syslog'); ?>
</td>
<td>
<select id='rows' onChange='applyFilterRemoval()'>
<select id='rows'>
<option value='-1'<?php if (get_request_var('rows') == '-1') {?> selected<?php }?>><?php print __('Default', 'syslog'); ?></option>
<?php
if (cacti_sizeof($item_rows)) {
Expand Down
8 changes: 4 additions & 4 deletions syslog_reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ function form_actions(): void {
$title = __esc('Export Syslog Report Rule(s)', 'syslog');
}

$save_html = "<input type='button' value='" . __esc('Cancel', 'syslog') . "' onClick='cactiReturnTo()'>&nbsp;<input type='submit' value='" . __esc('Continue', 'syslog') . "' title='$title'";
$save_html = "<input type='button' value='" . __esc('Cancel', 'syslog') . "' class='cactiReturnTo'>&nbsp;<input type='submit' value='" . __esc('Continue', 'syslog') . "' title='$title'";
} else {
print "<tr><td class='odd'><span class='textError'>" . __('You must select at least one Syslog Report.', 'syslog') . "</span></td></tr>\n";
$save_html = "<input type='button' value='" . __esc('Return', 'syslog') . "' onClick='cactiReturnTo()'>";
$save_html = "<input type='button' value='" . __esc('Return', 'syslog') . "' class='cactiReturnTo'>";
}

print "<tr>
Expand Down Expand Up @@ -663,7 +663,7 @@ function syslog_reports_filter(): void {
<?php print __('Enabled', 'syslog'); ?>
</td>
<td>
<select id='enabled' onChange='applyFilterReports()'>
<select id='enabled'>
<option value='-1'<?php if (get_request_var('enabled') == '-1') {?> selected<?php }?>><?php print __('All', 'syslog'); ?></option>
<option value='1'<?php if (get_request_var('enabled') == '1') {?> selected<?php }?>><?php print __('Yes', 'syslog'); ?></option>
<option value='0'<?php if (get_request_var('enabled') == '0') {?> selected<?php }?>><?php print __('No', 'syslog'); ?></option>
Expand All @@ -673,7 +673,7 @@ function syslog_reports_filter(): void {
<?php print __('Rows', 'syslog'); ?>
</td>
<td>
<select id='rows' onChange='applyFilterReports()'>
<select id='rows'>
<option value='-1'<?php if (get_request_var('rows') == '-1') {?> selected<?php }?>><?php print __('Default', 'syslog'); ?></option>
<?php
if (cacti_sizeof($item_rows)) {
Expand Down
4 changes: 2 additions & 2 deletions syslog_saved_searches.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function syslog_saved_search_filter() {
<?php print __('Rows', 'syslog'); ?>
</td>
<td>
<select id='rows' onChange='applyFilterSavedSearches()'>
<select id='rows'>
<option value='-1'<?php if (get_request_var('rows') == '-1') {?> selected<?php }?>><?php print __('Default', 'syslog'); ?></option>
<?php
if (cacti_sizeof($item_rows)) {
Expand Down Expand Up @@ -378,7 +378,7 @@ function syslog_template_actions() {

$title = $export ? __esc('Export Saved Search Template(s)', 'syslog') : __esc('Delete Saved Search Template(s)', 'syslog');

$save_html = "<input type='button' value='" . __esc('Cancel', 'syslog') . "' onClick='cactiReturnTo()'>&nbsp;<input type='submit' class='export' value='" . __esc('Continue', 'syslog') . "' title='$title'>";
$save_html = "<input type='button' value='" . __esc('Cancel', 'syslog') . "' class='cactiReturnTo'>&nbsp;<input type='submit' class='export' value='" . __esc('Continue', 'syslog') . "' title='$title'>";
} else {
raise_message(40);
header('Location: syslog_saved_searches.php');
Expand Down
Loading