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 }}}
46 <& /Elements/Header, Title => $title &>
47 <& /Ticket/Elements/Tabs,
51 <FORM ACTION="Update.html" NAME="TicketUpdate"
52 METHOD=POST enctype="multipart/form-data">
53 <input type="hidden" name="QuoteTransaction" value="<% $ARGS{QuoteTransaction} %>">
54 <input type="hidden" name="DefaultStatus" value="<% $DefaultStatus %>">
55 <input type="hidden" name="Action" value="<% $ARGS{Action} %>">
59 <tr><td align=right><&|/l&>Status</&>:</td>
61 <& /Elements/SelectStatus, Name=>"Status", DefaultLabel => loc("[_1] (Unchanged)", loc($TicketObj->Status)), Default => $ARGS{'Status'} || ($TicketObj->Status eq $DefaultStatus ? undef : $DefaultStatus)&>
63 <& /Elements/SelectOwner, Name=>"Owner", DefaultLabel => loc("[_1] (Unchanged)", $TicketObj->OwnerObj->Name()), QueueObj => $TicketObj->QueueObj, TicketObj => $TicketObj, Default => $ARGS{'Owner'} &>
64 <&|/l&>Worked</&>: <input size=4 name="UpdateTimeWorked" value="<% $ARGS{UpdateTimeWorked}%>"> <&|/l&>minutes</&></td></tr>
66 <& /Elements/Callback, _CallbackName => 'BeforeUpdateType', skip => \$skip, %ARGS &>
68 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$TicketObj->Id%>"><br>
70 <tr><td align=right><&|/l&>Update Type</&>:</td>
71 <td><select name="UpdateType">
73 <option value="private" <%$ARGS{'UpdateType'} eq "private" ? "SELECTED" : !$ARGS{'UpdateType'}&&$CommentDefault%>><&|/l&>Comments (Not sent to requestors)</&></option>
76 <option value="response" <%$ARGS{'UpdateType'} eq "response" ? "SELECTED" : !$ARGS{'UpdateType'}&&$ResponseDefault%>><&|/l&>Reply to requestors</&></option>
80 <tr><td align=right><&|/l&>Subject</&>:</td><td> <input name="UpdateSubject" size=60 value="<% $ARGS{UpdateSubject} || $TicketObj->Subject()%>"></td></tr>
81 <tr><td align=right><&|/l&>Cc</&>:</td><td> <input name="UpdateCc" size=60
82 value="<% $ARGS{UpdateCc} %>"><BR>
84 <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. Does <b>not</b> change who will receive future updates.)</&></font></i>
86 <tr><td align=right><&|/l&>Bcc</&>:</td><td> <input name="UpdateBcc" size=60 VALUE="<%$ARGS{UpdateBcc}%>"><BR>
88 <&|/l&>(Sends a blind carbon-copy of this update to a comma-delimited list of email addresses. Does <b>not</b> change who will receive future updates.)</&></font></i>
90 % if (exists $session{'Attachments'}) {
92 <&|/l&>Attached file</&>:
95 <&|/l&>Check box to delete</&><BR>
96 % foreach my $attach_name (keys %{$session{'Attachments'}}) {
97 <input type="checkbox" name="DeleteAttach-<%$attach_name%>" value="1"><%$attach_name%><BR>
104 % if (my $TxnCFs = $TicketObj->TransactionCustomFields) {
105 % while (my $CF = $TxnCFs->Next()) {
107 <TD ALIGN=RIGHT><% $CF->Name %>:</TD>
108 <TD><& /Elements/EditCustomField, CustomField => $CF, NamePrefix =>
109 "Object-RT::Transaction--CustomField-" &><em><% $CF->FriendlyType %></em></TD>
114 <tr><td align=right><&|/l&>Attach</&>:</td><td><input name="Attach" type="file"><INPUT TYPE=SUBMIT NAME="AddMoreAttach" VALUE="<&|/l&>Add More Files</&>"><input type="hidden" name="UpdateAttach" value="1">
116 <tr><td align="right" valign="top"><&|/l&>Message</&>:</td><td>
117 <& /Elements/Callback, _CallbackName => 'BeforeMessageBox', %ARGS &>
118 % if (exists $ARGS{UpdateContent}) {
119 % # preserve QuoteTransaction so we can use it to set up sane references/in/reply to
120 % my $temp = $ARGS{'QuoteTransaction'};
121 % delete $ARGS{'QuoteTransaction'};
122 <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0, %ARGS&>
123 % $ARGS{'QuoteTransaction'} = $temp;
125 <& /Elements/MessageBox, Name=>"UpdateContent", %ARGS &>
133 <& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket' &>
134 % if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
135 <& /Ticket/Elements/PreviewScrips, TicketObj => $TicketObj, %ARGS &>
143 my $TicketObj = LoadTicket($id);
145 unless($DefaultStatus){
146 $DefaultStatus=($ARGS{'Status'} ||$TicketObj->Status());
149 if ($DefaultStatus =~ '^new$'){
150 $DefaultStatus='open';
153 if ($DefaultStatus eq 'resolved') {
154 $title = loc("Resolve ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
156 $title = loc("Update ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
159 # Things needed in the template - we'll do the processing here, just
160 # for the convenience:
162 my ($CommentDefault, $ResponseDefault);
163 if ($Action ne 'Respond') {
164 $CommentDefault = "SELECTED";
166 $ResponseDefault = "SELECTED";
170 $CanRespond = 1 if ( $TicketObj->CurrentUserHasRight('ReplyToTicket') or
171 $TicketObj->CurrentUserHasRight('ModifyTicket') );
173 $CanComment = 1 if ( $TicketObj->CurrentUserHasRight('CommentOnTicket') or
174 $TicketObj->CurrentUserHasRight('ModifyTicket') );
177 # {{{ deal with deleting uploaded attachments
178 foreach my $key (keys %ARGS) {
179 if ($key =~ m/^DeleteAttach-(.+)$/) {
180 delete $session{'Attachments'}{$1};
182 $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
186 # {{{ store the uploaded attachment in session
187 if ($ARGS{'Attach'}) { # attachment?
188 $session{'Attachments'} = {} unless defined $session{'Attachments'};
190 my $subject = "$ARGS{'Attach'}";
191 # since CGI.pm deutf8izes the magic field, we need to add it back.
192 Encode::_utf8_on($subject);
193 # strip leading directories
194 $subject =~ s#^.*[\\/]##;
196 my $attachment = MakeMIMEEntity(
197 Filename => $subject,
199 AttachmentFieldName => 'Attach'
202 $session{'Attachments'} = { %{$session{'Attachments'} || {}},
203 $ARGS{'Attach'} => $attachment };
207 # delete temporary storage entry to make WebUI clean
208 unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
209 delete $session{'Attachments'};
213 if ( exists $ARGS{SubmitTicket} ) {
214 $m->comp('Display.html', TicketObj => $TicketObj, %ARGS);
223 $DefaultStatus => undef