Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 62822c6a

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

  • ID 62822c6ab826078a7f17422dc29e1ceeaf7e311e
  • Vorgänger 39139d92
  • Nachfolger f7467a94

Sprites für das Menü verwenden.

Unterschiede anzeigen:

bin/mozilla/menu.pl
76 76
sub acc_menu {
77 77
  $::lxdebug->enter_sub;
78 78

  
79
  $::form->{stylesheet} = [ qw(css/icons16.css css/icons24.css ) ];
80

  
79 81
  my $framesize    = _calc_framesize() - 2;
80 82
  my $menu         = Menu->new("menu.ini");
81 83
  $::form->{title} = $::locale->text('kivitendo');
......
101 103

  
102 104
  for my $item (@menuorder) {
103 105
    my $menuitem   = $menu->{$item};
104
    my $label      = apply { s/.*--// } $item;
106
    my $olabel     = apply { s/.*--// } $item;
105 107
    my $ml         = apply { s/--.*// } $item;
108
    my $icon_class = apply { y/ /-/   } $item;
106 109
    my $spacer     = "s" . (0 + $item =~ s/--/--/g);
107
    my $label_icon = $level . "--" . $label . ".png";
108 110

  
109
    next if $level && $item ne "$level--$label";
111
    next if $level && $item ne "$level--$olabel";
110 112

  
111
    $label         = $::locale->text($label);
113
    my $label         = $::locale->text($olabel);
112 114

  
113 115
    $menuitem->{module} ||= $::form->{script};
114 116
    $menuitem->{action} ||= "section_menu";
......
136 138

  
137 139
    if (!$level) { # toplevel
138 140
      push @items, { %common_args,
139
        img      =>  make_image(icon => $item . '.png', size => 24, label => $label),
141
        img      => "icon24 $icon_class",   #  make_image(size => 24, label => $item),
140 142
        height   => 24,
141 143
        class    => 'm',
142 144
      };
143 145
      push @items, section_menu($menu, $item, "$id_prefix\_$id");
144 146
    } elsif ($menuitem->{submenu}) {
145 147
      push @items, { %common_args,
146
        img      => make_image(submenu => 1),
148
        img      => "icon16 submenu",   #make_image(label => 'submenu'),
147 149
        class    => 'sm',
148 150
      };
149 151
      push @items, section_menu($menu, $item, "$id_prefix\_$id");
150 152
    } elsif ($menuitem->{module}) {
151 153
      push @items, { %common_args,
152
        img     => make_image(label => $label, icon => $label_icon),
154
        img     => "icon16 $icon_class",  #make_image(size => 16, label => $item),
153 155
        href    => $anchor,
154 156
        class   => 'i',
155 157
      };
......
162 164
  return @items;
163 165
}
164 166

  
165
sub make_image {
166
  my (%params) = @_;
167

  
168
  my $icon   = $params{icon};
169
  my $size   = $params{size}   || 16;
170

  
171
  return unless _show_images();
172

  
173
  my $icon_found = $icon && -f _icon_path($icon, $size);
174

  
175
  return  {
176
    src     => $icon_found ? _icon_path($icon, $size) : "image/unterpunkt.png",
177
    alt     => $params{label},
178
    width   => $icon_found ? $size : 24,
179
    height  => $icon_found ? $size : 15,
180
  }
181
}
182

  
183 167
sub _calc_framesize {
184 168
  my $is_lynx_browser   = $ENV{HTTP_USER_AGENT} =~ /links/i;
185 169
  my $is_mobile_browser = $ENV{HTTP_USER_AGENT} =~ /mobile/i;
......
195 179
  _calc_framesize() != 240;
196 180
}
197 181

  
198
sub _icon_path {
199
  my ($label, $size) = @_;
200

  
201
  $size ||= 16;
202

  
203
  return "image/icons/${size}x${size}/$label";
204
}
205

  
206 182
1;
207 183

  
208 184
__END__
css/lx-office-erp/menu.css
300 300
#html-menu div.sm { font-weight: bold }
301 301
#html-menu img { vertical-align: top; border: 0; }
302 302
#html-menu a { vertical-align: top }
303
#html-menu .i span.ms { float:left; width: 24px }
304
#html-menu .m span.ms { float:left; width: 32px }
303
#html-menu .i span.ms { float: left; width: 24px }
304
#html-menu .m span.ms { float: left; width: 32px }
305
#html-menu .sm span.ms { float: left; width: 24px; background: url(../../image/unterpunkt.png); }
305 306
#html-menu div.m { height: 24px }
306 307
#html-menu div.m span.mic { color:blue; position: relative; top: 5px; }
307 308
#html-menu div.m:hover,
templates/webpages/menu/menu.html
5 5
<div id='html-menu'>
6 6
[%- FOREACH item IN sections %]
7 7
 <div id='mi[% item.item_id %]' class='mi [% item.spacer %] [% item.class %]'>[%- IF item.href %]
8
  <a href="[% item.href | html %]" class='ml' target='[% item.target %]'><span class="mii ms">[% L.img_tag(item.img) %]</span><span class='mic'>[% item.label %]</span></a>[%- ELSE %]
9
  <span class="mii ms">[% L.img_tag(item.img) %]</span><span class='mic'>[% item.label %]</span>[%- END %]
8
  <a href="[% item.href | html %]" class='ml' target='[% item.target %]'><span class="mii ms"><div class="[% item.img %]"></div></span><span class='mic'>[% item.label %]</span></a>[%- ELSE %]
9
  <span class="mii ms"><div class="[% item.img %]"></div></span><span class='mic'>[% item.label %]</span>[%- END %]
10 10
 </div>
11 11
[%- END %]
12 12
</div>

Auch abrufbar als: Unified diff