1 package SL::Layout::MenuLeft;
4 use parent qw(SL::Layout::Base);
8 use List::MoreUtils qw(apply);
11 qw(icons16.css icons24.css menu.css)
14 sub javascripts_inline {
16 my $sections = [ section_menu($self->menu) ];
17 $self->render('menu/menu', { partial => 1, no_output => 1 },
18 sections => $sections,
30 "<div id='html-menu'></div>\n";
34 "<div id='content' class='html-menu'>\n";
42 $::lxdebug->enter_sub(2);
43 my ($menu, $level, $id_prefix) = @_;
44 my @menuorder = $menu->access_control(\%::myconfig, $level);
49 for my $item (@menuorder) {
50 my $menuitem = $menu->{$item};
51 my $olabel = apply { s/.*--// } $item;
52 my $ml = apply { s/--.*// } $item;
53 my $icon_class = apply { y/ /-/ } $item;
54 my $spacer = "s" . (0 + $item =~ s/--/--/g);
56 next if $level && $item ne "$level--$olabel";
58 my $label = $::locale->text($olabel);
60 $menuitem->{module} ||= $::form->{script};
61 $menuitem->{action} ||= "section_menu";
62 $menuitem->{href} ||= "$menuitem->{module}?action=$menuitem->{action}";
65 foreach my $key (keys %$menuitem) {
66 next if $key =~ /target|module|action|href/;
67 $menuitem->{href} .= "&" . $::form->escape($key, 1) . "=";
68 my ($value, $conf) = split(/=/, $menuitem->{$key}, 2);
69 $value = $::myconfig{$value} . "/$conf" if ($conf);
70 $menuitem->{href} .= $::form->escape($value, 1);
73 my $anchor = $menuitem->{href};
75 my @common_args = ($label, $spacer, "$id_prefix\_$id");
77 if (!$level) { # toplevel
78 push @items, [ @common_args, "icon24 $icon_class", 'm' ];
79 # make_image(size => 24, label => $item),
80 push @items, section_menu($menu, $item, "$id_prefix\_$id");
81 } elsif ($menuitem->{submenu}) {
82 push @items, [ @common_args, "icon16 submenu", 'sm' ];
83 #make_image(label => 'submenu'),
84 push @items, section_menu($menu, $item, "$id_prefix\_$id");
85 } elsif ($menuitem->{module}) {
86 push @items, [ @common_args, "icon16 $icon_class", 'i', $anchor ];
87 #make_image(size => 16, label => $item),
93 $::lxdebug->leave_sub(2);
98 my $is_lynx_browser = $ENV{HTTP_USER_AGENT} =~ /links/i;
99 my $is_mobile_browser = $ENV{HTTP_USER_AGENT} =~ /mobile/i;
100 my $is_mobile_style = $::form->{stylesheet} =~ /mobile/i;
102 return $is_mobile_browser && $is_mobile_style ? 130
103 : $is_lynx_browser ? 240
108 # don't show images in links
109 _calc_framesize() != 240;
120 SL::Layout::MenuLeft - ex html meanu, now only left menu
124 Data will be embedded into the page as a json array of entries.
125 Each entry is another array with the following fields:
128 1: indentation classes
133 From each entry the following dom will be generated, with [0] being entry 0 of
136 <div id="mi[2]" class="mi [4] [1]">
138 <span class="mii ms">
139 <div class="[3]"></div>
141 <span class="mic">[0]</span>
145 The classes are minified to keep the json somewhat in check, their meaning is as follows:
149 =item Indentation Classes
152 s1: One level of indentation
153 s2: Two levels of indentation
157 Each icon consists of two classes, one for the icon, and one for the size.
158 The icon classes are taken from the file names, for example C<Master-Data> is
159 the icon for master data, and refers to Master-Icon.png.
167 Role classes may be used to style types of links differently. Currently used:
169 ml: menu link, any <a> tag will have this
170 mi: menu item, the enclosing div for each entry has this
171 mii: menu item icon, the enclosing div for the icons has this
172 ms: menu spacer, the first <span> in the link will have this
173 m: menu, only top level entries have this
174 i: item, only leaf entries have this
175 sm: sub menu, eveything that is not top nor leaf has this
176 mic: menu item content, the span with the human readable description has this
186 Sven Schoeling E<lt>s.schoeling@linet-services.deE<gt>