9 |
use Unicode::MapUTF8 qw(to_utf8 from_utf8 utf8_supported_charset); |
use Unicode::MapUTF8 qw(to_utf8 from_utf8 utf8_supported_charset); |
10 |
use DBI; |
use DBI; |
11 |
|
|
12 |
|
use lib '..'; |
13 |
|
use index_DBI; |
14 |
|
|
15 |
# configuration options |
# configuration options |
16 |
# FIX: they really should go in configuration file! |
# FIX: they really should go in configuration file! |
17 |
my $TEMPLATE_PATH = '/data/webpac/template_html'; |
my $TEMPLATE_PATH = '/data/webpac/template_html'; |
168 |
|
|
169 |
my $q = $self->query(); |
my $q = $self->query(); |
170 |
|
|
171 |
|
my $field = $q->param("f$i"); |
172 |
|
my $limit = $q->param("v$i"); |
173 |
|
|
174 |
my $html; |
my $html; |
175 |
|
|
176 |
$html .= "show index of ".$q->param("f$i")." for ".$q->param("v$i"); |
my $index = new index_DBI(); |
177 |
|
|
178 |
|
my $total = $index->check($field); |
179 |
|
if (! $total) { |
180 |
|
my $tmpl = $self->load_tmpl('no_index.html'); |
181 |
|
$tmpl->param('field',$field); |
182 |
|
$html = $tmpl->output; |
183 |
|
return $html; |
184 |
|
} |
185 |
|
|
186 |
return $html; |
my $tmpl = $self->load_tmpl('index_res.html'); |
187 |
|
$tmpl->param('field',$field); |
188 |
|
$tmpl->param('limit',$limit); |
189 |
|
$tmpl->param('total',$total); |
190 |
|
|
191 |
|
my $pager = HTML::Pager->new( |
192 |
|
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 $pager->output; |
211 |
} |
} |
212 |
|
|
213 |
1; |
1; |