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'} ) {
49 my $item_map = $session{'tickets'}->ItemMap;
51 # Don't $current_toptab = display prev links if we're on the first ticket
53 if ($item_map->{$Ticket->Id}->{prev}) {
54 $searchtabs->{'_a'} = {
56 path => "Ticket/Display.html?id=" . $item_map->{first},
57 title => '<< ' . loc('First') };
58 $searchtabs->{"_b"} = { class => "nav",
59 path => "Ticket/Display.html?id=" . $item_map->{$Ticket->Id}->{prev},
60 title => '< ' . loc('Prev') };
64 # Don't display next links if we're on the last ticket
65 if ($item_map->{$Ticket->Id}->{next}) {
66 $searchtabs->{'d'} = { class => "nav",
67 path => "Ticket/Display.html?id=" . $item_map->{$Ticket->Id}->{next},
68 title => loc('Next') . ' >' };
69 $searchtabs->{'e'} = {
71 path => "Ticket/Display.html?id=" . $item_map->{last},
72 title => loc('Last') . ' >>' };
78 $tabs->{"this"} = { class => "currentnav",
79 path => "Ticket/Display.html?id=" . $Ticket->id,
81 current_subtab => $current_subtab };
83 my $ticket_page_tabs = {
84 _A => { title => loc('Display'),
85 path => "Ticket/Display.html?id=" . $id, },
87 _Ab => { title => loc('History'),
88 path => "Ticket/History.html?id=" . $id, },
89 _B => { title => loc('Basics'),
90 path => "Ticket/Modify.html?id=" . $id, },
92 _C => { title => loc('Dates'),
93 path => "Ticket/ModifyDates.html?id=" . $id, },
95 { title => loc('People'), path => "Ticket/ModifyPeople.html?id=" . $id, },
96 _E => { title => loc('Links'),
97 path => "Ticket/ModifyLinks.html?id=" . $id, },
98 _F => { title => loc('Jumbo'),
99 path => "Ticket/ModifyAll.html?id=" . $id,
105 foreach my $tab ( sort keys %{$ticket_page_tabs} ) {
106 if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_tab ) {
107 $ticket_page_tabs->{$tab}->{"subtabs"} = $subtabs;
108 $tabs->{'this'}->{"current_subtab"} =
109 $ticket_page_tabs->{$tab}->{"path"};
112 $tabs->{'this'}->{"subtabs"} = $ticket_page_tabs;
113 $current_tab = "Ticket/Display.html?id=" . $id;
119 if ( $Ticket->CurrentUserHasRight('ModifyTicket')
120 or $Ticket->CurrentUserHasRight('ReplyToTicket') ) {
121 $actions->{'A'} = { title => loc('Reply'),
122 path => "Ticket/Update.html?Action=Respond&id=" . $id,
126 if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
127 if ( $Ticket->Status ne 'resolved' ) {
130 path => "Ticket/Update.html?Action=Comment&DefaultStatus=resolved&id=" . $id,
131 title => loc('Resolve') };
133 if ( $Ticket->Status ne 'open' ) {
134 $actions->{'C'} = { path => "Ticket/Display.html?Status=open&id=" . $id,
135 title => loc('Open it') };
139 if ( $Ticket->CurrentUserHasRight('OwnTicket') ) {
140 if ( $Ticket->OwnerObj->id == $RT::Nobody->id ) {
141 $actions->{'D'} = { path => "Ticket/Display.html?Action=Take&id=" . $id,
142 title => loc('Take') };
144 elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id ) {
145 $actions->{'E'} = {path => "Ticket/Display.html?Action=Steal&id=" . $id,
146 title => loc('Steal') };
150 if ( $Ticket->CurrentUserHasRight('ModifyTicket')
151 or $Ticket->CurrentUserHasRight('CommentOnTicket') ) {
152 $actions->{'F'} = { title => loc('Comment'),
153 path => "Ticket/Update.html?Action=Comment&id=" . $id,
157 $tabs->{"g"} = { path => 'Search/Listing.html',
158 title => loc('Search'),
160 subtabs => $searchtabs };
167 $current_tab => undef
168 $current_subtab => undef