Skip to content

Commit

Permalink
- Added vertical splitter for folders list resizing
Browse files Browse the repository at this point in the history
- Added possibility to view all headers in message view
- Fixed splitter drag/resize on Opera (#1485170)
- debug console css fixes for IE
  • Loading branch information
alecpl committed Sep 12, 2008
1 parent 3e8bd7a commit e5686f4
Show file tree
Hide file tree
Showing 18 changed files with 415 additions and 141 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
@@ -1,6 +1,12 @@
CHANGELOG RoundCube Webmail
---------------------------

2008/09/12 (alec)
----------
- Added vertical splitter for folders list resizing
- Added possibility to view all headers in message view
- Fixed splitter drag/resize on Opera (#1485170)

2008/09/12 (thomasb)
----------
- Refactor drag & drop functionality. Don't rely on browser events anymore (#1484453)
Expand Down
17 changes: 17 additions & 0 deletions program/include/rcube_imap.php
Expand Up @@ -1371,6 +1371,23 @@ function &get_raw_body($uid)

return $body;
}


/**
* Returns the message headers as string
*
* @param int Message UID
* @return string Message headers string
*/
function &get_raw_headers($uid)
{
if (!($msg_id = $this->_uid2id($uid)))
return FALSE;

$headers = iil_C_FetchPartHeader($this->conn, $this->mailbox, $msg_id, NULL);

return $headers;
}


/**
Expand Down
4 changes: 2 additions & 2 deletions program/include/rcube_template.php
Expand Up @@ -320,9 +320,9 @@ private function parse($name = 'main', $exit = true)

// add debug console
if ($this->config['debug_level'] & 8) {
$this->add_footer('<div style="position:absolute;top:5px;left:5px;width:400px;padding:0.2em;background:white;opacity:0.8;z-index:9000">
$this->add_footer('<div style="position:absolute;top:5px;left:5px;width:405px;padding:2px;background:white;opacity:0.8;filter:alpha(opacity=80);z-index:9000">
<a href="#toggle" onclick="con=document.getElementById(\'dbgconsole\');con.style.display=(con.style.display==\'none\'?\'block\':\'none\');return false">console</a>
<form action="/" name="debugform"><textarea name="console" id="dbgconsole" rows="20" cols="40" wrap="off" style="display:none;width:400px;border:none;font-size:x-small"></textarea></form></div>'
<form action="/" name="debugform" style="display:inline"><textarea name="console" id="dbgconsole" rows="20" cols="40" wrap="off" style="display:none;width:400px;border:none;font-size:x-small"></textarea></form></div>'
);
}
$output = $this->parse_with_globals($output);
Expand Down
58 changes: 55 additions & 3 deletions program/js/app.js
Expand Up @@ -159,7 +159,7 @@ function rcube_webmail()

if (this.env.action=='show' || this.env.action=='preview')
{
this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete', 'mark', 'viewsource', 'print', 'load-attachment', true);
this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete', 'mark', 'viewsource', 'print', 'load-attachment', 'load-headers', true);
if (this.env.next_uid)
{
this.enable_command('nextmessage', true);
Expand Down Expand Up @@ -510,7 +510,6 @@ function rcube_webmail()
return false;
}


// process command
switch (command)
{
Expand Down Expand Up @@ -554,6 +553,11 @@ function rcube_webmail()
break;


case 'load-headers':
this.load_headers(obj);
break;


case 'sort':
// get the type of sorting
var a_sort = props.split('_');
Expand Down Expand Up @@ -3654,6 +3658,54 @@ function rcube_webmail()
}


// display fetched raw headers
this.set_headers = function(content)
{
if (this.gui_objects.all_headers_row && this.gui_objects.all_headers_box && content)
{
var box = this.gui_objects.all_headers_box;
box.innerHTML = content;
box.style.display = 'block';

if (this.env.framed && parent.rcmail)
parent.rcmail.set_busy(false);
else
this.set_busy(false);
}
};

// display all-headers row and fetch raw message headers
this.load_headers = function(elem)
{
if (!this.gui_objects.all_headers_row || !this.gui_objects.all_headers_box || !this.env.uid)
return;

this.set_classname(elem, 'show-headers', false);
this.set_classname(elem, 'hide-headers', true);
this.gui_objects.all_headers_row.style.display = bw.ie ? 'block' : 'table-row';
elem.onclick = function() { rcmail.hide_headers(elem); }

// fetch headers only once
if (!this.gui_objects.all_headers_box.innerHTML)
{
this.set_busy(true, 'loading');
this.http_post('headers', '_uid='+this.env.uid);
}
}


// hide all-headers row
this.hide_headers = function(elem)
{
if (!this.gui_objects.all_headers_row || !this.gui_objects.all_headers_box)
return;

this.set_classname(elem, 'hide-headers', false);
this.set_classname(elem, 'show-headers', true);
this.gui_objects.all_headers_row.style.display = 'none';
elem.onclick = function() { rcmail.load_headers(elem); }
}


/********************************************************/
/********* remote request methods *********/
Expand Down Expand Up @@ -3760,7 +3812,7 @@ function rcube_webmail()
}

if (request_obj.__lock)
this.set_busy(false);
this.set_busy(false);

console.log(request_obj.get_text());

Expand Down
26 changes: 16 additions & 10 deletions program/js/common.js
Expand Up @@ -253,23 +253,28 @@ function rcube_layer(id, attributes)
var obj;

