%# Things are more like they used to be than they are now.
<& /Work/Elements/104Header, Title => 'My Tickets', Method => 'POST', Enctype => 'multipart/form-data' &>
<& /Work/Tickets/Elements/ShowQueue, QueueObj => $Ticket->QueueObj, TicketObj => $Ticket &>
<& /Work/Tickets/Elements/ShowBasics, Ticket => $Ticket &>
<& /Work/Tickets/Elements/EditCustomFields, Ticket => $Ticket, ReadOnly => ($IsRequestor), NoCF => $NoCF &>
%# Info {{{
<&|/l&>Status&>
<& /Work/Elements/SelectStatus, Name=>"Status", Default => ($ARGS{'Status'} || $ARGS{'DefaultStatus'} || $Ticket->Status), ReadOnly => ($IsRequestor) &>
<&|/l&>Owner&>
<& /Work/Elements/SelectOwner, Name=>"Owner", Default => ($ARGS{'Owner'} || $Ticket->OwnerObj->Id()), QueueObj => $Ticket->QueueObj, TicketObj => $Ticket &>
<&|/l&>Update Type&>
% if ($CanComment) {
type="radio" name="UpdateType" value="private" <%$CommentDefault%>><&|/l&>Comments (Not sent to requestors)&>
% }
% if ($CanRespond) {
type="radio" name="UpdateType" value="response" <%$ResponseDefault%>><&|/l&>Response to requestors&>
% }
%# }}}
<&|/l&>Cc&>
% if ($RT::OIN104) {
% my %Cc = map { ($_ => 1) } (split(/\s*,\s*/, $CcExtra || $Ticket->CcAddresses), (map $_->Name, @$CcList));
" style="width:50px">
% } else {
% }
<&|/l&>Bcc&>
<&|/l&>(Sends a blind carbon-copy of this update to a comma-delimited list of email addresses. Does not change who will receive future updates.)&>
% unless ($NoCF->{Attachments}) {
<& /Work/Tickets/Elements/AddAttachments, %ARGS &>
% }
% unless ($NoCF->{Content}) {
<& /Work/Tickets/Elements/AddContent, UpdateType => '', %ARGS &>
% }
<& /Work/Elements/BackButton &>
<%INIT>
my $CanRespond = 0;
my $CanComment = 0;
my $Ticket = LoadTicket($id);
my $QueueObj = $Ticket->QueueObj;
my $OwnerObj = $Ticket->OwnerObj;
foreach my $key (keys %ARGS) {
next unless $key =~ /^Action-(.+?)(?:\.[xy])?(?:-(\d+))?(?:-(\w+))?$/;
$Action = $1; $ARGS{QuoteTransaction} = $2; $ARGS{$3} = 1; last;
}
if ($Action eq 'Open') {
return $m->comp('Display.html', %ARGS, Status => 'open', Owner => $session{CurrentUser}->UserObj->Id);
}
elsif ($Action eq 'Links') {
ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
return $m->comp('Display.html', %ARGS);
}
elsif ($Action eq 'People') {
ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
if ($ARGS{OnlySearchForPeople} or $ARGS{OnlySearchForGroup}) {
$ARGS{Show} = 'People';
}
else {
ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
}
return $m->comp('Display.html', %ARGS);
}
elsif ($Action eq 'Basics') {
ProcessTicketBasics(TicketObj => $Ticket, ARGSRef => \%ARGS);
ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
$ARGS{Queue} = $Ticket->Queue;
return $m->comp('Display.html', %ARGS);
}
elsif ( $Action eq 'Resolve' ) {
$Action = 'Comment';
$ARGS{Status} = 'resolved';
}
my $ValidCFs = $m->comp(
'Elements/ValidateCustomFields',
CustomFields => $Ticket->QueueObj->CustomFields,
Prefix => ("Ticket-" . $Ticket->Id . "-"),
ARGSRef => \%ARGS,
);
$DefaultStatus = $ARGS{Status} if exists $ARGS{Status};
# Things needed in the template - we'll do the processing here, just
# for the convenience:
my ($CommentDefault, $ResponseDefault);
if (($Action eq 'Comment') or ($ARGS{'UpdateType'} eq 'private')) {
$CommentDefault = "CHECKED";
} else {
$ResponseDefault = "CHECKED";
}
$DefaultStatus = $Ticket->Status() unless ($DefaultStatus);
$CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
$Ticket->CurrentUserHasRight('ModifyTicket') );
$CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
$Ticket->CurrentUserHasRight('ModifyTicket') );
# {{{ deal with deleting uploaded attachments
foreach my $key (keys %ARGS) {
if ($key =~ m/^DeleteAttach-(.+)$/) {
delete $session{'Attachments'}{$1};
}
$session{'Attachments'} = { %{$session{'Attachments'} || {}} };
}
# {{{ store the uploaded attachment in session
if ($ARGS{'Attach'}) { # attachment?
$session{'Attachments'} = {} unless defined $session{'Attachments'};
my $subject = "$ARGS{'Attach'}";
# since CGI.pm deutf8izes the magic field, we need to add it back.
Encode::_utf8_on($subject);
# strip leading directories
$subject =~ s#^.*[\\/]##;
my $attachment = MakeMIMEEntity(
Subject => $subject,
Body => "",
AttachmentFieldName => 'Attach'
);
$session{'Attachments'} = { %{$session{'Attachments'} || {}},
$ARGS{'Attach'} => $attachment };
}
# }}}
# delete temporary storage entry to make WebUI clean
unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
delete $session{'Attachments'};
}
# }}}
foreach my $key (keys %ARGS) {
$key =~ /^AddMoreEntry-(.*)$/ or next;
$ARGS{'AddMoreEntry'} = [ split(/-/, $1) ];
}
my $Entries = $m->comp('Elements/ProcessEntryUpdates', TicketObj => $Ticket, %ARGS);
$ARGS{"Ticket-".$Ticket->Id."-CustomField-$_-Values"} = $Entries->{$_} foreach keys %{$Entries};
ProcessTicketCustomFieldUpdates( ARGSRef => \%ARGS, TicketObj => $Ticket );
my $IsRequestor = ($Role eq 'requestor');
if ( exists $ARGS{SubmitTicket} and $ValidCFs ) {
# clear up for next time
$session{'CcSet'} = 0;
$m->comp('Display.html', %ARGS, TicketObj => $Ticket);
$m->abort();
}
my $CcList = [];
my $CcExtra = '';
if ($session{'CcSet'}) {
$CcList = [ @{$session{'CcList'}} ];
$CcExtra = $session{'CcExtra'};
}
else {
$session{'CcList'} = [];
$session{'CcOffList'} = undef;
$session{'CcExtra'} = $Ticket->CcAddresses;
}
my $NoCF = {};
%INIT>
<%ARGS>
$id => undef
$Role => undef
$Action => undef
$DefaultStatus => undef
$QuoteTransaction => undef
%ARGS>