use strict;
use SL::Menu;
-use Data::Dumper;
use URI;
use List::MoreUtils qw(apply);
-my $menufile = "menu.ini";
my $nbsp = ' ';
my $mainlevel;
} elsif ($menuitem->{submenu}) {
my $image = make_image(submenu => 1);
if ($mainlevel && $item =~ /^\Q$mainlevel\E/) {
- push @items, make_item(target => $menuitem->{target}, spacer => $spacer, bold => 1, img => $image, label => $label, class => 'submenu') if $show;
+ push @items, make_item(target => $menuitem->{target}, spacer => $spacer, img => $image, label => $label, class => 'submenu') if $show;
push @items, section_menu($menu, $item);
} else {
push @items, make_item(spacer => $spacer, href => $anchor, img => $image, label => $label . ' ...', class => 'submenu') if $show;
sub make_image {
my (%params) = @_;
- my $label = $params{label};
my $icon = $params{icon};
my $size = $params{size} || 16;
return unless _show_images();
my $icon_found = $icon && -f _icon_path($icon, $size);
-
- my $image_url = $icon_found ? _icon_path($icon, $size) : "image/unterpunkt.png";
- my $width = $icon_found ? $size : 24;
-
- my $padding = $size == 16 && $icon_found ? $nbsp x 2
- : $size == 24 ? $nbsp
- : '';
-
- return "<img src='$image_url' alt='$label' width='$width' height='$size'>$padding";
+ my $padding = $size == 16 && $icon_found ? $nbsp x 2
+ : $size == 24 ? $nbsp
+ : '';
+
+ return {
+ src => $icon_found ? _icon_path($icon, $size) : "image/unterpunkt.png",
+ alt => $params{label},
+ width => $icon_found ? $size : 24,
+ height => $size,
+ padding => $padding,
+ }
}
sub _calc_framesize {
<style type='text/css'>
#html-menu { float:left; white-space: nowrap; }
#html-menu tr { vertical-align: top; }
- #html-menu img { vertical-align: middle; }
#html-menu div.menuitem { padding: 2px 4px 1px 4px; }
#html-menu div.submenu { font-weight: bold }
- #html-menu img { visibility:hidden; border: 0 }
+ #html-menu img { vertical-align: middle; visibility:hidden; border: 0; }
#html-menu div.menuitem:first-child img { visibility:visible }
#html-menu a { vertical-align: top }
</style>
[%- FOREACH chunk IN item.chunks %]
<div class='menuitem [% item.class %] hover'>[% item.spacer %]
[%- IF item.href %]
- [% L.link(item.href, item.img _ chunk, target=item.target) %]
+ [% L.link(item.href, L.html_tag('img', undef, item.img) _ chunk, target=item.target) %]
[%- ELSE %]
- [% item.img _ chunk %]
+ [% L.html_tag('img', undef, item.img) _ chunk %]
[%- END %]
</div>
[%- END %]