mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
filter, move code to highlight (point) selected option from system_advanced_firewall.php to generic javascript legacy function and enable support on interfaces.php page as well, including a fix to firewall_rule_lookup.php for supporting ?if=<interface> lookups
for https://github.com/opnsense/core/issues/3312
This commit is contained in:
parent
9746ebf8f1
commit
96eb3f6f03
@ -42,7 +42,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// search auto-generated rules
|
||||
foreach ($fw->iterateFilterRules() as $rule) {
|
||||
if (!empty($rule->getRef()) && $rid == $rule->getLabel()) {
|
||||
header(url_safe('Location: /%s#%s', explode("#", $rule->getRef())));
|
||||
if (strpos($rule->getRef(), '?if=') !== false) {
|
||||
$parts = parse_url($rule->getRef());
|
||||
if (!empty($parts['fragment'])) {
|
||||
parse_str($parts['query'], $query);
|
||||
$params = [$parts['path'], $query['if'], $parts['fragment']];
|
||||
header(url_safe('Location: /%s?if=%s#%s', $params));
|
||||
}
|
||||
} else {
|
||||
header(url_safe('Location: /%s#%s', explode("#", $rule->getRef())));
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1756,7 +1756,7 @@ include("head.inc");
|
||||
}
|
||||
});
|
||||
$("#rfc3118_isp").change();
|
||||
|
||||
window_highlight_table_option();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -31,15 +31,15 @@
|
||||
*/
|
||||
|
||||
function notice_action(action,msgid) {
|
||||
jQuery.ajax({
|
||||
type: 'post',
|
||||
cache: false,
|
||||
url: 'index.php',
|
||||
data: {closenotice: msgid},
|
||||
success: function(response) {
|
||||
jQuery('#menu_messages').html(response);
|
||||
}
|
||||
});
|
||||
jQuery.ajax({
|
||||
type: 'post',
|
||||
cache: false,
|
||||
url: 'index.php',
|
||||
data: {closenotice: msgid},
|
||||
success: function(response) {
|
||||
jQuery('#menu_messages').html(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -144,3 +144,27 @@ function hook_stacked_form_tables(match)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* highlight table option using window location hash
|
||||
*/
|
||||
function window_highlight_table_option()
|
||||
{
|
||||
if (window.location.hash != "") {
|
||||
let option_id = window.location.hash.substr(1);
|
||||
let option = $("[name='" + option_id +"']");
|
||||
let arrow = $("<i/>").addClass("fa fa-arrow-right pull-right");
|
||||
let container = $("<div/>");
|
||||
let title_td = option.closest('tr').find('td:eq(0)');
|
||||
container.css('width', '0%');
|
||||
container.css('display', 'inline-block');
|
||||
container.css('white-space', 'nowrap');
|
||||
|
||||
title_td.append(container);
|
||||
let animate_width = title_td.width() - container.position().left+ title_td.find('i:eq(0)').position().left;
|
||||
$('html, body').animate({scrollTop: option.position().top}, 500, function() {
|
||||
container.append(arrow);
|
||||
container.animate({width: animate_width}, 800);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,24 +237,7 @@ include("head.inc");
|
||||
?>
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
if (window.location.hash != "") {
|
||||
let option_id = window.location.hash.substr(1);
|
||||
let option = $("[name='" + option_id +"']");
|
||||
let arrow = $("<i/>").addClass("fa fa-arrow-right pull-right");
|
||||
let container = $("<div/>");
|
||||
let title_td = option.closest('tr').find('td:eq(0)');
|
||||
container.css('width', '0%');
|
||||
container.css('display', 'inline-block');
|
||||
container.css('white-space', 'nowrap');
|
||||
|
||||
title_td.append(container);
|
||||
let animate_width = title_td.width() - container.position().left+ title_td.find('i:eq(0)').position().left;
|
||||
$('html, body').animate({scrollTop: option.position().top}, 500, function() {
|
||||
container.append(arrow);
|
||||
container.animate({width: animate_width}, 800);
|
||||
});
|
||||
|
||||
}
|
||||
window_highlight_table_option();
|
||||
});
|
||||
</script>
|
||||
<body>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user