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 }}}
48 <& /Elements/Header, Title => $title &>
49 <& /Ticket/Elements/Tabs,
53 <form action="Update.html" name="TicketUpdate"
54 method="post" enctype="multipart/form-data">
55 <& /Elements/Callback, _CallbackName => 'FormStart',ARGSRef =>\%ARGS &>
56 <input type="hidden" class="hidden" name="QuoteTransaction" value="<% $ARGS{QuoteTransaction} %>" />
57 <input type="hidden" class="hidden" name="DefaultStatus" value="<% $DefaultStatus %>" />
58 <input type="hidden" class="hidden" name="Action" value="<% $ARGS{Action} %>" />
59 <table width="100%" border="0">
61 <tr><td align="right"><&|/l&>Status</&>:</td>
63 <& /Elements/SelectStatus, Name=>"Status", DefaultLabel => loc("[_1] (Unchanged)", loc($TicketObj->Status)), Default => $ARGS{'Status'} || ($TicketObj->Status eq $DefaultStatus ? undef : $DefaultStatus)&>
65 <& /Elements/SelectOwner, Name=>"Owner", DefaultLabel => loc("[_1] (Unchanged)", $TicketObj->OwnerObj->Name()), QueueObj => $TicketObj->QueueObj, TicketObj => $TicketObj, Default => $ARGS{'Owner'} &>
66 <&|/l&>Worked</&>: <input size="4" name="UpdateTimeWorked" value="<% $ARGS{UpdateTimeWorked} %>" />
67 <& /Elements/SelectTimeUnits, Name => 'UpdateTimeWorked'&>
70 <& /Elements/Callback, _CallbackName => 'BeforeUpdateType', skip => \$skip, %ARGS &>
72 <input type="hidden" class="hidden" name="id" value="<%$TicketObj->Id%>" /><br />
74 <tr><td align="right"><&|/l&>Update Type</&>:</td>
75 <td><select name="UpdateType">
77 <option value="private" <%$ARGS{'UpdateType'} eq "private" ? "SELECTED" : !$ARGS{'UpdateType'}&&$CommentDefault%>><&|/l&>Comments (Not sent to requestors)</&></option>
80 <option value="response" <%$ARGS{'UpdateType'} eq "response" ? "SELECTED" : !$ARGS{'UpdateType'}&&$ResponseDefault%>><&|/l&>Reply to requestors</&></option>
84 <tr><td align="right"><&|/l&>Subject</&>:</td><td> <input name="UpdateSubject" size="60" value="<% $ARGS{UpdateSubject} || $TicketObj->Subject()%>" /></td></tr>
85 <tr><td align="right"><&|/l&>Cc</&>:</td><td> <input name="UpdateCc" size="60"
86 value="<%$ARGS{UpdateCc}||""%>" /><br />
88 <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. Does <strong>not</strong> change who will receive future updates.)</&></font></i>
90 <tr><td align="right"><&|/l&>Bcc</&>:</td><td> <input name="UpdateBcc" size="60" value="<%$ARGS{UpdateBcc}||""%>" /><br />
92 <&|/l&>(Sends a blind carbon-copy of this update to a comma-delimited list of email addresses. Does <strong>not</strong> change who will receive future updates.)</&></font></i>
94 % if (exists $session{'Attachments'}) {
96 <&|/l&>Attached file</&>:
99 <&|/l&>Check box to delete</&><br />
100 % foreach my $attach_name (keys %{$session{'Attachments'}}) {
101 <input type="checkbox" class="checkbox" name="DeleteAttach-<%$attach_name%>" value="1" /><%$attach_name%><br />
108 % if (my $TxnCFs = $TicketObj->TransactionCustomFields) {
109 % while (my $CF = $TxnCFs->Next()) {
111 <td align="right"><% $CF->Name %>:</td>
112 <td><& /Elements/EditCustomField, CustomField => $CF, NamePrefix =>
113 "Object-RT::Transaction--CustomField-" &><em><% $CF->FriendlyType %></em></td>
118 <tr><td align="right"><&|/l&>Attach</&>:</td><td><input name="Attach" type="file" /><input type="submit" class="button" name="AddMoreAttach" value="<&|/l&>Add More Files</&>" /><input type="hidden" class="hidden" name="UpdateAttach" value="1" />
120 <tr><td align="right" valign="top"><&|/l&>Message</&>:</td><td>
121 <& /Elements/Callback, _CallbackName => 'BeforeMessageBox', %ARGS &>
122 % if (exists $ARGS{UpdateContent}) {
123 % # preserve QuoteTransaction so we can use it to set up sane references/in/reply to
124 % my $temp = $ARGS{'QuoteTransaction'};
125 % delete $ARGS{'QuoteTransaction'};
126 <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0, %ARGS&>
127 % $ARGS{'QuoteTransaction'} = $temp;
129 <& /Elements/MessageBox, Name=>"UpdateContent", %ARGS &>
137 <& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket' &>
138 % if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
139 <& /Ticket/Elements/PreviewScrips, TicketObj => $TicketObj, %ARGS &>
147 my $TicketObj = LoadTicket($id);
149 unless($DefaultStatus){
150 $DefaultStatus=($ARGS{'Status'} ||$TicketObj->Status());
153 if ($DefaultStatus =~ '^new$'){
154 $DefaultStatus='open';
157 if ($DefaultStatus eq 'resolved') {
158 $title = loc("Resolve ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
160 $title = loc("Update ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
163 # Things needed in the template - we'll do the processing here, just
164 # for the convenience:
166 my ($CommentDefault, $ResponseDefault);
167 if ($Action ne 'Respond') {
168 $CommentDefault = "SELECTED";
170 $ResponseDefault = "SELECTED";
174 $CanRespond = 1 if ( $TicketObj->CurrentUserHasRight('ReplyToTicket') or
175 $TicketObj->CurrentUserHasRight('ModifyTicket') );
177 $CanComment = 1 if ( $TicketObj->CurrentUserHasRight('CommentOnTicket') or
178 $TicketObj->CurrentUserHasRight('ModifyTicket') );
181 # {{{ deal with deleting uploaded attachments
182 foreach my $key (keys %ARGS) {
183 if ($key =~ m/^DeleteAttach-(.+)$/) {
184 delete $session{'Attachments'}{$1};
186 $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
190 # {{{ store the uploaded attachment in session
191 if ($ARGS{'Attach'}) { # attachment?
192 $session{'Attachments'} = {} unless defined $session{'Attachments'};
194 my $subject = "$ARGS{'Attach'}";
195 # since CGI.pm deutf8izes the magic field, we need to add it back.
196 Encode::_utf8_on($subject);
197 # strip leading directories
198 $subject =~ s#^.*[\\/]##;
200 my $attachment = MakeMIMEEntity(
201 Filename => $subject,
203 AttachmentFieldName => 'Attach'
206 $session{'Attachments'} = { %{$session{'Attachments'} || {}},
207 $ARGS{'Attach'} => $attachment };
211 # delete temporary storage entry to make WebUI clean
212 unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
213 delete $session{'Attachments'};
217 if ( exists $ARGS{SubmitTicket} ) {
218 $m->comp('Display.html', TicketObj => $TicketObj, %ARGS);
227 $DefaultStatus => undef