[Rt-commit] rt branch, 4.2-trunk, updated. rt-4.2.12-114-g0ae3783

Shawn Moore shawn at bestpractical.com
Thu Mar 24 21:21:52 EDT 2016


The branch, 4.2-trunk has been updated
       via  0ae37834d2e6b9ca8bcd3e16aa6c59822fb6ad29 (commit)
      from  40b9adb822c00a7997e278e4ec4eb2157b66c2d9 (commit)

Summary of changes:
 share/html/Elements/ShowTransactionAttachments | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

- Log -----------------------------------------------------------------
commit 0ae37834d2e6b9ca8bcd3e16aa6c59822fb6ad29
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Fri Mar 25 00:42:24 2016 +0000

    Add a BeforeAttachment callback to ShowTransactionAttachments
    
        It passes a ShouldRenderDownload scalar ref to control whether the
        download links should be displayed for this attachment.

diff --git a/share/html/Elements/ShowTransactionAttachments b/share/html/Elements/ShowTransactionAttachments
index bb80997..9d222a5 100644
--- a/share/html/Elements/ShowTransactionAttachments
+++ b/share/html/Elements/ShowTransactionAttachments
@@ -56,7 +56,11 @@ foreach my $message ( @{ $Attachments->{ $Parent || 0 } || [] } ) {
             );
 
     my $name = defined $message->Filename && length $message->Filename ?  $message->Filename : '';
-    if ( $message->ContentLength or $name ) {
+    my $should_render_download = $message->ContentLength || $name;
+
+    $m->callback(CallbackName => 'BeforeAttachment', ARGSRef => \%ARGS, Object => $Object, Transaction => $Transaction, Attachment => $message, Name => $name, ShouldRenderDownload => \$should_render_download);
+
+    if ($should_render_download) {
 </%PERL>
 <div class="downloadattachment">
 <a href="<% $AttachmentPath %>/<% $Transaction->Id %>/<% $message->Id %>/<% $name | u%>"><&|/l&>Download</&> <% length $name ? $name : loc('(untitled)') %></a>\

-----------------------------------------------------------------------


More information about the rt-commit mailing list