128 |
my $tree = new WebPAC::Tree( |
my $tree = new WebPAC::Tree( |
129 |
tree => \@tree, |
tree => \@tree, |
130 |
log => 'log4perl.conf', |
log => 'log4perl.conf', |
131 |
|
detail_url => sub { |
132 |
|
my $mfn = shift; |
133 |
|
my $path = "./out/thes/${mfn}.html"; |
134 |
|
return $path if (-e $path); |
135 |
|
}, |
136 |
); |
); |
137 |
|
|
138 |
C<tree> is tree array with levels of tree described above. |
C<tree> is tree array with levels of tree described above. |
140 |
C<log> is optional parametar which specify filename of L<Log::Log4Perl> |
C<log> is optional parametar which specify filename of L<Log::Log4Perl> |
141 |
config file. Default is C<log.conf>. |
config file. Default is C<log.conf>. |
142 |
|
|
143 |
|
C<detail_url> code ref to check if detail html exists (and return URL if |
144 |
|
it does). |
145 |
|
|
146 |
=cut |
=cut |
147 |
|
|
148 |
sub new { |
sub new { |
271 |
sub unroll { |
sub unroll { |
272 |
my $self = shift; |
my $self = shift; |
273 |
|
|
274 |
my ($level,$data_arr) = @_; |
my ($level,$data_arr, $base_path) = @_; |
275 |
|
|
276 |
|
$base_path ||= ''; |
277 |
|
|
278 |
my $log = $self->_get_logger(); |
my $log = $self->_get_logger(); |
279 |
|
|
328 |
|
|
329 |
($link_start,$link_end) = (qq{<a href="#mfn$mfn" onClick="return toggle_display('id$mfn');">},qq{</a>}) if ($have_children); |
($link_start,$link_end) = (qq{<a href="#mfn$mfn" onClick="return toggle_display('id$mfn');">},qq{</a>}) if ($have_children); |
330 |
|
|
331 |
my $mfn_link = "thes/$mfn.html"; |
my $mfn_link; |
332 |
if (-e "out/$mfn_link") { |
$mfn_link = $self->{'detail_url'}->($mfn) if ($self->{'detail_url'}); |
333 |
$term =~ s# *\* *# <img src="img/crovoc.png" border="0">#; |
|
334 |
|
if ($mfn_link) { |
335 |
|
$term =~ s, *#C# *, <img src="${base_path}img/crovoc.png" border="0">,; |
336 |
$html .= " " x $level . |
$html .= " " x $level . |
337 |
qq{<li>${link_start}<span id="o$mfn">${term}</span>${link_end}}. |
qq{<li>${link_start}<span id="o$mfn">${term}</span>${link_end}}. |
338 |
qq{ <a href="$mfn_link" onClick="javascript:return popup(this);"><img src="img/listic.png" border="0"></a></li>\n}; |
qq{ <a href="${base_path}${mfn_link}" onClick="javascript:return popup(this);"><img src="${base_path}img/listic.png" border="0"></a></li>\n}; |
339 |
|
$log->debug("linked details to $mfn_link"); |
340 |
} else { |
} else { |
341 |
$log->warn("file 'out/$mfn_link' doesn't exist, skipping"); |
$log->warn("file 'out/$mfn_link' doesn't exist, skipping"); |
342 |
} |
} |
364 |
|
|
365 |
if ($tree->[$level]->{'iframe'}) { |
if ($tree->[$level]->{'iframe'}) { |
366 |
# unroll to separate file |
# unroll to separate file |
367 |
$self->{'node_html'}->{$mfn} = $self->unroll($next_level, $have_children); |
$self->{'node_html'}->{$mfn} = $self->unroll($next_level, $have_children, '../'); |
368 |
|
|
369 |
} else { |
} else { |
370 |
# unroll at base HTML |
# unroll at base HTML |
371 |
$html .= $self->unroll($next_level, $have_children); |
$html .= $self->unroll($next_level, $have_children, $base_path); |
372 |
} |
} |
373 |
|
|
374 |
$html .= " " x $level . qq{</ul>\n}; |
$html .= " " x $level . qq{</ul>\n}; |