1 %# {{{ BEGIN BPS TAGGED BLOCK
5 %# This software is Copyright (c) 1996-2004 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 &>
61 <& /Ticket/Elements/ShowHistory ,
64 Collapsed => $ARGS{'Collapsed'},
65 ShowHeaders => $ARGS{'ShowHeaders'},
66 Attachments => $attachments,
67 AttachmentContent => $attachment_content
82 $m->comp('/Elements/Callback', _CallbackName => 'Initial', TicketObj => $TicketObj, ARGSRef => \%ARGS);
84 my ($linkid, $message, $tid, @Actions, $Tickets);
86 unless ($id || $TicketObj) {
87 Abort('No ticket specified');
90 if ($ARGS{'id'} eq 'new') {
91 # {{{ Create a new ticket
93 my $Queue = new RT::Queue($session{'CurrentUser'});
94 unless ($Queue->Load($ARGS{'Queue'})) {
95 Abort('Queue not found');
98 unless ($Queue->CurrentUserHasRight('CreateTicket')) {
99 Abort('You have no permission to create tickets in that queue.');
101 ($TicketObj, @Actions) =
102 CreateTicket(Attachments => $session{'Attachments'}, %ARGS);
103 delete $session{'Attachments'};
104 unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
105 Abort("No permission to view newly created ticket #".$TicketObj->id.".");
111 $TicketObj = RT::Ticket->new($session{'CurrentUser'});
113 $TicketObj = LoadTicket($ARGS{'id'});
114 unless ($TicketObj->CurrentUserHasRight('ShowTicket')) {
115 Abort("No permission to view ticket");
119 if (defined $ARGS{'Action'}) {
120 if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
122 my ($res, $msg)=$TicketObj->$action();
123 push(@Actions, $msg);
127 $ARGS{'UpdateContent'} =~ s/\r\n/\n/g;
128 if ( $ARGS{'UpdateTimeWorked'} ||
129 $session{'Attachments'} ||
130 ( $ARGS{'UpdateContent'} ne ''
131 && $ARGS{'UpdateContent'} ne "-- \n"
132 . $session{'CurrentUser'}->UserObj->Signature )) {
133 $ARGS{UpdateAttachments} = $session{'Attachments'};
134 ProcessUpdateMessage( ARGSRef => \%ARGS,
135 Actions => \@Actions,
136 TicketObj => $TicketObj );
137 delete $session{'Attachments'};
139 #Process status updates
140 my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$TicketObj);
141 my @results = ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => \%ARGS);
143 push (@Actions, @BasicActions, @results);
148 $m->comp('/Elements/Callback', _CallbackName => 'BeforeDisplay',
149 TicketObj => \$TicketObj, Tickets => \$Tickets, ARGSRef => \%ARGS);
152 my $attachments = $m->comp('Elements/FindAttachments', Ticket => $TicketObj, Tickets => $Tickets);
153 my $attachment_content = $m->comp('Elements/LoadTextAttachments', Ticket => $TicketObj);