1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2005 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., 675 Mass Ave, Cambridge, MA 02139, USA.
28 %# CONTRIBUTION SUBMISSION POLICY:
30 %# (The following paragraph is not intended to limit the rights granted
31 %# to you to modify and distribute this software under the terms of
32 %# the GNU General Public License and is only of importance to you if
33 %# you choose to contribute your changes and enhancements to the
34 %# community by submitting them to Best Practical Solutions, LLC.)
36 %# By intentionally submitting any modifications, corrections or
37 %# derivatives to this work, or any other work intended for use with
38 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
39 %# you are the copyright holder for those contributions and you grant
40 %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
41 %# royalty-free, perpetual, license to use, copy, create derivative
42 %# works based on those contributions, and sublicense and distribute
43 %# those contributions and any derivatives thereof.
45 %# END BPS TAGGED BLOCK }}}
46 <& /Elements/Callback, Ticket => $Ticket, actions=> $actions, tabs => $tabs, %ARGS &>
50 current_tab => $current_tab,
51 current_toptab => $current_toptab,
56 my $current_toptab = "Search/Build.html",
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') };
82 $searchtabs->{"_b"} = { class => "nav",
83 path => "Ticket/Display.html?id=" . $item_map->{$Ticket->Id}->{prev},
84 title => '< ' . loc('Prev') };
88 # Don't display next links if we're on the last ticket
89 if ($item_map->{$Ticket->Id}->{next}) {
90 $searchtabs->{'d'} = { class => "nav",
91 path => "Ticket/Display.html?id=" . $item_map->{$Ticket->Id}->{next},
92 title => loc('Next') . ' >' };
93 $searchtabs->{'e'} = {
95 path => "Ticket/Display.html?id=" . $item_map->{last},
96 title => loc('Last') . ' >>' };
102 $tabs->{"this"} = { class => "currentnav",
103 path => "Ticket/Display.html?id=" . $Ticket->id,
105 current_subtab => $current_subtab };
107 my $ticket_page_tabs = {
108 _A => { title => loc('Display'),
109 path => "Ticket/Display.html?id=" . $id, },
111 _Ab => { title => loc('History'),
112 path => "Ticket/History.html?id=" . $id, },
113 _B => { title => loc('Basics'),
114 path => "Ticket/Modify.html?id=" . $id, },
116 _C => { title => loc('Dates'),
117 path => "Ticket/ModifyDates.html?id=" . $id, },
119 { title => loc('People'), path => "Ticket/ModifyPeople.html?id=" . $id, },
120 _E => { title => loc('Links'),
121 path => "Ticket/ModifyLinks.html?id=" . $id, },
122 _Eb=> { title => loc('Customers'),
123 path => "Ticket/ModifyCustomers.html?id=" . $id, },
124 _F => { title => loc('Jumbo'),
125 path => "Ticket/ModifyAll.html?id=" . $id,
131 foreach my $tab ( sort keys %{$ticket_page_tabs} ) {
132 if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_tab ) {
133 $ticket_page_tabs->{$tab}->{"subtabs"} = $subtabs;
134 $tabs->{'this'}->{"current_subtab"} =
135 $ticket_page_tabs->{$tab}->{"path"};
138 $tabs->{'this'}->{"subtabs"} = $ticket_page_tabs;
139 $current_tab = "Ticket/Display.html?id=" . $id;
145 if ( $Ticket->CurrentUserHasRight('ModifyTicket')
146 or $Ticket->CurrentUserHasRight('ReplyToTicket') ) {
147 $actions->{'A'} = { title => loc('Reply'),
148 path => "Ticket/Update.html?Action=Respond&id=" . $id,
152 if ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
153 if ( $Ticket->Status ne 'resolved' ) {
156 path => "Ticket/Update.html?Action=Comment&DefaultStatus=resolved&id=" . $id,
157 title => loc('Resolve') };
159 if ( $Ticket->Status ne 'open' ) {
160 $actions->{'C'} = { path => "Ticket/Display.html?Status=open&id=" . $id,
161 title => loc('Open it') };
165 if ( $Ticket->CurrentUserHasRight('OwnTicket') ) {
166 if ( $Ticket->OwnerObj->id == $RT::Nobody->id ) {
167 $actions->{'D'} = { path => "Ticket/Display.html?Action=Take&id=" . $id,
168 title => loc('Take') };
170 elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id ) {
171 $actions->{'E'} = {path => "Ticket/Display.html?Action=Steal&id=" . $id,
172 title => loc('Steal') };
176 if ( $Ticket->CurrentUserHasRight('ModifyTicket')
177 or $Ticket->CurrentUserHasRight('CommentOnTicket') ) {
178 $actions->{'F'} = { title => loc('Comment'),
179 path => "Ticket/Update.html?Action=Comment&id=" . $id,
184 my $args = "?" . $m->comp(
185 '/Elements/QueryString',
186 Query => $ARGS{'Query'} || $session{'CurrentSearchHash'}->{'Query'},
187 Format => $ARGS{'Format'} || $session{'CurrentSearchHash'}->{'Format'},
188 OrderBy => $ARGS{'OrderBy'} || $session{'CurrentSearchHash'}->{'OrderBy'},
189 Order => $ARGS{'Order'} || $session{'CurrentSearchHash'}->{'Order'},
190 Rows => $ARGS{'Rows'},
191 ) if ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'});
194 $tabs->{"f"} = { path => "Search/Build.html?NewQuery=1",
195 title => loc('New Query')};
196 $tabs->{"g"} = { path => "Search/Build.html$args",
197 title => loc('Query Builder')};
198 $tabs->{"h"} = { path => "Search/Edit.html$args",
199 title => loc('Advanced'),
201 if (defined $session{'tickets'} and $session{'tickets'}->Count) {
202 $tabs->{"i"} = { path => "Search/Results.html$args",
203 title => loc('Show Results'),
205 subtabs => $searchtabs };
206 if ($current_tab =~ "Search/Results.html") {
207 $current_tab = "Search/Results.html$args";
218 $current_subtab => ''