diff --git a/CHANGELOG b/CHANGELOG index 2b86f3da6..a5b68a7e6 100644 --- a/CHANGELOG +++ b/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) diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index 8a7ad2c9b..1b5ec1670 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -1371,6 +1371,23 @@ class rcube_imap 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; + } /** diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php index 9f94194c4..1b61770c0 100755 --- a/program/include/rcube_template.php +++ b/program/include/rcube_template.php @@ -320,9 +320,9 @@ class rcube_template extends rcube_html_page // add debug console if ($this->config['debug_level'] & 8) { - $this->add_footer('
+ $this->add_footer('
console -
' +
' ); } $output = $this->parse_with_globals($output); diff --git a/program/js/app.js b/program/js/app.js index 36072e384..b724287ef 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -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); @@ -510,7 +510,6 @@ function rcube_webmail() return false; } - // process command switch (command) { @@ -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('_'); @@ -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 *********/ @@ -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()); diff --git a/program/js/common.js b/program/js/common.js index 209ce1070..063657f89 100644 --- a/program/js/common.js +++ b/program/js/common.js @@ -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; }; @@ -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); @@ -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) @@ -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'; diff --git a/program/localization/en_GB/labels.inc b/program/localization/en_GB/labels.inc index 75ffea521..82d06b090 100644 --- a/program/localization/en_GB/labels.inc +++ b/program/localization/en_GB/labels.inc @@ -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'; diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc index 565cdc47a..6b503ff4c 100644 --- a/program/localization/en_US/labels.inc +++ b/program/localization/en_US/labels.inc @@ -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'; diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 54abb24fe..7de78a1ef 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -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]) @@ -771,6 +771,14 @@ function rcmail_message_headers($attrib, $headers=NULL) $header_count++; } + // all headers division + $out .= "\n".''; + $out .= "\n".'
'; + + $OUTPUT->add_gui_object('all_headers_row', 'all-headers'); + $OUTPUT->add_gui_object('all_headers_box', 'headers-source'); + $out .= "\n\n\n"; return $header_count ? $out : ''; diff --git a/program/steps/mail/headers.inc b/program/steps/mail/headers.inc new file mode 100644 index 000000000..653fb9647 --- /dev/null +++ b/program/steps/mail/headers.inc @@ -0,0 +1,39 @@ + | + +-----------------------------------------------------------------------+ + + $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/', '    ', $source); + $source = preg_replace('/^([a-z0-9_:-]+)/im', ''.'\1'.'', $source); + $source = preg_replace('/\r?\n/', '
', $source); + + $OUTPUT->command('set_headers', $source); + $OUTPUT->send(); + } +} + +exit; + +?> diff --git a/skins/default/addresses.css b/skins/default/addresses.css index 8ae298781..051b0a099 100644 --- a/skins/default/addresses.css +++ b/skins/default/addresses.css @@ -1,6 +1,5 @@ /***** RoundCube|Mail address book task styles *****/ - #abooktoolbar { position: absolute; @@ -18,7 +17,7 @@ { position: absolute; bottom: 16px; - left: 185px; + left: 190px; width: 240px; height: 20px; text-align: left; @@ -30,38 +29,63 @@ color: #333333; } -#directorylist, #addresslist, #importbox +#mainscreen { position: absolute; top: 85px; + right: 20px; bottom: 40px; - border: 1px solid #999999; - background-color: #F9F9F9; - overflow: auto; + left: 200px; /* css hack for IE */ - height: expression((parseInt(document.documentElement.clientHeight)-135)+'px'); + width: expression((parseInt(document.documentElement.clientWidth)-220)+'px'); + height: expression((parseInt(document.documentElement.clientHeight)-125)+'px'); } #directorylist { + position: absolute; + top: 85px; + bottom: 40px; left: 20px; width: 170px; + border: 1px solid #999999; + background-color: #F9F9F9; overflow: hidden; + /* css hack for IE */ + height: expression((parseInt(document.documentElement.clientHeight)-125)+'px'); } #addresslist { - left: 200px; - width: 340px; + position: absolute; + top: 0px; + bottom: 0px; + border: 1px solid #999999; + background-color: #F9F9F9; + overflow: auto; + /* css hack for IE */ + height: expression(parseInt(this.parentNode.offsetHeight)+'px'); } #importbox { + position: absolute; + top: 85px; + bottom: 40px; left: 20px; - right: 40px; - height: auto; - bottom: auto; + right: 20px; + border: 1px solid #999999; + background-color: #F9F9F9; padding-bottom: 4ex; + overflow: auto; + /* css hack for IE */ + height: expression((parseInt(document.documentElement.clientHeight)-135)+'px'); +} + +#addresslist +{ + left: 0px; + width: 340px; } #importbox a @@ -129,30 +153,17 @@ #contacts-box { position: absolute; - top: 85px; + top: 0px; left: 555px; - right: 20px; - bottom: 40px; + right: 0px; + bottom: 0px; border: 1px solid #999999; overflow: hidden; /* css hack for IE */ - width: expression((parseInt(document.documentElement.clientWidth)-45-document.getElementById('addresslist').offsetLeft-document.getElementById('addresslist').offsetWidth)+'px'); - height: expression((parseInt(document.documentElement.clientHeight)-135)+'px'); + height: expression(parseInt(this.parentNode.offsetHeight)+'px'); + width: expression((parseInt(this.parentNode.offsetWidth)-555)+'px'); } - -#addressviewsplitter -{ - background-position: 4px center; -} - -#addressviewsplitter .splitterLine -{ - margin-left: 3px; - width: 6px; -} - - body.iframe, #contact-frame { diff --git a/skins/default/common.css b/skins/default/common.css index c9a641fa7..a5b73b002 100644 --- a/skins/default/common.css +++ b/skins/default/common.css @@ -194,6 +194,8 @@ a.button-logout right: 200px; z-index: 5000; opacity: 0.85; + /* IE */ + filter: alpha(opacity=85); } #message div @@ -237,8 +239,10 @@ a.button-logout .splitter { + user-select: none; + -moz-user-select: none; + -khtml-user-select: none; position: absolute; - padding: 2px; background: url(images/dimple.png) center no-repeat; } @@ -251,7 +255,7 @@ a.button-logout .splitter-v { cursor: e-resize; - background-position: 1px center; + background-position: 2px center; } .boxtitle diff --git a/skins/default/images/icons/down_small.gif b/skins/default/images/icons/down_small.gif new file mode 100644 index 000000000..f865893f4 Binary files /dev/null and b/skins/default/images/icons/down_small.gif differ diff --git a/skins/default/images/icons/up_small.gif b/skins/default/images/icons/up_small.gif new file mode 100644 index 000000000..40deb891f Binary files /dev/null and b/skins/default/images/icons/up_small.gif differ diff --git a/skins/default/mail.css b/skins/default/mail.css index 7807ca231..7f76ed85b 100644 --- a/skins/default/mail.css +++ b/skins/default/mail.css @@ -146,6 +146,30 @@ td.formlinks a:visited color: #333333; } +#mainscreen +{ + position: absolute; + top: 85px; + right: 20px; + bottom: 40px; + left: 20px; + /* css hack for IE */ + width: expression((parseInt(document.documentElement.clientWidth)-40)+'px'); + height: expression((parseInt(document.documentElement.clientHeight)-125)+'px'); +} + +#mailrightcontainer +{ + position: absolute; + top: 0px; + left: 170px; + bottom: 0px; + right: 0px; + /* css hack for IE */ + width: expression((parseInt(this.parentNode.offsetWidth)-170)+'px'); + height: expression(parseInt(this.parentNode.offsetHeight)+'px'); +} + #messagepartcontainer { position: absolute; @@ -161,42 +185,37 @@ td.formlinks a:visited #mailcontframe { position: absolute; - top: 85px; - left: 200px; - right: 20px; - bottom: 40px; + width: 100%; + top: 0px; + bottom: 0px; border: 1px solid #999999; background-color: #F9F9F9; overflow: auto; /* css hack for IE */ - width: expression((parseInt(document.documentElement.clientWidth)-220)+'px'); - height: expression((parseInt(document.documentElement.clientHeight)-125)+'px'); + height: expression(parseInt(this.parentNode.offsetHeight)+'px'); } #mailpreviewframe { position: absolute; - top: 305px; - left: 200px; - right: 20px; - bottom: 40px; + width: 100%; + top: 205px; + bottom: 0px; border: 1px solid #999999; background-color: #F9F9F9; /* css hack for IE */ - width: expression((parseInt(document.documentElement.clientWidth)-220)+'px'); - height: expression((parseInt(document.documentElement.clientHeight)-135-document.getElementById('mailcontframe').offsetHeight)+'px'); + height: expression((parseInt(this.parentNode.offsetHeight)-205)+'px'); } #messagecontframe { - position: absolute; + position: relative; top: 0px; left: 0px; right: 0px; bottom: 0px; - /* css hack for IE */ - width: expression((parseInt(document.documentElement.clientWidth)-220)+'px'); - height: expression((parseInt(document.documentElement.clientHeight)-135-document.getElementById('mailcontframe').offsetHeight)+'px'); + width: 100%; + height: 100%; } #messagepartframe @@ -253,15 +272,15 @@ td.formlinks a:visited #mailboxlist-container { position: absolute; - top: 85px; - left: 20px; - width: 170px; - bottom: 40px; + top: 0px; + left: 0px; + width: 160px; + bottom: 0px; border: 1px solid #999; background-color: #F9F9F9; overflow: auto; /* css hack for IE */ - height: expression((parseInt(document.documentElement.clientHeight)-125)+'px'); + height: expression(parseInt(this.parentNode.offsetHeight)+'px'); } #mailboxlist @@ -599,15 +618,14 @@ html>body*#messagelist[id$="messagelist"]:not([class="none"]) { table-layout: au #messageframe { position: absolute; - top: 85px; - left: 200px; - right: 20px; - bottom: 40px; + top: 0px; + left: 0px; + right: 0px; + bottom: 0px; border: 1px solid #999; background-color: #FFF; overflow: auto; /* css hack for IE */ - /* margin-bottom: 10px; */ width: expression((parseInt(document.documentElement.clientWidth)-220)+'px'); height: expression((parseInt(document.documentElement.clientHeight)-125)+'px'); } @@ -641,7 +659,7 @@ table.headers-table tr td table.headers-table td.header-title { - width: 80px; + width: 85px; color: #666666; font-weight: bold; text-align: right; @@ -651,10 +669,20 @@ table.headers-table td.header-title table.headers-table tr td.subject { - width: 95%; + width: 90%; font-weight: bold; } +table.headers-table tr td.all +{ + width: 100%; + color: #666666; + text-align: left; + padding-right: 10px; + vertical-align: center; + text-align: center; +} + #attachment-list { margin: 0px; @@ -949,3 +977,46 @@ div.message-htmlpart div.rcmBody { margin-top: 4px; } + +.more-headers +{ + cursor: pointer; + width: 100%; + height: 6px; +} + +.show-headers +{ + background: url(images/icons/down_small.gif) no-repeat center; +} + +.hide-headers +{ + background: url(images/icons/up_small.gif) no-repeat center; +} + +#all-headers +{ + height: 150px; + display: none; +} + +#headers-source +{ + margin: 0 5px; + width: 100%; + height: 145px; + background: white; + overflow: auto; + font-size: 11px; + white-space: nowrap; + border: 1px solid #999999; + display: none; + text-align: left; + color: #666666; +} + +font.bold +{ + font-weight: bold; +} diff --git a/skins/default/splitter.js b/skins/default/splitter.js index 31862ce84..4391ae9fe 100644 --- a/skins/default/splitter.js +++ b/skins/default/splitter.js @@ -11,40 +11,48 @@ function rcube_splitter(attrib) this.id = attrib.id ? attrib.id : this.p1id + '_' + this.p2id + '_splitter'; this.orientation = attrib.orientation; this.horizontal = (this.orientation == 'horizontal' || this.orientation == 'h'); - this.offset_1 = bw.ie ? 0 : -1; - this.offset_2 = bw.ie ? -2 : 1; - this.pos = 0; + this.offset = bw.ie6 ? 2 : 0; + this.pos = attrib.start ? attrib.start * 1 : 0; + this.relative = attrib.relative ? true : false; + this.drag_active = false; this.init = function() { this.p1 = document.getElementById(this.p1id); this.p2 = document.getElementById(this.p2id); - + // create and position the handle for this splitter - this.p1pos = rcube_get_object_pos(this.p1); - this.p2pos = rcube_get_object_pos(this.p2); - var top = this.p1pos.y + this.p1.offsetHeight; - var height = this.p2pos.y - this.p1pos.y - this.p1.offsetHeight; - var left = this.p1pos.x + this.p1.offsetWidth; - var width = this.p2pos.x - this.p1pos.x - this.p1.offsetWidth; + this.p1pos = rcube_get_object_pos(this.p1, this.relative); + this.p2pos = rcube_get_object_pos(this.p2, this.relative); if (this.horizontal) - this.layer = new rcube_layer(this.id, {x: this.p1pos.x, y: top, height: height, width: this.p1.offsetWidth, vis: 1}); + { + var top = this.p1pos.y + this.p1.offsetHeight; + this.layer = new rcube_layer(this.id, {x: 0, y: top, height: 10, + width: '100%', vis: 1, parent: this.p1.parentNode}); + } else - this.layer = new rcube_layer(this.id, {x: left, y: this.p1pos.y, width: width, height: this.p1.offsetHeight, vis: 1}); + { + var left = this.p1pos.x + this.p1.offsetWidth; + this.layer = new rcube_layer(this.id, {x: left, y: 0, width: 10, + height: '100%', vis: 1, parent: this.p1.parentNode}); + } this.elm = this.layer.elm; this.elm.className = 'splitter '+(this.horizontal ? 'splitter-h' : 'splitter-v'); + this.elm.unselectable = 'on'; // add the mouse event listeners rcube_event.add_listener({element: this.elm, event:'mousedown', object:this, method:'onDragStart'}); - rcube_event.add_listener({element: window, event:'resize', object:this, method:'onResize'}); + if (bw.ie) + rcube_event.add_listener({element: window, event:'resize', object:this, method:'onResize'}); // read saved position from cookie var cookie = bw.get_cookie(this.id); if (cookie) { var param = cookie.split(':'); + for (var i=0, p; i this.p1pos.y) && ((pos.y + this.layer.height * 1.5) < (this.p2pos.y + this.p2.offsetHeight))) @@ -147,8 +177,8 @@ function rcube_splitter(attrib) } } - this.p1pos = rcube_get_object_pos(this.p1); - this.p2pos = rcube_get_object_pos(this.p2); + this.p1pos = rcube_get_object_pos(this.p1, this.relative); + this.p2pos = rcube_get_object_pos(this.p2, this.relative); return false; }; @@ -160,6 +190,8 @@ function rcube_splitter(attrib) // cancel the listening for drag events rcube_event.remove_listener({element:document, event:'mousemove', object:this, method:'onDrag'}); rcube_event.remove_listener({element:document, event:'mouseup', object:this, method:'onDragStop'}); + this.drag_active = false; + var iframes = document.getElementsByTagName('IFRAME'); for (var n in iframes) @@ -176,39 +208,37 @@ function rcube_splitter(attrib) if (this.iframe_events[n]) { if (iframedoc.removeEventListener) iframedoc.removeEventListener('mousemove', this.iframe_events[n], false); - else if (iframedoc.detachEvent) + else if (iframedoc.detachEvent) iframedoc.detachEvent('onmousemove', this.iframe_events[n]); else iframedoc['onmousemove'] = null; - } + } rcube_event.remove_listener({element:iframedoc, event:'mouseup', object:this, method:'onDragStop'}); } } - // save state in cookie - var exp = new Date(); - exp.setYear(exp.getFullYear() + 1); - bw.set_cookie(this.id, 'pos='+this.pos, exp); - - // Firefox 3 will initiate its built in drag-and-drop on the divider - // widget if it already has focus when a second drag event starts - this.p1.focus(); - this.p1.blur(); + this.set_cookie(); return bw.safari ? true : rcube_event.cancel(e); }; - /** * Handler for window resize events */ this.onResize = function(e) { - this.p1pos = rcube_get_object_pos(this.p1); - this.p2pos = rcube_get_object_pos(this.p2); - var height = this.horizontal ? this.p2pos.y - this.p1pos.y - this.p1.offsetHeight : this.p1.offsetHeight; - var width = this.horizontal ? this.p1.offsetWidth : this.p2pos.x - this.p1pos.x - this.p1.offsetWidth; - this.layer.resize(width, height); + if (this.horizontal) + this.p2.style.height = (parseInt(this.p2.parentNode.offsetHeight) - parseInt(this.p2.style.top))+'px'; + else + this.p2.style.width = (parseInt(this.p2.parentNode.offsetWidth) - parseInt(this.p2.style.left))+'px'; }; + this.set_cookie = function() + { + // save state in cookie + var exp = new Date(); + exp.setYear(exp.getFullYear() + 1); + bw.set_cookie(this.id, 'pos='+this.pos, exp); + } + } // end class rcube_splitter diff --git a/skins/default/templates/addressbook.html b/skins/default/templates/addressbook.html index 3f8e460a5..df5f20a02 100644 --- a/skins/default/templates/addressbook.html +++ b/skins/default/templates/addressbook.html @@ -24,26 +24,31 @@ +
+ +
+
@@ -51,6 +56,8 @@
+ +
diff --git a/skins/default/templates/mail.html b/skins/default/templates/mail.html index 7b6037b31..3d2068d91 100644 --- a/skins/default/templates/mail.html +++ b/skins/default/templates/mail.html @@ -47,17 +47,19 @@ body_keypress: function(evt, p) +
+

-
-:  -  -  -
+ +
+ +
+ +
+ +
+ +
+:  +  +  +
+ +
  @@ -100,6 +113,14 @@ body_keypress: function(evt, p)
+
+ +  + + +
+
@@ -124,14 +145,6 @@ body_keypress: function(evt, p)
-
- -  - - -
- @@ -30,6 +31,8 @@
+
+
@@ -45,5 +48,12 @@
+
+ + +