From bb1ed2740d5d576d0f43b9d6ad9557948dbc2805 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 9 Oct 2015 10:53:52 +0200 Subject: [PATCH] Display attachment size in compose (#1484774) --- CHANGELOG | 1 + program/steps/mail/attachments.inc | 3 ++- program/steps/mail/compose.inc | 6 +++++- skins/larry/mail.css | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 040abb9fc..03af71e0c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Display attachment size in compose (#1484774) - Added possibility to drag-n-drop attachments from mail preview to compose window - Implemented mail messages searching with predefined date interval - PGP encryption support via Mailvelope integration diff --git a/program/steps/mail/attachments.inc b/program/steps/mail/attachments.inc index c39b25ca0..fe2f8453a 100644 --- a/program/steps/mail/attachments.inc +++ b/program/steps/mail/attachments.inc @@ -203,7 +203,8 @@ function rcmail_attachment_success($attachment, $uploadid) 'aria-label' => $RCMAIL->gettext('delete') . ' ' . $attachment['name'], ), $button); - $content .= rcube::Q($attachment['name']); + $content .= sprintf('%s (%s)', + rcube::Q($attachment['name']), $RCMAIL->show_bytes($attachment['size'])); $RCMAIL->output->command('add2attachment_list', "rcmfile$id", array( 'html' => $content, diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 0e61e263d..86e33fc82 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -385,6 +385,7 @@ function rcmail_process_compose_params(&$COMPOSE) 'group' => $COMPOSE_ID, 'name' => $filename, 'mimetype' => rcube_mime::file_content_type($attach, $filename), + 'size' => filesize($attach), 'path' => $attach, ); } @@ -1557,6 +1558,9 @@ function rcmail_compose_attachment_list($attrib) continue; } + $content = sprintf('%s (%s)', + rcube::Q($a_prop['name']), $RCMAIL->show_bytes($a_prop['size'])); + $out .= html::tag('li', array( 'id' => 'rcmfile'.$id, 'class' => rcube_utils::file2class($a_prop['mimetype'], $a_prop['name']), @@ -1571,7 +1575,7 @@ function rcmail_compose_attachment_list($attrib) 'aria-label' => $RCMAIL->gettext('delete') . ' ' . $a_prop['name'], ), $button - ) . rcube::Q($a_prop['name']) + ) . $content ); $jslist['rcmfile'.$id] = array( diff --git a/skins/larry/mail.css b/skins/larry/mail.css index 3dc93d282..969cb1faf 100644 --- a/skins/larry/mail.css +++ b/skins/larry/mail.css @@ -1366,6 +1366,10 @@ div.message-partheaders .headers-table td.header { -webkit-box-shadow: 0 0 5px 2px rgba(71,135,177, 0.9); } +#compose-attachments .attachment-size { + color: #888; +} + #composeview-bottom .formbuttons.floating { position: absolute; width: auto;