--- trunk2/lib/WebPAC/Tree.pm 2004/09/24 18:04:48 469 +++ trunk2/lib/WebPAC/Tree.pm 2004/11/01 18:00:26 575 @@ -6,6 +6,7 @@ use Carp; use Log::Log4perl qw(get_logger :levels); use YAML; +use Template; =head1 NAME @@ -14,7 +15,7 @@ =head1 DESCRIPTION This module will create tree from lookup data. It requires quite complicated -data structure, but once you get hang of that, it's peace of case :-) +data structure, but once you get hang of that, it's peace of cake :-) Data structure for tree definition is non-recursive, and defines each level of tree individually (so you can limit depth of tree) like this: @@ -33,6 +34,7 @@ lookup_term => sub { shift @{$l->{"d:".$_[0]}} }, lookup_mfn => sub { shift @{$l->{"900_mfn:".$_[0]}} }, have_children => sub { return $l->{$_[1]} }, + iframe => 1, },{ # level 1 code_arr => sub { @{$_[0]} }, @@ -45,6 +47,7 @@ lookup_term => sub { shift @{$l->{"d:".$_[0]}} }, lookup_mfn => sub { shift @{$l->{"900_mfn:".$_[0]}} }, have_children => sub { 0 }, + style => 'display: none', )}; You can, however, create recursion with C discussed @@ -105,6 +108,15 @@ It's safe to return undef just for next level data (C<$next_lvl> in example above) to stop recursion. +=item iframe + +This optional option will create all children nodes in separate file, and iframe in tree html, +so that generated tee html will have resonable size with large number of nodes. + +=item style + +Optional option to specify style of this node. + =back =head1 METHODS @@ -114,29 +126,27 @@ Create new tree object my $tree = new WebPAC::Tree( - dir => './out', - html => 'browse.html', - template => './output_template/tree.tt', - js => 'tree-ids.js', tree => \@tree, log => 'log4perl.conf', + detail_url => sub { + my $mfn = shift; + my $path = "thes/${mfn}.html"; + return $path if (-e "./out/$path"); + }, + nodes_dir => 'nodes', ); -C is output directory in which html files and JavaScript files will be -created (think of it as C). - -C is name of output html file. - -C