3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
5 %# (Except where explictly superceded by other copyright notices)
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
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.
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.
24 <& /Elements/Callback, Ticket => $Ticket, actions=> $actions, tabs => $tabs, %ARGS &>
28 current_tab => $current_tab,
29 current_toptab => $current_toptab,
34 my $current_toptab = "Search/Listing.html",
35 my $searchtabs = { new => { title => loc('New Search'),
36 path => 'Search/Listing.html?ClearRestrictions=1'}
44 my $id = $Ticket->id();
46 if ( defined $session{'tickets'} ) {
48 # we have to update session data if we get new ItemMap
49 my $updatesession = 1 unless($session{'tickets'}->{'item_map'});
51 my $item_map = $session{'tickets'}->ItemMap;
55 $session{'tickets'}->PrepForSerialization();
58 # Don't $current_toptab = display prev links if we're on the first ticket
59 if ($item_map->{$Ticket->Id}->{prev}) {
60 $searchtabs->{'_a'} = {
62 path => "Ticket/Display.html?id=" . $item_map->{first},
63 title => '<< ' . loc('First') };
64 $searchtabs->{"_b"} = { class => "nav",
65 path => "Ticket/Display.html?id=" . $item_map->{$Ticket->Id}->{prev},
66 title => '< ' . loc('Prev') };
70 # Don't display next links if we're on the last ticket
71 if ($item_map->{$Ticket->Id}->{next}) {
72 $searchtabs->{'d'} = { class => "nav",
73 path => "Ticket/Display.html?id=" . $item_map->{$Ticket->Id}->{next},
74 title => loc('Next') . ' >' };
75 $searchtabs->{'e'} = {
77 path => "Ticket/Display.html?id=" . $item_map->{last},
78 title => loc('Last') . ' >>' };
84 $tabs->{"this"} = { class => "currentnav",
85 path => "Ticket/Display.html?id=" . $Ticket->id,
87 current_subtab => $current_subtab };
89 my $ticket_page_tabs = {
90 _A => { title => loc('Display'),
91 path => "Ticket/Display.html?id=" . $id, },
93 _Ab => { title => loc('History'),
94 path => "Ticket/History.html?id=" . $id, },
95 _B => { title => loc('Basics'),
96 path => "Ticket/Modify.html?id=" . $id, },
98 _C => { title => loc('Dates'),
99 path => "Ticket/ModifyDates.html?id=" . $id, },
101 { title => loc('People'), path => "Ticket/ModifyPeople.html?id=" . $id, },
102 _E => { title => loc('Links'),
103 path => "Ticket/ModifyLinks.html?id=" . $id, },
104 _F => { title => loc('Jumbo'),
105 path => "Ticket/ModifyAll.html?id=" . $id,
111 foreach my $tab ( sort keys %{$ticket_page_tabs} ) {
112 if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_tab ) {
113 $ticket_page_tabs->{$tab}->{"subtabs"} = $subtabs;
114 $tabs->{'this'}->{"current_subtab"} =
115 $ticket_page_tabs->{$tab}->{"path"};
118 $tabs->{'this'}->{"subtabs"} = $ticket_page_tabs;
119 $current_tab = "Ticket/Display.html?id=" . $id;
125 if ( $Ticket->CurrentUserHasRight('ModifyTicket')
126 or $Ticket->CurrentUserHasRight('ReplyToTicket') ) {
127 $actions->{'A'} = { title => loc('Reply'),
128 path => "Ticket/Update.html?Action=Respond&id=" . $id,
132 if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
133 if ( $Ticket->Status ne 'resolved' ) {
136 path => "Ticket/Update.html?Action=Comment&DefaultStatus=resolved&id=" . $id,
137 title => loc('Resolve') };
139 if ( $Ticket->Status ne 'open' ) {
140 $actions->{'C'} = { path => "Ticket/Display.html?Status=open&id=" . $id,
141 title => loc('Open it') };
145 if ( $Ticket->CurrentUserHasRight('OwnTicket') ) {
146 if ( $Ticket->OwnerObj->id == $RT::Nobody->id ) {
147 $actions->{'D'} = { path => "Ticket/Display.html?Action=Take&id=" . $id,
148 title => loc('Take') };
150 elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id ) {
151 $actions->{'E'} = {path => "Ticket/Display.html?Action=Steal&id=" . $id,
152 title => loc('Steal') };
156 if ( $Ticket->CurrentUserHasRight('ModifyTicket')
157 or $Ticket->CurrentUserHasRight('CommentOnTicket') ) {
158 $actions->{'F'} = { title => loc('Comment'),
159 path => "Ticket/Update.html?Action=Comment&id=" . $id,
163 $tabs->{"g"} = { path => 'Search/Listing.html',
164 title => loc('Search'),
166 subtabs => $searchtabs };
173 $current_tab => undef
174 $current_subtab => undef