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 }}}
47 Title => loc("#[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject) &>
48 <& /Ticket/Elements/Tabs,
50 current_tab => 'Ticket/Display.html?id='.$TicketObj->id,
51 Title => loc("#[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject) &>
53 <& /Elements/ListActions, actions => \@Actions &>
55 <& /Elements/TitleBoxStart, title => loc('Ticket metadata'), contentbg =>
57 <& /Ticket/Elements/ShowSummary, Ticket => $TicketObj, Attachments => $attachments &>
58 <& /Elements/TitleBoxEnd &>
62 <& /Elements/Callback, _CallbackName => 'BeforeShowHistory', Ticket => $TicketObj, %ARGS &>
64 <& /Ticket/Elements/ShowHistory ,
67 Collapsed => $ARGS{'Collapsed'},
68 ShowHeaders => $ARGS{'ShowHeaders'},
69 Attachments => $attachments,
70 AttachmentContent => $attachment_content
85 $m->comp('/Elements/Callback', _CallbackName => 'Initial', TicketObj => $TicketObj, ARGSRef => \%ARGS);
87 my ($linkid, $message, $tid, @Actions, $Tickets);
89 unless ($id || $TicketObj) {
90 Abort('No ticket specified');
93 if ($ARGS{'id'} eq 'new') {
94 # {{{ Create a new ticket
96 my $Queue = new RT::Queue($session{'CurrentUser'});
97 unless ($Queue->Load($ARGS{'Queue'})) {
98 Abort('Queue not found');
101 unless ($Queue->CurrentUserHasRight('CreateTicket')) {
102 Abort('You have no permission to create tickets in that queue.');
104 ($TicketObj, @Actions) =
105 CreateTicket(Attachments => $session{'Attachments'}, %ARGS);
106 delete $session{'Attachments'};
107 unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
108 Abort("No permission to view newly created ticket #".$TicketObj->id.".");
114 $TicketObj = RT::Ticket->new($session{'CurrentUser'});
116 $TicketObj = LoadTicket($ARGS{'id'});
117 unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
118 Abort("No permission to view ticket");
122 if (defined $ARGS{'Action'}) {
123 if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
125 my ($res, $msg)=$TicketObj->$action();
126 push(@Actions, $msg);
130 $ARGS{'UpdateContent'} =~ s/\r\n/\n/g if defined $ARGS{'UpdateContent'};
131 if ( $ARGS{'UpdateTimeWorked'} ||
132 $session{'Attachments'} ||
133 ( defined $ARGS{'UpdateContent'}
134 && $ARGS{'UpdateContent'} ne ''
135 && $ARGS{'UpdateContent'} ne "-- \n"
136 . $session{'CurrentUser'}->UserObj->Signature )) {
137 $ARGS{UpdateAttachments} = $session{'Attachments'};
138 ProcessUpdateMessage( ARGSRef => \%ARGS,
139 Actions => \@Actions,
140 TicketObj => $TicketObj );
141 delete $session{'Attachments'};
143 #Process status updates
144 my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$TicketObj);
145 my @results = ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => \%ARGS);
147 push (@Actions, @BasicActions, @results);
152 $m->comp('/Elements/Callback', _CallbackName => 'BeforeDisplay',
153 TicketObj => \$TicketObj, Tickets => \$Tickets, ARGSRef => \%ARGS);
156 my $attachments = $m->comp('Elements/FindAttachments', Ticket => $TicketObj, Tickets => $Tickets);
157 my $attachment_content = $m->comp('Elements/LoadTextAttachments', Ticket => $TicketObj);