diff options
Diffstat (limited to 'program/steps/mail/show.inc')
-rw-r--r-- | program/steps/mail/show.inc | 61 |
1 files changed, 21 insertions, 40 deletions
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 59f4d55e1..c1726bbdf 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -19,7 +19,7 @@ +-----------------------------------------------------------------------+ */ -$PRINT_MODE = $RCMAIL->action == 'print' ? TRUE : FALSE; +$PRINT_MODE = $RCMAIL->action=='print' ? TRUE : FALSE; // Read browser capabilities and store them in session if ($caps = get_input_value('_caps', RCUBE_INPUT_GET)) { @@ -31,21 +31,8 @@ if ($caps = get_input_value('_caps', RCUBE_INPUT_GET)) { $_SESSION['browser_caps'] = $browser_caps; } -$uid = get_input_value('_uid', RCUBE_INPUT_GET); -$mbox_name = $RCMAIL->storage->get_folder(); - // similar code as in program/steps/mail/get.inc -if ($uid) { - // set message format (need to be done before rcube_message construction) - if (!empty($_GET['_format'])) { - $prefer_html = $_GET['_format'] == 'html'; - $RCMAIL->config->set('prefer_html', $prefer_html); - $_SESSION['msg_formats'][$mbox_name.':'.$uid] = $prefer_html; - } - else if (isset($_SESSION['msg_formats'][$mbox_name.':'.$uid])) { - $RCMAIL->config->set('prefer_html', $_SESSION['msg_formats'][$mbox_name.':'.$uid]); - } - +if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) { $MESSAGE = new rcube_message($uid); // if message not found (wrong UID)... @@ -53,6 +40,7 @@ if ($uid) { rcmail_message_error($uid); } + $mbox_name = $RCMAIL->storage->get_folder(); // show images? rcmail_check_safe($MESSAGE); @@ -116,12 +104,7 @@ if ($uid) { if (!$OUTPUT->ajax_call) $OUTPUT->add_label('checkingmail', 'deletemessage', 'movemessagetotrash', - 'movingmessage', 'deletingmessage', 'markingmessage', 'replyall', 'replylist'); - - $prefer_html = $RCMAIL->config->get('prefer_html'); - if ($MESSAGE->has_html_part()) { - $OUTPUT->set_env('optional_format', $prefer_html ? 'text' : 'html'); - } + 'movingmessage', 'deletingmessage', 'markingmessage'); // check for unset disposition notification if ($MESSAGE->headers->mdn_to @@ -164,7 +147,6 @@ function rcmail_message_attachments($attrib) global $PRINT_MODE, $MESSAGE, $RCMAIL; $out = $ol = ''; - $attachments = array(); if (sizeof($MESSAGE->attachments)) { foreach ($MESSAGE->attachments as $attach_prop) { @@ -175,31 +157,30 @@ function rcmail_message_attachments($attrib) $ol .= html::tag('li', null, Q(sprintf("%s (%s)", $filename, $size))); } else { - if (mb_strlen($filename) > 50) { + if ($attrib['maxlength'] && mb_strlen($filename) > $attrib['maxlength']) { $title = $filename; - $filename = abbreviate_string($filename, 50); + $filename = abbreviate_string($filename, $attrib['maxlength']); } else { $title = ''; } - $mimetype = rcmail_fix_mimetype($attach_prop->mimetype); - $class = rcmail_filetype2classname($mimetype, $filename); - $id = 'attach' . $attach_prop->mime_id; - $link = html::a(array( + $ol .= html::tag('li', rcmail_filetype2classname($attach_prop->mimetype, $filename), + html::a(array( 'href' => $MESSAGE->get_part_url($attach_prop->mime_id, false), - 'onclick' => sprintf('return %s.command(\'load-attachment\',\'%s\',this)', - JS_OBJECT_NAME, $attach_prop->mime_id), - 'title' => Q($title), - ), Q($filename)); - $ol .= html::tag('li', array('class' => $class, 'id' => $id), $link); - - $attachments[$attach_prop->mime_id] = $mimetype; + 'onclick' => sprintf( + 'return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)', + JS_OBJECT_NAME, + $attach_prop->mime_id, + rcmail_fix_mimetype($attach_prop->mimetype)), + 'onmouseover' => $title ? '' : 'rcube_webmail.long_subject_title_ex(this, 0)', + 'title' => Q($title), + ), + Q($filename))); } } $out = html::tag('ul', $attrib, $ol, html::$common_attrib); - $RCMAIL->output->set_env('attachments', $attachments); } return $out; @@ -228,11 +209,11 @@ function rcmail_remote_objects_msg() function rcmail_message_buttons() { - global $RCMAIL; + global $MESSAGE, $RCMAIL, $CONFIG; $mbox = $RCMAIL->storage->get_folder(); $delim = $RCMAIL->storage->get_hierarchy_delimiter(); - $dbox = $RCMAIL->config->get('drafts_mbox'); + $dbox = $CONFIG['drafts_mbox']; // the message is not a draft if ($mbox != $dbox && strpos($mbox, $dbox.$delim) !== 0) { @@ -309,9 +290,9 @@ $OUTPUT->add_handlers(array( )); -if ($RCMAIL->action == 'print' && $OUTPUT->template_exists('messageprint')) +if ($RCMAIL->action=='print' && $OUTPUT->template_exists('messageprint')) $OUTPUT->send('messageprint', false); -else if ($RCMAIL->action == 'preview' && $OUTPUT->template_exists('messagepreview')) +else if ($RCMAIL->action=='preview' && $OUTPUT->template_exists('messagepreview')) $OUTPUT->send('messagepreview', false); else $OUTPUT->send('message', false); |