From ce06d32dd81e3a9c5c5c8a5e27562b5c55b49c81 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Thu, 17 Jun 2010 15:08:00 -0400 Subject: [PATCH] - UI unification - Added button to hide/unhide the preview pane (#1484215) --- program/steps/mail/func.inc | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 53 insertions(+), 5 deletions(-) diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 5e53a75..1614f4c 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -407,14 +407,15 @@ */ function rcmail_messagecontent_frame($attrib) { - global $OUTPUT; + global $OUTPUT, $RCMAIL; if (empty($attrib['id'])) $attrib['id'] = 'rcmailcontentwindow'; $attrib['name'] = $attrib['id']; - $OUTPUT->set_env('contentframe', $attrib['id']); + if ($RCMAIL->config->get('preview_pane')) + $OUTPUT->set_env('contentframe', $attrib['id']); $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/blank.gif'); return html::iframe($attrib); @@ -551,12 +552,16 @@ } -function rcmail_send_unread_count($mbox_name, $force=false) +function rcmail_send_unread_count($mbox_name, $force=false, $count=null) { global $RCMAIL; $old_unseen = $_SESSION['unseen_count'][$mbox_name]; - $unseen = $RCMAIL->imap->messagecount($mbox_name, 'UNSEEN', $force); + + if ($count === null) + $unseen = $RCMAIL->imap->messagecount($mbox_name, 'UNSEEN', $force); + else + $unseen = $count; if ($unseen != $old_unseen || ($mbox_name == 'INBOX')) $RCMAIL->output->command('set_unread_count', $mbox_name, $unseen, ($mbox_name == 'INBOX')); @@ -959,6 +964,11 @@ // fetch part if not available if (!isset($part->body)) $part->body = $MESSAGE->get_part_content($part->mime_id); + + // message is cached but not exists (#1485443), or other error + if ($part->body === false) { + rcmail_message_error($MESSAGE->uid); + } // re-format format=flowed content if ($part->ctype_secondary == "plain" && $part->ctype_parameters['format'] == "flowed") @@ -1469,7 +1479,7 @@ // compose headers array $headers = array( - 'Date' => date('r'), + 'Date' => rcmail_user_date(), 'From' => $sender, 'To' => $message->headers->mdn_to, 'Subject' => rcube_label('receiptread') . ': ' . $message->subject, @@ -1514,6 +1524,29 @@ return false; } +// Returns RFC2822 formatted current date in user's timezone +function rcmail_user_date() +{ + global $CONFIG; + + // get user's timezone + if ($CONFIG['timezone'] === 'auto') { + $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : date('Z')/3600; + } + else { + $tz = $CONFIG['timezone']; + if ($CONFIG['dst_active']) + $tz++; + } + + $date = time() + $tz * 60 * 60; + $date = gmdate('r', $date); + $date = preg_replace('/[+-][0-9]{4}$/', sprintf('%+05d', $tz * 100), $date); + + return $date; +} + + function rcmail_search_filter($attrib) { global $OUTPUT, $CONFIG; @@ -1546,6 +1579,21 @@ return $out; } +function rcmail_message_error($uid=null) +{ + global $RCMAIL; + + // Set env variables for messageerror.html template + if ($RCMAIL->action == 'show') { + $mbox_name = $RCMAIL->imap->get_mailbox_name(); + $RCMAIL->output->set_env('mailbox', $mbox_name); + $RCMAIL->output->set_env('uid', null); + } + // display error message + $RCMAIL->output->show_message('messageopenerror', 'error'); + // ... display message error page + $RCMAIL->output->send('messageerror'); +} // register UI objects $OUTPUT->add_handlers(array( -- Gitblit v1.9.1