/[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 11 by dpavlin, Wed Jan 22 20:24:32 2003 UTC revision 12 by dpavlin, Wed Jan 22 22:27:19 2003 UTC
# Line 171  sub show_index { Line 171  sub show_index {
171          my $field = $q->param("f$i");          my $field = $q->param("f$i");
172          my $limit = $q->param("v$i");          my $limit = $q->param("v$i");
173    
   
174          my $html;          my $html;
175    
176          my $index = new index_DBI();          my $index = new index_DBI();
177    
178          if (! $index->check($field)) {          my $total = $index->check($field);
179            if (! $total) {
180                  my $tmpl = $self->load_tmpl('no_index.html');                  my $tmpl = $self->load_tmpl('no_index.html');
181                  $tmpl->param('field',$field);                  $tmpl->param('field',$field);
182                  $html = $tmpl->output;                  $html = $tmpl->output;
183                  return $html;                  return $html;
184          }          }
185    
186          my @index_arr = $index->fetch($field,'item',$limit);          my $tmpl = $self->load_tmpl('index_res.html');
187            $tmpl->param('field',$field);
188          $html .= "show index of <i>$field</i>";          $tmpl->param('limit',$limit);
189          $html .= " for <i>$limit</i>" if ($limit);          $tmpl->param('total',$total);
190    
191          while (my $row = shift @index_arr) {          my $pager = HTML::Pager->new(
192                  $html .= "<br>".$row->{item}."\n";                  query => $q,
193          }                  get_data_callback => sub {
194                            my ($offset, $rows) = @_;
195    
196                            my @result = $index->fetch($field,'item',$limit, $offset, $rows);
197                            return \@result;
198                    },
199                    rows => $total,
200                    page_size => $ON_PAGE,
201                    persist_vars => [
202                            'rm',
203                            "f$i", "v$i", "f".$i."_index",
204                            'offset',
205                            ],
206                    debug => 1,
207                    template => $tmpl,
208            );
209    
210          return $html;          return $pager->output;
211  }  }
212    
213  1;  1;

Legend:
Removed from v.11  
changed lines
  Added in v.12

  ViewVC Help
Powered by ViewVC 1.1.26