rt 4.2.15
[freeside.git] / rt / share / html / m / ticket / reply
index ea2a6ca..c7414b1 100644 (file)
@@ -1,3 +1,50 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%#                                          <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
 <&|/m/_elements/wrapper, title => loc('Update ticket #[_1]', $t->id) &>
 <& /m/_elements/ticket_menu, ticket => $t &>
 <& /Elements/ListActions, actions => \@results &>
     method="post" enctype="multipart/form-data">
 <input type="hidden" class="hidden" name="DefaultStatus" value="<% $DefaultStatus ||''%>" />
 <input type="hidden" class="hidden" name="Action" value="<% $ARGS{Action}||'' %>" />
+<input type="hidden" class="hidden" name="Token" value="<% $ARGS{'Token'} %>" />
+
+% if ($gnupg_widget) {
+<& /Elements/Crypt/SignEncryptWidget:ShowIssues, self => $gnupg_widget &>
+% }
 
 <div class="entry"><span class="label"><&|/l&>Status</&>:</span>
 <div class="value">
-<& /Elements/SelectStatus, Name=>"Status", DefaultLabel => loc("[_1] (Unchanged)", loc($t->Status)), Default => $ARGS{'Status'} || ($t->Status eq $DefaultStatus ? undef : $DefaultStatus)&>
+<& /Ticket/Elements/SelectStatus,
+   Name=>"Status",
+   TicketObj => $t,
+   Default => $DefaultStatus &>
 </div></div>
 
 <div class="entry"><span class="label"><&|/l&>Owner</&>:</span>
@@ -19,7 +74,7 @@
     Name         => "Owner",
     TicketObj    => $t,
     QueueObj     => $t->QueueObj,
-    DefaultLabel => loc("[_1] (Unchanged)", $t->OwnerObj->Name),
+    DefaultLabel => loc("[_1] (Unchanged)", $t->OwnerObj->Format),
     Default      => $ARGS{'Owner'}
 &>
 </div></div>
@@ -27,9 +82,9 @@
 <& /Elements/EditTimeValue,
     Name => 'UpdateTimeWorked',
     Default => $ARGS{UpdateTimeWorked}||'',
-    InUnits => $ARGS{'UpdateTimeWorked-TimeUnits'}||'minutes',
 &>
 </span></div>
+% $m->callback( %ARGS, CallbackName => 'AfterWorked', Ticket => $t );
 <input type="hidden" class="hidden" name="id" value="<%$t->Id%>" /><br />
 <div class="entry"><span class="label"><&|/l&>Update Type</&>:</span>
 <div class="value"><select name="UpdateType">
@@ -41,7 +96,7 @@
 % }
 </select> 
 </div></div>
-<div class="entry"><span class="label"><&|/l&>Subject</&>:</span><div class="value"> <input name="UpdateSubject" size="60" value="<% $ARGS{UpdateSubject} || $t->Subject()%>" />
+<div class="entry"><span class="label"><&|/l&>Subject</&>:</span><div class="value"> <input type="text" name="UpdateSubject" size="60" value="<% $ARGS{UpdateSubject} || $t->Subject()%>" />
 % $m->callback( %ARGS, CallbackName => 'AfterSubject' );
 </div></div>
 
 <& /Elements/MessageBox, Name=>"UpdateContent", IncludeSignature => $IncludeSignature, %ARGS &>
 % }
 </div></div>
+
+% if (exists $session{'Attachments'}) {
+
+<%loc("Attached file") %>
+
+<%loc("Check box to delete")%><br />
+% foreach my $attach_name (keys %{$session{'Attachments'}}) {
+<input type="checkbox" class="checkbox" name="DeleteAttach-<%$attach_name%>" value="1" /><%$attach_name%><br />
+% } # end of foreach
+
+
+% } # end of if
+
+<div class="entry">
+<span class="label"><&|/l&>Attach file</&>:</span>
+<div class="value">
+<input type="file" name="Attach" />
+<input type="submit" class="button" name="AddMoreAttach" value="<% loc("Add More Files") %>" />
+<input type="hidden" class="hidden" name="UpdateAttach" value="1" />
+</div>
+</div>
+
+% if ( $gnupg_widget ) {
+<& /Elements/Crypt/SignEncryptWidget, self => $gnupg_widget, QueueObj => $t->QueueObj &>
+% }
+
 <& /Elements/Submit, Label => loc('Update Ticket'), Name => 'SubmitTicket' &>
 </form>
 </&>
@@ -113,35 +194,7 @@ $CanRespond = 1 if ( $t->CurrentUserHasRight('ReplyToTicket') or
 $CanComment = 1 if ( $t->CurrentUserHasRight('CommentOnTicket') or
                      $t->CurrentUserHasRight('ModifyTicket') ); 
 
-
-# {{{ deal with deleting uploaded attachments
-foreach my $key (keys %ARGS) {
-    if ($key =~ m/^DeleteAttach-(.+)$/) {
-        delete $session{'Attachments'}{$1};
-    }
-    $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
-}
-# }}}
-
-# {{{ store the uploaded attachment in session
-if ($ARGS{'Attach'}) {            # attachment?
-    my $attachment = MakeMIMEEntity(
-        AttachmentFieldName => 'Attach'
-    );
-
-    my $file_path = Encode::decode_utf8("$ARGS{'Attach'}");
-    $session{'Attachments'} = {
-        %{$session{'Attachments'} || {}},
-        $file_path => $attachment,
-    };
-}
-# }}}
-
-# delete temporary storage entry to make WebUI clean
-unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
-    delete $session{'Attachments'};
-}
-# }}}
+ProcessAttachments(ARGSRef => \%ARGS);
 
 # check email addresses for RT's
 {
@@ -159,13 +212,29 @@ unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) {
     }
 }
 
-if ( !$checks_failure && exists $ARGS{SubmitTicket} ) {
+my $gnupg_widget = $m->comp('/Elements/Crypt/SignEncryptWidget:new', Arguments => \%ARGS );
+$m->comp( '/Elements/Crypt/SignEncryptWidget:Process',
+    self => $gnupg_widget,
+    TicketObj => $t,
+);
+
+my $skip_update = 0;
+$m->callback( CallbackName => 'BeforeUpdate', ARGSRef => \%ARGS, skip_update => \$skip_update,
+              checks_failure => $checks_failure, results => \@results, TicketObj => $t );
+
+if ( !$checks_failure && !$skip_update && exists $ARGS{SubmitTicket} ) {
+    my $status = $m->comp('/Elements/Crypt/SignEncryptWidget:Check',
+        self      => $gnupg_widget,
+        TicketObj => $t,
+    );
+    $checks_failure = 1 unless $status;
+    $m->callback( Ticket => $t, ARGSRef => \%ARGS, CallbackName => 'BeforeDisplay' );
     return $m->comp('/m/ticket/show', TicketObj => $t, %ARGS);
 }
 </%INIT>
 
 <%ARGS>
 $id => undef
-$Action => 'reply'
+$Action => 'Respond'
 $DefaultStatus => undef
 </%ARGS>