Woops !
I think I have to sleep a little....anyway here is the right patch to
apply....sorry about that...
Olivier
Le Samedi 15 Octobre 2005 02:34, Myles Eftos a écrit :
> It doesn't look like you have included program/steps/mail/preview.inc
> in that patch (unless I'm missing something - it was from last nights
> CVS - everything is upto date
--- old.roundcubemail/index.php 2005-10-14 09:58:24.000000000 +0200
+++ roundcubemail/index.php 2005-10-15 00:43:15.000000000 +0200
@@ -226,6 +226,9 @@
if ($_action=='list' && $_GET['_remote'])
include('program/steps/mail/list.inc');
+ if ($_action=='preview')
+ include('program/steps/mail/preview.inc');
+
// kill compose entry from session
if (isset($_SESSION['compose']))
rcmail_compose_cleanup();
--- old.roundcubemail/program/js/app.js 2005-10-14 00:21:10.000000000 +0200
+++ roundcubemail/program/js/app.js 2005-10-15 02:25:33.000000000 +0200
@@ -610,12 +610,17 @@
case 'send':
if (!this.gui_objects.messageform)
break;
-
+
// check input fields
var input_to = rcube_find_object('_to');
var input_subject = rcube_find_object('_subject');
var input_message = rcube_find_object('_message');
-
+
+ // plugin api filter hook
+ this.trigger_filter('email_send', input_to);
+ this.trigger_filter('email_send', input_subject);
+ this.trigger_filter('email_send', input_message);
+
if (input_to.value!='' && input_message.value!='')
{
this.set_busy(true, 'sendingmessage');
@@ -826,6 +831,9 @@
this.drag_start = false;
this.in_selection_before = false;
+
+ if (this.task == 'mail' && this.list_rows)
+ this.show_preview_message(id);
// row was double clicked
if (this.task=='mail' && this.list_rows && this.list_rows[id].clicked && !shift)
@@ -949,6 +957,48 @@
this.select(n, true);
};
+ /**
+ * Preview message (single click on a row)
+ */
+ this.show_preview_message = function(id) {
+ this.set_busy(true, 'loading');
+ this.http_request('preview', '_uid=' + escape(id));
+ }
+
+ /**
+ * Append an html content after the message list
+ */
+ this.append_content = function(content) {
+ var parent;
+ var node;
+ var height;
+
+ if (this.env.task != 'mail') {
+ return ;
+ }
+
+ parent = this.gui_objects.messagelist.parentNode;
+ if (!parent) {
+ return ;
+ }
+
+ node = document.getElementById('preview_node');
+ if (node) {
+ parent.parentNode.removeChild(node);
+ height = parent.offsetHeight * 2;
+ } else {
+ height = parent.offsetHeight;
+ parent.style.height = (height / 2) + 'px';
+ parent.style.overflow = 'auto';
+ }
+
+ node = document.createElement('div');
+ node.id = 'preview_node';
+ node.innerHTML = content;
+ node.style.height = ((height / 2) - 10) + 'px';
+ node.style.width = (document.body.clientWidth - parent.offsetLeft - 25) + 'px';
+ parent.parentNode.appendChild(node);
+ }
// when user doble-clicks on a row
this.show_message = function(id, safe)
@@ -2263,6 +2313,10 @@
case 'list':
this.enable_command('select-all', 'select-none', this.env.messagecount ? true : false);
break;
+
+ case 'preview':
+ this.append_content(this.request_obj.responseText);
+ break;
}
}
};
@@ -2376,7 +2430,45 @@
form.elements[n].disabled = lock;
}
};
-
+
+ // client plugins api
+ this.register_filter = function(event, filter) {
+ if (!event || !filter) {
+ return ;
+ }
+ if (!this.filters) {
+ this.filters = new Array();
+ }
+ for (i = 0, found = 0; !found && i < this.filters.length; i++) {
+ if (this.filters[i].event == event) {
+ found = 1;
+ }
+ }
+ if (!found) {
+ // creating new event
+ this.filters[i] = new Object();
+ this.filters[i].event = event;
+ this.filters[i].data = new Array();
+ }
+ this.filters[i].data.push(filter);
+ };
+
+ this.trigger_filter = function(event, obj) {
+ if (!event) {
+ return (obj);
+ }
+
+ for (i = 0; i < this.filters.length; i++) {
+ if (this.filters[i].event == event) {
+ for (j = 0; j < this.filters[i].data.length; j++) {
+ obj = eval(this.filters[i].data[j] + '(obj);');
+ }
+ }
+ }
+
+ return (obj);
+ }
+
} // end object rcube_webmail
--- old.roundcubemail/program/lib/imap.inc 2005-10-11 23:11:42.000000000 +0200
+++ roundcubemail/program/lib/imap.inc 2005-10-15 00:45:26.000000000 +0200
@@ -325,7 +325,7 @@
}
//open socket connection
- $conn->fp = @fsockopen($host, $ICL_PORT, &$errno, &$errstr, 10);
+ $conn->fp = @fsockopen($host, $ICL_PORT, $errno, $errstr, 10);
if (!$conn->fp){
$iil_error = "Could not connect to $host at port $ICL_PORT: $errstr";
$iil_errornum = -1;
--- old.roundcubemail/program/steps/mail/preview.inc 1970-01-01 01:00:00.000000000 +0100
+++ roundcubemail/program/steps/mail/preview.inc 2005-10-15 03:18:24.000000000 +0200
@@ -0,0 +1,169 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/steps/mail/preview.inc |
+ | |
+ | This file is part of the RoundCube Webmail client |
+ | Copyright (C) 2005, RoundCube Dev. - Switzerland |
+ | Licensed under the GNU GPL |
+ | |
+ | PURPOSE: |
+ | Display a mail message similar as a usual mail application does |
+ | |
+ +-----------------------------------------------------------------------+
+ | Author: Olivier Sirven <[EMAIL PROTECTED]> |
+ +-----------------------------------------------------------------------+
+
+ $Id$
+
+*/
+
+require_once('Mail/mimeDecode.php');
+
+$PRINT_MODE = FALSE;
+
+
+// similar code as in program/steps/mail/get.inc
+if ($_GET['_uid'])
+ {
+ $MESSAGE = array();
+ $MESSAGE['headers'] = $IMAP->get_headers($_GET['_uid']);
+ $MESSAGE['source'] = rcmail_message_source($_GET['_uid']);
+
+ // go back to list if message not found (wrong UID)
+ if (!$MESSAGE['headers'] || !$MESSAGE['source'])
+ {
+ $_action = 'list';
+ return;
+ }
+
+ $mmd = new Mail_mimeDecode($MESSAGE['source']);
+ $MESSAGE['structure'] = $mmd->decode(array('include_bodies' => TRUE,
+ 'decode_headers' => FALSE,
+ 'decode_bodies' => FALSE));
+
+ $mmd->getMimeNumbers($MESSAGE['structure']);
+
+ $MESSAGE['subject'] = $IMAP->decode_header($MESSAGE['structure']->headers['subject']);
+
+ if ($MESSAGE['structure'])
+ list($MESSAGE['parts'], $MESSAGE['attachments']) = rcmail_parse_message($MESSAGE['structure'],
+ array('safe' => !empty($_GET['_safe']),
+ 'prefer_html' => $CONFIG['prefer_html'],
+ 'get_url' => $GET_URL.'&_part=%s'));
+ else
+ $MESSAGE['body'] = $IMAP->get_body($_GET['_uid']);
+
+
+ // mark message as read
+ if (!$MESSAGE['headers']->seen)
+ $IMAP->set_flag($_GET['_uid'], 'SEEN');
+
+ // give message uid to the client
+ $javascript = sprintf("%s.set_env('uid', '%s');\n", $JS_OBJECT_NAME, $_GET['_uid']);
+ $javascript .= sprintf("%s.set_env('safemode', '%b');", $JS_OBJECT_NAME, isset($_GET['_safe']) ? $_GET['_safe'] : 0);
+
+ // get previous and next message UID
+ $a_msg_index = $IMAP->message_index();
+ $MESSAGE['index'] = array_search((string)$_GET['_uid'], $a_msg_index, TRUE);
+
+ if (isset($a_msg_index[$MESSAGE['index']-1]))
+ $javascript .= sprintf("\n%s.set_env('prev_uid', '%s');", $JS_OBJECT_NAME, $a_msg_index[$MESSAGE['index']-1]);
+ if (isset($a_msg_index[$MESSAGE['index']+1]))
+ $javascript .= sprintf("\n%s.set_env('next_uid', '%s');", $JS_OBJECT_NAME, $a_msg_index[$MESSAGE['index']+1]);
+
+ $OUTPUT->add_script($javascript);
+ }
+
+
+
+function rcmail_message_attachments($attrib)
+ {
+ global $CONFIG, $OUTPUT, $PRINT_MODE, $MESSAGE, $GET_URL, $JS_OBJECT_NAME;
+
+ if (sizeof($MESSAGE['attachments']))
+ {
+ // allow the following attributes to be added to the <ul> tag
+ $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));
+ $out = '<ul' . $attrib_str . ">\n";
+
+ foreach ($MESSAGE['attachments'] as $attach_prop)
+ {
+ if ($PRINT_MODE)
+ $out .= sprintf('<li>%s (%s)</li>'."\n",
+ $attach_prop['filename'],
+ show_bytes($attach_prop['size']));
+ else
+ $out .= sprintf('<li><a href="#attachment" onclick="return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)">%s</a></li>'."\n",
+ $JS_OBJECT_NAME,
+ $attach_prop['part_id'],
+ $attach_prop['mimetype'],
+ $attach_prop['filename']);
+ /* direct link
+ else
+ $out .= sprintf('<li><a href="%s&_part=%s&_frame=1" target="rcubemailattachment">%s</a></li>'."\n",
+ $GET_URL,
+ $attach_prop['part_id'],
+ $attach_prop['filename']);
+ */
+ }
+
+ $out .= "</ul>";
+ return $out;
+ }
+ }
+
+
+
+// return an HTML iframe for loading mail content
+function rcmail_messagecontent_frame($attrib)
+ {
+ global $COMM_PATH, $OUTPUT, $GET_URL, $JS_OBJECT_NAME;
+
+ // allow the following attributes to be added to the <iframe> tag
+ $attrib_str = create_attrib_string($attrib);
+ $framename = 'rcmailcontentwindow';
+
+ $out = sprintf('<iframe src="%s" name="%s"%s>%s</iframe>'."\n",
+ $GET_URL,
+ $framename,
+ $attrib_str,
+ rcube_label('loading'));
+
+
+ $OUTPUT->add_script("$JS_OBJECT_NAME.set_env('contentframe', '$framename');");
+
+ return $out;
+ }
+
+
+function rcmail_remote_objects_msg($attrib)
+ {
+ global $CONFIG, $OUTPUT, $JS_OBJECT_NAME;
+
+ if (!$attrib['id'])
+ $attrib['id'] = 'rcmremoteobjmsg';
+
+ // allow the following attributes to be added to the <div> tag
+ $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));
+ $out = '<div' . $attrib_str . ">";
+
+ $out .= rep_specialchars_output(sprintf('%s <a href="#loadimages" onclick="%s.command(\'load-images\')" title="%s">%s</a>',
+ rcube_label('blockedimages'),
+ $JS_OBJECT_NAME,
+ rcube_label('showimages'),
+ rcube_label('showimages')));
+
+ $out .= '</div>';
+
+ $OUTPUT->add_script(sprintf("%s.gui_object('remoteobjectsmsg', '%s');", $JS_OBJECT_NAME, $attrib['id']));
+ return $out;
+ }
+
+
+if ($_action=='print')
+ parse_template('printmessage');
+else
+ parse_template('preview_message', true, false);
+?>
\ Pas de fin de ligne à la fin du fichier.
--- old.roundcubemail/skins/default/mail.css 2005-10-04 22:28:01.000000000 +0200
+++ roundcubemail/skins/default/mail.css 2005-10-15 00:38:54.000000000 +0200
@@ -402,6 +402,18 @@
width: expression(document.body.clientWidth-240);
}
+#preview_node
+{
+ border-width: 1px;
+ border-color: gray;
+ border-style: solid;
+ overflow: auto;
+ position: absolute;
+ right: 40px;
+ bottom: 80px;
+}
+
+
table.headers-table
{
width: 100%;
--- old.roundcubemail/skins/default/templates/preview_message.html 1970-01-01 01:00:00.000000000 +0100
+++ roundcubemail/skins/default/templates/preview_message.html 2005-10-15 00:34:12.000000000 +0200
@@ -0,0 +1,6 @@
+<div class="previewmessage">
+<roundcube:object name="messageHeaders" class="headers-table" cellspacing="0" cellpadding="2" addicon="/images/icons/plus.gif" summary="Message headers" />
+<roundcube:object name="messageAttachments" id="attachment-list" />
+<roundcube:object name="blockedObjects" id="remote-objects-message" />
+<roundcube:object name="messageBody" id="messagebody" showImages="true" />
+</div>