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; |