PageLayout 6.72 KB
Newer Older
1
%# BEGIN BPS TAGGED BLOCK {{{
Linda Julien's avatar
Linda Julien committed
2
%# 
3
4
%# COPYRIGHT:
%#  
Jesse Vincent's avatar
Jesse Vincent committed
5
%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC 
6
%#                                          <jesse@bestpractical.com>
Linda Julien's avatar
Linda Julien committed
7
%# 
8
9
10
11
%# (Except where explicitly superseded by other copyright notices)
%# 
%# 
%# LICENSE:
Linda Julien's avatar
Linda Julien committed
12
13
14
15
%# 
%# This work is made available to you under the terms of Version 2 of
%# the GNU General Public License. A copy of that license should have
%# been provided with this software, but in any event can be snarfed
16
%# from www.gnu.org.
Linda Julien's avatar
Linda Julien committed
17
18
19
20
21
22
%# 
%# This work is distributed in the hope that it will be useful, but
%# WITHOUT ANY WARRANTY; without even the implied warranty of
%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%# General Public License for more details.
%# 
23
24
25
26
27
28
29
30
31
32
33
34
%# You should have received a copy of the GNU General Public License
%# along with this program; if not, write to the Free Software
%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%# 
%# 
%# CONTRIBUTION SUBMISSION POLICY:
%# 
%# (The following paragraph is not intended to limit the rights granted
%# to you to modify and distribute this software under the terms of
%# the GNU General Public License and is only of importance to you if
%# you choose to contribute your changes and enhancements to the
%# community by submitting them to Best Practical Solutions, LLC.)
Linda Julien's avatar
Linda Julien committed
35
%# 
36
37
38
39
40
41
42
43
%# By intentionally submitting any modifications, corrections or
%# derivatives to this work, or any other work intended for use with
%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
%# you are the copyright holder for those contributions and you grant
%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
%# royalty-free, perpetual, license to use, copy, create derivative
%# works based on those contributions, and sublicense and distribute
%# those contributions and any derivatives thereof.
Linda Julien's avatar
Linda Julien committed
44
%# 
45
%# END BPS TAGGED BLOCK }}}
46
  <div id="topactions">
47
% foreach my $action (reverse sort keys %{$topactions}) {
48
    <span class="topaction">
49
% $m->out($topactions->{"$action"}->{'html'});
50
    </span>
Linda Julien's avatar
Linda Julien committed
51
% }
52
53
54
  </div>

  <div id="logo">
55
    <a href="http://bestpractical.com"><img src="<%$RT::WebImagesURL%>/bplogo.gif" alt="<%loc("Best Practical Solutions, LLC corporate logo")%>" width="230" height="50"></a>
56
57
58
59
    <div class="rtname"><%$AppName%></div>
  </div>

%# End of div#quickbar from /Elements/Header
60
</div>
61
62
63
64
65

<div id="nav">
<& /Elements/Menu, toptabs => $toptabs, current_toptab => $current_toptab &>
</div>

66
<div id="header" style="padding-top: <% 1.2 * $menu_depth %>em; _padding-top: <% 0.5 * $menu_depth %>;">
67
68
69
70
71
72
  <div class="clear"></div>
  <h1><%$title%></h1>

% my $count = 0;
% my $class = {};
% 
73
  <ul id="page-menu"<% ($actions || $subactions) && q[ class="actions-present"] | n %>>
74
    <div><div><div>
75
% if ($page_tabs) {
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
%     foreach my $tab (sort keys %{$page_tabs}) {
%         next if $tab =~ /^(?:current_toptab|this)$/;
%         $count++;
%
%         my $current = $page_tabs->{current_toptab} || "";
%         my $path    = $page_tabs->{$tab}->{'path'} || "";
%         
%         $path    =~ s#/index.html$##gi;
%         $current =~ s#/index.html$##gi;
%         
%         my $sep = $toptabs->{$tab}->{'separator'} ? 1 : 0;
%
%         $class->{a} = $path eq $current ? ' class="selected"' : undef;
%
%         my @li;
%         push @li, 'first'
%                if $count == 1;
%
%         push @li, 'separator'
%                if $sep;
%
%         $class->{li} = join ' ', @li;
%     
%
    <li<% $class->{li} ? qq[ class="$class->{li}"] : ''|n %>><% $count > 1 && "&#183; "|n%><a href="<%$RT::WebPath%>/<%$page_tabs->{$tab}->{'path'}%>"<%$class->{a}|n%><% $class->{a} ? ' name="focus"' : ''|n %>><% $page_tabs->{$tab}->{'title'} %></a></li>
%     }
102
103
104
% } else {
&nbsp;
% }
105
106
    </div></div></div>
  </ul>