obj = document.createElement('DIV');

with(obj)
{
id = this.name;
with(style)
{
position = 'absolute';
position = 'absolute';
visibility = (vis) ? (vis==2) ? 'inherit' : 'visible' : 'hidden';
left = l+'px';
top = t+'px';
if(w) width = w+'px';
if(h) height = h+'px';
if (w)
width = w.toString().match(/\%$/) ? w : w+'px';
if (h)
height = h.toString().match(/\%$/) ? h : h+'px';
if(z) zIndex = z;
}
}
}

if(parent) parent.appendChild(obj);
else document.body.appendChild(obj);

if (parent)
parent.appendChild(obj);
else
document.body.appendChild(obj);

this.elm = obj;
};
Expand Down Expand Up @@ -496,7 +501,7 @@ function rcube_find_object(id, d)


// return the absolute position of an object within the document
function rcube_get_object_pos(obj)
function rcube_get_object_pos(obj, relative)
{
if(typeof(obj)=='string')
obj = rcube_find_object(obj);
Expand All @@ -506,7 +511,7 @@ function rcube_get_object_pos(obj)
var iX = (bw.layers) ? obj.x : obj.offsetLeft;
var iY = (bw.layers) ? obj.y : obj.offsetTop;

if(bw.ie || bw.mz)
if(!relative && (bw.ie || bw.mz))
{
var elm = obj.offsetParent;
while(elm && elm!=null)
Expand Down Expand Up @@ -598,8 +603,9 @@ function rcube_console()
this.log = function(msg)
{
box = rcube_find_object('console');

if (box)
if (msg[msg.length-1]=='\n')
if (msg.charAt(msg.length-1)=='\n')
box.value += msg+'--------------------------------------\n';
else
box.value += msg+'\n--------------------------------------\n';
Expand Down
2 changes: 1 addition & 1 deletion program/localization/en_GB/labels.inc
Expand Up @@ -128,7 +128,7 @@ $labels['quicksearch'] = 'Quick search';
$labels['resetsearch'] = 'Reset search';
$labels['compose'] = 'Compose a message';
$labels['savemessage'] = 'Save this draft';
$labels['sendmessage'] = 'Send the message now';
$labels['sendmessage'] = 'Send now';
$labels['addattachment'] = 'Attach a file';
$labels['charset'] = 'Charset';
$labels['editortype'] = 'Editor type';
Expand Down
2 changes: 1 addition & 1 deletion program/localization/en_US/labels.inc
Expand Up @@ -164,7 +164,7 @@ $labels['resetsearch'] = 'Reset search';
// message compose
$labels['compose'] = 'Compose a message';
$labels['savemessage'] = 'Save this draft';
$labels['sendmessage'] = 'Send the message now';
$labels['sendmessage'] = 'Send now';
$labels['addattachment'] = 'Attach a file';
$labels['charset'] = 'Charset';
$labels['editortype'] = 'Editor type';
Expand Down
10 changes: 9 additions & 1 deletion program/steps/mail/func.inc
Expand Up @@ -740,7 +740,7 @@ function rcmail_message_headers($attrib, $headers=NULL)

// show these headers
$standard_headers = array('subject', 'from', 'organization', 'to', 'cc', 'bcc', 'replyto', 'date');

foreach ($standard_headers as $hkey)
{
if (!$headers[$hkey])
Expand Down Expand Up @@ -771,6 +771,14 @@ function rcmail_message_headers($attrib, $headers=NULL)
$header_count++;
}

// all headers division
$out .= "\n".'<tr><td colspan="2" class="more-headers show-headers"
onclick="return '.JS_OBJECT_NAME.'.command(\'load-headers\', \'\', this)"></td></tr>';
$out .= "\n".'<tr id="all-headers"><td colspan="2" class="all"><div id="headers-source"></div></td></tr>';

$OUTPUT->add_gui_object('all_headers_row', 'all-headers');
$OUTPUT->add_gui_object('all_headers_box', 'headers-source');

$out .= "\n</table>\n\n";

return $header_count ? $out : '';
Expand Down
39 changes: 39 additions & 0 deletions program/steps/mail/headers.inc
@@ -0,0 +1,39 @@
<?php
/*
+-----------------------------------------------------------------------+
| program/steps/mail/headers.inc |
| |
| This file is part of the RoundCube Webmail client |
| Copyright (C) 2005-2007, RoundCube Dev. - Switzerland |
| Licensed under the GNU GPL |
| |
| PURPOSE: |
| Fetch message headers in raw format for display |
| |
+-----------------------------------------------------------------------+
| Author: Aleksander Machniak <alec@alec.pl> |
+-----------------------------------------------------------------------+
$Id: mark.inc 1580 2008-06-30 09:36:18Z alec $
*/

if ($uid = get_input_value('_uid', RCUBE_INPUT_POST))
{
$source = $IMAP->get_raw_headers($uid);

if ($source)
{
$source = htmlspecialchars(trim($source));
$source = preg_replace('/\t/', '&nbsp;&nbsp;&nbsp;&nbsp;', $source);
$source = preg_replace('/^([a-z0-9_:-]+)/im', '<font class="bold">'.'\1'.'</font>', $source);
$source = preg_replace('/\r?\n/', '<br />', $source);

$OUTPUT->command('set_headers', $source);
$OUTPUT->send();
}
}

exit;

?>

0 comments on commit e5686f4

Please sign in to comment.