import rt 3.4.6
[freeside.git] / rt / html / Ticket / Update.html
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %# 
3 %# COPYRIGHT:
4 %#  
5 %# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC 
6 %#                                          <jesse@bestpractical.com>
7 %# 
8 %# (Except where explicitly superseded by other copyright notices)
9 %# 
10 %# 
11 %# LICENSE:
12 %# 
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
16 %# from www.gnu.org.
17 %# 
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.
22 %# 
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.
26 %# 
27 %# 
28 %# CONTRIBUTION SUBMISSION POLICY:
29 %# 
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.)
35 %# 
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.
44 %# 
45 %# END BPS TAGGED BLOCK }}}
46 <& /Elements/Header, Title => $title &>
47 <& /Ticket/Elements/Tabs, 
48     Ticket => $TicketObj, 
49     Title=> $title &>
50
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} %>">
56
57 <TABLE BORDER=0>
58
59 <tr><td align=right><&|/l&>Status</&>:</td>
60 <td>
61 <& /Elements/SelectStatus, Name=>"Status", DefaultLabel => loc("[_1] (Unchanged)", loc($TicketObj->Status)), Default => $ARGS{'Status'} || ($TicketObj->Status eq $DefaultStatus ? undef : $DefaultStatus)&>
62 <&|/l&>Owner</&>:  
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>
65 % my $skip;
66 <& /Elements/Callback, _CallbackName => 'BeforeUpdateType', skip => \$skip, %ARGS &>
67 % if (!$skip) {
68 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$TicketObj->Id%>"><br>
69 % }
70 <tr><td align=right><&|/l&>Update Type</&>:</td>
71 <td><select name="UpdateType">
72 % if ($CanComment) {
73   <option value="private" <%$ARGS{'UpdateType'} eq "private" ? "SELECTED" : !$ARGS{'UpdateType'}&&$CommentDefault%>><&|/l&>Comments (Not sent to requestors)</&></option>
74 % }
75 % if ($CanRespond) {
76    <option value="response" <%$ARGS{'UpdateType'} eq "response" ? "SELECTED" : !$ARGS{'UpdateType'}&&$ResponseDefault%>><&|/l&>Reply to requestors</&></option>
77 % }
78 </select> 
79 </td></tr>
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>
83 <i><font size=-2>
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>
85 </td></tr>
86 <tr><td align=right><&|/l&>Bcc</&>:</td><td> <input name="UpdateBcc" size=60 VALUE="<%$ARGS{UpdateBcc}%>"><BR>
87 <i><font size=-2>
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>
89 </td></tr>
90 % if (exists $session{'Attachments'}) {
91 <TD>
92 <&|/l&>Attached file</&>:
93 </TD>
94 <TD COLSPAN=5>
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>
98 % } # end of foreach
99 </TD>
100 </TR>
101 <TR>
102 % } # end of if
103
104 % if (my $TxnCFs = $TicketObj->TransactionCustomFields) {
105 %    while (my $CF = $TxnCFs->Next()) {
106 <TR>
107 <TD ALIGN=RIGHT><% $CF->Name %>:</TD>
108 <TD><& /Elements/EditCustomField, CustomField => $CF, NamePrefix =>
109     "Object-RT::Transaction--CustomField-" &><em><% $CF->FriendlyType %></em></TD>
110 </TR>
111 %    } # end if while
112 % } # end of if
113
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">
115 </td></tr>
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;
124 % } else {
125 <& /Elements/MessageBox, Name=>"UpdateContent", %ARGS &>
126 % }
127 </td></tr>
128 </table>
129
130
131
132
133 <& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket' &>
134 % if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
135 <& /Ticket/Elements/PreviewScrips, TicketObj => $TicketObj, %ARGS &>
136 % }
137 </FORM>
138 <%INIT>
139 my $CanRespond = 0;
140 my $CanComment = 0;
141 my $title;
142
143 my $TicketObj = LoadTicket($id);
144
145 unless($DefaultStatus){
146     $DefaultStatus=($ARGS{'Status'} ||$TicketObj->Status());
147 }
148
149 if ($DefaultStatus =~ '^new$'){
150         $DefaultStatus='open';
151 }
152
153 if ($DefaultStatus eq 'resolved') {
154     $title = loc("Resolve ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
155 } else {
156     $title = loc("Update ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
157 }
158
159 # Things needed in the template - we'll do the processing here, just
160 # for the convenience:
161
162 my ($CommentDefault, $ResponseDefault);
163 if ($Action ne 'Respond') {
164    $CommentDefault = "SELECTED"; 
165 } else {
166     $ResponseDefault = "SELECTED";
167 }
168
169
170 $CanRespond = 1 if ( $TicketObj->CurrentUserHasRight('ReplyToTicket') or
171                      $TicketObj->CurrentUserHasRight('ModifyTicket') ); 
172
173 $CanComment = 1 if ( $TicketObj->CurrentUserHasRight('CommentOnTicket') or
174                      $TicketObj->CurrentUserHasRight('ModifyTicket') ); 
175
176
177 # {{{ deal with deleting uploaded attachments
178 foreach my $key (keys %ARGS) {
179     if ($key =~ m/^DeleteAttach-(.+)$/) {
180         delete $session{'Attachments'}{$1};
181     }
182     $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
183 }
184 # }}}
185
186 # {{{ store the uploaded attachment in session
187 if ($ARGS{'Attach'}) {                  # attachment?
188     $session{'Attachments'} = {} unless defined $session{'Attachments'};
189
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#^.*[\\/]##;
195
196     my $attachment = MakeMIMEEntity(
197         Filename             => $subject,
198         Body                => "",
199         AttachmentFieldName => 'Attach'
200     );
201
202     $session{'Attachments'} = { %{$session{'Attachments'} || {}},
203                                 $ARGS{'Attach'} => $attachment };
204 }
205 # }}}
206
207 # delete temporary storage entry to make WebUI clean
208 unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
209     delete $session{'Attachments'};
210 }
211 # }}}
212
213 if ( exists $ARGS{SubmitTicket} ) {
214     $m->comp('Display.html', TicketObj => $TicketObj, %ARGS);
215     return;
216 }
217
218 </%INIT>
219
220 <%ARGS>
221 $id => undef
222 $Action => undef
223 $DefaultStatus => undef
224 </%ARGS>