1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2009 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/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 <& /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 _F => { title => loc('Reminders'),
125 path => "Ticket/Reminders.html?id=" . $id,
127 _X => { title => loc('Jumbo'),
128 path => "Ticket/ModifyAll.html?id=" . $id,
133 foreach my $tab ( sort keys %{$ticket_page_tabs} ) {
134 if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_tab ) {
135 $ticket_page_tabs->{$tab}->{"subtabs"} = $subtabs;
136 $tabs->{'this'}->{"current_subtab"} =
137 $ticket_page_tabs->{$tab}->{"path"};
140 $tabs->{'this'}->{"subtabs"} = $ticket_page_tabs;
141 $current_tab = "Ticket/Display.html?id=" . $id;
144 ModifyTicket => $Ticket->CurrentUserHasRight('ModifyTicket'),
147 if ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('ReplyToTicket') ) {
149 title => loc('Reply'),
150 path => "Ticket/Update.html?Action=Respond&id=" . $id,
154 if ( $can{'ModifyTicket'} ) {
155 if ( $Ticket->Status ne 'resolved' ) {
157 path => "Ticket/Update.html?Action=Comment&DefaultStatus=resolved&id=" . $id,
158 title => loc('Resolve') };
160 if ( $Ticket->Status ne 'open' ) {
161 $actions->{'A'} = { path => "Ticket/Display.html?Status=open&id=" . $id,
162 title => loc('Open it') };
166 if ( $Ticket->CurrentUserHasRight('OwnTicket') ) {
167 if ( $Ticket->OwnerObj->Id == $RT::Nobody->id
168 and ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('TakeTicket') ) )
171 path => "Ticket/Display.html?Action=Take&id=" . $id,
172 title => loc('Take'),
175 elsif ( $Ticket->OwnerObj->id != $session{CurrentUser}->id
176 and ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('StealTicket') ) )
179 path => "Ticket/Display.html?Action=Steal&id=" . $id,
180 title => loc('Steal'),
185 if ( $can{'ModifyTicket'} or $Ticket->CurrentUserHasRight('CommentOnTicket') ) {
187 title => loc('Comment'),
188 path => "Ticket/Update.html?Action=Comment&id=" . $id,
193 if ( (defined $actions->{A} || defined $actions->{B} || defined $actions->{C})
194 && (defined $actions->{E} || defined $actions->{F} || defined $actions->{G}) ) {
196 if (defined $actions->{C}) { $actions->{C}->{separator} = 1 }
197 elsif (defined $actions->{B}) { $actions->{B}->{separator} = 1 }
198 elsif (defined $actions->{A}) { $actions->{A}->{separator} = 1 }
202 $args= "?" . $m->comp(
203 '/Elements/QueryString',
204 Query => $ARGS{'Query'} || $session{'CurrentSearchHash'}->{'Query'},
205 Format => $ARGS{'Format'} || $session{'CurrentSearchHash'}->{'Format'},
206 OrderBy => $ARGS{'OrderBy'} || $session{'CurrentSearchHash'}->{'OrderBy'},
207 Order => $ARGS{'Order'} || $session{'CurrentSearchHash'}->{'Order'},
208 Page => $ARGS{'Page'} || $session{'CurrentSearchHash'}->{'Page'},
209 Rows => $ARGS{'Rows'},
210 ) if ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'});
213 $tabs->{"f"} = { path => "Search/Build.html?NewQuery=1",
214 title => loc('New Search')};
215 $tabs->{"g"} = { path => "Search/Build.html$args",
216 title => loc('Edit Search')};
217 $tabs->{"h"} = { path => "Search/Edit.html$args",
218 title => loc('Advanced'),
221 $tabs->{"i"} = { path => "Search/Results.html$args",
222 title => loc('Show Results'),
224 if ($current_tab =~ m{Search/Results.html}) {
225 $current_tab = "Search/Results.html$args";
227 $tabs->{"j"} = { path => "Search/Bulk.html$args",
228 title => loc('Bulk Update'),
230 if ($current_tab =~ m{Search/Bulk.html}) {
231 $current_tab = "Search/Bulk.html$args";
233 foreach my $searchtab (keys %{$searchtabs}) {
234 ($searchtab =~ /^_/) ? $tabs->{"s".$searchtab} = $searchtabs->{$searchtab} : $tabs->{"z_".$searchtab} = $searchtabs->{$searchtab};
246 $current_subtab => ''