Roger 'Rocky' Vetterberg wrote:
I will check out your patch on my test-installation asap. If you make any changes/improvements and want them tested, let me know and I will try them out for you.
You might want to wait for an hour or so; after Bratt's comments I looked again at doing it the Web2.0 way and I'm almost there.
Already fixed the resizing problem.
Robin
Robin Elfrink wrote:
You might want to wait for an hour or so; after Bratt's comments I looked again at doing it the Web2.0 way and I'm almost there.
Here's a new version of my patch.
There's a new config option, called $rcmail_config['preview']. If set to true, a single click will show the message in a preview pane.
A small number of issues remain:
the 'expression' css attributes from JavaScript but IE gave errors. Can anybody help me to do this from JavaScript:
width: expression((parseInt(document.documentElement.clientWidth)-240)+'px'); height: expression((parseInt(document.documentElement.clientHeight)-125)+'px');
[125 should be replaced with 125 plus mailcontframe.offsetHeight]
have not yet taken time to investigate this.
new content.
view. I think I saw something in the DOM docs about that.
Any more comments anybody?
Robin
--- config/main.inc.php.dist (revision 335) +++ config/main.inc.php.dist (working copy) @@ -225,6 +225,9 @@ // list of configuration option names that need to be available in Javascript. $rcmail_config['javascript_config'] = array('read_when_deleted', 'flag_for_deletion');
+// use preview pane +$rcmail_config['preview'] = TRUE;
// end of config file ?> Index: program/include/main.inc =================================================================== --- program/include/main.inc (revision 335) +++ program/include/main.inc (working copy) @@ -1170,6 +1170,7 @@ 'charsetselector' => 'rcmail_charset_selector', 'searchform' => 'rcmail_search_form', 'receiptcheckbox' => 'rcmail_receipt_checkbox',
'preview' => 'rcmail_message_preview',
// ADDRESS BOOK
'addresslist' => 'rcmail_contacts_list',
--- program/js/app.js (revision 335) +++ program/js/app.js (working copy) @@ -1256,18 +1256,28 @@ this.in_selection_before = false;
// row was double clicked
if (this.env.mailbox==this.env.drafts_mailbox)
// row was double clicked
if (this.list_rows[id].clicked && this.in_selection(id))
{
this.set_busy(true);
location.href = this.env.comm_path+'&_action=compose&_draft_uid='+id+'&_mbox='+urlencode(this.env.mailbox);
if (this.env.mailbox==this.env.drafts_mailbox)
{
this.set_busy(true);
location.href = this.env.comm_path+'&_action=compose&_draft_uid='+id+'&_mbox='+urlencode(this.env.mailbox);
}
else
{
this.show_message(id);
}
return false;
}
// row was single clicked
else
{
this.show_message(id);
if (this.env.preview)
this.show_preview(id);
}
return false;
}
else if (this.task=='addressbook')
{@@ -1502,6 +1512,29 @@
return true;
};
// when user clicks on a row
this.show_preview = function(id, safe)
{
var add_url = '';
var target = window;
var contentframe = rcube_find_object('mailcontframe');
var previewpane = rcube_find_object('previewpane');
if (id && contentframe && previewpane)
{
rcmail.set_busy(true, 'loading');
if (previewpane.style.display=='none')
{
contentframe.style.height = (contentframe.offsetHeight/2) + 'px';
previewpane.style.top = (contentframe.offsetTop+contentframe.offsetHeight) + 'px';
previewpane.style.display = 'block';
}
var url = '_action=preview&_uid='+id;
rcmail.http_request('preview', url, true);
}
};
// when user doble-clicks on a row
@@ -3569,6 +3602,11 @@ case 'expunge': this.enable_command('select-all', 'select-none', 'expunge', this.env.messagecount ? true : false); break;
case 'preview':
var previewpane = rcube_find_object('previewpane');
previewpane.innerHTML = request_obj.get_text();
break;
}
request_obj.reset();
--- program/steps/mail/show.inc (revision 335) +++ program/steps/mail/show.inc (working copy) @@ -171,6 +171,8 @@
if ($_action=='print') parse_template('printmessage'); +else if ($_action=='preview')
else parse_template('message'); -?> \ No newline at end of file +?> Index: program/steps/mail/func.inc =================================================================== --- program/steps/mail/func.inc (revision 335) +++ program/steps/mail/func.inc (working copy) @@ -480,6 +480,7 @@ $javascript .= sprintf("%s.set_env('pagecount', %d);\n", $JS_OBJECT_NAME, ceil($message_count/$IMAP->page_size)); $javascript .= sprintf("%s.set_env('sort_col', '%s');\n", $JS_OBJECT_NAME, $sort_col); $javascript .= sprintf("%s.set_env('sort_order', '%s');\n", $JS_OBJECT_NAME, $sort_order);
$javascript .= sprintf("%s.set_env('preview', '%s');\n", $JS_OBJECT_NAME, $sort_order);
if ($attrib['messageicon']) $javascript .= sprintf("%s.set_env('messageicon', '%s%s');\n", $JS_OBJECT_NAME, $skin_path, $attrib['messageicon']);
--- skins/default/mail.css (revision 335) +++ skins/default/mail.css (working copy) @@ -120,7 +120,19 @@ height: expression((parseInt(document.documentElement.clientHeight)-125)+'px'); }
+#previewpane +{
+}
#messagepartframe { border: 1px solid #999999; Index: skins/default/templates/mail.html =================================================================== --- skins/default/templates/mail.html (revision 335) +++ skins/default/templates/mail.html (working copy) @@ -52,6 +52,8 @@ attachmentIcon="/images/icons/attachment.png" />
</div>
+<div id="previewpane" style="display: none;"></div>
<div id="listcontrols"> <roundcube:label name="select" />: <roundcube:button command="select-all" label="all" classAct="active" /> Index: skins/default/templates/previewmessage.html =================================================================== --- skins/default/templates/previewmessage.html (revision 0) +++ skins/default/templates/previewmessage.html (revision 0) @@ -0,0 +1,3 @@ +<roundcube:object name="messageHeaders" class="headers-table" cellspacing="0" cellpadding="2" /> +<roundcube:object name="messageAttachments" id="attachment-list" /> +<roundcube:object name="messageBody" id="messagebody" showImages="false" /> Index: index.php =================================================================== --- index.php (revision 335) +++ index.php (working copy) @@ -241,7 +241,7 @@ { include_once('program/steps/mail/func.inc');
if ($_action=='show' || $_action=='print' || $_action=='preview') include('program/steps/mail/show.inc');
if ($_action=='get')
Robin Elfrink wrote:
- Internet Explorer has a problem with width and height. I tried to set
the 'expression' css attributes from JavaScript but IE gave errors. Can anybody help me to do this from JavaScript:
width: expression((parseInt(document.documentElement.clientWidth)-240)+'px'); height: expression((parseInt(document.documentElement.clientHeight)-125)+'px');
[125 should be replaced with 125 plus mailcontframe.offsetHeight]
This is still a problem. Internet Explorer 7 does the right thing, though. It may have something to do with top and bottom being set both. Internet Explorer is bad, bad, bad.
- Clicking on an attachment within the preview pane does nothing. I
have not yet taken time to investigate this.
Fixed, the 'load-attachment' command had to be enabled.
- I probably should scroll the preview pane to the top when inserting
new content.
Fixed.
- The selected message in the message list should be scrolled in to
view. I think I saw something in the DOM docs about that.
Fixed.
Other changes:
so 'cursor key down' etc. work as well.
If somebody can help me fix the problem with positioning in Internet Explorer, I will post the complete patch to the Trac system so whoever has the powers can include it in SVN if wanted.
Robin
--- program/include/main.inc (revision 335) +++ program/include/main.inc (working copy) @@ -1170,6 +1170,7 @@ 'charsetselector' => 'rcmail_charset_selector', 'searchform' => 'rcmail_search_form', 'receiptcheckbox' => 'rcmail_receipt_checkbox',
'preview' => 'rcmail_message_preview',
// ADDRESS BOOK
'addresslist' => 'rcmail_contacts_list',
--- program/localization/nl_NL/labels.inc (revision 335) +++ program/localization/nl_NL/labels.inc (working copy) @@ -202,6 +202,7 @@ $labels['pagesize'] = 'Rijen per pagina'; $labels['signature'] = 'Onderschrift'; $labels['dstactive'] = 'Zomertijd'; +$labels['preview'] = 'Voorbeeldvenster';
$labels['folder'] = 'Map'; $labels['folders'] = 'Mappen'; Index: program/localization/en_US/labels.inc =================================================================== --- program/localization/en_US/labels.inc (revision 335) +++ program/localization/en_US/labels.inc (working copy) @@ -201,6 +201,7 @@ $labels['pagesize'] = 'Rows per page'; $labels['signature'] = 'Signature'; $labels['dstactive'] = 'Daylight savings'; +$labels['preview'] = 'Preview message';
$labels['folder'] = 'Folder'; $labels['folders'] = 'Folders'; Index: program/js/app.js =================================================================== --- program/js/app.js (revision 335) +++ program/js/app.js (working copy) @@ -126,7 +126,7 @@ }
// enable mail commands
this.enable_command('list', 'checkmail', 'compose', 'add-contact', 'search', 'reset-search', true);
this.enable_command('list', 'checkmail', 'compose', 'add-contact', 'search', 'reset-search', 'load-attachment', true);
if (this.env.action=='show')
{
@@ -758,6 +758,7 @@ var input_pagesize = rcube_find_object('_pagesize'); var input_name = rcube_find_object('_name'); var input_email = rcube_find_object('_email');
var input_preview = rcube_find_object('_preview');
// user prefs
if (input_pagesize && isNaN(input_pagesize.value))
@@ -1438,6 +1439,8 @@
this.last_selected = id;
this.set_classname(this.list_rows[id].obj, 'focused', true);
if (this.env.preview)
this.show_preview(id);
};
this.shift_select = function(id, control) {
@@ -1502,6 +1505,31 @@
return true;
};
// when user clicks on a row
this.show_preview = function(id, safe)
{
var add_url = '';
var target = window;
var contentframe = rcube_find_object('mailcontframe');
var previewpane = rcube_find_object('previewpane');
if (id && contentframe && previewpane)
{
rcmail.set_busy(true, 'loading');
if (previewpane.style.display=='none')
{
contentframe.style.height = (contentframe.offsetHeight/2) + 'px';
previewpane.style.top = (contentframe.offsetTop+contentframe.offsetHeight) + 'px';
previewpane.style.display = 'block';
var message = rcube_find_object('rcmrow' + id);
message.scrollIntoView();
}
var url = '_action=preview&_uid='+id;
rcmail.http_request('preview', url, true);
}
};
// when user doble-clicks on a row
@@ -3569,6 +3597,12 @@ case 'expunge': this.enable_command('select-all', 'select-none', 'expunge', this.env.messagecount ? true : false); break;
case 'preview':
var previewpane = rcube_find_object('previewpane');
previewpane.innerHTML = request_obj.get_text();
previewpane.scrollTop = 0;
break;
}
request_obj.reset();
--- program/steps/settings/func.inc (revision 335) +++ program/steps/settings/func.inc (working copy) @@ -49,7 +49,8 @@ $a_show_cols = array('language' => array('type' => 'text'), 'pagesize' => array('type' => 'text'), 'timezone' => array('type' => 'text'),
'prettydate' => array('type' => 'text'));
'prettydate' => array('type' => 'text'),
'preview' => array('type' => 'text'));
// show language selection $a_lang = rcube_list_languages();
@@ -144,7 +145,16 @@ rep_specialchars_output(rcube_label('prettydate')), $input_prettydate->show($CONFIG['prettydate']?1:0));
// show preview window selection
$field_id = 'rcmfd_preview';
$input_preview = new checkbox(array('name' => '_preview', 'id' => $field_id, 'value' => 1));
$out .= sprintf("<tr><td class="title"><label for="%s">%s</label></td><td>%s</td></tr>\n",
$field_id,
rep_specialchars_output(rcube_label('preview')),
$input_preview->show($CONFIG['preview']?1:0));
$out .= "\n</table>$form_end";
return $out;
@@ -219,4 +229,4 @@ }
-?> \ No newline at end of file +?> Index: program/steps/settings/save_prefs.inc =================================================================== --- program/steps/settings/save_prefs.inc (revision 335) +++ program/steps/settings/save_prefs.inc (working copy) @@ -28,6 +28,7 @@ $a_user_prefs['dst_active'] = isset($_POST['_dst_active']) ? TRUE : FALSE; $a_user_prefs['pagesize'] = is_numeric($_POST['_pagesize']) ? (int)$_POST['_pagesize'] : $CONFIG['pagesize']; $a_user_prefs['prefer_html'] = isset($_POST['_prefer_html']) ? TRUE : FALSE; +$a_user_prefs['preview'] = isset($_POST['_preview']) ? TRUE : FALSE;
// MM: Date format toggle (Pretty / Standard)
$a_user_prefs['prettydate'] = isset($_POST['_pretty_date']) ? TRUE : FALSE;
@@ -48,4 +49,4 @@
// overwrite action variable
$OUTPUT->add_script(sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $_action));
-?> \ No newline at end of file +?> Index: program/steps/mail/show.inc =================================================================== --- program/steps/mail/show.inc (revision 335) +++ program/steps/mail/show.inc (working copy) @@ -171,6 +171,8 @@
if ($_action=='print') parse_template('printmessage'); +else if ($_action=='preview')
else parse_template('message'); -?> \ No newline at end of file +?> Index: program/steps/mail/func.inc =================================================================== --- program/steps/mail/func.inc (revision 335) +++ program/steps/mail/func.inc (working copy) @@ -480,6 +480,7 @@ $javascript .= sprintf("%s.set_env('pagecount', %d);\n", $JS_OBJECT_NAME, ceil($message_count/$IMAP->page_size)); $javascript .= sprintf("%s.set_env('sort_col', '%s');\n", $JS_OBJECT_NAME, $sort_col); $javascript .= sprintf("%s.set_env('sort_order', '%s');\n", $JS_OBJECT_NAME, $sort_order);
$javascript .= sprintf("%s.set_env('preview', '%s');\n", $JS_OBJECT_NAME, $CONFIG['preview']);
if ($attrib['messageicon']) $javascript .= sprintf("%s.set_env('messageicon', '%s%s');\n", $JS_OBJECT_NAME, $skin_path, $attrib['messageicon']);
--- skins/default/mail.css (revision 335) +++ skins/default/mail.css (working copy) @@ -120,7 +120,23 @@ height: expression((parseInt(document.documentElement.clientHeight)-125)+'px'); }
+#previewpane +{
+}
#messagepartframe { border: 1px solid #999999; Index: skins/default/templates/mail.html =================================================================== --- skins/default/templates/mail.html (revision 335) +++ skins/default/templates/mail.html (working copy) @@ -52,6 +52,8 @@ attachmentIcon="/images/icons/attachment.png" />
</div>
+<div id="previewpane" style="display: none;"></div>
<div id="listcontrols"> <roundcube:label name="select" />: <roundcube:button command="select-all" label="all" classAct="active" /> Index: skins/default/templates/previewmessage.html =================================================================== --- skins/default/templates/previewmessage.html (revision 0) +++ skins/default/templates/previewmessage.html (revision 0) @@ -0,0 +1,4 @@ +<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" /> Index: index.php =================================================================== --- index.php (revision 335) +++ index.php (working copy) @@ -241,7 +241,7 @@ { include_once('program/steps/mail/func.inc');
if ($_action=='show' || $_action=='print' || $_action=='preview') include('program/steps/mail/show.inc');
if ($_action=='get')
I would like an icon which will allow me to preview the email, similar to ask.com.
http://www.ask.com/web?q=web+2.0&qsrc=1&o=0&l=dir
But that shows a screenshot. I would just show the first few sentences of the email in a larger tooltip. I also like how GMail show the first line of the email next to the subject. The subject is black and the body of the email is in light gray. That is a major time saver as you scan your email and try to decide how to sort it.
I could help you by writing the Javascript to generate the floating preview if you like. The question is, do you click on the icon or just hover over it for a moment?
Brennan
On Tue, 05 Sep 2006 16:49:33 +0200, Robin Elfrink elfrink@introweb.nl wrote:
Robin Elfrink wrote:
You might want to wait for an hour or so; after Bratt's comments I looked again at doing it the Web2.0 way and I'm almost there.
Here's a new version of my patch.
There's a new config option, called $rcmail_config['preview']. If set to true, a single click will show the message in a preview pane.
A small number of issues remain:
- Internet Explorer has a problem with width and height. I tried to set
the 'expression' css attributes from JavaScript but IE gave errors. Can anybody help me to do this from JavaScript:
width: expression((parseInt(document.documentElement.clientWidth)-240)+'px'); height: expression((parseInt(document.documentElement.clientHeight)-125)+'px');
[125 should be replaced with 125 plus mailcontframe.offsetHeight]
- Clicking on an attachment within the preview pane does nothing. I
have not yet taken time to investigate this.
- I probably should scroll the preview pane to the top when inserting
new content.
- The selected message in the message list should be scrolled in to
view. I think I saw something in the DOM docs about that.
Any more comments anybody?
Robin
-- Brennan Stehling Offwhite.net LLC brennan@offwhite.net