1 package SL::Controller::Layout::MenuLeft;
4 use parent qw(SL::Controller::Layout::Base);
8 use List::MoreUtils qw(apply);
11 qw(css/icons16.css css/icons24.css)
14 sub javascripts_inline {
16 my $sections = [ section_menu($self->menu) ];
17 $self->render('menu/menu', { no_menu => 1, no_output => 1 },
18 sections => $sections,
23 "<div id='html-menu'></div>\n";
27 "<div id='content' class='html-menu'>\n";
35 $::lxdebug->enter_sub(2);
36 my ($menu, $level, $id_prefix) = @_;
37 my @menuorder = $menu->access_control(\%::myconfig, $level);
42 for my $item (@menuorder) {
43 my $menuitem = $menu->{$item};
44 my $olabel = apply { s/.*--// } $item;
45 my $ml = apply { s/--.*// } $item;
46 my $icon_class = apply { y/ /-/ } $item;
47 my $spacer = "s" . (0 + $item =~ s/--/--/g);
49 next if $level && $item ne "$level--$olabel";
51 my $label = $::locale->text($olabel);
53 $menuitem->{module} ||= $::form->{script};
54 $menuitem->{action} ||= "section_menu";
55 $menuitem->{href} ||= "$menuitem->{module}?action=$menuitem->{action}";
58 foreach my $key (keys %$menuitem) {
59 next if $key =~ /target|module|action|href/;
60 $menuitem->{href} .= "&" . $::form->escape($key, 1) . "=";
61 my ($value, $conf) = split(/=/, $menuitem->{$key}, 2);
62 $value = $::myconfig{$value} . "/$conf" if ($conf);
63 $menuitem->{href} .= $::form->escape($value, 1);
66 my $anchor = $menuitem->{href};
68 my @common_args = ($label, $spacer, "$id_prefix\_$id");
70 if (!$level) { # toplevel
71 push @items, [ @common_args, "icon24 $icon_class", 'm' ];
72 # make_image(size => 24, label => $item),
73 push @items, section_menu($menu, $item, "$id_prefix\_$id");
74 } elsif ($menuitem->{submenu}) {
75 push @items, [ @common_args, "icon16 submenu", 'sm' ];
76 #make_image(label => 'submenu'),
77 push @items, section_menu($menu, $item, "$id_prefix\_$id");
78 } elsif ($menuitem->{module}) {
79 push @items, [ @common_args, "icon16 $icon_class", 'i', $anchor ];
80 #make_image(size => 16, label => $item),
86 $::lxdebug->leave_sub(2);
91 my $is_lynx_browser = $ENV{HTTP_USER_AGENT} =~ /links/i;
92 my $is_mobile_browser = $ENV{HTTP_USER_AGENT} =~ /mobile/i;
93 my $is_mobile_style = $::form->{stylesheet} =~ /mobile/i;
95 return $is_mobile_browser && $is_mobile_style ? 130
96 : $is_lynx_browser ? 240
101 # don't show images in links
102 _calc_framesize() != 240;