--- trunk/WebPac.pm 2003/01/22 20:24:32 11
+++ trunk/WebPac.pm 2003/01/22 22:27:19 12
@@ -171,28 +171,43 @@
my $field = $q->param("f$i");
my $limit = $q->param("v$i");
-
my $html;
my $index = new index_DBI();
- if (! $index->check($field)) {
+ my $total = $index->check($field);
+ if (! $total) {
my $tmpl = $self->load_tmpl('no_index.html');
$tmpl->param('field',$field);
$html = $tmpl->output;
return $html;
}
- my @index_arr = $index->fetch($field,'item',$limit);
-
- $html .= "show index of $field";
- $html .= " for $limit" if ($limit);
-
- while (my $row = shift @index_arr) {
- $html .= "
".$row->{item}."\n";
- }
+ my $tmpl = $self->load_tmpl('index_res.html');
+ $tmpl->param('field',$field);
+ $tmpl->param('limit',$limit);
+ $tmpl->param('total',$total);
+
+ my $pager = HTML::Pager->new(
+ query => $q,
+ get_data_callback => sub {
+ my ($offset, $rows) = @_;
+
+ my @result = $index->fetch($field,'item',$limit, $offset, $rows);
+ return \@result;
+ },
+ rows => $total,
+ page_size => $ON_PAGE,
+ persist_vars => [
+ 'rm',
+ "f$i", "v$i", "f".$i."_index",
+ 'offset',
+ ],
+ debug => 1,
+ template => $tmpl,
+ );
- return $html;
+ return $pager->output;
}
1;