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 }}}
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 if ( $item_map->{first} ) {
79 $searchtabs->{'_a'} = {
81 path => "Ticket/Display.html?id=" . $item_map->{first},
82 title => '<< ' . loc('First')
85 $searchtabs->{"_b"} = {
87 path => "Ticket/Display.html?id="
88 . $item_map->{ $Ticket->Id }->{prev},
89 title => '< ' . loc('Prev')
93 # Don't display next links if we're on the last ticket
94 if ( $item_map->{ $Ticket->Id }->{next} ) {
95 $searchtabs->{'d'} = {
97 path => "Ticket/Display.html?id="
98 . $item_map->{ $Ticket->Id }->{next},
99 title => loc('Next') . ' >'
101 if ( $item_map->{last} ) {
102 $searchtabs->{'e'} = {
104 path => "Ticket/Display.html?id=" . $item_map->{last},
105 title => loc('Last') . ' >>'
112 class => "currentnav",
113 path => "Ticket/Display.html?id=" . $Ticket->id,
115 current_subtab => $current_subtab
118 my $ticket_page_tabs = {
120 title => loc('Display'),
121 path => "Ticket/Display.html?id=" . $id,
125 title => loc('History'),
126 path => "Ticket/History.html?id=" . $id,
129 title => loc('Basics'),
130 path => "Ticket/Modify.html?id=" . $id,
134 title => loc('Dates'),
135 path => "Ticket/ModifyDates.html?id=" . $id,
138 title => loc('People'),
139 path => "Ticket/ModifyPeople.html?id=" . $id,
142 title => loc('Links'),
143 path => "Ticket/ModifyLinks.html?id=" . $id,
146 title => loc('Checklist'),
147 path => "Ticket/Checklist.html?id=" . $id,
150 title => loc('Customers'),
151 path => "Ticket/ModifyCustomers.html?id=" . $id,
154 title => loc('Jumbo'),
155 path => "Ticket/ModifyAll.html?id=" . $id,
160 if ( RT->Config->Get('EnableReminders') ) {
161 $ticket_page_tabs->{_F} = {
162 title => loc('Reminders'),
163 path => "Ticket/Reminders.html?id=" . $id,
168 foreach my $tab ( sort keys %{$ticket_page_tabs} ) {
169 if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_tab ) {
170 $ticket_page_tabs->{$tab}->{"subtabs"} = $subtabs;
171 $tabs->{'this'}->{"current_subtab"}
172 = $ticket_page_tabs->{$tab}->{"path"};
175 $tabs->{'this'}->{"subtabs"} = $ticket_page_tabs;
176 $current_tab = "Ticket/Display.html?id=" . $id;
178 my %can = ( ModifyTicket => $Ticket->CurrentUserHasRight('ModifyTicket'), );
180 if ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('ReplyToTicket') )
183 title => loc('Reply'),
184 path => "Ticket/Update.html?Action=Respond&id=" . $id,
188 if ( $Ticket->CurrentUserHasRight('ForwardMessage') )
191 title => loc('Forward'),
192 path => "Ticket/Forward.html?id=" . $id,
196 if ( $can{'ModifyTicket'} ) {
197 if ( $Ticket->Status ne 'resolved' ) {
200 ($Ticket->MissingRequiredFields) ?
201 "Ticket/Modify.html?Status=resolved&id=$id" :
202 "Ticket/Update.html?Action="
203 . RT->Config->Get('ResolveDefaultUpdateType', $session{'CurrentUser'})
204 . "&DefaultStatus=resolved&id="
206 title => loc('Resolve')
209 if ( $Ticket->Status ne 'open' ) {
211 path => "Ticket/Display.html?Status=open&id=" . $id,
212 title => loc('Open it')
217 if ( $Ticket->CurrentUserHasRight('OwnTicket') ) {
218 if ( $Ticket->OwnerObj->Id == $RT::Nobody->id ) {
220 path => "Ticket/Display.html?Action=Take&id=" . $id,
221 title => loc('Take'),
223 if $can{'ModifyTicket'}
224 or $Ticket->CurrentUserHasRight('TakeTicket');
225 } elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id ) {
227 path => "Ticket/Display.html?Action=Steal&id=" . $id,
228 title => loc('Steal'),
230 if $can{'ModifyTicket'}
231 or $Ticket->CurrentUserHasRight('StealTicket');
235 if ( $can{'ModifyTicket'}
236 or $Ticket->CurrentUserHasRight('CommentOnTicket') )
239 title => loc('Comment'),
240 path => "Ticket/Update.html?Action=Comment&id=" . $id,
245 = { html => $m->scomp( '/Ticket/Elements/Bookmark', id => $Ticket->id ),
250 if ( ( defined $actions->{A} || defined $actions->{B} || defined $actions->{C} )
251 && ( defined $actions->{E}
252 || defined $actions->{F}
253 || defined $actions->{G} ) )
256 if ( defined $actions->{C} ) { $actions->{C}->{separator} = 1 }
257 elsif ( defined $actions->{B} ) { $actions->{B}->{separator} = 1 }
258 elsif ( defined $actions->{A} ) { $actions->{A}->{separator} = 1 }
264 my $search_id = $ARGS{'SavedSearchId'}
265 || $session{'CurrentSearchHash'}->{'SearchId'} || '';
266 my $chart_search_id = $ARGS{'SavedChartSearchId'} || '';
268 $has_query = 1 if ( $ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'} );
271 SavedSearchId => ($search_id eq 'new') ? undef : $search_id,
272 SavedChartSearchId => $chart_search_id,
273 Query => $ARGS{'Query'} || $session{'CurrentSearchHash'}->{'Query'},
274 Format => $ARGS{'Format'} || $session{'CurrentSearchHash'}->{'Format'},
275 OrderBy => $ARGS{'OrderBy'}
276 || $session{'CurrentSearchHash'}->{'OrderBy'},
277 Order => $ARGS{'Order'} || $session{'CurrentSearchHash'}->{'Order'},
278 Page => $ARGS{'Page'} || $session{'CurrentSearchHash'}->{'Page'},
279 RowsPerPage => $ARGS{'RowsPerPage'} || $session{'CurrentSearchHash'}->{'RowsPerPage'},
282 $args = "?" . $m->comp( '/Elements/QueryString', %query_args );
285 path => "Search/Build.html?NewQuery=1",
286 title => loc('New Search')
289 path => "Search/Build.html" . (($has_query) ? $args : ''),
290 title => loc('Edit Search')
293 path => "Search/Edit.html$args",
294 title => loc('Advanced'),
299 if ( $current_tab =~ m{Search/Results.html} ) {
300 $current_tab = "Search/Results.html$args";
302 if ( $session{'CurrentUser'}
303 ->HasRight( Right => 'SuperUser', Object => $RT::System ) )
305 my $shred_args = $m->comp(
306 '/Elements/QueryString',
309 'Tickets:query' => $query_args{'Query'},
310 'Tickets:limit' => $query_args{'Rows'}
313 $tabs->{"shredder"} = {
314 path => 'Admin/Tools/Shredder/?' . $shred_args,
315 title => loc('Shredder')
320 if ( $current_tab =~ m{Search/(Bulk|Build|Edit)\.html} ) {
321 $current_tab = "Search/$1.html$args";
325 path => "Search/Results.html$args",
326 title => loc('Show Results'),
330 path => "Search/Bulk.html$args",
331 title => loc('Bulk Update'),
335 path => "Search/Chart.html$args",
336 title => loc('Graph'),
340 path => "Prefs/SavedSearches.html",
341 title => 'Saved Searches',
346 foreach my $searchtab ( keys %{$searchtabs} ) {
347 ( $searchtab =~ /^_/ )
348 ? $tabs->{ "s" . $searchtab } = $searchtabs->{$searchtab}
349 : $tabs->{ "z_" . $searchtab } = $searchtabs->{$searchtab};
359 $current_subtab => ''
361 $RowsPerPage => undef