import rt 3.0.12
[freeside.git] / rt / html / Elements / Menu
1 %# BEGIN LICENSE BLOCK
2 %# 
3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
4 %# 
5 %# (Except where explictly superceded by other copyright notices)
6 %# 
7 %# This work is made available to you under the terms of Version 2 of
8 %# the GNU General Public License. A copy of that license should have
9 %# been provided with this software, but in any event can be snarfed
10 %# from www.gnu.org.
11 %# 
12 %# This work is distributed in the hope that it will be useful, but
13 %# WITHOUT ANY WARRANTY; without even the implied warranty of
14 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 %# General Public License for more details.
16 %# 
17 %# Unless otherwise specified, all modifications, corrections or
18 %# extensions to this work which alter its source code become the
19 %# property of Best Practical Solutions, LLC when submitted for
20 %# inclusion in the work.
21 %# 
22 %# 
23 %# END LICENSE BLOCK
24 %# font size depends on level
25 % if ($level ge 3) {
26 %   $size = $basesize-(6);
27 % } elsif ($level gt 0) {
28 %   $size = $basesize-($level * 2);
29 %   $padding = 2;
30 % }
31 %  else {
32 %   $size = $basesize;
33 %   $padding = 5;
34 % }
35 <ul class="topnav" >
36 % my $sep=0;
37 % my $accesskey="1";
38 % foreach $tab (sort keys %{$toptabs}) {
39 % my $current = $current_toptab || "";
40 % my $path = $toptabs->{$tab}->{'path'} || "";
41 % $path =~ s#/index.html$##gi;
42 % $current =~ s#/index.html$##gi;
43 % if ( $path eq $current) {
44 %     $class="currenttopnav"
45 % } else {
46 %     $class="topnav"
47 % } 
48 % my $style="";
49 % if ($sep) {
50 % $style="border-top: solid #999 1px; padding-top: .1em; margin-top: .5em;";
51 % } elsif ($level == 0 ) {
52 % $style="border-bottom: solid white 1px; padding-top: .25em; padding-bottom: .5em;" ;
53 % }
54 % if ($toptabs->{$tab}->{'separator'}) {
55 % $sep=1;
56 % } else {
57 % $sep=0;
58 % }
59 <li style="<%$style%>"><A HREF="<%($toptabs->{$tab}->{'path'} !~ m/^https?:/i) ? $RT::WebPath."/" : ""%><%$toptabs->{$tab}->{'path'}|n%>" style="font-size: <%$size%>;" class="<%$class%>"
60 <%($class eq 'currenttopnav') ? "name='focus'" : ""|n %> 
61 <% !$level && "accesskey='".$accesskey++."'" |n%>><% $toptabs->{$tab}->{'title'}%></A>
62 %# Second-level items
63 %# if ($current_toptab eq $toptabs->{$tab}->{'path'}) {
64 %# commented out by jesse on 4 jan 2003 so that tickets/search and ticket/# can
65 %# both have menu items
66 % if ($toptabs->{$tab}->{'subtabs'}) {
67         <& /Elements/Menu, level => $level+1, 
68                 current_toptab => $toptabs->{$tab}->{'current_subtab'},
69                 toptabs => $toptabs->{$tab}->{'subtabs'} &></li>
70 % }
71 %# }
72 % }
73 </ul>
74
75 <%INIT>
76 my ($tab, $subtab, $class, $size, $padding);
77 my $basesize=16;
78 </%INIT>
79
80 <%ARGS>
81 $current_toptab => ""
82 $toptabs => undef
83 $level => 0
84 </%ARGS>