1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
6 %# <sales@bestpractical.com>
8 %# (Except where explicitly superseded by other copyright notices)
13 %# This work is made available to you under the terms of Version 2 of
14 %# the GNU General Public License. A copy of that license should have
15 %# been provided with this software, but in any event can be snarfed
18 %# This work is distributed in the hope that it will be useful, but
19 %# WITHOUT ANY WARRANTY; without even the implied warranty of
20 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 %# General Public License for more details.
23 %# You should have received a copy of the GNU General Public License
24 %# along with this program; if not, write to the Free Software
25 %# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 %# 02110-1301 or visit their web page on the internet at
27 %# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
30 %# CONTRIBUTION SUBMISSION POLICY:
32 %# (The following paragraph is not intended to limit the rights granted
33 %# to you to modify and distribute this software under the terms of
34 %# the GNU General Public License and is only of importance to you if
35 %# you choose to contribute your changes and enhancements to the
36 %# community by submitting them to Best Practical Solutions, LLC.)
38 %# By intentionally submitting any modifications, corrections or
39 %# derivatives to this work, or any other work intended for use with
40 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
41 %# you are the copyright holder for those contributions and you grant
42 %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
43 %# royalty-free, perpetual, license to use, copy, create derivative
44 %# works based on those contributions, and sublicense and distribute
45 %# those contributions and any derivatives thereof.
47 %# END BPS TAGGED BLOCK }}}
49 <% include('/elements/init_calendar.html') |n %>
51 % if (0) { ## new ticket via customer, and we already have a ticket search box
53 % foreach my $action (reverse sort keys %{$topactions}) {
54 <span class="topaction" id="topaction-<%$action%>"><% $topactions->{"$action"}->{'html'} |n %></span>
59 % if (0) { ##FREESIDE MENUS INSTEAD## if ( $show_menu ) {
62 <& /Elements/Menu, toptabs => $toptabs, current_toptab => $current_toptab &>
68 %#already shown <h1><% $title %></h1>
69 <div id="page-navigation">
75 <ul id="page-menu" <% (($actions && %$actions) || ($subactions && %$subactions)) && q[ class="actions-present"] | n %>>
79 my @tabs = ( sort grep { $_ !~ /^(?:current_toptab|this)$/ } keys %{$page_tabs});
81 foreach my $tab ( @tabs ) {
85 my $current = $page_tabs->{current_toptab} || "";
86 my $path = $page_tabs->{$tab}->{'path'} || "";
88 $path =~ s#(/index\.html)?(\?)?$##gi;
89 $current =~ s#(/index\.html)?(\?)?$##gi;
91 $sep = $toptabs->{$tab}->{'separator'} ? 1 : 0;
93 my $next_tab = $tabs[$tab_idx+1];
94 if ($next_tab && $toptabs->{$next_tab}->{'pre_separator'}) {
98 $class->{a} = $path eq $current ? ' class="selected"' : undef;
101 push @li, 'first' if $count == 1;
102 push @li, 'pre-separator' if $sep;
103 push @li, 'post-separator' if $postsep;
104 push @li, 'last' if $tab eq $tabs[-1];
105 $class->{li} = join ' ', @li;
107 my $href = $page_tabs->{$tab}->{'path'} || "";
108 $href = RT->Config->Get('WebPath') .'/'. $href
109 unless $path =~ /^\w+:/;
110 my $target = $page_tabs->{$tab}->{'target'} || '';
111 $target = $m->interp->apply_escapes( $target, 'h' );
113 <li<% $class->{li} ? qq[ class="$class->{li}"] : ''|n %>><% $count > 1 && !$postsep && "· "|n%><a href="<% $href %>"<%$class->{a}|n%><% $class->{a} ? ' name="focus"' : ''|n %><% $target? " target='$target'": '' |n %>><% $page_tabs->{$tab}->{'title'} %></a></li>
116 <li class="separator">···</li>
126 % if (($actions && %$actions) || ($subactions && %$subactions)) {
127 <ul id="actions-menu">
135 for my $type ($actions, $subactions) {
137 if ($type && %$type) {
138 my @actions = sort keys %{$type};
140 foreach my $action (@actions) {
144 $sep = $type->{$action}->{'separator'} ? 1 : 0;
146 my $next_action = $actions[$action_idx+1];
147 if ($next_action && $type->{$next_action}->{'pre_separator'}) {
152 push @li, 'first' if $count == 1;
153 push @li, 'pre-separator' if $sep;
154 push @li, 'post-separator' if $postsep;
155 push @li, 'last' if $action eq $actions[-1];
157 $class->{li} = join ' ', @li;
159 <li<% $class->{li} ? qq[ class="$class->{li}"] : ''|n %>><% $count > 1 && !$postsep && qq[<span class="bullet">· </span>]|n%>
160 % if ($type->{"$action"}->{'html'}) {
161 <% $type->{"$action"}->{'html'} | n %>
163 <a href="<%RT->Config->Get('WebPath')%>/<%$type->{$action}->{'path'}%>"<% $type->{$action}->{class} && ' class="'.$type->{$action}->{class}.'"' |n %><% $type->{$action}->{id} && ' id="'.$type->{$action}->{id}.'"' |n %>><%$type->{$action}->{'title'}%></a>
167 <li class="separator">···</li>
179 % $m->callback( %ARGS, CallbackName => 'BeforeBody' );
180 % $m->flush_buffer(); # we've got the page laid out, let's flush the buffer;
183 if ( defined $current_toptab ) {
184 foreach my $tab ( values %{$toptabs} ) {
185 next unless $tab->{'path'} eq $current_toptab;
186 @{ $tab }{ qw(subtabs current_subtab) } = ($tabs, $current_tab);
190 my ($menu_depth, $almost_last, $page_tabs);
192 # don't pull out the last submenu for 3.5-compat theme
193 # see #14853 for details.
194 if (RT->Config->Get( 'WebDefaultStylesheet', $session{'CurrentUser'} ) ne '3.4-compat') {
195 ($menu_depth, $almost_last) = @{ $m->comp('.menu_recurse', data => $toptabs, current => $current_toptab ) };
197 if (defined $almost_last->{subtabs} and %{$almost_last->{subtabs}}) {
199 current_toptab => $almost_last->{current_subtab},
200 %{$almost_last->{subtabs}},
203 delete $almost_last->{subtabs};
204 delete $almost_last->{current_subtab};
209 %# There's probably a better way to do this that involves three times as
210 %# much work and redoing the whole menu/tab system... which would seem a
213 %# This function recurses through the menu and returns the second to
214 %# last menu, that is, the menu holding the last reference to
215 %# and submenu. It also returns the number of menu levels minus
227 for my $key (keys %$data) {
228 next if !defined $data->{$key}->{'path'}
229 || $data->{$key}->{'path'} ne $current;
230 next unless ref( $data->{$key} ) eq 'HASH'
231 && ref( $data->{$key}->{'subtabs'} ) eq 'HASH'
232 && keys %{ $data->{$key}->{'subtabs'} };
233 return $m->comp('.menu_recurse',
234 data => $data->{$key}->{'subtabs'},
235 current => $data->{$key}->{'current_subtab'} || '',
236 pdata => $data->{$key},
242 $ppdata->{last_system_menu_level}++;
243 return [$level, $pdata];
248 $current_toptab => undef
249 $current_tab => undef
255 $title => $m->callers(-1)->path