diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-06-25 08:58:23 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-06-25 08:58:23 +0200 |
commit | 2b3a3b1407bf2f6a7019f921a177d99506e3b76c (patch) | |
tree | d8ebe415bef86c4448de220ce9c60a0fe80fc25f /program/steps/mail/get.inc | |
parent | 855c85377d44943ba307d083632c6c5a9f1c98ad (diff) | |
parent | 093a3d9e7df58e2bd41db2caf6a348bf60c9ec8a (diff) |
Merge branch 'master' of github.com:roundcube/roundcubemail
Diffstat (limited to 'program/steps/mail/get.inc')
-rw-r--r-- | program/steps/mail/get.inc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc index 372757720..5efa5c5c4 100644 --- a/program/steps/mail/get.inc +++ b/program/steps/mail/get.inc @@ -51,6 +51,12 @@ if (!empty($_GET['_frame'])) { $OUTPUT->set_pagetitle(rcmail_attachment_name($part)); } + // register UI objects + $OUTPUT->add_handlers(array( + 'messagepartframe' => 'rcmail_message_part_frame', + 'messagepartcontrols' => 'rcmail_message_part_controls', + )); + $OUTPUT->send('messagepart'); exit; } @@ -410,3 +416,45 @@ function check_storage_status() exit; } } + + +function rcmail_message_part_controls($attrib) +{ + global $MESSAGE, $RCMAIL; + + $part = asciiwords(get_input_value('_part', RCUBE_INPUT_GPC)); + if (!is_object($MESSAGE) || !is_array($MESSAGE->parts) + || !($_GET['_uid'] && $_GET['_part']) || !$MESSAGE->mime_parts[$part] + ) { + return ''; + } + + $part = $MESSAGE->mime_parts[$part]; + $table = new html_table(array('cols' => 2)); + + $table->add('title', Q(rcube_label('name')).':'); + $table->add('header', Q(rcmail_attachment_name($part))); + + $table->add('title', Q(rcube_label('type')).':'); + $table->add('header', Q($part->mimetype)); + + $table->add('title', Q(rcube_label('size')).':'); + $table->add('header', Q($RCMAIL->message_part_size($part))); + + return $table->show($attrib); +} + + +function rcmail_message_part_frame($attrib) +{ + global $MESSAGE, $RCMAIL; + + $part = $MESSAGE->mime_parts[asciiwords(get_input_value('_part', RCUBE_INPUT_GPC))]; + $ctype_primary = strtolower($part->ctype_primary); + + $attrib['src'] = './?' . str_replace('_frame=', ($ctype_primary=='text' ? '_embed=' : '_preload='), $_SERVER['QUERY_STRING']); + + $RCMAIL->output->add_gui_object('messagepartframe', $attrib['id']); + + return html::iframe($attrib); +} |