[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.7-157-g82b813d
sartak at bestpractical.com
sartak at bestpractical.com
Tue Feb 16 14:44:36 EST 2010
The branch, 3.8-trunk has been updated
via 82b813d4771ca303c098382e00790cde21b1155a (commit)
from 8079c05cc2f513c7d511d324f7e9e74513c19890 (commit)
Summary of changes:
etc/RT_Config.pm.in | 12 ++++++++++++
share/html/Ticket/Elements/ShowAttachments | 17 ++++++++++++++---
2 files changed, 26 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit 82b813d4771ca303c098382e00790cde21b1155a
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Feb 16 14:44:15 2010 -0500
New configuration for AttachmentUnits
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 5500356..5d9607e 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1078,6 +1078,18 @@ this overrides C<TrustHTMLAttachments>.
Set($AlwaysDownloadAttachments, undef);
+=item C<$AttachmentUnits>
+
+Controls the units (kilobytes or bytes) that attachment sizes use
+for display. The default is to display kilobytes if the attachment
+is larger than 1024 bytes, bytes otherwise. If you set
+C<$AttachmentUnits> to C<'k'> then attachment sizes will always be
+displayed in kilobytes. If set to C<'b'>, then sizes will be bytes.
+
+=cut
+
+Set($AttachmentUnits, undef);
+
=item C<$RedistributeAutoGeneratedMessages>
Should RT redistribute correspondence that it identifies as
diff --git a/share/html/Ticket/Elements/ShowAttachments b/share/html/Ticket/Elements/ShowAttachments
index 72298d7..ab0d921 100755
--- a/share/html/Ticket/Elements/ShowAttachments
+++ b/share/html/Ticket/Elements/ShowAttachments
@@ -61,11 +61,22 @@
my $size = $rev->ContentLength;
if ($size) {
- if ($size > 1024) {
- $size = int($size/102.4)/10 . "k";
+ my $kb = int($size/102.4) / 10;
+ my $units = RT->Config->Get('AttachmentUnits');
+
+ if (!defined($units)) {
+ if ($size > 1024) {
+ $size = $kb . "k";
+ }
+ else {
+ $size = $size . "b";
+ }
+ }
+ elsif ($units eq 'k') {
+ $size = $kb . "k";
}
else {
- $size = $size ."b";
+ $size = $size . "b";
}
</%PERL>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list