/[webpac]/trunk/WebPac.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/WebPac.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 643 by dpavlin, Sun Jan 23 15:18:03 2005 UTC revision 670 by dpavlin, Wed Feb 16 00:26:37 2005 UTC
# Line 148  sub make_pager($$$) { Line 148  sub make_pager($$$) {
148    
149    
150          foreach my $p (@{$pager->pages_in_set()}) {          foreach my $p (@{$pager->pages_in_set()}) {
151                  next if ($p < 0);                  next if ($p <= 0);
152                  if($p == $pager->current_page()) {                  if($p == $pager->current_page()) {
153                          $pager_jump .= "<b>$p</b> ";                          $pager_jump .= "<b>$p</b> ";
154                  } else {                  } else {
# Line 328  sub show_results_list { Line 328  sub show_results_list {
328                  push @s_arr, $q->param("f$i")."_swish".$exact."=(".join(" or ",@swish_q).")";                  push @s_arr, $q->param("f$i")."_swish".$exact."=(".join(" or ",@swish_q).")";
329          }          }
330    
331          my $tmpl = $self->load_tmpl(url_ex($q,'results.html'), global_vars => 1);          my $tmpl = $self->load_tmpl(url_ex($q,'results.html'), global_vars => 1, die_on_bad_params => 0);
332    
333          $tmpl->param('url_params',"?".join("&",@url_params));          $tmpl->param('url_params',"?".join("&",@url_params));
334    
# Line 345  sub show_results_list { Line 345  sub show_results_list {
345                  push @persist_vars, "sort";                  push @persist_vars, "sort";
346          }          }
347    
348            my $sortby = $q->param("sortby");
349            if ($sortby) {
350                    $sort = $sortby;
351                    push @persist_vars, "sortby";
352            }
353            $tmpl->param('url_params_paths',"?".join("&",@url_params).'&'.join("&",map { my $t = $_; $t =~ s/\#/%23/g; "path=$t"; } @path_arr));
354    
355          # construct swish query          # construct swish query
356          my $sw_q = join(" and ",@s_arr);          my $sw_q = join(" and ",@s_arr);
357          if (@path_arr && $q->param('show_full')) {          if (@path_arr && $q->param('show_full')) {
# Line 359  sub show_results_list { Line 366  sub show_results_list {
366                  $tmpl->param('full',0);                  $tmpl->param('full',0);
367          }          }
368    
369            my $swish_msg = ' ';
370    
371          # create new swish instance          # create new swish instance
372          my $swish = SWISH::API->new($INDEX);          my $swish = SWISH::API->new($INDEX);
373          die $swish->ErrorString.": ".$swish->LastErrorMsg if $swish->Error;          $swish_msg .= $swish->ErrorString." ".$swish->LastErrorMsg if $swish->Error;
374    
375          # execute query and get number of results from SWISH-E          # execute query and get number of results from SWISH-E
376          my $search = $swish->New_Search_Object;          my $search = $swish->New_Search_Object;
# Line 369  sub show_results_list { Line 378  sub show_results_list {
378          $search->SetSort($sort);          $search->SetSort($sort);
379    
380          my $results = $search->Execute($sw_q);          my $results = $search->Execute($sw_q);
381          die $swish->ErrorString.": ".$swish->LastErrorMsg if $swish->Error;          $swish_msg .= $swish->ErrorString." ".$swish->LastErrorMsg if $swish->Error;
382    
383          my $hits = $results->Hits;          my $hits = $results->Hits;
384    
385          $tmpl->param('hits',$hits);          $tmpl->param('hits',$hits);
386          $tmpl->param('search',$sw_q);          my $search_msg = $sw_q;
387            $search_msg .= '<em>'.$swish_msg.'</em>' if ($swish_msg);
388            $tmpl->param('search', $search_msg);
389    
390          $tmpl->param('PAGER_offset',$q->param("PAGER_offset") || 0);          $tmpl->param('PAGER_offset',$q->param("PAGER_offset") || 0);
391          $tmpl->param('last_PAGER_offset',$q->param("last_PAGER_offset") || 0);          $tmpl->param('last_PAGER_offset',$q->param("last_PAGER_offset") || 0);
# Line 458  sub show_index { Line 469  sub show_index {
469                  return $html;                  return $html;
470          }          }
471    
472          my $tmpl = $self->load_tmpl(url_ex($q,'index_res.html'), global_vars => 1);          my $tmpl = $self->load_tmpl(url_ex($q,'index_res.html'), global_vars => 1, die_on_bad_params => 0);
473          $tmpl->param('field',$field);          $tmpl->param('field',$field);
474          $tmpl->param('limit',$limit);          $tmpl->param('limit',$limit);
475          $tmpl->param('total',$total);          $tmpl->param('total',$total);

Legend:
Removed from v.643  
changed lines
  Added in v.670

  ViewVC Help
Powered by ViewVC 1.1.26