import rt 3.2.2
[freeside.git] / rt / html / Ticket / Update.html
1 %# {{{ BEGIN BPS TAGGED BLOCK
2 %# 
3 %# COPYRIGHT:
4 %#  
5 %# This software is Copyright (c) 1996-2004 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)", $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%>"><%$attach_name%><BR>
98 % } # end of foreach
99 </TD>
100 </TR>
101 <TR>
102 % } # end of if
103 <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">
104 </td></tr>
105 <tr><td align="right" valign="top"><&|/l&>Message</&>:</td><td>
106 <& /Elements/Callback, _CallbackName => 'BeforeMessageBox', %ARGS &>
107 % if (exists $ARGS{UpdateContent}) {
108 % delete $ARGS{'QuoteTransaction'};
109 <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0, %ARGS&>
110 % } else {
111 <& /Elements/MessageBox, Name=>"UpdateContent", %ARGS &>
112 % }
113 </td></tr>
114 </table>
115
116
117
118
119 <& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket' &>
120 % if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
121 <& /Ticket/Elements/PreviewScrips, TicketObj => $TicketObj, %ARGS &>
122 % }
123 </FORM>
124 <%INIT>
125
126 my $CanRespond = 0;
127 my $CanComment = 0;
128 my $title;
129
130 my $TicketObj = LoadTicket($id);
131
132 unless($DefaultStatus){
133     $DefaultStatus=($ARGS{'Status'} ||$TicketObj->Status());
134 }
135
136 if ($DefaultStatus =~ '^new$'){
137         $DefaultStatus='open';
138 }
139
140 if ($DefaultStatus eq 'resolved') {
141     $title = loc("Resolve ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
142 } else {
143     $title = loc("Update ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
144 }
145
146 # Things needed in the template - we'll do the processing here, just
147 # for the convenience:
148
149 my ($CommentDefault, $ResponseDefault);
150 if ($Action ne 'Respond') {
151    $CommentDefault = "SELECTED"; 
152 } else {
153     $ResponseDefault = "SELECTED";
154 }
155
156
157 $CanRespond = 1 if ( $TicketObj->CurrentUserHasRight('ReplyToTicket') or
158                      $TicketObj->CurrentUserHasRight('ModifyTicket') ); 
159
160 $CanComment = 1 if ( $TicketObj->CurrentUserHasRight('CommentOnTicket') or
161                      $TicketObj->CurrentUserHasRight('ModifyTicket') ); 
162
163
164 # {{{ deal with deleting uploaded attachments
165 foreach my $key (keys %ARGS) {
166     if ($key =~ m/^DeleteAttach-(.+)$/) {
167         delete $session{'Attachments'}{$1};
168     }
169     $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
170 }
171
172 # {{{ store the uploaded attachment in session
173 if ($ARGS{'Attach'}) {                  # attachment?
174     $session{'Attachments'} = {} unless defined $session{'Attachments'};
175
176     my $subject = "$ARGS{'Attach'}";
177     # since CGI.pm deutf8izes the magic field, we need to add it back.
178     Encode::_utf8_on($subject);
179     # strip leading directories
180     $subject =~ s#^.*[\\/]##;
181
182     my $attachment = MakeMIMEEntity(
183         Subject             => $subject,
184         Body                => "",
185         AttachmentFieldName => 'Attach'
186     );
187
188     $session{'Attachments'} = { %{$session{'Attachments'} || {}},
189                                 $ARGS{'Attach'} => $attachment };
190 }
191 # }}}
192
193 # delete temporary storage entry to make WebUI clean
194 unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
195     delete $session{'Attachments'};
196 }
197 # }}}
198
199 if ( exists $ARGS{SubmitTicket} ) {
200     $m->comp('Display.html', TicketObj => $TicketObj, %ARGS);
201     return;
202 }
203 </%INIT>
204
205 <%ARGS>
206 $id => undef
207 $Action => undef
208 $DefaultStatus => undef
209 </%ARGS>