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 }}}
49 Title => loc("#[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject) &>
50 <& /Ticket/Elements/Tabs,
52 current_tab => 'Ticket/Display.html?id='.$TicketObj->id,
53 Title => loc("#[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject) &>
55 <& /Elements/ListActions, actions => \@Actions &>
56 <& /Elements/Callback, _CallbackName => 'BeforeShowSummary', Ticket => $TicketObj, %ARGS &>
57 <&| /Widgets/TitleBox, title => loc('Ticket metadata') &>
58 <& /Ticket/Elements/ShowSummary, Ticket => $TicketObj, Attachments => $attachments &>
63 <& /Elements/Callback, _CallbackName => 'BeforeShowHistory', Ticket => $TicketObj, %ARGS &>
65 <& /Ticket/Elements/ShowHistory ,
68 Collapsed => $ARGS{'Collapsed'},
69 ShowHeaders => $ARGS{'ShowHeaders'},
70 Attachments => $attachments,
71 AttachmentContent => $attachment_content
75 <& /Elements/Callback, _CallbackName => 'AfterShowHistory', Ticket => $TicketObj,
76 current_tab => 'Ticket/Display.html?id=' . $TicketObj->id, %ARGS &>
88 $m->comp('/Elements/Callback', _CallbackName => 'Initial', TicketObj => $TicketObj, ARGSRef => \%ARGS);
90 my ($linkid, $message, $tid, @Actions, $Tickets);
92 unless ($id || $TicketObj) {
93 Abort('No ticket specified');
96 if ($ARGS{'id'} eq 'new') {
97 # {{{ Create a new ticket
99 my $Queue = new RT::Queue($session{'CurrentUser'});
100 unless ($Queue->Load($ARGS{'Queue'})) {
101 Abort('Queue not found');
104 unless ($Queue->CurrentUserHasRight('CreateTicket')) {
105 Abort('You have no permission to create tickets in that queue.');
107 ($TicketObj, @Actions) =
108 CreateTicket(Attachments => $session{'Attachments'}, %ARGS);
109 delete $session{'Attachments'};
110 unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
111 Abort("No permission to view newly created ticket #".$TicketObj->id.".");
117 $TicketObj = RT::Ticket->new($session{'CurrentUser'});
119 $TicketObj = LoadTicket($ARGS{'id'});
120 unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
121 Abort("No permission to view ticket");
125 $m->comp('/Elements/Callback', _CallbackName => 'BeforeProcessArguments',
126 TicketObj => $TicketObj, Tickets => $Tickets,
127 ActionsRef => \@Actions, ARGSRef => \%ARGS);
129 if (defined $ARGS{'Action'}) {
130 if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
132 my ($res, $msg)=$TicketObj->$action();
133 push(@Actions, $msg);
137 $ARGS{'UpdateContent'} =~ s/\r\n/\n/g if defined $ARGS{'UpdateContent'};
138 if ( $ARGS{'UpdateTimeWorked'} || (
139 defined $ARGS{'UpdateContent'}
140 && $ARGS{'UpdateContent'} ne ''
141 && $ARGS{'UpdateContent'} ne "-- \n"
142 . $session{'CurrentUser'}->UserObj->Signature ) )
144 $ARGS{UpdateAttachments} = $session{'Attachments'};
145 ProcessUpdateMessage(
147 Actions => \@Actions,
148 TicketObj => $TicketObj,
150 delete $session{'Attachments'};
152 #Process status updates
153 my @PeopleActions = ProcessTicketWatchers(ARGSRef => \%ARGS, TicketObj=>$TicketObj);
154 my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$TicketObj);
155 my @results = ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => \%ARGS);
157 push (@Actions, @PeopleActions, @BasicActions, @results);
160 $m->comp('/Elements/Callback', _CallbackName => 'BeforeDisplay',
161 TicketObj => \$TicketObj,
162 Tickets => \$Tickets,
163 Actions => \@Actions,
167 # This code does automatic redirection if any updates happen.
170 # We've done something, so we need to clear the decks to avoid
171 # resubmission on refresh.
172 # But we need to store Actions somewhere too, so we don't lose them.
173 $session{"Actions"} = \@Actions;
174 RT::Interface::Web::Redirect($RT::WebURL."Ticket/Display.html?id=".$TicketObj->id);
176 @Actions = @{ delete $session{"Actions"} || [] };
179 my $attachments = $m->comp('Elements/FindAttachments', Ticket => $TicketObj, Tickets => $Tickets);
180 my $attachment_content = $m->comp('Elements/LoadTextAttachments', Ticket => $TicketObj);