--- trunk/WebPac.pm 2005/01/16 20:24:40 635 +++ trunk/WebPac.pm 2005/01/18 17:07:14 636 @@ -184,12 +184,13 @@ my $hidden_vars = ''; foreach my $v (@persist_vars) { foreach my $val ($q->param($v)) { + next if (! $val || $val eq ''); $hidden_vars .= ''."\n"; } } $tmpl->param('PAGER_HIDDEN', $hidden_vars); - $tmpl->param('PAGER_JAVASCRIPT', qq{ + $tmpl->param('PAGER_JAVASCRIPT', qq# - }); + #); } #-------------------------------------------------------------------------- @@ -230,26 +231,47 @@ my @path_arr = $q->param('path'); my $full = $q->param('full'); - my @persist_vars = ( 'rm' ); + my @persist_vars = ( 'rm', 'persist_search' ); my @url_params = ( 'rm=results', 'show_full=1', 'last_PAGER_offset='.($q->param('PAGER_offset') || 0) ); + my @persist_search_vars; + my @url_params_persist; + if ($q->param("persist_search")) { + @persist_search_vars = split(/\s*,\s*/, $q->param("persist_search")); + push @url_params_persist, "persist_search=".$q->url_param("persist_search"); + push @url_params,"persist_search=".$q->url_param("persist_search"); + } + # support parametars "f" and "v" for start - for(my $i = ""; $i <=30; $i++) { + for(my $i = 0; $i <=30; $i++) { + + $i = '' if ($i == 0); return show_index($self, $i) if ($q->param("f".$i."_index")); - next if (! $q->param("v$i")); + next if (! $q->param("v$i") || $q->param("v$i") eq ''); next if (! $q->param("f$i")); + my $persist = grep(/^$i$/,@persist_search_vars); + push @persist_vars, "f$i"; push @persist_vars, "v$i"; push @persist_vars, "e$i" if ($q->param("e$i")); + # create url parametars (and persistent ones) + push @url_params,"f$i=".$q->url_param("f$i"); + push @url_params_persist,"f$i=".$q->url_param("f$i") if ($persist); + foreach my $v ($q->url_param("v$i")) { push @url_params,"v$i=$v"; + push @url_params_persist,"v$i=$v" if ($persist); + } + + if ($q->param("e$i")) { + push @url_params,"e$i=".$q->url_param("e$i"); + push @url_params_persist,"e$i=".$q->url_param("e$i"); } - push @url_params,"e$i=".$q->url_param("e$i"); my $wc="*"; # swish wildcard $wc="" if ($i eq ""); # don't apply wildcard on field 0 @@ -270,8 +292,9 @@ # filed e[nr] is exact match bitmask # 1 = beginning, 2=end, 3=both - $pre = '"xxbxx ' if ($q->param("e$i") & 1); - $post = ' xxexx"' if ($q->param("e$i") & 2); + my $exact_flag = $q->param("e$i") || 0; + $pre = '"xxbxx ' if ($exact_flag & 1); + $post = ' xxexx"' if ($exact_flag & 2); # add qotes on other side if ($q->param("e$i")) { $pre = '"' if (! $pre); @@ -324,13 +347,12 @@ # construct swish query my $sw_q = join(" and ",@s_arr); - if (@path_arr) { + if (@path_arr && $q->param('show_full')) { $sw_q .= "and (swishdocpath=\""; $sw_q .= join("\" or swishdocpath=\"",@path_arr); $sw_q .= "\")"; - } - - if ($q->param('show_full')) { + $tmpl->param('full',1); # show full records + } elsif ($q->param('show_full')) { # just show full path, no path defined $tmpl->param('full',1); } else { @@ -390,7 +412,7 @@ rank => $result->Property('swishrank') }; - $r->{html} = back2html($from_utf8->convert($result->Property('html'))) if ($q->param('show_full')); + $r->{html} = back2html($from_utf8->convert($result->Property('html')), join("&",@url_params_persist)) if ($q->param('show_full')); push @pager_data_list, $r; }