<%args>
$name => undef
$check => undef
$root => 1
$level => 15
$style => undef
%args>
<%init>
my $tree;
if ( exists $request->{"_section_tree_$root"} ) {
$tree = $request->{"_section_tree_$root"};
} else {
$tree = $keeper->get_section_tree( root_id => $root );
$request->{"_section_tree_$root"} = $tree;
}
my $root_sect = $tree->{root};
my $color = 0;
sub select_index_tree {
my ($sect, $offset, $count_offset, $selected, $cb, $TREE) = @_;
return unless ref $sect;
my $padding = 'padding-left:'.int($offset * 15).'px;';
my $color = $$cb ? 'background:#f0f0f0;' : '';
$$cb = $$cb ? 0 : 1;
my $style = $sect->id == 1 ? ' style="background-color:#606060;color:#ffffff;'.$padding.$color.'"' : ' style="'.$padding.$color.'"';
my $sel = $selected && $selected == $sect->id ? ' selected' : '';
$m->out (''."\n");
if ( exists $sect->{children} && $offset < $count_offset ) {
$offset++;
foreach my $child ( @{$sect->{children}} ) {
select_index_tree( $child, $offset, $count_offset, $selected, $cb, $TREE );
}
}
}
%init>