[Rt-commit] rt branch, records_history, updated. rt-3.8.8-125-g9cc6746

Ruslan Zakirov ruz at bestpractical.com
Tue Jul 6 09:17:52 EDT 2010


The branch, records_history has been updated
       via  9cc674624c7cbb6c63e16fef60c9e240e10a4ff4 (commit)
       via  6de8a4ea26fd8111ea67929088a6398515a00c78 (commit)
       via  7c0c812c477cf7e481e8ee365bccda0df5651ad7 (commit)
       via  9c850f37efad2f744abb3594ac9e0589885861c8 (commit)
       via  f887842604e32173216951da7a5a07ab12a93c06 (commit)
       via  8fb5931c5b3c8344d9265d0c525618c1d0f940b0 (commit)
       via  6936d3403005a6004b8a9dff5c1d8574224800a0 (commit)
       via  138640897857177bd38cb75c5a9cb83d3f12158f (commit)
       via  31f4e2394efee01fb6292d806a35b35706f5f3fc (commit)
       via  41d51f1c9edaa671fa08dd6e4eeebb213a781750 (commit)
       via  0d04a0ebf31f6c8dde9831518ed50068470dd6cc (commit)
       via  fde9e681c3fab37c9482c7a39d42f446b35156e4 (commit)
      from  b2f92270097d5fd970cf4565086135c5edbbc60a (commit)

Summary of changes:
 etc/RT_Config.pm.in                                |   21 +++++++++----------
 lib/RT/Attachment_Overlay.pm                       |   18 ++++++++++++++++
 lib/RT/Config.pm                                   |   13 ++++++++++-
 share/html/Admin/CustomFields/Modify.html          |    9 --------
 share/html/Elements/RT__SavedSearch/ColumnMap      |    9 +++----
 .../{Toggle/TicketBookmark => TicketHistory.html}  |   15 ++++++++++++-
 share/html/Search/Results.tsv                      |    5 ++-
 share/html/Ticket/Display.html                     |   22 ++++++++++++-------
 .../Elements/ClickToShowHistory}                   |   16 +++++++-------
 .../Ticket/Elements/ShowTransactionAttachments     |   20 ++---------------
 share/html/Ticket/Elements/UpdateCc                |    2 +
 11 files changed, 87 insertions(+), 63 deletions(-)
 copy share/html/Helpers/{Toggle/TicketBookmark => TicketHistory.html} (80%)
 copy share/html/{Admin/Elements/SelectModifyQueue => Ticket/Elements/ClickToShowHistory} (88%)
 mode change 100755 => 100644

- Log -----------------------------------------------------------------
commit 6de8a4ea26fd8111ea67929088a6398515a00c78
Merge: b2f9227 7c0c812
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Jul 6 17:03:28 2010 +0400

    Merge remote branch 'origin/3.9-trunk' into records_history


commit 9cc674624c7cbb6c63e16fef60c9e240e10a4ff4
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Jul 6 17:14:30 2010 +0400

    FriendlyContentLength method for RT::Attachments

diff --git a/lib/RT/Attachment_Overlay.pm b/lib/RT/Attachment_Overlay.pm
index 8406590..e3c1b9c 100644
--- a/lib/RT/Attachment_Overlay.pm
+++ b/lib/RT/Attachment_Overlay.pm
@@ -356,6 +356,24 @@ sub ContentLength {
     return $len;
 }
 
+sub FriendlyContentLength {
+    my $self = shift;
+    my $size = $self->ContentLength;
+    return '' unless $size;
+
+    my $res = '';
+    if ( $size > 1024*1024 ) {
+        $res = $self->loc( "[_1]M", int( $size / 1024 / 102.4 ) / 10 );
+    }
+    elsif ( $size > 1024 ) {
+        $res = $self->loc( "[_1]k", int( $size / 102.4 ) / 10 );
+    }
+    else {
+        $res = $self->loc( "[_1]b", $size );
+    }
+    return $res;
+}
+
 =head2 Quote
 
 =cut
diff --git a/share/html/Ticket/Elements/ShowTransactionAttachments b/share/html/Ticket/Elements/ShowTransactionAttachments
index 32a6a91..2d81346 100644
--- a/share/html/Ticket/Elements/ShowTransactionAttachments
+++ b/share/html/Ticket/Elements/ShowTransactionAttachments
@@ -59,8 +59,7 @@ foreach my $message ( grep $_->__Value('Parent') == $Parent, @$Attachments ) {
               DisplayHeaders => \@DisplayHeaders,
             );
 
-    my $size = $message->ContentLength;
-    if ( $size ) {
+    if ( $message->ContentLength ) {
 </%PERL>
 <div class="downloadattachment">
 <a href="<% $AttachPath %>/<% $Transaction->Id %>/<% $message->Id %>/<% ($message->Filename ||'')| u%>"><&|/l&>Download</&> <% $message->Filename || loc('(untitled)') %></a>
@@ -71,7 +70,7 @@ foreach my $message ( grep $_->__Value('Parent') == $Parent, @$Attachments ) {
 % $m->callback(CallbackName => 'AfterDownloadLinks', ARGSRef => \%ARGS, Ticket => $Ticket, Transaction => $Transaction, Attachment => $message);
 
 <br />
-<span class="downloadcontenttype"><% $message->ContentType %> <% $size_to_str->( $size ) %></span>
+<span class="downloadcontenttype"><% $message->ContentType %> <% $message->FriendlyContentLength %></span>
 </div>
 %   }
 
@@ -127,21 +126,6 @@ elsif (!$ShowHeaders)  {
 
 $m->callback(CallbackName => 'MassageDisplayHeaders', DisplayHeaders => \@DisplayHeaders, Transaction => $Transaction);
 
-my $size_to_str = sub {
-    my $size = shift;
-    # show a download link
-    if ( $size > 1024*1024 ) {
-        $size = loc( "[_1]b", int( $size / 1024 / 102.4 ) / 10 );
-    }
-    elsif ( $size > 1024 ) {
-        $size = loc( "[_1]k", int( $size / 102.4 ) / 10 );
-    }
-    else {
-        $size = loc( "[_1]b", $size );
-    }
-    return $size;
-};
-
 my $render_attachment = sub {
     my $message = shift;
 

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


More information about the Rt-commit mailing list