[Rt-commit] rt branch, 4.4.1/attachment-count, created. rt-4.4.1rc1-1-g572fa79

Shawn Moore shawn at bestpractical.com
Thu Jun 2 18:38:33 EDT 2016


The branch, 4.4.1/attachment-count has been created
        at  572fa79284eef205beb1be76739a324463983da1 (commit)

- Log -----------------------------------------------------------------
commit 572fa79284eef205beb1be76739a324463983da1
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Jun 2 22:37:21 2016 +0000

    Add AttachmentListCount RT_Config option
    
        This restores the 4.4.0 behavior of showing all attachments by default.
    
        This also fixes the "Show all attachments" button being missing when
        AttachmentListCount is 0.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 76c337d..7722558 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1967,6 +1967,18 @@ overrides C<TrustHTMLAttachments>.
 
 Set($AlwaysDownloadAttachments, undef);
 
+=item C<$AttachmentListCount>
+
+The number of attachments to display by default on ticket display and ticket
+reply pages. Attachments beyond this count will be displayed only after the
+user clicks a "Show all attachments" link. The default value, C<undef>, means
+always show all attachments. A value of C<0> means show no attachments by
+default.
+
+=cut
+
+Set($AttachmentListCount, undef);
+
 =item C<$PreferRichText>
 
 By default, RT shows rich text (HTML) messages if possible.  If
diff --git a/share/html/Ticket/Elements/AddAttachments b/share/html/Ticket/Elements/AddAttachments
index 1173093..f38a13c 100644
--- a/share/html/Ticket/Elements/AddAttachments
+++ b/share/html/Ticket/Elements/AddAttachments
@@ -172,7 +172,7 @@ jQuery( function() {
       Selectable   => 1,
       HideTitleBox => 1,
       Checked      => \@AttachExisting,
-      Count        => 5,
+      Count        => RT->Config->Get('AttachmentListCount'),
     &>
   </td>
 </tr>
diff --git a/share/html/Ticket/Elements/ShowAttachments b/share/html/Ticket/Elements/ShowAttachments
index 9ecfc0c..a13c9be 100644
--- a/share/html/Ticket/Elements/ShowAttachments
+++ b/share/html/Ticket/Elements/ShowAttachments
@@ -45,7 +45,6 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-% if (keys %documents) {
 <&| /Widgets/TitleBox, title => loc('Attachments'), 
         title_class=> 'inverse',  
         class => 'ticket-info-attachments',
@@ -118,8 +117,6 @@
 </div>
 </&>
 
-% }
-
 <%INIT>
 
 # If we haven't been passed in an Attachments object (through the precaching mechanism)
@@ -153,6 +150,8 @@ while ( my $attach = $Attachments->Next() ) {
 }
 
 my %is_checked = map { $_ => 1 } @Checked;
+
+return if !$show_more && keys %documents == 0;
 </%INIT>
 <%ARGS>
 $Ticket => undef
diff --git a/share/html/Ticket/Elements/ShowSummary b/share/html/Ticket/Elements/ShowSummary
index 4183dab..528f36e 100644
--- a/share/html/Ticket/Elements/ShowSummary
+++ b/share/html/Ticket/Elements/ShowSummary
@@ -64,7 +64,7 @@
         class => 'ticket-info-people',
     &><& /Ticket/Elements/ShowPeople, Ticket => $Ticket &></&>
 % $m->callback( %ARGS, CallbackName => 'AfterPeople' );
-    <& /Ticket/Elements/ShowAttachments, Ticket => $Ticket, Attachments => $Attachments, Count => 5 &>
+    <& /Ticket/Elements/ShowAttachments, Ticket => $Ticket, Attachments => $Attachments, Count => RT->Config->Get('AttachmentListCount') &>
 % $m->callback( %ARGS, CallbackName => 'AfterAttachments' );
     <& /Ticket/Elements/ShowRequestor, Ticket => $Ticket &>
 % $m->callback( %ARGS, CallbackName => 'LeftColumn' );

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


More information about the rt-commit mailing list