$Data::Dumper::Indent = 0;
my $U = 'OpenILS::Application::AppUtils';
+my @_qtype_list;
+
sub _prepare_biblio_search_basics {
my ($cgi) = @_;
return scalar($cgi->param('query')) unless scalar($cgi->param('qtype'));
+ # fetch, once per mod_perl backend, the list of valid classes and aliases
+ unless (@_qtype_list) {
+ my $editor = new_editor();
+ my $classes = $editor->retrieve_all_config_metabib_class();
+ my $aliases = $editor->retrieve_all_config_metabib_search_alias();
+
+ push @_qtype_list, map { $_->name } @$classes;
+ push @_qtype_list, map { $_->alias } @$aliases;
+ }
+
my %parts;
my @part_names = qw/qtype contains query bool/;
$parts{$_} = [ $cgi->param($_) ] for (@part_names);
$jtitle = 1;
}
+ # This restricts qtype to classes, aliases, and field lists (approximately)
+ next unless grep { $qtype =~ /^$_(?:\|\w+)*$/ } @_qtype_list;
+
# This stuff probably will need refined or rethought to better handle
# the weird things Real Users will surely type in.
$contains = "" unless defined $contains; # silence warning
# Don't wrap in l() here; do that where this format string is actually used.
SET HUMAN_NAME_FORMAT = '[_1] [_2] [_3] [_4] [_5]';
- is_advanced = CGI.param("_adv").size || CGI.param("query").size;
+ is_advanced = CGI.param("_adv").size || CGI.param("query").size > 1;
is_special = CGI.param("_special").size;
# Check if we want to show the detail record view. Doing this
# Don't wrap in l() here; do that where this format string is actually used.
SET HUMAN_NAME_FORMAT = '[_1] [_2] [_3] [_4] [_5]';
- is_advanced = CGI.param("_adv").size || CGI.param("query").size;
+ is_advanced = CGI.param("_adv").size || CGI.param("query").size > 1;
is_special = CGI.param("_special").size;
# Check if we want to show the detail record view. Doing this