Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 88bd305a

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

  • ID 88bd305a4cf8eee63e4b8b81f714395584e3bb52
  • Vorgänger f1b07855
  • Nachfolger 5cdb20ed

menuitem nach menu.pl verlagert. links in template generiert

Unterschiede anzeigen:

bin/mozilla/menu.pl
113 113

  
114 114
    $label         = $::locale->text($label);
115 115

  
116
    $menuitem->{target} ||= "main_window";
116
    menuitem($menuitem);
117 117

  
118
    my $anchor     = $menu->menuitem(\%::myconfig, $::form, $item, $level);
118
    my $anchor = $menuitem->{href};
119 119

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

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

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

  
146
sub menuitem {
147
  my ($item, $name) = @_;
148

  
149
  $item->{module} ||= $::form->{script};
150
  $item->{action} ||= "section_menu";
151
  $item->{target} ||= "main_window";
152
  $item->{href}   ||= "$item->{module}?action=$item->{action}";
153

  
154
  # add other params
155
  foreach my $key (keys %$item) {
156
    next if $key =~ /target|module|action|href/;
157
    $item->{href} .= "&" . $::form->escape($key, 1) . "=";
158
    my ($value, $conf) = split(/=/, $item->{$key}, 2);
159
    $value = $::myconfig{$value} . "/$conf" if ($conf);
160
    $item->{href} .= $::form->escape($value, 1);
161
  }
162

  
163
#  my $str = "<a href='$href' $target_token>";
164
#
165
#  return $str;
166
}
167

  
146 168
sub make_item {
147 169
  my %params = @_;
148 170
  $params{a}      ||= '';
templates/webpages/menu/menu.html
1

  
1
[%- USE L %]
2 2
<style type='text/css'>
3
  .bold { font-weight: bold; }
4
  #html-menu { float:left }
3
  #html-menu { float:left; white-space: nowrap; }
5 4
  #html-menu tr { vertical-align: top; }
6 5
  #html-menu img { vertical-align: middle; }
7 6
  #html-menu div.menuitem { padding: 2px 4px 1px 4px; }
......
17 16
[%- FOREACH item IN sections %]
18 17
   <div class='menu-multiline'>
19 18
 [%- FOREACH chunk IN item.chunks %]
20
     <div class='menuitem [% item.class %] hover'>[% item.spacer %][% item.a %][% item.img %][% chunk %][% '</a>' IF item.a %]</div>
19
     <div class='menuitem [% item.class %] hover'>[% item.spacer %]
20
     [%- IF item.href %]
21
       [% L.link(item.href, item.img _ chunk, target=item.target) %]
22
     [%- ELSE %]
23
       [% item.img _ chunk %]
24
     [%- END %]
25
     </div>
21 26
 [%- END %]
22 27
   </div>
23 28
[%- END %]

Auch abrufbar als: Unified diff