1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2009 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., 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.
30 %# CONTRIBUTION SUBMISSION POLICY:
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.)
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.
47 %# END BPS TAGGED BLOCK }}}
48 <& /Elements/Header, Title => $title &>
49 <& /Ticket/Elements/Tabs,
53 % $m->callback(CallbackName => 'BeforeActionList', ARGSRef => \%ARGS, Ticket => $TicketObj);
54 <& /Elements/ListActions, actions => \@results &>
56 <form action="Update.html" name="TicketUpdate"
57 method="post" enctype="multipart/form-data">
58 % $m->callback( CallbackName => 'FormStart', ARGSRef => \%ARGS, Ticket => $TicketObj );
59 <input type="hidden" class="hidden" name="QuoteTransaction" value="<% $ARGS{QuoteTransaction}||'' %>" />
60 <input type="hidden" class="hidden" name="DefaultStatus" value="<% $DefaultStatus ||''%>" />
61 <input type="hidden" class="hidden" name="Action" value="<% $ARGS{Action}||'' %>" />
63 <& /Elements/GnuPG/SignEncryptWidget:ShowIssues, self => $gnupg_widget &>
65 <table width="100%" border="0">
66 % $m->callback(CallbackName => 'AfterTableOpens', ARGSRef => \%ARGS, Ticket => $TicketObj);
68 <tr><td class="label"><&|/l&>Status</&>:</td>
70 <& /Elements/SelectStatus, Name=>"Status", DefaultLabel => loc("[_1] (Unchanged)", loc($TicketObj->Status)), Default => $ARGS{'Status'} || ($TicketObj->Status eq $DefaultStatus ? undef : $DefaultStatus)&>
71 <span class="label"><&|/l&>Owner</&>:</span>
72 <& /Elements/SelectOwner,
74 TicketObj => $TicketObj,
75 QueueObj => $TicketObj->QueueObj,
76 DefaultLabel => loc("[_1] (Unchanged)", $TicketObj->OwnerObj->Name),
77 Default => $ARGS{'Owner'}
79 <span class="label"><&|/l&>Worked</&>:</span>
80 <& /Elements/EditTimeValue,
81 Name => 'UpdateTimeWorked',
82 Default => $ARGS{UpdateTimeWorked}||'',
83 InUnits => $ARGS{'UpdateTimeWorked-TimeUnits'}||'minutes',
87 % $m->callback( %ARGS, CallbackName => 'BeforeUpdateType', skip => \$skip );
89 <input type="hidden" class="hidden" name="id" value="<%$TicketObj->Id%>" /><br />
91 <tr><td class="label"><&|/l&>Update Type</&>:</td>
92 <td><select name="UpdateType">
94 <option value="private" <% ($ARGS{'UpdateType'} && $ARGS{'UpdateType'} eq "private") ? qq[ selected="selected"] : !$ARGS{'UpdateType'}&&$CommentDefault |n %>><&|/l&>Comments (Not sent to requestors)</&></option>
97 <option value="response" <% ($ARGS{'UpdateType'} && $ARGS{'UpdateType'} eq "response") ? qq[ selected="selected"] : !$ARGS{'UpdateType'}&&$ResponseDefault |n %>><&|/l&>Reply to requestors</&></option>
101 <tr><td class="label"><&|/l&>Subject</&>:</td><td> <input name="UpdateSubject" size="60" value="<% $ARGS{UpdateSubject} || $TicketObj->Subject()%>" /></td></tr>
103 <& /Ticket/Elements/UpdateCc, %ARGS, TicketObj => $TicketObj &>
105 <& /Ticket/Elements/EditTransactionCustomFields, %ARGS, TicketObj => $TicketObj &>
107 % if (exists $session{'Attachments'}) {
108 <tr><td><&|/l&>Attached file</&>:</td>
110 <&|/l&>Check box to delete</&><br />
111 % foreach my $attach_name (keys %{$session{'Attachments'}}) {
112 <input type="checkbox" class="checkbox" name="DeleteAttach-<%$attach_name%>" value="1" /><%$attach_name%><br />
118 <tr><td class="label"><&|/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" />
121 % if ( $gnupg_widget ) {
122 <tr><td> </td><td>
123 <& /Elements/GnuPG/SignEncryptWidget,
124 self => $gnupg_widget,
125 TicketObj => $TicketObj,
130 <tr><td class="label" valign="top"><&|/l&>Message</&>:</td><td>
131 % $m->callback( %ARGS, CallbackName => 'BeforeMessageBox' );
132 % if (exists $ARGS{UpdateContent}) {
133 % # preserve QuoteTransaction so we can use it to set up sane references/in/reply to
134 % my $temp = $ARGS{'QuoteTransaction'};
135 % delete $ARGS{'QuoteTransaction'};
136 <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0, %ARGS&>
137 % $ARGS{'QuoteTransaction'} = $temp;
139 <& /Elements/MessageBox, Name=>"UpdateContent", %ARGS &>
147 <& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket' &>
148 % if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail')) {
149 <&|/Widgets/TitleBox, title => loc('Scrips and Recipients') &>
150 <& /Ticket/Elements/PreviewScrips, TicketObj => $TicketObj, %ARGS &>
158 my $checks_failure = 0;
161 my $TicketObj = LoadTicket($id);
165 $m->callback( Ticket => $TicketObj, ARGSRef => \%ARGS, results => \@results, CallbackName => 'Initial' );
167 unless($DefaultStatus){
168 $DefaultStatus=($ARGS{'Status'} ||$TicketObj->Status());
171 if ($DefaultStatus eq 'new'){
172 $DefaultStatus='open';
175 if ($DefaultStatus eq 'resolved') {
176 $title = loc("Resolve ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
178 $title = loc("Update ticket #[_1] ([_2])", $TicketObj->id, $TicketObj->Subject);
181 # Things needed in the template - we'll do the processing here, just
182 # for the convenience:
184 my ($CommentDefault, $ResponseDefault);
185 if ($Action ne 'Respond') {
186 $CommentDefault = qq[ selected="selected"];
187 $ResponseDefault = "";
189 $CommentDefault = "";
190 $ResponseDefault = qq[ selected="selected"];
195 $CanRespond = 1 if ( $TicketObj->CurrentUserHasRight('ReplyToTicket') or
196 $TicketObj->CurrentUserHasRight('ModifyTicket') );
198 $CanComment = 1 if ( $TicketObj->CurrentUserHasRight('CommentOnTicket') or
199 $TicketObj->CurrentUserHasRight('ModifyTicket') );
202 # {{{ deal with deleting uploaded attachments
203 foreach my $key (keys %ARGS) {
204 if ($key =~ m/^DeleteAttach-(.+)$/) {
205 delete $session{'Attachments'}{$1};
207 $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
211 # {{{ store the uploaded attachment in session
212 if ($ARGS{'Attach'}) { # attachment?
213 my $attachment = MakeMIMEEntity(
214 AttachmentFieldName => 'Attach'
217 my $file_path = Encode::decode_utf8("$ARGS{'Attach'}");
218 $session{'Attachments'} = {
219 %{$session{'Attachments'} || {}},
220 $file_path => $attachment,
225 # delete temporary storage entry to make WebUI clean
226 unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
227 delete $session{'Attachments'};
231 my $gnupg_widget = $m->comp('/Elements/GnuPG/SignEncryptWidget:new', Arguments => \%ARGS );
232 $m->comp( '/Elements/GnuPG/SignEncryptWidget:Process',
233 self => $gnupg_widget,
234 TicketObj => $TicketObj,
237 if ( $ARGS{'SubmitTicket'} ) {
238 my $CFs = $TicketObj->TransactionCustomFields;
239 my $ValidCFs = $m->comp(
240 '/Elements/ValidateCustomFields',
241 CustomFields => $CFs,
242 NamePrefix => "Object-RT::Transaction--CustomField-",
245 unless ( $ValidCFs ) {
247 while (my $CF = $CFs->Next) {
248 my $msg = $m->notes('InvalidField-' . $CF->Id) or next;
249 push @results, loc($CF->Name) . ': ' . $msg;
252 my $status = $m->comp('/Elements/GnuPG/SignEncryptWidget:Check',
253 self => $gnupg_widget,
254 TicketObj => $TicketObj,
256 $checks_failure = 1 unless $status;
259 if ( !$checks_failure && exists $ARGS{SubmitTicket} ) {
260 $m->callback( Ticket => $TicketObj, ARGSRef => \%ARGS, CallbackName => 'BeforeDisplay' );
261 return $m->comp('Display.html', TicketObj => $TicketObj, %ARGS);
268 $DefaultStatus => undef