1 |
8 |
ahitrov@rambler.ru |
<%args> |
2 |
|
|
|
3 |
|
|
$root => undef, |
4 |
|
|
$offset => undef, |
5 |
|
|
$count_offset => undef, |
6 |
|
|
$selected => undef, |
7 |
|
|
$section_tree => undef |
8 |
|
|
|
9 |
|
|
</%args> |
10 |
|
|
<%INIT> |
11 |
|
|
|
12 |
|
|
my $spacer = ''; |
13 |
|
|
for(my $c=1; $c<$offset; $c++) { |
14 |
|
|
$spacer = $spacer.(($c == $offset-1) ? ' >> ' : ' '); |
15 |
|
|
} |
16 |
|
|
if( ref $root && $root->id != $Contenido::Section::ROOT ) { |
17 |
|
|
$m->out('<option value="'.$root->id.'" '.(($selected == $root->id) ? ' selected' : '').'>'.$spacer.$root->name.'</option>'); |
18 |
|
|
} |
19 |
|
|
|
20 |
|
|
my $childs = exists $section_tree->{$root->id} ? $section_tree->{$root->id}{children} : undef; |
21 |
|
|
if((ref($childs) eq 'ARRAY') and (@$childs) && ($offset < $count_offset)) { |
22 |
|
|
$offset++; |
23 |
|
|
foreach my $child (@$childs) { |
24 |
|
|
$m->comp('/contenido/components/select_index_tree_elem.msn', |
25 |
|
|
section_tree => $section_tree, root => $child, |
26 |
|
|
offset => $offset, count_offset => $count_offset, selected => $selected); |
27 |
|
|
} |
28 |
|
|
$offset--; |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
</%init> |