Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c6a27f90

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

  • ID c6a27f90a8e644ed00910aeddaff38c74b513032
  • Vorgänger 16a12c3c
  • Nachfolger daf97549

html menü rewrite v1

Unterschiede anzeigen:

bin/mozilla/menu.pl
87 87
  $::form->{title} = $::locale->text('kivitendo');
88 88
  $::form->header;
89 89

  
90
  print qq|
91
<body class="menu">
92

  
93
<div align="left">\n<table width="$framesize" border="0">\n|;
94

  
95
  section_menu($menu);
96

  
97
  print qq|</table></div>
98
</body>
99
</html>
100
|;
90
  print $::form->parse_html_template('menu/menu', {
91
    framesize => $framesize,
92
    sections  => [ section_menu($menu) ],
93
  });
101 94

  
102 95
  $::lxdebug->leave_sub;
103 96
}
......
106 99
  $::lxdebug->enter_sub;
107 100
  my ($menu, $level) = @_;
108 101
  my @menuorder = $menu->access_control(\%::myconfig, $level);
102
  my @items;
109 103

  
110 104
  for my $item (@menuorder) {
111 105
    my $menuitem   = $menu->{$item};
......
125 119

  
126 120
    if (!$level) { # toplevel
127 121
      my $ml_    = $::form->escape($ml);
128
      my $image  = make_image(icon => $item . '.png', size => 24, label => $label, valign => 'middle');
122
      my $image  = make_image(icon => $item . '.png', size => 24, label => $label);
129 123
      my $anchor = "<a href='menu.pl?action=acc_menu&level=$ml_' class='nohover' title='$label'>";
130 124

  
131
      print make_item(a => $anchor, img => $image, label => $label, height => 24);
132
      section_menu($menu, $item);
125
      push @items, make_item(a => $anchor, img => $image, label => $label, height => 24, class => 'menu');
126
      push @items, section_menu($menu, $item);
133 127

  
134 128
    } elsif ($menuitem->{submenu}) {
135 129
      my $image = make_image(submenu => 1);
136 130
      if ($mainlevel && $item =~ /^\Q$mainlevel\E/) {
137
        print make_item(spacer => $spacer, bold => 1, img => $image, label => $label) if $show;
138
        section_menu($menu, $item);
131
        push @items, make_item(spacer => $spacer, bold => 1, img => $image, label => $label, class => 'submenu') if $show;
132
        push @items, section_menu($menu, $item);
139 133
      } else {
140
        print make_item(spacer => $spacer, a => $anchor, img => $image, label => $label . '&nbsp;...') if $show;
134
        push @items, make_item(spacer => $spacer, a => $anchor, img => $image, label => $label . '&nbsp;...', class => 'submenu') if $show;
141 135
      }
142 136
    } elsif ($menuitem->{module}) {
143 137
      my $image = make_image(label => $label, icon => $label_icon);
144
      print make_item(img => $image, a => $anchor, spacer => $spacer, label => $label) if $show;
145
      section_menu($menu, $item) if $show && $::form->{$item} && $::form->{level} eq $item;
138
      push @items, make_item(img => $image, a => $anchor, spacer => $spacer, label => $label, class => 'item') if $show;
139
      push @items, section_menu($menu, $item) if $show && $::form->{$item} && $::form->{level} eq $item;
146 140
    }
147 141
  }
148 142
  $::lxdebug->leave_sub;
143
  return @items;
149 144
}
150 145

  
151 146
sub make_item {
152 147
  my %params = @_;
153
  my $anchor = $params{a} || '';
154
  my @chunks = multiline($params{label});
155
  my $spacer = $params{spacer} || '';
156
  my $image  = $params{img};
157
  my $height = $params{height} || 16;
158
  my $a_end  = $anchor       ? '</a>' : '';
159
  my $bold   = $params{bold} ?  '<b>' : '';
160
  my $b_end  = $bold         ? '</b>' : '';
161
  my $hidden_image = make_image(hidden => 1);
162
  return join "\n",
163
        "<tr><td class='hover' height='$height'>$bold$spacer$anchor$image$chunks[0]$a_end$b_end</td></tr>\n",
164
    map "<tr style='vertical-align:top'><td class='hover'>$bold$spacer$hidden_image$anchor$chunks[$_]$a_end$b_end</td></tr>\n",
165
      1..$#chunks;
148
  $params{a}      ||= '';
149
  $params{spacer} ||= '';
150
  $params{height} ||= 16;
151

  
152
  return {
153
    %params,
154
    chunks => [ multiline($params{label}) ],
155
  };
166 156
}
167 157

  
168 158
# multi line hack, sschoeling jul06
......
190 180

  
191 181
  my $label  = $params{label};
192 182
  my $icon   = $params{icon};
193
  my $hidden = $params{hidden};
194 183
  my $size   = $params{size}   || 16;
195
  my $valign = $params{valign} || 'text-top';
196 184

  
197 185
  return unless _show_images();
198 186

  
199 187
  my $icon_found = $icon && -f _icon_path($icon, $size);
200 188

  
201 189
  my $image_url = $icon_found ? _icon_path($icon, $size) : "image/unterpunkt.png";
202
  my $style     = $hidden     ? "visibility:hidden"      : "vertical-align:$valign";
203
  my $width     = $hidden     ? "width='$size'"          : '';
190
  my $width     = $icon_found ? $size : 24;
204 191

  
205
  my $padding   = $size == 16 && $icon_found || $hidden ? $nbsp x 2
206
                : $size == 24                           ? $nbsp
207
                :                                         '';
192
  my $padding   = $size == 16 && $icon_found ? $nbsp x 2
193
                : $size == 24                ? $nbsp
194
                :                            '';
208 195

  
209
  return "<img src='$image_url' border='0' style='$style' title='$label' $width>$padding";
196
  return "<img src='$image_url' title='$label' width='$width' height='$size'>$padding";
210 197
}
211 198

  
212 199
sub _calc_framesize {

Auch abrufbar als: Unified diff