add invert port search option, fix wildcarding on partial

This commit is contained in:
Oliver Gorwits
2013-09-22 16:40:10 +01:00
parent 230c6e3c0c
commit 108e1b5201
4 changed files with 41 additions and 6 deletions

View File

@@ -36,10 +36,15 @@ ajax '/ajax/content/device/ports' => require_login sub {
$f =~ s/\*/%/g;
$f =~ s/\?/_/g;
# set wilcards at param boundaries
$f =~ s/^\%*/%/;
$f =~ s/\%*$/%/;
if ($f !~ m/[%_]/) {
$f =~ s/^\%*/%/;
$f =~ s/\%*$/%/;
}
# enable ILIKE op
$f = { '-ilike' => $f };
$f = { (param('invert') ? '-not_ilike' : '-ilike') => $f };
}
elsif (param('invert')) {
$f = { '!=' => $f };
}
if ($set->search({'me.port' => $f})->count) {