Revision 590708a7
Von Sven Schöling vor mehr als 9 Jahren hinzugefügt
SL/Layout/MenuLeft.pm | ||
---|---|---|
39 | 39 |
} |
40 | 40 |
|
41 | 41 |
sub section_menu { |
42 |
$::lxdebug->enter_sub(2); |
|
43 |
my ($menu, $level, $id_prefix) = @_; |
|
44 |
my @menuorder = $menu->access_control(\%::myconfig, $level); |
|
42 |
my ($menu) = @_; |
|
43 |
my @menuorder = @{ $menu->{ORDER} }; |
|
45 | 44 |
my @items; |
46 |
|
|
47 |
my $id = 0; |
|
45 |
my @id_stack = (-1); |
|
48 | 46 |
|
49 | 47 |
for my $item (@menuorder) { |
50 | 48 |
my $menuitem = $menu->{$item}; |
51 | 49 |
my $olabel = apply { s/.*--// } $item; |
52 | 50 |
my $ml = apply { s/--.*// } $item; |
53 | 51 |
my $icon_class = apply { $_ = lc $_; s/[^a-z0-9_-]/-/g } $menuitem->{ICON}; |
54 |
my $spacer = "s" . (0 + $item =~ s/--/--/g); |
|
52 |
my $level = (0 + $item =~ s/--/--/g); |
|
53 |
my $spacer = "s" . $level; |
|
55 | 54 |
|
56 |
next if $level && $item ne "$level--$olabel"; |
|
55 |
# do id stack |
|
56 |
push @id_stack, -1 if $level > $#id_stack; |
|
57 |
pop @id_stack while $level < $#id_stack; |
|
58 |
$id_stack[-1]++; |
|
57 | 59 |
|
58 | 60 |
my $label = $::locale->text($olabel); |
59 | 61 |
|
... | ... | |
63 | 65 |
|
64 | 66 |
# add other params |
65 | 67 |
foreach my $key (keys %$menuitem) { |
66 |
next if $key =~ /target|module|action|href/; |
|
68 |
next if $key =~ /target|module|action|href|ICON/;
|
|
67 | 69 |
$menuitem->{href} .= "&" . $::form->escape($key, 1) . "="; |
68 | 70 |
my ($value, $conf) = split(/=/, $menuitem->{$key}, 2); |
69 | 71 |
$value = $::myconfig{$value} . "/$conf" if ($conf); |
70 | 72 |
$menuitem->{href} .= $::form->escape($value, 1); |
71 | 73 |
} |
72 | 74 |
|
73 |
my @common_args = ($label, $spacer, "$id_prefix\_$id");
|
|
75 |
my @common_args = ($label, $spacer, join '_', @id_stack);
|
|
74 | 76 |
|
75 |
if (!$level) { # toplevel
|
|
77 |
if ($spacer eq 's0') { # toplevel
|
|
76 | 78 |
push @items, [ @common_args, "icon24 $icon_class", 'm' ]; |
77 |
# make_image(size => 24, label => $item), |
|
78 |
push @items, section_menu($menu, $item, "$id_prefix\_$id"); |
|
79 | 79 |
} elsif ($menuitem->{submenu}) { |
80 | 80 |
push @items, [ @common_args, "icon16 submenu", 'sm' ]; |
81 |
#make_image(label => 'submenu'), |
|
82 |
push @items, section_menu($menu, $item, "$id_prefix\_$id"); |
|
83 | 81 |
} elsif ($menuitem->{module}) { |
84 | 82 |
push @items, [ @common_args, "icon16 $icon_class", 'i', $menuitem->{href}, $menuitem->{target} ]; |
85 |
#make_image(size => 16, label => $item), |
|
86 | 83 |
} |
87 |
} continue { |
|
88 |
$id++; |
|
89 | 84 |
} |
90 | 85 |
|
91 |
$::lxdebug->leave_sub(2); |
|
92 | 86 |
return @items; |
93 | 87 |
} |
94 | 88 |
|
Auch abrufbar als: Unified diff
Menu: HTML Menü parsing n+1 beseitigt