Revision 7adc5519
Von Sven Schöling vor etwa 12 Jahren hinzugefügt
bin/mozilla/menu.pl | ||
---|---|---|
45 | 45 |
use List::MoreUtils qw(apply); |
46 | 46 |
|
47 | 47 |
my $nbsp = ' '; |
48 |
my $mainlevel; |
|
49 | 48 |
|
50 | 49 |
# end of main |
51 | 50 |
|
... | ... | |
81 | 80 |
|
82 | 81 |
my $framesize = _calc_framesize() - 2; |
83 | 82 |
my $menu = Menu->new("menu.ini"); |
84 |
$mainlevel = $::form->{level}; |
|
85 | 83 |
$::form->{title} = $::locale->text('kivitendo'); |
86 | 84 |
$::form->header; |
87 | 85 |
|
86 |
$::lxdebug->dump(0, "menu", $menu); |
|
87 |
|
|
88 |
my $sections = section_menu($menu); |
|
89 |
|
|
88 | 90 |
print $::form->parse_html_template('menu/menu', { |
89 | 91 |
framesize => $framesize, |
90 |
sections => [ section_menu($menu) ],
|
|
92 |
sections => $sections,
|
|
91 | 93 |
}); |
92 | 94 |
|
93 | 95 |
$::lxdebug->leave_sub; |
... | ... | |
103 | 105 |
my $menuitem = $menu->{$item}; |
104 | 106 |
my $label = apply { s/.*--// } $item; |
105 | 107 |
my $ml = apply { s/--.*// } $item; |
106 |
my $show = $ml eq $mainlevel; |
|
107 | 108 |
my $spacer = $nbsp x (($item =~ s/--/--/g) * 2); |
108 | 109 |
my $label_icon = $level . "--" . $label . ".png"; |
109 | 110 |
|
... | ... | |
128 | 129 |
my $anchor = $menuitem->{href}; |
129 | 130 |
|
130 | 131 |
if (!$level) { # toplevel |
131 |
my $ml_ = $::form->escape($ml); |
|
132 |
my $image = make_image(icon => $item . '.png', size => 24, label => $label); |
|
133 |
my $anchor = "menu.pl?action=acc_menu&level=$ml_"; |
|
134 |
|
|
135 |
push @items, make_item(href => $anchor, img => $image, label => $label, height => 24, class => 'menu'); |
|
136 |
push @items, section_menu($menu, $item); |
|
137 |
|
|
132 |
push @items, make_item( |
|
133 |
href => '#', |
|
134 |
img => make_image(icon => $item . '.png', size => 24, label => $label), |
|
135 |
label => $label, |
|
136 |
height => 24, |
|
137 |
class => 'menu', |
|
138 |
subitems => section_menu($menu, $item) |
|
139 |
); |
|
138 | 140 |
} elsif ($menuitem->{submenu}) { |
139 |
my $image = make_image(submenu => 1); |
|
140 |
if ($mainlevel && $item =~ /^\Q$mainlevel\E/) { |
|
141 |
push @items, make_item(target => $menuitem->{target}, spacer => $spacer, img => $image, label => $label, class => 'submenu') if $show; |
|
142 |
push @items, section_menu($menu, $item); |
|
143 |
} else { |
|
144 |
push @items, make_item(spacer => $spacer, href => $anchor, img => $image, label => $label . ' ...', class => 'submenu') if $show; |
|
145 |
} |
|
141 |
push @items, make_item( |
|
142 |
target => $menuitem->{target}, |
|
143 |
spacer => $spacer, |
|
144 |
img => make_image(submenu => 1), |
|
145 |
label => $label, |
|
146 |
class => 'submenu', |
|
147 |
subitems => section_menu($menu, $item), |
|
148 |
); |
|
146 | 149 |
} elsif ($menuitem->{module}) { |
147 |
my $image = make_image(label => $label, icon => $label_icon); |
|
148 |
push @items, make_item(target => $menuitem->{target}, img => $image, href => $anchor, spacer => $spacer, label => $label, class => 'item') if $show; |
|
149 |
push @items, section_menu($menu, $item) if $show && $::form->{$item} && $::form->{level} eq $item; |
|
150 |
push @items, make_item( |
|
151 |
target => $menuitem->{target}, |
|
152 |
img => make_image(label => $label, icon => $label_icon), |
|
153 |
href => $anchor, |
|
154 |
spacer => $spacer, |
|
155 |
label => $label, |
|
156 |
class => 'item', |
|
157 |
); |
|
150 | 158 |
} |
151 | 159 |
} |
152 | 160 |
$::lxdebug->leave_sub; |
153 |
return @items; |
|
161 |
return \@items;
|
|
154 | 162 |
} |
155 | 163 |
|
156 | 164 |
sub make_item { |
157 | 165 |
my %params = @_; |
158 |
$params{a} ||= ''; |
|
159 | 166 |
$params{spacer} ||= ''; |
160 | 167 |
$params{height} ||= 16; |
161 | 168 |
|
... | ... | |
203 | 210 |
alt => $params{label}, |
204 | 211 |
width => $icon_found ? $size : 24, |
205 | 212 |
height => $size, |
206 |
padding => $padding, |
|
207 | 213 |
} |
208 | 214 |
} |
209 | 215 |
|
Auch abrufbar als: Unified diff
auf volle anzeige und javascript umgestellt
bugs:
- ausklappen klappt nicht alles andere ein
- ausklappen klappt berichte und abwärts nicht mit aus
- interne nummerierung ist noch bogus