import rt 3.6.6
[freeside.git] / rt / html / Ticket / Update.html
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %# 
3 %# COPYRIGHT:
4 %#  
5 %# This software is Copyright (c) 1996-2007 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., 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.
28 %# 
29 %# 
30 %# CONTRIBUTION SUBMISSION POLICY:
31 %# 
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.)
37 %# 
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.
46 %# 
47 %# END BPS TAGGED BLOCK }}}
48 <& /Elements/Header, Title => $title &>
49 <& /Ticket/Elements/Tabs, 
50     Ticket => $TicketObj, 
51     Title=> $title &>
52
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">
60
61 <tr><td align="right"><&|/l&>Status</&>:</td>
62 <td>
63 <& /Elements/SelectStatus, Name=>"Status", DefaultLabel => loc("[_1] (Unchanged)", loc($TicketObj->Status)), Default => $ARGS{'Status'} || ($TicketObj->Status eq $DefaultStatus ? undef : $DefaultStatus)&>
64 <&|/l&>Owner</&>:  
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'&>
68 </td></tr>
69 % my $skip;
70 <& /Elements/Callback, _CallbackName => 'BeforeUpdateType', skip => \$skip, %ARGS &>
71 % if (!$skip) {
72 <input type="hidden" class="hidden" name="id" value="<%$TicketObj->Id%>" /><br />
73 % }
74 <tr><td align="right"><&|/l&>Update Type</&>:</td>
75 <td><select name="UpdateType">
76 % if ($CanComment) {
77   <option value="private" <%$ARGS{'UpdateType'} eq "private" ? "SELECTED" : !$ARGS{'UpdateType'}&&$CommentDefault%>><&|/l&>Comments (Not sent to requestors)</&></option>
78 % }
79 % if ($CanRespond) {
80    <option value="response" <%$ARGS{'UpdateType'} eq "response" ? "SELECTED" : !$ARGS{'UpdateType'}&&$ResponseDefault%>><&|/l&>Reply to requestors</&></option>
81 % }
82 </select> 
83 </td></tr>
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 />
87 <i><font size="-2">
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>
89 </td></tr>
90 <tr><td align="right"><&|/l&>Bcc</&>:</td><td> <input name="UpdateBcc" size="60" value="<%$ARGS{UpdateBcc}||""%>" /><br />
91 <i><font size="-2">
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>
93 </td></tr>
94 % if (exists $session{'Attachments'}) {
95 <td>
96 <&|/l&>Attached file</&>:
97 </td>
98 <td colspan="5">
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 />
102 % } # end of foreach
103 </td>
104 </tr>
105 <tr>
106 % } # end of if
107
108 % if (my $TxnCFs = $TicketObj->TransactionCustomFields) {
109 %    while (my $CF = $TxnCFs->Next()) {
110 <tr>
111 <td align="right"><% $CF->Name %>:</td>
112 <td><& /Elements/EditCustomField, CustomField => $CF, NamePrefix =>
113     "Object-RT::Transaction--CustomField-" &><em><% $CF->FriendlyType %></em></td>
114 </tr>
115 %    } # end if while
116 % } # end of if
117
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" />
119 </td></tr>
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;
128 % } else {
129 <& /Elements/MessageBox, Name=>"UpdateContent", %ARGS &>
130 % }
131 </td></tr>
132 </table>
133
134
135
136
137 <& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket' &>
138 % if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
139 <& /Ticket/Elements/PreviewScrips, TicketObj => $TicketObj, %ARGS &>
140 % }
141 </form>
142 <%INIT>
143 my $CanRespond = 0;
144 my $CanComment = 0;
145 my $title;
146
147 my $TicketObj = LoadTicket($id);
148
149 unless($DefaultStatus){
150     $DefaultStatus=($ARGS{'Status'} ||$TicketObj->Status());
151 }
152
153 if ($DefaultStatus =~ '^new$'){
154         $DefaultStatus='open';
155 }
156
157 if ($DefaultStatus eq 'resolved') {
158     $title = loc("Resolve ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
159 } else {
160     $title = loc("Update ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
161 }
162
163 # Things needed in the template - we'll do the processing here, just
164 # for the convenience:
165
166 my ($CommentDefault, $ResponseDefault);
167 if ($Action ne 'Respond') {
168    $CommentDefault = "SELECTED"; 
169 } else {
170     $ResponseDefault = "SELECTED";
171 }
172
173
174 $CanRespond = 1 if ( $TicketObj->CurrentUserHasRight('ReplyToTicket') or
175                      $TicketObj->CurrentUserHasRight('ModifyTicket') ); 
176
177 $CanComment = 1 if ( $TicketObj->CurrentUserHasRight('CommentOnTicket') or
178                      $TicketObj->CurrentUserHasRight('ModifyTicket') ); 
179
180
181 # {{{ deal with deleting uploaded attachments
182 foreach my $key (keys %ARGS) {
183     if ($key =~ m/^DeleteAttach-(.+)$/) {
184         delete $session{'Attachments'}{$1};
185     }
186     $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
187 }
188 # }}}
189
190 # {{{ store the uploaded attachment in session
191 if ($ARGS{'Attach'}) {                  # attachment?
192     $session{'Attachments'} = {} unless defined $session{'Attachments'};
193
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#^.*[\\/]##;
199
200     my $attachment = MakeMIMEEntity(
201         Filename             => $subject,
202         Body                => "",
203         AttachmentFieldName => 'Attach'
204     );
205
206     $session{'Attachments'} = { %{$session{'Attachments'} || {}},
207                                 $ARGS{'Attach'} => $attachment };
208 }
209 # }}}
210
211 # delete temporary storage entry to make WebUI clean
212 unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
213     delete $session{'Attachments'};
214 }
215 # }}}
216
217 if ( exists $ARGS{SubmitTicket} ) {
218     $m->comp('Display.html', TicketObj => $TicketObj, %ARGS);
219     return;
220 }
221
222 </%INIT>
223
224 <%ARGS>
225 $id => undef
226 $Action => undef
227 $DefaultStatus => undef
228 </%ARGS>