]> git.uio.no Git - usit-rt.git/blob - share/html/m/ticket/reply
Putting 4.2.0 on top of 4.0.17
[usit-rt.git] / share / html / m / ticket / reply
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %#
3 %# COPYRIGHT:
4 %#
5 %# This software is Copyright (c) 1996-2013 Best Practical Solutions, LLC
6 %#                                          <sales@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/licenses/old-licenses/gpl-2.0.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 <&|/m/_elements/wrapper, title => loc('Update ticket #[_1]', $t->id) &>
49 <& /m/_elements/ticket_menu, ticket => $t &>
50 <& /Elements/ListActions, actions => \@results &>
51 <div class="ticket-reply">
52 <&|/Widgets/TitleBox &>
53 <form action="reply" id="update"
54     method="post" enctype="multipart/form-data">
55 <input type="hidden" class="hidden" name="DefaultStatus" value="<% $DefaultStatus ||''%>" />
56 <input type="hidden" class="hidden" name="Action" value="<% $ARGS{Action}||'' %>" />
57 <input type="hidden" class="hidden" name="Token" value="<% $ARGS{'Token'} %>" />
58
59 % if ($gnupg_widget) {
60 <& /Elements/Crypt/SignEncryptWidget:ShowIssues, self => $gnupg_widget &>
61 % }
62
63 <div class="entry"><span class="label"><&|/l&>Status</&>:</span>
64 <div class="value">
65 <& /Ticket/Elements/SelectStatus,
66    Name=>"Status",
67    TicketObj => $t,
68    Default => $DefaultStatus &>
69 </div></div>
70
71 <div class="entry"><span class="label"><&|/l&>Owner</&>:</span>
72 <div class="value">
73 <& /Elements/SelectOwner,
74     Name         => "Owner",
75     TicketObj    => $t,
76     QueueObj     => $t->QueueObj,
77     DefaultLabel => loc("[_1] (Unchanged)", $t->OwnerObj->Format),
78     Default      => $ARGS{'Owner'}
79 &>
80 </div></div>
81 <div class="entry timefield"><span class="label"><&|/l&>Worked</&>:</span><span class="value">
82 <& /Elements/EditTimeValue,
83     Name => 'UpdateTimeWorked',
84     Default => $ARGS{UpdateTimeWorked}||'',
85     InUnits => $ARGS{'UpdateTimeWorked-TimeUnits'}||'minutes',
86 &>
87 </span></div>
88 % $m->callback( %ARGS, CallbackName => 'AfterWorked', Ticket => $t );
89 <input type="hidden" class="hidden" name="id" value="<%$t->Id%>" /><br />
90 <div class="entry"><span class="label"><&|/l&>Update Type</&>:</span>
91 <div class="value"><select name="UpdateType">
92 % if ($CanComment) {
93 <option value="private" <% ($ARGS{'UpdateType'} &&  $ARGS{'UpdateType'} eq "private") ? qq[ selected="selected"] : !$ARGS{'UpdateType'}&&$CommentDefault |n %>><&|/l&>Comments (Not sent to requestors)</&></option>
94 % }
95 % if ($CanRespond) {
96 <option value="response" <% ($ARGS{'UpdateType'} && $ARGS{'UpdateType'} eq "response") ? qq[ selected="selected"] : !$ARGS{'UpdateType'}&&$ResponseDefault |n %>><&|/l&>Reply to requestors</&></option>
97 % }
98 </select> 
99 </div></div>
100 <div class="entry"><span class="label"><&|/l&>Subject</&>:</span><div class="value"> <input type="text" name="UpdateSubject" size="60" value="<% $ARGS{UpdateSubject} || $t->Subject()%>" />
101 % $m->callback( %ARGS, CallbackName => 'AfterSubject' );
102 </div></div>
103
104 <div class="entry"><span class="label"><&|/l&>One-time Cc</&>:</span><span class="value"><& /Elements/EmailInput, Name => 'UpdateCc', Size => '60', Default => $ARGS{UpdateCc} &></span></div>
105
106 <div class="entry"><span class="label"><&|/l&>One-time Bcc</&>:</span><span class="value"><& /Elements/EmailInput, Name => 'UpdateBcc', Size => '60', Default => $ARGS{UpdateBcc} &></span></div>
107
108 <div class="entry"><span class="label" ><&|/l&>Message</&>:</span><div class="value">
109 % if (exists $ARGS{UpdateContent}) {
110 % # preserve QuoteTransaction so we can use it to set up sane references/in/reply to
111 % my $temp = $ARGS{'QuoteTransaction'};
112 % delete $ARGS{'QuoteTransaction'};
113 <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0, %ARGS&>
114 % $ARGS{'QuoteTransaction'} = $temp;
115 % } else {
116 % my $IncludeSignature = 1;
117 % $IncludeSignature = 0 if $Action ne 'Respond' && !RT->Config->Get('MessageBoxIncludeSignatureOnComment');
118 <& /Elements/MessageBox, Name=>"UpdateContent", IncludeSignature => $IncludeSignature, %ARGS &>
119 % }
120 </div></div>
121
122 % if (exists $session{'Attachments'}) {
123
124 <%loc("Attached file") %>
125
126 <%loc("Check box to delete")%><br />
127 % foreach my $attach_name (keys %{$session{'Attachments'}}) {
128 <input type="checkbox" class="checkbox" name="DeleteAttach-<%$attach_name%>" value="1" /><%$attach_name%><br />
129 % } # end of foreach
130
131
132 % } # end of if
133
134 <div class="entry">
135 <span class="label"><&|/l&>Attach file</&>:</span>
136 <div class="value">
137 <input type="file" name="Attach" />
138 <input type="submit" class="button" name="AddMoreAttach" value="<% loc("Add More Files") %>" />
139 <input type="hidden" class="hidden" name="UpdateAttach" value="1" />
140 </div>
141 </div>
142
143 % if ( $gnupg_widget ) {
144 <& /Elements/Crypt/SignEncryptWidget, self => $gnupg_widget, QueueObj => $t->QueueObj &>
145 % }
146
147 <& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket' &>
148 </form>
149 </&>
150 </div>
151 </&>
152 <%INIT>
153 my $CanRespond = 0;
154 my $CanComment = 0;
155 my $checks_failure = 0;
156 my $title;
157
158 my $t = LoadTicket($id);
159
160 my @results;
161
162 $m->callback( Ticket => $t, ARGSRef => \%ARGS, results => \@results, CallbackName => 'Initial' );
163
164 unless($DefaultStatus){
165     $DefaultStatus=($ARGS{'Status'} ||$t->Status());
166 }
167
168 if ($DefaultStatus eq 'new'){
169     $DefaultStatus='open';
170 }
171
172 if ($DefaultStatus eq 'resolved') {
173     $title = loc("Resolve ticket #[_1] ([_2])", $t->id, $t->Subject);
174 } else {
175     $title = loc("Update ticket #[_1] ([_2])", $t->id, $t->Subject);
176 }
177
178 # Things needed in the template - we'll do the processing here, just
179 # for the convenience:
180
181 my ($CommentDefault, $ResponseDefault);
182 if ($Action ne 'Respond') {
183     $CommentDefault = qq[ selected="selected"]; 
184     $ResponseDefault = "";
185 } else {
186     $CommentDefault = ""; 
187     $ResponseDefault = qq[ selected="selected"];
188 }
189
190
191
192 $CanRespond = 1 if ( $t->CurrentUserHasRight('ReplyToTicket') or
193                      $t->CurrentUserHasRight('ModifyTicket') ); 
194
195 $CanComment = 1 if ( $t->CurrentUserHasRight('CommentOnTicket') or
196                      $t->CurrentUserHasRight('ModifyTicket') ); 
197
198 ProcessAttachments(ARGSRef => \%ARGS);
199
200 # check email addresses for RT's
201 {
202     foreach my $field ( qw(UpdateCc UpdateBcc) ) {
203         my $value = $ARGS{ $field };
204         next unless defined $value && length $value;
205
206         my @emails = Email::Address->parse( $value );
207         foreach my $email ( grep RT::EmailParser->IsRTAddress($_->address), @emails ) {
208             push @results, loc("[_1] is an address RT receives mail at. Adding it as a '[_2]' would create a mail loop", $email->format, loc(substr($field, 6)) );
209             $checks_failure = 1;
210             $email = undef;
211         }
212         $ARGS{ $field } = join ', ', map $_->format, grep defined, @emails;
213     }
214 }
215
216 my $gnupg_widget = $m->comp('/Elements/Crypt/SignEncryptWidget:new', Arguments => \%ARGS );
217 $m->comp( '/Elements/Crypt/SignEncryptWidget:Process',
218     self => $gnupg_widget,
219     TicketObj => $t,
220 );
221
222 my $skip_update = 0;
223 $m->callback( CallbackName => 'BeforeUpdate', ARGSRef => \%ARGS, skip_update => \$skip_update,
224               checks_failure => $checks_failure, results => \@results, TicketObj => $t );
225
226 if ( !$checks_failure && !$skip_update && exists $ARGS{SubmitTicket} ) {
227     my $status = $m->comp('/Elements/Crypt/SignEncryptWidget:Check',
228         self      => $gnupg_widget,
229         TicketObj => $t,
230     );
231     $checks_failure = 1 unless $status;
232     $m->callback( Ticket => $t, ARGSRef => \%ARGS, CallbackName => 'BeforeDisplay' );
233     return $m->comp('/m/ticket/show', TicketObj => $t, %ARGS);
234 }
235 </%INIT>
236
237 <%ARGS>
238 $id => undef
239 $Action => 'Respond'
240 $DefaultStatus => undef
241 </%ARGS>