Show search box for too many map file entries:

This commit is contained in:
Jamie Cameron
2019-12-22 19:44:36 -08:00
parent 6fc0cedcc4
commit 72db1df466
9 changed files with 41 additions and 8 deletions

View File

@@ -9,6 +9,7 @@
require './postfix-lib.pl';
&ReadParse();
$access{'body'} || &error($text{'body_ecannot'});
&ui_print_header(undef, $text{'body_title'}, "", "body");

View File

@@ -9,6 +9,7 @@
require './postfix-lib.pl';
&ReadParse();
$access{'header'} || &error($text{'header_ecannot'});
&ui_print_header(undef, $text{'header_title'}, "", "header");

View File

@@ -383,6 +383,10 @@ map_noname=Missing or invalid mapping name
map_cannot=This map cannot be edited : $1
map_unknown=Webmin does not support the map type $1
mapping_none=No mappings of this type have been defined yet.
mapping_toomany=There are $1 map entries, which is above the display limit of $2.
mapping_find=Show mappings matching:
mapping_search=Search
mapping_match=Map file entries matching <tt>$1</tt> ..
virtual_title=Virtual Domains
virtual_ecannot=You are not allowed to edit the virtual domains mapping configuration

View File

@@ -893,8 +893,36 @@ sub generate_map_edit
$text{'new_manual'}));
}
if ($#{$mappings} ne -1)
{
if ($in{'search'}) {
# Filter down to matching entries
$mappings = [ grep { $_->{'name'} =~ /\Q$in{'search'}\E/i ||
$_->{'value'} =~ /\Q$in{'search'}\E/i } @$mappings ];
print "<b>",&text('mapping_match', &html_escape($in{'search'})),
"</b><p>\n";
}
if ($#{$mappings} == -1) {
# None, so just show edit link
print "<b>$text{'mapping_none'}</b><p>\n";
print &ui_links_row(\@links);
}
elsif ($config{'max_maps'} && @{$mappings} > $config{'max_maps'} &&
!$in{'search'}) {
# If there are too many, show a search form
print &ui_form_start($ENV{'SCRIPT_NAME'});
foreach my $i (keys %in) {
next if ($i eq 'search');
print &ui_hidden($i, $in{$i});
}
print &text('mapping_toomany', scalar(@{$mappings}),
$config{'max_maps'}),"<p>\n";
print $text{'mapping_find'}," ",
&ui_textbox("search", $in{'search'}, 20)," ",
&ui_submit($text{'mapping_search'}),"\n";
print &ui_form_end();
print &ui_links_row(\@links);
}
else {
# Map description
print $_[1],"<p>\n";
@@ -964,11 +992,6 @@ sub generate_map_edit
print &ui_links_row(\@links);
print &ui_form_end([ [ "delete", $text{'mapping_delete'} ] ]);
}
else {
# None, so just show edit link
print "<b>$text{'mapping_none'}</b><p>\n";
print &ui_links_row(\@links);
}
}

View File

@@ -9,6 +9,7 @@
require './postfix-lib.pl';
&ReadParse();
$access{'relocated'} || &error($text{'relocated_ecannot'});
&ui_print_header(undef, $text{'relocated_title'}, "", "relocated");

View File

@@ -12,7 +12,7 @@ $no_ = $text{'opts_no'};
# Form start
print &ui_form_start("save_sasl.cgi");
print &ui_table_start($text{'sasl_title'}, "width=100%", 4);
print &ui_table_start($text{'sasl_title'}, "width=100%", 2);
# Enabled, accept broken clients
&option_yesno("smtpd_sasl_auth_enable");

View File

@@ -9,6 +9,7 @@
# << Here are all options seen in Postfix sample-smtpd.cf >>
require './postfix-lib.pl';
&ReadParse();
$access{'smtpd'} || &error($text{'smtpd_ecannot'});
&ui_print_header(undef, $text{'smtpd_title'}, "");

View File

@@ -9,6 +9,7 @@
require './postfix-lib.pl';
&ReadParse();
$access{'transport'} || &error($text{'transport_ecannot'});
&ui_print_header(undef, $text{'transport_title'}, "", "transport");

View File

@@ -9,6 +9,7 @@
require './postfix-lib.pl';
&ReadParse();
$access{'virtual'} || &error($text{'virtual_ecannot'});
&ui_print_header(undef, $text{'virtual_title'}, "", "virtual");