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 $self->SUPER::javascripts_inline;
17 my $sections = [ section_menu($self->menu) ];
18 $self->presenter->render('menu/menu',
19 sections => $sections,
31 "<div id='html-menu'></div>\n";
35 "<div id='content' class='html-menu'>\n";
43 $::lxdebug->enter_sub(2);
44 my ($menu, $level, $id_prefix) = @_;
45 my @menuorder = $menu->access_control(\%::myconfig, $level);
50 for my $item (@menuorder) {
51 my $menuitem = $menu->{$item};
52 my $olabel = apply { s/.*--// } $item;
53 my $ml = apply { s/--.*// } $item;
54 my $icon_class = apply { y/ /-/ } $item;
55 my $spacer = "s" . (0 + $item =~ s/--/--/g);
57 next if $level && $item ne "$level--$olabel";
59 my $label = $::locale->text($olabel);
61 $menuitem->{module} ||= $::form->{script};
62 $menuitem->{action} ||= "section_menu";
63 $menuitem->{href} ||= "$menuitem->{module}?action=$menuitem->{action}";
66 foreach my $key (keys %$menuitem) {
67 next if $key =~ /target|module|action|href/;
68 $menuitem->{href} .= "&" . $::form->escape($key, 1) . "=";
69 my ($value, $conf) = split(/=/, $menuitem->{$key}, 2);
70 $value = $::myconfig{$value} . "/$conf" if ($conf);
71 $menuitem->{href} .= $::form->escape($value, 1);
74 my @common_args = ($label, $spacer, "$id_prefix\_$id");
76 if (!$level) { # toplevel
77 push @items, [ @common_args, "icon24 $icon_class", 'm' ];
78 # make_image(size => 24, label => $item),
79 push @items, section_menu($menu, $item, "$id_prefix\_$id");
80 } elsif ($menuitem->{submenu}) {
81 push @items, [ @common_args, "icon16 submenu", 'sm' ];
82 #make_image(label => 'submenu'),
83 push @items, section_menu($menu, $item, "$id_prefix\_$id");
84 } elsif ($menuitem->{module}) {
85 push @items, [ @common_args, "icon16 $icon_class", 'i', $menuitem->{href}, $menuitem->{target} ];
86 #make_image(size => 16, label => $item),
92 $::lxdebug->leave_sub(2);
97 my $is_lynx_browser = $ENV{HTTP_USER_AGENT} =~ /links/i;
98 my $is_mobile_browser = $ENV{HTTP_USER_AGENT} =~ /mobile/i;
99 my $is_mobile_style = $::form->{stylesheet} =~ /mobile/i;
101 return $is_mobile_browser && $is_mobile_style ? 130
102 : $is_lynx_browser ? 240
107 # don't show images in links
108 _calc_framesize() != 240;
119 SL::Layout::MenuLeft - ex html meanu, now only left menu
123 Data will be embedded into the page as a json array of entries.
124 Each entry is another array with the following fields:
127 1: indentation classes
134 From each entry the following dom will be generated, with [0] being entry 0 of
137 <div id="mi[2]" class="mi [4] [1]">
139 <span class="mii ms">
140 <div class="[3]"></div>
142 <span class="mic">[0]</span>
146 The classes are minified to keep the json somewhat in check, their meaning is as follows:
150 =item Indentation Classes
153 s1: One level of indentation
154 s2: Two levels of indentation
158 Each icon consists of two classes, one for the icon, and one for the size.
159 The icon classes are taken from the file names, for example C<Master-Data> is
160 the icon for master data, and refers to Master-Icon.png.
168 Role classes may be used to style types of links differently. Currently used:
170 ml: menu link, any <a> tag will have this
171 mi: menu item, the enclosing div for each entry has this
172 mii: menu item icon, the enclosing div for the icons has this
173 ms: menu spacer, the first <span> in the link will have this
174 m: menu, only top level entries have this
175 i: item, only leaf entries have this
176 sm: sub menu, eveything that is not top nor leaf has this
177 mic: menu item content, the span with the human readable description has this
187 Sven Schoeling E<lt>s.schoeling@linet-services.deE<gt>