1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2007 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/copyleft/gpl.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 <& /Elements/Callback, Ticket => $Ticket, actions=> $actions, tabs => $tabs, %ARGS &>
52 current_tab => $current_tab,
53 current_toptab => $current_toptab,
58 my $current_toptab = "Search/Build.html",
64 my $id = $Ticket->id();
66 if ( defined $session{'tickets'} ) {
68 # we have to update session data if we get new ItemMap
69 my $updatesession = 1 unless($session{'tickets'}->{'item_map'});
71 my $item_map = $session{'tickets'}->ItemMap;
75 $session{'tickets'}->PrepForSerialization();
78 # Don't display prev links if we're on the first ticket
79 if ($item_map->{$Ticket->Id}->{prev}) {
80 $searchtabs->{'_a'} = {
82 path => "Ticket/Display.html?id=" . $item_map->{first},
83 title => '<< ' . loc('First') };
84 $searchtabs->{"_b"} = { class => "nav",
85 path => "Ticket/Display.html?id=" . $item_map->{$Ticket->Id}->{prev},
86 title => '< ' . loc('Prev') };
90 # Don't display next links if we're on the last ticket
91 if ($item_map->{$Ticket->Id}->{next}) {
92 $searchtabs->{'d'} = { class => "nav",
93 path => "Ticket/Display.html?id=" . $item_map->{$Ticket->Id}->{next},
94 title => loc('Next') . ' >' };
95 $searchtabs->{'e'} = {
97 path => "Ticket/Display.html?id=" . $item_map->{last},
98 title => loc('Last') . ' >>' };
104 $tabs->{"this"} = { class => "currentnav",
105 path => "Ticket/Display.html?id=" . $Ticket->id,
107 current_subtab => $current_subtab };
109 my $ticket_page_tabs = {
110 _A => { title => loc('Display'),
111 path => "Ticket/Display.html?id=" . $id, },
113 _Ab => { title => loc('History'),
114 path => "Ticket/History.html?id=" . $id, },
115 _B => { title => loc('Basics'),
116 path => "Ticket/Modify.html?id=" . $id, },
118 _C => { title => loc('Dates'),
119 path => "Ticket/ModifyDates.html?id=" . $id, },
121 { title => loc('People'), path => "Ticket/ModifyPeople.html?id=" . $id, },
122 _E => { title => loc('Links'),
123 path => "Ticket/ModifyLinks.html?id=" . $id, },
124 _Eb=> { title => loc('Customers'),
125 path => "Ticket/ModifyCustomers.html?id=" . $id, },
126 _F => { title => loc('Reminders'),
127 path => "Ticket/Reminders.html?id=" . $id,
129 _X => { title => loc('Jumbo'),
130 path => "Ticket/ModifyAll.html?id=" . $id,
135 foreach my $tab ( sort keys %{$ticket_page_tabs} ) {
136 if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_tab ) {
137 $ticket_page_tabs->{$tab}->{"subtabs"} = $subtabs;
138 $tabs->{'this'}->{"current_subtab"} =
139 $ticket_page_tabs->{$tab}->{"path"};
142 $tabs->{'this'}->{"subtabs"} = $ticket_page_tabs;
143 $current_tab = "Ticket/Display.html?id=" . $id;
146 ModifyTicket => $Ticket->CurrentUserHasRight('ModifyTicket'),
149 if ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('ReplyToTicket') ) {
151 title => loc('Reply'),
152 path => "Ticket/Update.html?Action=Respond&id=" . $id,
156 if ( $can{'ModifyTicket'} ) {
157 if ( $Ticket->Status ne 'resolved' ) {
159 path => "Ticket/Update.html?Action=Comment&DefaultStatus=resolved&id=" . $id,
160 title => loc('Resolve') };
162 if ( $Ticket->Status ne 'open' ) {
163 $actions->{'A'} = { path => "Ticket/Display.html?Status=open&id=" . $id,
164 title => loc('Open it') };
168 if ( $Ticket->CurrentUserHasRight('OwnTicket') ) {
169 if ( $Ticket->OwnerObj->Id == $RT::Nobody->id
170 and ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('TakeTicket') ) )
173 path => "Ticket/Display.html?Action=Take&id=" . $id,
174 title => loc('Take'),
177 elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id
178 and ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('StealTicket') ) )
181 path => "Ticket/Display.html?Action=Steal&id=" . $id,
182 title => loc('Steal'),
187 if ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('CommentOnTicket') ) {
189 title => loc('Comment'),
190 path => "Ticket/Update.html?Action=Comment&id=" . $id,
195 if ( (defined $actions->{A} || defined $actions->{B} || defined $actions->{C})
196 && (defined $actions->{E} || defined $actions->{F} || defined $actions->{G}) ) {
198 if (defined $actions->{C}) { $actions->{C}->{separator} = 1 }
199 elsif (defined $actions->{B}) { $actions->{B}->{separator} = 1 }
200 elsif (defined $actions->{A}) { $actions->{A}->{separator} = 1 }
204 $args= "?" . $m->comp(
205 '/Elements/QueryString',
206 Query => $ARGS{'Query'} || $session{'CurrentSearchHash'}->{'Query'},
207 Format => $ARGS{'Format'} || $session{'CurrentSearchHash'}->{'Format'},
208 OrderBy => $ARGS{'OrderBy'} || $session{'CurrentSearchHash'}->{'OrderBy'},
209 Order => $ARGS{'Order'} || $session{'CurrentSearchHash'}->{'Order'},
210 Page => $ARGS{'Page'} || $session{'CurrentSearchHash'}->{'Page'},
211 Rows => $ARGS{'Rows'},
212 ) if ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'});
215 $tabs->{"f"} = { path => "Search/Build.html?NewQuery=1",
216 title => loc('New Search')};
217 $tabs->{"g"} = { path => "Search/Build.html$args",
218 title => loc('Edit Search')};
219 $tabs->{"h"} = { path => "Search/Edit.html$args",
220 title => loc('Advanced'),
223 $tabs->{"i"} = { path => "Search/Results.html$args",
224 title => loc('Show Results'),
226 if ($current_tab =~ "Search/Results.html") {
227 $current_tab = "Search/Results.html$args";
229 $tabs->{"j"} = { path => "Search/Bulk.html$args",
230 title => loc('Bulk Update'),
232 if ($current_tab =~ "Search/Bulk.html") {
233 $current_tab = "Search/Bulk.html$args";
235 foreach my $searchtab (keys %{$searchtabs}) {
236 ($searchtab =~ /^_/) ? $tabs->{"s".$searchtab} = $searchtabs->{$searchtab} : $tabs->{"z_".$searchtab} = $searchtabs->{$searchtab};
248 $current_subtab => ''