107
108

% if ($actions or $subactions) {
109
  <ul id="actions-menu">
110
    <div><div><div>
111
112
113
114
115
116
117
118
119
% $count = 0;
%
% if ($actions) {
%     my @actions;
%     foreach my $action (sort keys %{$actions}) {
%         $count++;
    <li<% $count == 1 ? q[ class="first"] : '' |n %>><% $count > 1 && "&#183; "|n%>
%         if ($actions->{"$action"}->{'html'}) {
<% $actions->{"$action"}->{'html'} | n %>
120
121
%         } elsif ($actions->{$action}->{separator}) {
&#183;
122
123
124
125
126
%         } else {
<a href="<%$RT::WebPath%>/<%$actions->{$action}->{'path'}%>"><%$actions->{$action}->{'title'}%></a>
%         }
</li>
%     }
127
% }
128
%
Linda Julien's avatar
Linda Julien committed
129
% if ($subactions) {
130
131
132
133
134
135
136
137
138
139
140
%     my $sep;
%     if ($count) {
%         $sep = 1;
<li class="separator">&#183;&#183;&#183;</li>
%     }
%
%     my @actions;
%     foreach my $action (sort keys %{$subactions}) {
%         $count++;
<li<% $count == 1 ? q[ class="first"] : '' |n %>><% $count > 1 && !$sep && "&#183; "|n%><% $subactions->{"$action"}->{'html'} | n %></li>
%     }
Linda Julien's avatar
Linda Julien committed
141
% }
142
    </div></div></div>
143
  </ul>
144
% }
145
</div>
146
147

<div id="body">
148
<& /Elements/Callback, __CallbackName => 'BeforeBody',  %ARGS &>
Jesse Vincent's avatar
Web:    
Jesse Vincent committed
149
%$m->flush_buffer(); # we've got the page laid out, let's flush the buffer;
Linda Julien's avatar
Linda Julien committed
150

151
<%INIT>
Linda Julien's avatar
Linda Julien committed
152
  foreach my $tab (sort keys %{$toptabs}) {
153
    if ($current_toptab && $toptabs->{$tab}->{'path'} eq $current_toptab) {
Linda Julien's avatar
Linda Julien committed
154
155
156
157
      $toptabs->{$tab}->{"subtabs"} = $tabs;
      $toptabs->{$tab}->{"current_subtab"} = $current_tab;
    }
  }
158

Linda Julien's avatar
Linda Julien committed
159
160
161
if (! defined($AppName)) {
  $AppName = loc("RT for [_1]", $RT::rtname);
}
162

163
164
165
166
167
168
169
170
171
172
173
174
175
176
my ($menu_depth, $almost_last) = @{$m->comp('.menu_recurse', data => $toptabs)};
my $page_tabs;

if (defined $almost_last->{subtabs} and %{$almost_last->{subtabs}}) {
    $page_tabs = {
        current_toptab => $almost_last->{current_subtab},
        %{$almost_last->{subtabs}},
    };

    delete $almost_last->{subtabs};
    delete $almost_last->{current_subtab};

#    $almost_last->{last_menu} = 1;
}
Linda Julien's avatar
Linda Julien committed
177
</%INIT>
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204

%# There's probably a better way to do this that involves three times as
%# much work and redoing the whole menu/tab system...
%#
%# This function recurses through the menu and returns the second to
%# last menu, that is, the menu holding the last reference to
%# and submenu.  It also returns the number of menu levels minus
%# the last submenu (used for CSS calcs later (HACK)).
<%def .menu_recurse>
  <%args>
      $data  => { }
      $pdata => { }
      $level => 0
  </%args>
  <%init>
      for my $key (keys %$data) {
          return $m->comp('.menu_recurse', data => $data->{$key}->{subtabs},
                                           pdata => $data->{$key},
                                           level => $level+1)
              if ref($data->{$key}) eq 'HASH'
                 and defined $data->{$key}->{subtabs}
                 and %{$data->{$key}->{subtabs}};
      }
      return [$level, $pdata];
  </%init>
</%def>

Linda Julien's avatar
Linda Julien committed
205
206
207
208
209
210
211
212
<%ARGS>
$current_toptab => undef
$current_tab => undef
$toptabs => undef
$topactions => undef
$tabs => undef
$actions => undef
$subactions => undef
213
$title => $m->callers(-1)->path
Linda Julien's avatar
Linda Julien committed
214
$AppName => undef
Linda Julien's avatar
Linda Julien committed
215
</%ARGS>