1 package SL::Controller::Layout::MenuLeft;
4 use parent qw(SL::Controller::Layout::Base);
8 use List::MoreUtils qw(apply);
11 my ($class, @slurp) = @_;
13 my $self = $class->SUPER::new(@slurp);
15 $self->use_stylesheet(qw(css/icons16.css css/icons24.css));
22 my $sections = [ section_menu($self->menu) ];
24 $self->SUPER::render('menu/menu', { no_menu => 1, no_output => 1 },
25 sections => $sections,
30 $::lxdebug->enter_sub(2);
31 my ($menu, $level, $id_prefix) = @_;
32 my @menuorder = $menu->access_control(\%::myconfig, $level);
37 for my $item (@menuorder) {
38 my $menuitem = $menu->{$item};
39 my $olabel = apply { s/.*--// } $item;
40 my $ml = apply { s/--.*// } $item;
41 my $icon_class = apply { y/ /-/ } $item;
42 my $spacer = "s" . (0 + $item =~ s/--/--/g);
44 next if $level && $item ne "$level--$olabel";
46 my $label = $::locale->text($olabel);
48 $menuitem->{module} ||= $::form->{script};
49 $menuitem->{action} ||= "section_menu";
50 $menuitem->{href} ||= "$menuitem->{module}?action=$menuitem->{action}";
53 foreach my $key (keys %$menuitem) {
54 next if $key =~ /target|module|action|href/;
55 $menuitem->{href} .= "&" . $::form->escape($key, 1) . "=";
56 my ($value, $conf) = split(/=/, $menuitem->{$key}, 2);
57 $value = $::myconfig{$value} . "/$conf" if ($conf);
58 $menuitem->{href} .= $::form->escape($value, 1);
61 my $anchor = $menuitem->{href};
66 id => "$id_prefix\_$id",
69 if (!$level) { # toplevel
70 push @items, { %common_args,
71 i => "icon24 $icon_class", # make_image(size => 24, label => $item),
74 push @items, section_menu($menu, $item, "$id_prefix\_$id");
75 } elsif ($menuitem->{submenu}) {
76 push @items, { %common_args,
77 i => "icon16 submenu", #make_image(label => 'submenu'),
80 push @items, section_menu($menu, $item, "$id_prefix\_$id");
81 } elsif ($menuitem->{module}) {
82 push @items, { %common_args,
83 i => "icon16 $icon_class", #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;