X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FLayout%2FMenuLeft.pm;h=2f99944d08fea1b943f68ac4737fafe80cb784da;hb=7196276bca4a155d1bcc3947859bc7d4ec1edcd6;hp=4c1901cc89ef725b23570bc9ebf3267b93745469;hpb=590708a7a8d02ecd60267271f276e975c08d56c6;p=kivitendo-erp.git diff --git a/SL/Layout/MenuLeft.pm b/SL/Layout/MenuLeft.pm index 4c1901cc8..2f99944d0 100644 --- a/SL/Layout/MenuLeft.pm +++ b/SL/Layout/MenuLeft.pm @@ -22,7 +22,6 @@ sub javascripts_inline { sub javascripts { qw( js/jquery.cookie.js - js/switchmenuframe.js ); } @@ -40,46 +39,28 @@ sub end_content { sub section_menu { my ($menu) = @_; - my @menuorder = @{ $menu->{ORDER} }; my @items; my @id_stack = (-1); - for my $item (@menuorder) { - my $menuitem = $menu->{$item}; - my $olabel = apply { s/.*--// } $item; - my $ml = apply { s/--.*// } $item; - my $icon_class = apply { $_ = lc $_; s/[^a-z0-9_-]/-/g } $menuitem->{ICON}; - my $level = (0 + $item =~ s/--/--/g); - my $spacer = "s" . $level; + for my $node ($menu->tree_walk) { + my $level = $node->{level}; # do id stack push @id_stack, -1 if $level > $#id_stack; pop @id_stack while $level < $#id_stack; $id_stack[-1]++; - my $label = $::locale->text($olabel); + my $label = $::locale->text($node->{name}); + my $href = $menu->href_for_node($node); - $menuitem->{module} ||= $::form->{script}; - $menuitem->{action} ||= "section_menu"; - $menuitem->{href} ||= "$menuitem->{module}?action=$menuitem->{action}"; + my @common_args = ($label, "s" . $level, join '_', @id_stack); - # add other params - foreach my $key (keys %$menuitem) { - next if $key =~ /target|module|action|href|ICON/; - $menuitem->{href} .= "&" . $::form->escape($key, 1) . "="; - my ($value, $conf) = split(/=/, $menuitem->{$key}, 2); - $value = $::myconfig{$value} . "/$conf" if ($conf); - $menuitem->{href} .= $::form->escape($value, 1); - } - - my @common_args = ($label, $spacer, join '_', @id_stack); - - if ($spacer eq 's0') { # toplevel - push @items, [ @common_args, "icon24 $icon_class", 'm' ]; - } elsif ($menuitem->{submenu}) { + if (!$node->{parent}) { # toplevel + push @items, [ @common_args, "icon24 $node->{icon}", 'm' ]; + } elsif ($node->{children}) { push @items, [ @common_args, "icon16 submenu", 'sm' ]; - } elsif ($menuitem->{module}) { - push @items, [ @common_args, "icon16 $icon_class", 'i', $menuitem->{href}, $menuitem->{target} ]; + } else { + push @items, [ @common_args, "icon16 $node->{icon}", 'i', $href, $node->{target} ]; } }