1.9-style menubar was hurting my eyes
[freeside.git] / httemplate / elements / menubar.html
1 <%doc>
2
3 Example:
4
5   include( '/elements/menubar.html',
6            
7            #options hashref (optional)
8            { 'newstyle' => 1,  #may become the default at some point
9              'url_base' => '', #prepended to menubar URLs, for convenience
10              'selected' => '', #currently selected label
11            },
12
13            #menubar entries (required)
14            'label'  => $url,
15            'label2' => $url2,
16            #etc.
17
18          );
19
20 </%doc>
21 %if ( $opt->{'newstyle'} ) {
22 %  my $s = '<FONT STYLE="border-bottom:1px solid #7e0079">';
23
24    <BR>
25    <% join("$s &nbsp; </FONT>", ( '', @html, '' ) ) %>
26    <BR>
27
28 %} else {
29
30    <% join(' | ', @html) %>
31
32 %}
33 <%init>
34
35 my $opt = ref($_[0]) ? shift : {};
36
37 my $url_base = $opt->{'url_base'};
38
39 my @html;
40 while (@_) {
41
42   my ($item, $url) = splice(@_,0,2);
43   next if $item =~ /^\s*Main\s+Menu\s*$/i;
44
45   my $style = '';
46   if ( $opt->{'newstyle'} ) {
47
48     my $dclass = $item eq $opt->{'selected'}
49                    ? 'fstabselected'
50                    : 'fstab';
51
52     $style = qq( CLASS="$dclass" );
53
54   }
55
56   push @html, qq!<A HREF="$url_base$url" $style>$item</A>!;
57
58 }
59
60 </%init>