summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VNDB/Handler')
-rw-r--r--lib/VNDB/Handler/Staff.pm35
-rw-r--r--lib/VNDB/Handler/VNEdit.pm4
2 files changed, 22 insertions, 17 deletions
diff --git a/lib/VNDB/Handler/Staff.pm b/lib/VNDB/Handler/Staff.pm
index e95a4ed5..24edf5ad 100644
--- a/lib/VNDB/Handler/Staff.pm
+++ b/lib/VNDB/Handler/Staff.pm
@@ -302,7 +302,7 @@ sub list {
my ($list, $np) = $self->filFetchDB(staff => $f->{fil}, {}, {
$char ne 'all' ? ( char => $char ) : (),
- $f->{q} ? ( search => $f->{q} ) : (),
+ $f->{q} ? ($f->{q} =~ /^=(.+)$/ ? (exact => $1) : (search => $f->{q})) : (),
results => 150,
page => $f->{p}
});
@@ -367,28 +367,33 @@ sub list {
sub staffxml {
my $self = shift;
- my $q = $self->formValidate(
- { get => 'a', required => 0, multi => 1, template => 'id' },
- { get => 's', required => 0, multi => 1, template => 'id' },
- { get => 'q', required => 0, maxlength => 500 },
- );
- return $self->resNotFound if $q->{_err} || !(@{$q->{s}} || @{$q->{a}} || $q->{q});
+ my $q = $self->formValidate({ get => 'q', required => 0, maxlength => 500 });
+ return $self->resNotFound if $q->{_err} || !$q->{q};
+
+ # Prefixing name with '=' forces exact matching, old behaviour, not very useful anymore.
+ my $exact = $q->{q} =~ s/^=//;
+ # Try exact match first, so exact match is always first result
my($list, $np) = $self->dbStaffGet(
- @{$q->{s}} ? (id => $q->{s}) :
- @{$q->{a}} ? (aid => $q->{a}) :
- $q->{q} =~ /^=(.+)/ ? (exact => $1) :
- $q->{q} =~ /^s([1-9]\d*)/ ? (id => $1) :
- (search => $q->{q}),
- results => 10,
- page => 1,
+ results => 10, page => 1,
+ $q->{q} =~ /^s([1-9]\d*)/ ? (id => $1) : (exact => $q->{q}),
);
+ # Append results of a substring match
+ if(!$np && !$exact) {
+ my($nlist, $nnp) = $self->dbStaffGet(
+ results => 10-@$list, page => 1, search => $q->{q},
+ notid => [ map $_->{id}, @$list ],
+ );
+ $np = $nnp;
+ $list = [ @$list, @$nlist ];
+ }
+
$self->resHeader('Content-type' => 'text/xml; charset=UTF-8');
xml;
tag 'staff', more => $np ? 'yes' : 'no';
for(@$list) {
- tag 'item', sid => $_->{id}, id => $_->{aid}, $_->{name};
+ tag 'item', sid => $_->{id}, id => $_->{aid}, orig => $_->{original}, $_->{name};
}
end;
}
diff --git a/lib/VNDB/Handler/VNEdit.pm b/lib/VNDB/Handler/VNEdit.pm
index 91217aa2..1c059e7a 100644
--- a/lib/VNDB/Handler/VNEdit.pm
+++ b/lib/VNDB/Handler/VNEdit.pm
@@ -331,7 +331,7 @@ sub _form {
h2 'Add staff';
table; Tr;
td class => 'tc_staff';
- input id => 'credit_input', type => 'text', class => 'text'; end;
+ input id => 'credit_input', type => 'text', class => 'text', style => 'width: 300px'; end;
td colspan => 3, '';
end; end;
}]],
@@ -370,7 +370,7 @@ sub _form {
txt ' voiced by';
end;
td class => 'tc_staff';
- input id => 'cast_input', type => 'text', class => 'text';
+ input id => 'cast_input', type => 'text', class => 'text', style => 'width: 300px';
end;
td colspan => 2, '';
end; end;