Revision c6a27f90
Von Sven Schöling vor etwa 12 Jahren hinzugefügt
SL/Dispatcher.pm | ||
---|---|---|
33 | 33 |
use SL::Common; |
34 | 34 |
use SL::Form; |
35 | 35 |
use SL::Helper::DateTime; |
36 |
use SL::Controller::LoginScreen; |
|
36 | 37 |
use SL::InstanceConfiguration; |
37 | 38 |
use SL::Template::Plugin::HTMLFixes; |
38 | 39 |
|
SL/Menu.pm | ||
---|---|---|
66 | 66 |
my $module = $self->{$item}{module} || $form->{script}; |
67 | 67 |
my $action = $self->{$item}{action} || "section_menu"; |
68 | 68 |
my $target = $self->{$item}{target} || ""; |
69 |
|
|
70 | 69 |
my $level = $form->escape($item); |
71 |
|
|
72 |
my $style = 'style="vertical-align:top"'; |
|
73 |
my $target_token = ($target) |
|
74 |
? "target='$target'" : ''; |
|
70 |
my $target_token = ($target) ? "target='$target'" : ''; |
|
75 | 71 |
|
76 | 72 |
my $href = ($self->{$item}{href}) |
77 | 73 |
? $form->escape($self->{$item}{href}) |
78 |
: "$module?action=$action&level=$level"; |
|
79 |
|
|
80 |
my @vars = ($self->{$item}{href}) |
|
81 |
? qw(module target href) |
|
82 |
: qw(module action target href); |
|
83 |
|
|
84 |
# map { delete $self->{$item}{$_} } @vars; |
|
74 |
: "$module?action=$action"; |
|
85 | 75 |
|
76 |
# my @vars = ($self->{$item}{href}) |
|
77 |
# ? qw(module target href) |
|
78 |
# : qw(module action target href); |
|
79 |
# |
|
86 | 80 |
# add other params |
87 | 81 |
foreach my $key (keys %{ $self->{$item} }) { |
82 |
next if $key =~ /target|module|action/; |
|
88 | 83 |
$href .= "&" . $form->escape($key, 1) . "="; |
89 | 84 |
my ($value, $conf) = split(/=/, $self->{$item}{$key}, 2); |
90 | 85 |
$value = $myconfig->{$value} . "/$conf" if ($conf); |
91 | 86 |
$href .= $form->escape($value, 1); |
92 | 87 |
} |
93 | 88 |
|
94 |
my $str = "<a href='$href' $target_token $style>";
|
|
89 |
my $str = "<a href='$href' $target_token>"; |
|
95 | 90 |
|
96 | 91 |
$main::lxdebug->leave_sub(); |
97 | 92 |
|
bin/mozilla/menu.pl | ||
---|---|---|
87 | 87 |
$::form->{title} = $::locale->text('kivitendo'); |
88 | 88 |
$::form->header; |
89 | 89 |
|
90 |
print qq| |
|
91 |
<body class="menu"> |
|
92 |
|
|
93 |
<div align="left">\n<table width="$framesize" border="0">\n|; |
|
94 |
|
|
95 |
section_menu($menu); |
|
96 |
|
|
97 |
print qq|</table></div> |
|
98 |
</body> |
|
99 |
</html> |
|
100 |
|; |
|
90 |
print $::form->parse_html_template('menu/menu', { |
|
91 |
framesize => $framesize, |
|
92 |
sections => [ section_menu($menu) ], |
|
93 |
}); |
|
101 | 94 |
|
102 | 95 |
$::lxdebug->leave_sub; |
103 | 96 |
} |
... | ... | |
106 | 99 |
$::lxdebug->enter_sub; |
107 | 100 |
my ($menu, $level) = @_; |
108 | 101 |
my @menuorder = $menu->access_control(\%::myconfig, $level); |
102 |
my @items; |
|
109 | 103 |
|
110 | 104 |
for my $item (@menuorder) { |
111 | 105 |
my $menuitem = $menu->{$item}; |
... | ... | |
125 | 119 |
|
126 | 120 |
if (!$level) { # toplevel |
127 | 121 |
my $ml_ = $::form->escape($ml); |
128 |
my $image = make_image(icon => $item . '.png', size => 24, label => $label, valign => 'middle');
|
|
122 |
my $image = make_image(icon => $item . '.png', size => 24, label => $label); |
|
129 | 123 |
my $anchor = "<a href='menu.pl?action=acc_menu&level=$ml_' class='nohover' title='$label'>"; |
130 | 124 |
|
131 |
print make_item(a => $anchor, img => $image, label => $label, height => 24);
|
|
132 |
section_menu($menu, $item); |
|
125 |
push @items, make_item(a => $anchor, img => $image, label => $label, height => 24, class => 'menu');
|
|
126 |
push @items, section_menu($menu, $item);
|
|
133 | 127 |
|
134 | 128 |
} elsif ($menuitem->{submenu}) { |
135 | 129 |
my $image = make_image(submenu => 1); |
136 | 130 |
if ($mainlevel && $item =~ /^\Q$mainlevel\E/) { |
137 |
print make_item(spacer => $spacer, bold => 1, img => $image, label => $label) if $show;
|
|
138 |
section_menu($menu, $item); |
|
131 |
push @items, make_item(spacer => $spacer, bold => 1, img => $image, label => $label, class => 'submenu') if $show;
|
|
132 |
push @items, section_menu($menu, $item);
|
|
139 | 133 |
} else { |
140 |
print make_item(spacer => $spacer, a => $anchor, img => $image, label => $label . ' ...') if $show;
|
|
134 |
push @items, make_item(spacer => $spacer, a => $anchor, img => $image, label => $label . ' ...', class => 'submenu') if $show;
|
|
141 | 135 |
} |
142 | 136 |
} elsif ($menuitem->{module}) { |
143 | 137 |
my $image = make_image(label => $label, icon => $label_icon); |
144 |
print make_item(img => $image, a => $anchor, spacer => $spacer, label => $label) if $show;
|
|
145 |
section_menu($menu, $item) if $show && $::form->{$item} && $::form->{level} eq $item; |
|
138 |
push @items, make_item(img => $image, a => $anchor, spacer => $spacer, label => $label, class => 'item') if $show;
|
|
139 |
push @items, section_menu($menu, $item) if $show && $::form->{$item} && $::form->{level} eq $item;
|
|
146 | 140 |
} |
147 | 141 |
} |
148 | 142 |
$::lxdebug->leave_sub; |
143 |
return @items; |
|
149 | 144 |
} |
150 | 145 |
|
151 | 146 |
sub make_item { |
152 | 147 |
my %params = @_; |
153 |
my $anchor = $params{a} || ''; |
|
154 |
my @chunks = multiline($params{label}); |
|
155 |
my $spacer = $params{spacer} || ''; |
|
156 |
my $image = $params{img}; |
|
157 |
my $height = $params{height} || 16; |
|
158 |
my $a_end = $anchor ? '</a>' : ''; |
|
159 |
my $bold = $params{bold} ? '<b>' : ''; |
|
160 |
my $b_end = $bold ? '</b>' : ''; |
|
161 |
my $hidden_image = make_image(hidden => 1); |
|
162 |
return join "\n", |
|
163 |
"<tr><td class='hover' height='$height'>$bold$spacer$anchor$image$chunks[0]$a_end$b_end</td></tr>\n", |
|
164 |
map "<tr style='vertical-align:top'><td class='hover'>$bold$spacer$hidden_image$anchor$chunks[$_]$a_end$b_end</td></tr>\n", |
|
165 |
1..$#chunks; |
|
148 |
$params{a} ||= ''; |
|
149 |
$params{spacer} ||= ''; |
|
150 |
$params{height} ||= 16; |
|
151 |
|
|
152 |
return { |
|
153 |
%params, |
|
154 |
chunks => [ multiline($params{label}) ], |
|
155 |
}; |
|
166 | 156 |
} |
167 | 157 |
|
168 | 158 |
# multi line hack, sschoeling jul06 |
... | ... | |
190 | 180 |
|
191 | 181 |
my $label = $params{label}; |
192 | 182 |
my $icon = $params{icon}; |
193 |
my $hidden = $params{hidden}; |
|
194 | 183 |
my $size = $params{size} || 16; |
195 |
my $valign = $params{valign} || 'text-top'; |
|
196 | 184 |
|
197 | 185 |
return unless _show_images(); |
198 | 186 |
|
199 | 187 |
my $icon_found = $icon && -f _icon_path($icon, $size); |
200 | 188 |
|
201 | 189 |
my $image_url = $icon_found ? _icon_path($icon, $size) : "image/unterpunkt.png"; |
202 |
my $style = $hidden ? "visibility:hidden" : "vertical-align:$valign"; |
|
203 |
my $width = $hidden ? "width='$size'" : ''; |
|
190 |
my $width = $icon_found ? $size : 24; |
|
204 | 191 |
|
205 |
my $padding = $size == 16 && $icon_found || $hidden ? $nbsp x 2
|
|
206 |
: $size == 24 ? $nbsp
|
|
207 |
: '';
|
|
192 |
my $padding = $size == 16 && $icon_found ? $nbsp x 2 |
|
193 |
: $size == 24 ? $nbsp |
|
194 |
: ''; |
|
208 | 195 |
|
209 |
return "<img src='$image_url' border='0' style='$style' title='$label' $width>$padding";
|
|
196 |
return "<img src='$image_url' title='$label' width='$width' height='$size'>$padding";
|
|
210 | 197 |
} |
211 | 198 |
|
212 | 199 |
sub _calc_framesize { |
templates/webpages/menu/menu.html | ||
---|---|---|
1 |
|
|
2 |
<style type='text/css'> |
|
3 |
.bold { font-weight: bold; } |
|
4 |
#html-menu { float:left } |
|
5 |
#html-menu tr { vertical-align: top; } |
|
6 |
#html-menu img { vertical-align: middle; } |
|
7 |
#html-menu div.menuitem { padding: 2px 4px 1px 4px; } |
|
8 |
#html-menu div.submenu { font-weight: bold } |
|
9 |
#html-menu img { visibility:hidden; border: 0 } |
|
10 |
#html-menu div.menuitem:first-child img { visibility:visible } |
|
11 |
#html-menu a { vertical-align: top } |
|
12 |
</style> |
|
13 |
<body class="menu"> |
|
14 |
|
|
15 |
<div id='html-menu'> |
|
16 |
|
|
17 |
[%- FOREACH item IN sections %] |
|
18 |
<div class='menu-multiline'> |
|
19 |
[%- FOREACH chunk IN item.chunks %] |
|
20 |
<div class='menuitem [% item.class %] hover'>[% item.spacer %][% item.a %][% item.img %][% chunk %][% '</a>' IF item.a %]</div> |
|
21 |
[%- END %] |
|
22 |
</div> |
|
23 |
[%- END %] |
|
24 |
</div> |
|
25 |
</body> |
|
26 |
</html> |
Auch abrufbar als: Unified diff
html menü rewrite v1