summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-09-12 12:13:13 +0000
committeralecpl <alec@alec.pl>2008-09-12 12:13:13 +0000
commite5686f4a011ea0110bf49ae1d56aa749c75ffc76 (patch)
tree899339efcde33e6839fcaa0910e44004716543fe /program/js
parent3e8bd7af5947761bf27d018fc02dab9840f7051f (diff)
- Added vertical splitter for folders list resizing
- Added possibility to view all headers in message view - Fixed splitter drag/resize on Opera (#1485170) - debug console css fixes for IE
Diffstat (limited to 'program/js')
-rw-r--r--program/js/app.js58
-rw-r--r--program/js/common.js26
2 files changed, 71 insertions, 13 deletions
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';