Revision 88bd305a
Von Sven Schöling vor mehr als 12 Jahren hinzugefügt
bin/mozilla/menu.pl | ||
---|---|---|
|
||
$label = $::locale->text($label);
|
||
|
||
$menuitem->{target} ||= "main_window";
|
||
menuitem($menuitem);
|
||
|
||
my $anchor = $menu->menuitem(\%::myconfig, $::form, $item, $level);
|
||
my $anchor = $menuitem->{href};
|
||
|
||
if (!$level) { # toplevel
|
||
my $ml_ = $::form->escape($ml);
|
||
my $image = make_image(icon => $item . '.png', size => 24, label => $label);
|
||
my $anchor = "<a href='menu.pl?action=acc_menu&level=$ml_' class='nohover' title='$label'>";
|
||
my $anchor = "menu.pl?action=acc_menu&level=$ml_";
|
||
|
||
push @items, make_item(a => $anchor, img => $image, label => $label, height => 24, class => 'menu');
|
||
push @items, make_item(href => $anchor, img => $image, label => $label, height => 24, class => 'menu');
|
||
push @items, section_menu($menu, $item);
|
||
|
||
} elsif ($menuitem->{submenu}) {
|
||
my $image = make_image(submenu => 1);
|
||
if ($mainlevel && $item =~ /^\Q$mainlevel\E/) {
|
||
push @items, make_item(spacer => $spacer, bold => 1, img => $image, label => $label, class => 'submenu') if $show;
|
||
push @items, make_item(target => $menuitem->{target}, spacer => $spacer, bold => 1, img => $image, label => $label, class => 'submenu') if $show;
|
||
push @items, section_menu($menu, $item);
|
||
} else {
|
||
push @items, make_item(spacer => $spacer, a => $anchor, img => $image, label => $label . ' ...', class => 'submenu') if $show;
|
||
push @items, make_item(spacer => $spacer, href => $anchor, img => $image, label => $label . ' ...', class => 'submenu') if $show;
|
||
}
|
||
} elsif ($menuitem->{module}) {
|
||
my $image = make_image(label => $label, icon => $label_icon);
|
||
push @items, make_item(img => $image, a => $anchor, spacer => $spacer, label => $label, class => 'item') if $show;
|
||
push @items, make_item(target => $menuitem->{target}, img => $image, href => $anchor, spacer => $spacer, label => $label, class => 'item') if $show;
|
||
push @items, section_menu($menu, $item) if $show && $::form->{$item} && $::form->{level} eq $item;
|
||
}
|
||
}
|
||
... | ... | |
return @items;
|
||
}
|
||
|
||
sub menuitem {
|
||
my ($item, $name) = @_;
|
||
|
||
$item->{module} ||= $::form->{script};
|
||
$item->{action} ||= "section_menu";
|
||
$item->{target} ||= "main_window";
|
||
$item->{href} ||= "$item->{module}?action=$item->{action}";
|
||
|
||
# add other params
|
||
foreach my $key (keys %$item) {
|
||
next if $key =~ /target|module|action|href/;
|
||
$item->{href} .= "&" . $::form->escape($key, 1) . "=";
|
||
my ($value, $conf) = split(/=/, $item->{$key}, 2);
|
||
$value = $::myconfig{$value} . "/$conf" if ($conf);
|
||
$item->{href} .= $::form->escape($value, 1);
|
||
}
|
||
|
||
# my $str = "<a href='$href' $target_token>";
|
||
#
|
||
# return $str;
|
||
}
|
||
|
||
sub make_item {
|
||
my %params = @_;
|
||
$params{a} ||= '';
|
templates/webpages/menu/menu.html | ||
---|---|---|
|
||
[%- USE L %]
|
||
<style type='text/css'>
|
||
.bold { font-weight: bold; }
|
||
#html-menu { float:left }
|
||
#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; }
|
||
... | ... | |
[%- FOREACH item IN sections %]
|
||
<div class='menu-multiline'>
|
||
[%- FOREACH chunk IN item.chunks %]
|
||
<div class='menuitem [% item.class %] hover'>[% item.spacer %][% item.a %][% item.img %][% chunk %][% '</a>' IF item.a %]</div>
|
||
<div class='menuitem [% item.class %] hover'>[% item.spacer %]
|
||
[%- IF item.href %]
|
||
[% L.link(item.href, item.img _ chunk, target=item.target) %]
|
||
[%- ELSE %]
|
||
[% item.img _ chunk %]
|
||
[%- END %]
|
||
</div>
|
||
[%- END %]
|
||
</div>
|
||
[%- END %]
|
Auch abrufbar als: Unified diff
menuitem nach menu.pl verlagert. links in template generiert