--- trunk/html/swish.cgi 2003/03/24 09:04:57 29 +++ trunk/html/swish.cgi 2003/04/30 12:40:09 32 @@ -58,6 +58,8 @@ $path_label{$_->{limit}} = x($_->{content}); } +my @properties = split(/\s+/,x($config->{properties})); + if ($config->{charset}) { print header(-charset=>x($config->{charset})); } else { @@ -69,7 +71,8 @@ print x($config->{text}->{documents}); print textfield('search'); print submit(-value=> x($config->{text}->{submit})); -print checkbox(-name=>'no_affix', -checked=>0, -label=>x($config->{text}->{no_spell})) if ($spelling_alt); +print br,checkbox(-name=>'no_affix', -checked=>0, -label=>x($config->{text}->{no_spell})) if ($spelling_alt); +print checkbox(-name=>'no_properties', -checked=>0, -label=>($config->{text}->{no_properties})) if (@properties); if (@path_name) { print br,x($config->{text}->{limit}); print popup_menu(-name=>'path',-values=>\@path_name,-labels=>\%path_label,-default=>$path); @@ -121,8 +124,15 @@ my %params; # optional parametars for swish - my @properties = split(/\s+/,x($config->{properties})); - $params{properties} = \@properties if (@properties); + # default format for output + my $hit_fmt = "%s [%s]
\n"; + + if (@properties) { + $hit_fmt = x($config->{hit}) if (! param('no_properties')); + $params{properties} = \@properties if (@properties); + } else { + $hit_fmt = x($config->{hit}) if (x($config->{hit})); + } my $sh = SWISH->connect('Fork', prog => x($config->{prog}), @@ -130,11 +140,8 @@ results => sub { my ($sh,$hit) = @_; - my $hit_fmt = x($config->{hit}) || - "%s [%s]
\n"; - if ($config->{url}) { - printf ($hit_fmt ,"http://".virtual_host().x($config->{url}).$hit->swishdocpath,e($hit->swishtitle) || 'untitled',$hit->swishrank); + printf ($hit_fmt ,"http://".virtual_host().x($config->{url}).$hit->swishdocpath,e($hit->swishtitle) || 'untitled',$hit->swishrank, map($hit->$_, @properties)); } else { printf ($hit_fmt ,$hit->swishdocpath,e($hit->swishtitle) || 'untitled',$hit->swishrank, map($hit->$_, @properties) );