/[webpac]/branches/ffzg/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 /branches/ffzg/WebPac.pm

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

revision 14 by dpavlin, Sat Feb 22 13:22:09 2003 UTC revision 51 by dpavlin, Sun Jun 1 15:33:08 2003 UTC
# Line 14  use index_DBI; Line 14  use index_DBI;
14  use back2html;  use back2html;
15    
16  # configuration options  # configuration options
17  # FIX: they really should go in configuration file!  # FIXME they really should go in configuration file!
18  my $TEMPLATE_PATH = '/data/webpac/template_html';  my $TEMPLATE_PATH = '/data/webpac/template_html';
19  my $CHARSET = 'ISO-8859-2';  my $CHARSET = 'ISO-8859-2';
20  my $SWISH = '/usr/bin/swish-e';  my $SWISH = '/usr/bin/swish-e';
# Line 22  my $INDEX = '/data/webpac/index/isis.ind Line 22  my $INDEX = '/data/webpac/index/isis.ind
22  my $MAX_HITS = 500;  my $MAX_HITS = 500;
23  my $ON_PAGE = 10;  my $ON_PAGE = 10;
24    
25  Text::Iconv->raise_error(1);     # Conversion errors raise exceptions  Text::Iconv->raise_error(0);     # Conversion errors raise exceptions
26    
27  my $from_utf8 = Text::Iconv->new('UTF8', $CHARSET);  my $from_utf8 = Text::Iconv->new('UTF8', $CHARSET);
28    
# Line 67  sub show_results_list { Line 67  sub show_results_list {
67    
68          my @s_arr;      # all queries are located here          my @s_arr;      # all queries are located here
69    
70            my @path_arr = $q->param('path');
71            my $full = $q->param('full');
72    
73          for(my $i = 1; $i <=10; $i++) {          for(my $i = 1; $i <=10; $i++) {
74    
75                  return show_index($self, $i) if ($q->param("f".$i."_index"));                  return show_index($self, $i) if ($q->param("f".$i."_index"));
# Line 91  sub show_results_list { Line 94  sub show_results_list {
94                                  $s.="$_* ";                                  $s.="$_* ";
95                          }                          }
96                  }                  }
97                    $s =~ s/\*+/*/g;
98    
99                  push @s_arr,$q->param("f$i")."_swish=($s)";                  push @s_arr,$q->param("f$i")."_swish=($s)";
100          }          }
# Line 114  sub show_results_list { Line 118  sub show_results_list {
118    
119                  },                  },
120                  #startnum => 0,                  #startnum => 0,
121                  maxhits => $MAX_HITS,                  maxhits => $MAX_HITS
122          );          );
123    
124          die $SWISH::errstr unless $sh;          die $SWISH::errstr unless $sh;
125    
126          my $hits = $sh->query(join(" and ",@s_arr)) || 0;       # FIX: and/or          # construct swish query
127            my $sw_q = join(" and ",@s_arr);
128            if (@path_arr) {
129                    $sw_q .= "and (swishdocpath=\"";
130                    $sw_q .= join("\" or swishdocpath=\"",@path_arr);
131                    $sw_q .= "\")";
132                    $tmpl->param('full',1); # show full records
133            }
134    
135            my $hits = $sh->query($sw_q);
136    
137          $tmpl->param('hits',$hits);          $tmpl->param('hits',$hits);
138          $tmpl->param('search',join(" and ",@s_arr));          $tmpl->param('search',$sw_q);
139    
140            $tmpl->param('PAGER_offset',$q->param("PAGER_offset") || 0);
141            $tmpl->param('last_PAGER_offset',$q->param("last_PAGER_offset") || 0);
142    
143          # create a Pager object          # create a Pager object
144          my $pager = HTML::Pager->new(          my $pager = HTML::Pager->new(
# Line 191  sub show_index { Line 207  sub show_index {
207          $tmpl->param('limit',$limit);          $tmpl->param('limit',$limit);
208          $tmpl->param('total',$total);          $tmpl->param('total',$total);
209    
210    # FIXME I should set offset and leave out limit from fetch!!
211    #       if (! $q->param("PAGER_offset") {
212    #               $q->param("Pager_offet)
213    #       }
214    
215          my $pager = HTML::Pager->new(          my $pager = HTML::Pager->new(
216                  query => $q,                  query => $q,
217                  get_data_callback => sub {                  get_data_callback => sub {

Legend:
Removed from v.14  
changed lines
  Added in v.51

  ViewVC Help
Powered by ViewVC 1.1.26