1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
6 %# <jesse@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 }}}
48 % $m->callback( Ticket => $Ticket, actions=> $actions, tabs => $tabs, %ARGS );
52 current_tab => $current_tab,
53 current_toptab => $current_toptab,
57 my $current_toptab = "Search/Build.html", my $searchtabs = {};
62 my $id = $Ticket->id();
64 if ( defined $session{'tickets'} ) {
66 # we have to update session data if we get new ItemMap
67 my $updatesession = 1 unless ( $session{'tickets'}->{'item_map'} );
69 my $item_map = $session{'tickets'}->ItemMap;
73 $session{'tickets'}->PrepForSerialization();
76 # Don't display prev links if we're on the first ticket
77 if ( $item_map->{ $Ticket->Id }->{prev} ) {
78 $searchtabs->{'_a'} = {
80 path => "Ticket/Display.html?id=" . $item_map->{first},
81 title => '<< ' . loc('First')
83 $searchtabs->{"_b"} = {
85 path => "Ticket/Display.html?id="
86 . $item_map->{ $Ticket->Id }->{prev},
87 title => '< ' . loc('Prev')
91 # Don't display next links if we're on the last ticket
92 if ( $item_map->{ $Ticket->Id }->{next} ) {
93 $searchtabs->{'d'} = {
95 path => "Ticket/Display.html?id="
96 . $item_map->{ $Ticket->Id }->{next},
97 title => loc('Next') . ' >'
99 $searchtabs->{'e'} = {
101 path => "Ticket/Display.html?id=" . $item_map->{last},
102 title => loc('Last') . ' >>'
108 class => "currentnav",
109 path => "Ticket/Display.html?id=" . $Ticket->id,
111 current_subtab => $current_subtab
114 my $ticket_page_tabs = {
116 title => loc('Display'),
117 path => "Ticket/Display.html?id=" . $id,
121 title => loc('History'),
122 path => "Ticket/History.html?id=" . $id,
125 title => loc('Basics'),
126 path => "Ticket/Modify.html?id=" . $id,
130 title => loc('Dates'),
131 path => "Ticket/ModifyDates.html?id=" . $id,
134 title => loc('People'),
135 path => "Ticket/ModifyPeople.html?id=" . $id,
138 title => loc('Links'),
139 path => "Ticket/ModifyLinks.html?id=" . $id,
142 title => loc('Customers'),
143 path => "Ticket/ModifyCustomers.html?id=" . $id,
146 title => loc('Jumbo'),
147 path => "Ticket/ModifyAll.html?id=" . $id,
152 if ( RT->Config->Get('EnableReminders') ) {
153 $ticket_page_tabs->{_F} = {
154 title => loc('Reminders'),
155 path => "Ticket/Reminders.html?id=" . $id,
160 foreach my $tab ( sort keys %{$ticket_page_tabs} ) {
161 if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_tab ) {
162 $ticket_page_tabs->{$tab}->{"subtabs"} = $subtabs;
163 $tabs->{'this'}->{"current_subtab"}
164 = $ticket_page_tabs->{$tab}->{"path"};
167 $tabs->{'this'}->{"subtabs"} = $ticket_page_tabs;
168 $current_tab = "Ticket/Display.html?id=" . $id;
170 my %can = ( ModifyTicket => $Ticket->CurrentUserHasRight('ModifyTicket'), );
172 if ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('ReplyToTicket') )
175 title => loc('Reply'),
176 path => "Ticket/Update.html?Action=Respond&id=" . $id,
180 if ( $Ticket->CurrentUserHasRight('ForwardMessage') )
183 title => loc('Forward'),
184 path => "Ticket/Forward.html?id=" . $id,
188 if ( $can{'ModifyTicket'} ) {
189 if ( $Ticket->Status ne 'resolved' ) {
192 "Ticket/Update.html?Action=Comment&DefaultStatus=resolved&id="
194 title => loc('Resolve')
197 if ( $Ticket->Status ne 'open' ) {
199 path => "Ticket/Display.html?Status=open&id=" . $id,
200 title => loc('Open it')
205 if ( $Ticket->CurrentUserHasRight('OwnTicket') ) {
206 if ( $Ticket->OwnerObj->Id == $RT::Nobody->id ) {
208 path => "Ticket/Display.html?Action=Take&id=" . $id,
209 title => loc('Take'),
211 if $can{'ModifyTicket'}
212 or $Ticket->CurrentUserHasRight('TakeTicket');
213 } elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id ) {
215 path => "Ticket/Display.html?Action=Steal&id=" . $id,
216 title => loc('Steal'),
218 if $can{'ModifyTicket'}
219 or $Ticket->CurrentUserHasRight('StealTicket');
223 if ( $can{'ModifyTicket'}
224 or $Ticket->CurrentUserHasRight('CommentOnTicket') )
227 title => loc('Comment'),
228 path => "Ticket/Update.html?Action=Comment&id=" . $id,
233 = { html => $m->scomp( '/Ticket/Elements/Bookmark', id => $Ticket->id ),
238 if ( ( defined $actions->{A} || defined $actions->{B} || defined $actions->{C} )
239 && ( defined $actions->{E}
240 || defined $actions->{F}
241 || defined $actions->{G} ) )
244 if ( defined $actions->{C} ) { $actions->{C}->{separator} = 1 }
245 elsif ( defined $actions->{B} ) { $actions->{B}->{separator} = 1 }
246 elsif ( defined $actions->{A} ) { $actions->{A}->{separator} = 1 }
252 my $search_id = $ARGS{'SavedSearchId'}
253 || $session{'CurrentSearchHash'}->{'SearchId'} || '';
254 my $chart_search_id = $ARGS{'SavedChartSearchId'} || '';
256 $has_query = 1 if ( $ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'} );
259 SavedSearchId => ($search_id eq 'new') ? undef : $search_id,
260 SavedChartSearchId => $chart_search_id,
261 Query => $ARGS{'Query'} || $session{'CurrentSearchHash'}->{'Query'},
262 Format => $ARGS{'Format'} || $session{'CurrentSearchHash'}->{'Format'},
263 OrderBy => $ARGS{'OrderBy'}
264 || $session{'CurrentSearchHash'}->{'OrderBy'},
265 Order => $ARGS{'Order'} || $session{'CurrentSearchHash'}->{'Order'},
266 Page => $ARGS{'Page'} || $session{'CurrentSearchHash'}->{'Page'},
267 RowsPerPage => $ARGS{'RowsPerPage'} || $session{'CurrentSearchHash'}->{'RowsPerPage'},
270 $args = "?" . $m->comp( '/Elements/QueryString', %query_args );
273 path => "Search/Build.html?NewQuery=1",
274 title => loc('New Search')
277 path => "Search/Build.html" . (($has_query) ? $args : ''),
278 title => loc('Edit Search')
281 path => "Search/Edit.html$args",
282 title => loc('Advanced'),
287 if ( $current_tab =~ m{Search/Results.html} ) {
288 $current_tab = "Search/Results.html$args";
290 if ( $session{'CurrentUser'}
291 ->HasRight( Right => 'SuperUser', Object => $RT::System ) )
293 my $shred_args = $m->comp(
294 '/Elements/QueryString',
297 'Tickets:query' => $query_args{'Query'},
298 'Tickets:limit' => $query_args{'Rows'}
301 $tabs->{"shredder"} = {
302 path => 'Admin/Tools/Shredder/?' . $shred_args,
303 title => loc('Shredder')
308 if ( $current_tab =~ m{Search/(Bulk|Build|Edit)\.html} ) {
309 $current_tab = "Search/$1.html$args";
313 path => "Search/Results.html$args",
314 title => loc('Show Results'),
318 path => "Search/Bulk.html$args",
319 title => loc('Bulk Update'),
323 path => "Search/Chart.html$args",
324 title => loc('Graph'),
329 foreach my $searchtab ( keys %{$searchtabs} ) {
330 ( $searchtab =~ /^_/ )
331 ? $tabs->{ "s" . $searchtab } = $searchtabs->{$searchtab}
332 : $tabs->{ "z_" . $searchtab } = $searchtabs->{$searchtab};
342 $current_subtab => ''
344 $RowsPerPage => undef