Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7adc5519

Von Sven Schöling vor etwa 12 Jahren hinzugefügt

  • ID 7adc5519c0e80de857987eff6a9a97f3f4e5a6ce
  • Vorgänger 1a3569b9
  • Nachfolger e2802668

auf volle anzeige und javascript umgestellt

bugs:
- ausklappen klappt nicht alles andere ein
- ausklappen klappt berichte und abwärts nicht mit aus
- interne nummerierung ist noch bogus

Unterschiede anzeigen:

bin/mozilla/menu.pl
45 45
use List::MoreUtils qw(apply);
46 46

  
47 47
my $nbsp     = ' ';
48
my $mainlevel;
49 48

  
50 49
# end of main
51 50

  
......
81 80

  
82 81
  my $framesize    = _calc_framesize() - 2;
83 82
  my $menu         = Menu->new("menu.ini");
84
  $mainlevel       = $::form->{level};
85 83
  $::form->{title} = $::locale->text('kivitendo');
86 84
  $::form->header;
87 85

  
86
  $::lxdebug->dump(0,  "menu", $menu);
87

  
88
  my $sections = section_menu($menu);
89

  
88 90
  print $::form->parse_html_template('menu/menu', {
89 91
    framesize => $framesize,
90
    sections  => [ section_menu($menu) ],
92
    sections  => $sections,
91 93
  });
92 94

  
93 95
  $::lxdebug->leave_sub;
......
103 105
    my $menuitem   = $menu->{$item};
104 106
    my $label      = apply { s/.*--// } $item;
105 107
    my $ml         = apply { s/--.*// } $item;
106
    my $show       = $ml eq $mainlevel;
107 108
    my $spacer     = $nbsp x (($item =~ s/--/--/g) * 2);
108 109
    my $label_icon = $level . "--" . $label . ".png";
109 110

  
......
128 129
    my $anchor = $menuitem->{href};
129 130

  
130 131
    if (!$level) { # toplevel
131
      my $ml_    = $::form->escape($ml);
132
      my $image  = make_image(icon => $item . '.png', size => 24, label => $label);
133
      my $anchor = "menu.pl?action=acc_menu&level=$ml_";
134

  
135
      push @items, make_item(href => $anchor, img => $image, label => $label, height => 24, class => 'menu');
136
      push @items, section_menu($menu, $item);
137

  
132
      push @items, make_item(
133
        href     => '#',
134
        img      =>  make_image(icon => $item . '.png', size => 24, label => $label),
135
        label    => $label,
136
        height   => 24,
137
        class    => 'menu',
138
        subitems => section_menu($menu, $item)
139
      );
138 140
    } elsif ($menuitem->{submenu}) {
139
      my $image = make_image(submenu => 1);
140
      if ($mainlevel && $item =~ /^\Q$mainlevel\E/) {
141
        push @items, make_item(target => $menuitem->{target}, spacer => $spacer, img => $image, label => $label, class => 'submenu') if $show;
142
        push @items, section_menu($menu, $item);
143
      } else {
144
        push @items, make_item(spacer => $spacer, href => $anchor, img => $image, label => $label . ' ...', class => 'submenu') if $show;
145
      }
141
      push @items, make_item(
142
        target   => $menuitem->{target},
143
        spacer   => $spacer,
144
        img      => make_image(submenu => 1),
145
        label    => $label,
146
        class    => 'submenu',
147
        subitems => section_menu($menu, $item),
148
      );
146 149
    } elsif ($menuitem->{module}) {
147
      my $image = make_image(label => $label, icon => $label_icon);
148
      push @items, make_item(target => $menuitem->{target}, img => $image, href => $anchor, spacer => $spacer, label => $label, class => 'item') if $show;
149
      push @items, section_menu($menu, $item) if $show && $::form->{$item} && $::form->{level} eq $item;
150
      push @items, make_item(
151
        target => $menuitem->{target},
152
        img    => make_image(label => $label, icon => $label_icon),
153
        href   => $anchor,
154
        spacer => $spacer,
155
        label  => $label,
156
        class  => 'item',
157
      );
150 158
    }
151 159
  }
152 160
  $::lxdebug->leave_sub;
153
  return @items;
161
  return \@items;
154 162
}
155 163

  
156 164
sub make_item {
157 165
  my %params = @_;
158
  $params{a}      ||= '';
159 166
  $params{spacer} ||= '';
160 167
  $params{height} ||= 16;
161 168

  
......
203 210
    alt     => $params{label},
204 211
    width   => $icon_found ? $size : 24,
205 212
    height  => $size,
206
    padding => $padding,
207 213
  }
208 214
}
209 215

  
templates/webpages/menu/menu.html
7 7
  #html-menu img { vertical-align: middle; visibility:hidden; border: 0; }
8 8
  #html-menu div.menuitem:first-child img { visibility:visible }
9 9
  #html-menu a { vertical-align: top }
10
  #html-menu .item span.menu-spacer { display: inline-block; width: 24px }
11
  #html-menu .menu span.menu-spacer { display: inline-block; width: 32px }
10 12
</style>
11 13
<body class="menu">
12 14

  
13 15
<div id='html-menu'>
14

  
16
  [% INCLUDE sections %]
17
</div>
18
</body>
19
</html>
20
[%- BLOCK sections %]
15 21
[%- FOREACH item IN sections %]
16 22
   <div class='menu-multiline'>
23
   [% SET menuouterloopcount = loop.count %]
17 24
 [%- FOREACH chunk IN item.chunks %]
18
     <div class='menuitem [% item.class %] hover'>[% item.spacer %]
19
     [%- IF item.href %]
20
       [% L.link(item.href, L.html_tag('img', undef, item.img) _ chunk, target=item.target) %]
21
     [%- ELSE %]
22
       [% L.html_tag('img', undef, item.img) _ chunk %]
23
     [%- END %]
24
     </div>
25
     <div id='menuitem[% menulevel %]_[% menuouterloopcount %]' class='menuitem [% item.class %] hover'>[% PROCESS item %]</div>
25 26
 [%- END %]
27
     [%- IF item.subitems.size %]
28
       <div id='menuitem[% menulevel %]_[% loop.count %]_submenu'>
29
       [% INCLUDE sections sections=item.subitems, menulevel='_'+loop.count %]
30
       </div>
31
     [%- END %]
26 32
   </div>
27 33
[%- END %]
28
 </div>
34
[%- END  %]
35
[%- BLOCK item %]
36
  [% item.spacer %]
37
  [%- IF item.href %]
38
    [% L.link(item.href, L.html_tag('span', L.html_tag('img', undef, item.img), class='menu-spacer') _ chunk, target=item.target) %]
39
  [%- ELSE %]
40
    [% L.html_tag('img', undef, item.img) _ chunk %]
41
  [%- END %]
42
[%- END %]
43

  
29 44
</body>
30
</html>
45

  
46
<script type='text/javascript'>
47
  $(function(){
48
    $('#html-menu div[id$=submenu]').hide();
49
    $('#html-menu div.menu').each(function() {
50
      $(this).click(function(){
51
        $('#' + $(this).attr('id') + '_submenu').toggle();
52
      });
53
    });
54
  });
55
</script>

Auch abrufbar als: Unified diff