summaryrefslogtreecommitdiff
path: root/program/steps/mail/show.inc
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps/mail/show.inc')
-rw-r--r--program/steps/mail/show.inc37
1 files changed, 20 insertions, 17 deletions
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 19e6e56a9..6c247aea9 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -5,7 +5,7 @@
| program/steps/mail/show.inc |
| |
| This file is part of the RoundCube Webmail client |
- | Copyright (C) 2005, RoundCube Dev. - Switzerland |
+ | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
@@ -32,7 +32,7 @@ if ($_GET['_uid'])
// go back to list if message not found (wrong UID)
if (!$MESSAGE['headers'])
{
- show_message('messageopenerror', 'error');
+ $OUTPUT->show_message('messageopenerror', 'error');
if ($_action=='preview' && template_exists('messagepreview'))
parse_template('messagepreview');
else
@@ -51,8 +51,8 @@ if ($_GET['_uid'])
else
send_modified_header($_SESSION['login_time'], $etag);
-
- $MESSAGE['subject'] = $IMAP->decode_header($MESSAGE['headers']->subject);
+ $MESSAGE['subject'] = rcube_imap::decode_mime_string($MESSAGE['headers']->subject, $MESSAGE['headers']->charset);
+ $OUTPUT->set_pagetitle($MESSAGE['subject']);
if ($MESSAGE['structure'] = $IMAP->get_structure($MESSAGE['UID']))
list($MESSAGE['parts'], $MESSAGE['attachments']) = rcmail_parse_message(
@@ -70,8 +70,8 @@ if ($_GET['_uid'])
$IMAP->set_flag($MESSAGE['UID'], 'SEEN');
// give message uid to the client
- $javascript = sprintf("%s.set_env('uid', '%s');\n", $JS_OBJECT_NAME, $MESSAGE['UID']);
- $javascript .= sprintf("%s.set_env('safemode', '%b');", $JS_OBJECT_NAME, $_GET['_safe']);
+ $OUTPUT->set_env('uid', $MESSAGE['UID']);
+ $OUTPUT->set_env('safemode', (bool)$_GET['_safe']);
$next = $prev = -1;
// get previous, first, next and last message UID
@@ -99,22 +99,20 @@ if ($_GET['_uid'])
}
if ($prev > 0)
- $javascript .= sprintf("\n%s.set_env('prev_uid', '%s');", $JS_OBJECT_NAME, $prev);
+ $OUTPUT->set_env('prev_uid', $prev);
if ($first >0)
- $javascript .= sprintf("\n%s.set_env('first_uid', '%s');", $JS_OBJECT_NAME, $first);
+ $OUTPUT->set_env('first_uid', $first);
if ($next > 0)
- $javascript .= sprintf("\n%s.set_env('next_uid', '%s');", $JS_OBJECT_NAME, $next);
+ $OUTPUT->set_env('next_uid', $next);
if ($last >0)
- $javascript .= sprintf("\n%s.set_env('last_uid', '%s');", $JS_OBJECT_NAME, $last);
-
- $OUTPUT->add_script($javascript);
+ $OUTPUT->set_env('last_uid', $last);
}
function rcmail_message_attachments($attrib)
{
- global $CONFIG, $OUTPUT, $PRINT_MODE, $MESSAGE, $GET_URL, $JS_OBJECT_NAME;
+ global $CONFIG, $OUTPUT, $PRINT_MODE, $MESSAGE, $GET_URL;
if (sizeof($MESSAGE['attachments']))
{
@@ -132,7 +130,7 @@ function rcmail_message_attachments($attrib)
$out .= sprintf('<li><a href="%s&amp;_part=%s" onclick="return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)">%s</a></li>'."\n",
htmlspecialchars($GET_URL),
$attach_prop->mime_id,
- $JS_OBJECT_NAME,
+ JS_OBJECT_NAME,
$attach_prop->mime_id,
$attach_prop->mimetype,
$attach_prop->filename);
@@ -147,7 +145,7 @@ function rcmail_message_attachments($attrib)
function rcmail_remote_objects_msg($attrib)
{
- global $CONFIG, $OUTPUT, $JS_OBJECT_NAME;
+ global $CONFIG, $OUTPUT;
if (!$attrib['id'])
$attrib['id'] = 'rcmremoteobjmsg';
@@ -158,16 +156,21 @@ function rcmail_remote_objects_msg($attrib)
$out .= sprintf('%s&nbsp;<a href="#loadimages" onclick="%s.command(\'load-images\')">%s</a>',
Q(rcube_label('blockedimages')),
- $JS_OBJECT_NAME,
+ JS_OBJECT_NAME,
Q(rcube_label('showimages')));
$out .= '</div>';
- $OUTPUT->add_script(sprintf("%s.gui_object('remoteobjectsmsg', '%s');", $JS_OBJECT_NAME, $attrib['id']));
+ $OUTPUT->add_gui_object('remoteobjectsmsg', $attrib['id']);
return $out;
}
+$OUTPUT->add_handlers(array(
+ 'messageattachments' => 'rcmail_message_attachments',
+ 'blockedobjects' => 'rcmail_remote_objects_msg'));
+
+
if ($_action=='print' && template_exists('printmessage'))
parse_template('printmessage');
else if ($_action=='preview' && template_exists('messagepreview'))