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,
 
  23  'js/jquery.cookie.js';
 
  27   "<div id='html-menu'></div>\n";
 
  31   "<div id='content' class='html-menu'>\n";
 
  39   $::lxdebug->enter_sub(2);
 
  40   my ($menu, $level, $id_prefix) = @_;
 
  41   my @menuorder = $menu->access_control(\%::myconfig, $level);
 
  46   for my $item (@menuorder) {
 
  47     my $menuitem   = $menu->{$item};
 
  48     my $olabel     = apply { s/.*--// } $item;
 
  49     my $ml         = apply { s/--.*// } $item;
 
  50     my $icon_class = apply { y/ /-/   } $item;
 
  51     my $spacer     = "s" . (0 + $item =~ s/--/--/g);
 
  53     next if $level && $item ne "$level--$olabel";
 
  55     my $label         = $::locale->text($olabel);
 
  57     $menuitem->{module} ||= $::form->{script};
 
  58     $menuitem->{action} ||= "section_menu";
 
  59     $menuitem->{href}   ||= "$menuitem->{module}?action=$menuitem->{action}";
 
  62     foreach my $key (keys %$menuitem) {
 
  63       next if $key =~ /target|module|action|href/;
 
  64       $menuitem->{href} .= "&" . $::form->escape($key, 1) . "=";
 
  65       my ($value, $conf) = split(/=/, $menuitem->{$key}, 2);
 
  66       $value = $::myconfig{$value} . "/$conf" if ($conf);
 
  67       $menuitem->{href} .= $::form->escape($value, 1);
 
  70     my $anchor = $menuitem->{href};
 
  72     my @common_args = ($label, $spacer, "$id_prefix\_$id");
 
  74     if (!$level) { # toplevel
 
  75       push @items, [ @common_args, "icon24 $icon_class", 'm' ];
 
  76       #  make_image(size => 24, label => $item),
 
  77       push @items, section_menu($menu, $item, "$id_prefix\_$id");
 
  78     } elsif ($menuitem->{submenu}) {
 
  79       push @items, [ @common_args, "icon16 submenu", 'sm' ];
 
  80       #make_image(label => 'submenu'),
 
  81       push @items, section_menu($menu, $item, "$id_prefix\_$id");
 
  82     } elsif ($menuitem->{module}) {
 
  83       push @items, [ @common_args, "icon16 $icon_class", 'i', $anchor ];
 
  84       #make_image(size => 16, label => $item),
 
  90   $::lxdebug->leave_sub(2);
 
  95   my $is_lynx_browser   = $ENV{HTTP_USER_AGENT} =~ /links/i;
 
  96   my $is_mobile_browser = $ENV{HTTP_USER_AGENT} =~ /mobile/i;
 
  97   my $is_mobile_style   = $::form->{stylesheet} =~ /mobile/i;
 
  99   return  $is_mobile_browser && $is_mobile_style ?  130
 
 100         : $is_lynx_browser                       ?  240
 
 105   # don't show images in links
 
 106   _calc_framesize() != 240;
 
 117 SL::Layout::MenuLeft - ex html meanu, now only left menu
 
 121 Data will be embedded into the page as a json array of entries.
 
 122 Each entry is another array with the following fields:
 
 125   1: indentation classes
 
 130 From each entry the following dom will be generated, with [0] being entry 0 of
 
 133   <div id="mi[2]" class="mi [4] [1]">
 
 135       <span class="mii ms">
 
 136         <div class="[3]"></div>
 
 138       <span class="mic">[0]</span>
 
 142 The classes are minified to keep the json somewhat in check, their meaning is as follows:
 
 146 =item Indentation Classes
 
 149   s1: One level of indentation
 
 150   s2: Two levels of indentation
 
 154 Each icon consists of two classes, one for the icon, and one for the size.
 
 155 The icon classes are taken from the file names, for example C<Master-Data> is
 
 156 the icon for master data, and refers to Master-Icon.png.
 
 164 Role classes may be used to style types of links differently. Currently used:
 
 166   ml:  menu link, any <a> tag will have this
 
 167   mi:  menu item, the enclosing div for each entry has this
 
 168   mii: menu item icon, the enclosing div for the icons has this
 
 169   ms:  menu spacer, the first <span> in the link will have this
 
 170   m:   menu, only top level entries have this
 
 171   i:   item, only leaf entries have this
 
 172   sm:  sub menu, eveything that is not top nor leaf has this
 
 173   mic: menu item content, the span with the human readable description has this
 
 183 Sven Schoeling E<lt>s.schoeling@linet-services.deE<gt>