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->presenter->render('menu/menu',
18 sections => $sections,
29 "<div id='html-menu'></div>\n";
33 "<div id='content' class='html-menu'>\n";
45 for my $node ($menu->tree_walk) {
46 my $level = $node->{level};
49 push @id_stack, -1 if $level > $#id_stack;
50 pop @id_stack while $level < $#id_stack;
53 my $label = $::locale->text($node->{name});
54 my $href = $menu->href_for_node($node);
56 my @common_args = ($label, "s" . $level, join '_', @id_stack);
58 if (!$node->{parent}) { # toplevel
59 push @items, [ @common_args, "icon24 $node->{icon}", 'm' ];
60 } elsif ($node->{children}) {
61 push @items, [ @common_args, "icon16 submenu", 'sm' ];
63 push @items, [ @common_args, "icon16 $node->{icon}", 'i', $href, $node->{target} ];
71 my $is_lynx_browser = $ENV{HTTP_USER_AGENT} =~ /links/i;
72 my $is_mobile_browser = $ENV{HTTP_USER_AGENT} =~ /mobile/i;
73 my $is_mobile_style = $::form->{stylesheet} =~ /mobile/i;
75 return $is_mobile_browser && $is_mobile_style ? 130
76 : $is_lynx_browser ? 240
81 # don't show images in links
82 _calc_framesize() != 240;
93 SL::Layout::MenuLeft - ex html meanu, now only left menu
97 Data will be embedded into the page as a json array of entries.
98 Each entry is another array with the following fields:
101 1: indentation classes
108 From each entry the following dom will be generated, with [0] being entry 0 of
111 <div id="mi[2]" class="mi [4] [1]">
113 <span class="mii ms">
114 <div class="[3]"></div>
116 <span class="mic">[0]</span>
120 The classes are minified to keep the json somewhat in check, their meaning is as follows:
124 =item Indentation Classes
127 s1: One level of indentation
128 s2: Two levels of indentation
132 Each icon consists of two classes, one for the icon, and one for the size.
133 The icon classes are taken from the file names, for example C<Master-Data> is
134 the icon for master data, and refers to Master-Icon.png.
142 Role classes may be used to style types of links differently. Currently used:
144 ml: menu link, any <a> tag will have this
145 mi: menu item, the enclosing div for each entry has this
146 mii: menu item icon, the enclosing div for the icons has this
147 ms: menu spacer, the first <span> in the link will have this
148 m: menu, only top level entries have this
149 i: item, only leaf entries have this
150 sm: sub menu, eveything that is not top nor leaf has this
151 mic: menu item content, the span with the human readable description has this
161 Sven Schoeling E<lt>s.schoeling@linet-services.deE<gt>