@ -22,129 +22,7 @@ function rcube_show_advanced(visible)
}
}
/ * *
/ * *
* Mail Composing
* Mail UI
* /
function rcmail _show _header _form ( id )
{
var row , s ,
link = document . getElementById ( id + '-link' ) ;
if ( ( s = rcmail _next _sibling ( link ) ) )
s . style . display = 'none' ;
else if ( ( s = rcmail _prev _sibling ( link ) ) )
s . style . display = 'none' ;
link . style . display = 'none' ;
if ( ( row = document . getElementById ( 'compose-' + id ) ) ) {
var div = document . getElementById ( 'compose-div' ) ,
headers _div = document . getElementById ( 'compose-headers-div' ) ;
row . style . display = ( document . all && ! window . opera ) ? 'block' : 'table-row' ;
div . style . top = ( parseInt ( headers _div . offsetHeight , 10 ) + 1 ) + 'px' ;
rcmail _resize _compose _body ( ) ;
}
return false ;
}
function rcmail _hide _header _form ( id )
{
var row , ns ,
link = document . getElementById ( id + '-link' ) ,
parent = link . parentNode ,
links = parent . getElementsByTagName ( 'a' ) ;
link . style . display = '' ;
for ( var i = 0 ; i < links . length ; i ++ )
if ( links [ i ] . style . display != 'none' )
for ( var j = i + 1 ; j < links . length ; j ++ )
if ( links [ j ] . style . display != 'none' )
if ( ( ns = rcmail _next _sibling ( links [ i ] ) ) ) {
ns . style . display = '' ;
break ;
}
document . getElementById ( '_' + id ) . value = '' ;
if ( ( row = document . getElementById ( 'compose-' + id ) ) ) {
var div = document . getElementById ( 'compose-div' ) ,
headers _div = document . getElementById ( 'compose-headers-div' ) ;
row . style . display = 'none' ;
div . style . top = ( parseInt ( headers _div . offsetHeight , 10 ) + 1 ) + 'px' ;
rcmail _resize _compose _body ( ) ;
}
return false ;
}
function rcmail _next _sibling ( elm )
{
var ns = elm . nextSibling ;
while ( ns && ns . nodeType == 3 )
ns = ns . nextSibling ;
return ns ;
}
function rcmail _prev _sibling ( elm )
{
var ps = elm . previousSibling ;
while ( ps && ps . nodeType == 3 )
ps = ps . previousSibling ;
return ps ;
}
function rcmail _init _compose _form ( )
{
var cc _field = document . getElementById ( '_cc' ) ,
bcc _field = document . getElementById ( '_bcc' ) ,
div = document . getElementById ( 'compose-div' ) ,
headers _div = document . getElementById ( 'compose-headers-div' ) ;
if ( cc _field && cc _field . value != '' )
rcmail _show _header _form ( 'cc' ) ;
if ( bcc _field && bcc _field . value != '' )
rcmail _show _header _form ( 'bcc' ) ;
// prevent from form data loss when pressing ESC key in IE
if ( bw . ie ) {
var form = rcube _find _object ( 'form' ) ;
form . onkeydown = function ( e ) {
if ( rcube _event . get _keycode ( e ) == 27 )
rcube _event . cancel ( e ) ;
} ;
}
$ ( window ) . resize ( function ( ) {
rcmail _resize _compose _body ( ) ;
} ) ;
$ ( '#compose-container' ) . resize ( function ( ) {
rcmail _resize _compose _body ( ) ;
} ) ;
div . style . top = ( parseInt ( headers _div . offsetHeight , 10 ) + 1 ) + 'px' ;
$ ( window ) . resize ( ) ;
}
function rcmail _resize _compose _body ( elem )
{
var ed , div = $ ( '#compose-div' ) , w = div . width ( ) , h = div . height ( ) ;
w = w - 4 ;
h = h - 25 ;
$ ( '#compose-body' ) . width ( w - ( bw . ie || bw . opera || bw . safari ? 2 : 0 ) + 'px' ) . height ( h + 'px' ) ;
if ( window . tinyMCE && tinyMCE . get ( 'compose-body' ) ) {
$ ( '#compose-body_tbl' ) . width ( ( w + 4 ) + 'px' ) . height ( '' ) ;
$ ( '#compose-body_ifr' ) . width ( ( w + 2 ) + 'px' ) . height ( ( h - 54 ) + 'px' ) ;
}
}
/ * *
* Mailbox view
* /
* /
function rcube _mail _ui ( )
function rcube _mail _ui ( )
@ -160,7 +38,7 @@ function rcube_mail_ui()
composemenu : 'composeoptionsmenu' ,
composemenu : 'composeoptionsmenu' ,
uploadform : 'attachment-form'
uploadform : 'attachment-form'
} ;
} ;
var obj ;
var obj ;
for ( var k in this . popupmenus ) {
for ( var k in this . popupmenus ) {
obj = $ ( '#' + this . popupmenus [ k ] )
obj = $ ( '#' + this . popupmenus [ k ] )
@ -181,7 +59,7 @@ show_popupmenu: function(obj, refname, show, above)
var pos = $ ( ref ) . offset ( ) ;
var pos = $ ( ref ) . offset ( ) ;
obj . css ( { left : pos . left , top : ( pos . top + ( above ? - obj . height ( ) : ref . offsetHeight ) ) } ) ;
obj . css ( { left : pos . left , top : ( pos . top + ( above ? - obj . height ( ) : ref . offsetHeight ) ) } ) ;
}
}
obj [ show ? 'show' : 'hide' ] ( ) ;
obj [ show ? 'show' : 'hide' ] ( ) ;
} ,
} ,
@ -238,15 +116,15 @@ show_searchmenu: function(show)
}
}
this . searchmenu [ show ? 'show' : 'hide' ] ( ) ;
this . searchmenu [ show ? 'show' : 'hide' ] ( ) ;
} ,
} ,
set _searchmod : function ( elem )
set _searchmod : function ( elem )
{
{
if ( ! rcmail . env . search _mods )
if ( ! rcmail . env . search _mods )
rcmail . env . search _mods = { } ;
rcmail . env . search _mods = { } ;
if ( ! rcmail . env . search _mods [ rcmail . env . mailbox ] )
if ( ! rcmail . env . search _mods [ rcmail . env . mailbox ] )
rcmail . env . search _mods [ rcmail . env . mailbox ] = rcube _clone _object ( rcmail . env . search _mods [ '*' ] ) ;
rcmail . env . search _mods [ rcmail . env . mailbox ] = rcube _clone _object ( rcmail . env . search _mods [ '*' ] ) ;
if ( ! elem . checked )
if ( ! elem . checked )
delete ( rcmail . env . search _mods [ rcmail . env . mailbox ] [ elem . value ] ) ;
delete ( rcmail . env . search _mods [ rcmail . env . mailbox ] [ elem . value ] ) ;
else
else
@ -417,10 +295,130 @@ switch_preview_pane: function(elem)
rcmail . show _contentframe ( false ) ;
rcmail . show _contentframe ( false ) ;
rcmail . http _post ( 'save-pref' , '_name=preview_pane&_value=0' ) ;
rcmail . http _post ( 'save-pref' , '_name=preview_pane&_value=0' ) ;
}
}
} ,
/* Message composing */
init _compose _form : function ( )
{
var cc _field = document . getElementById ( '_cc' ) ,
bcc _field = document . getElementById ( '_bcc' ) ,
div = document . getElementById ( 'compose-div' ) ,
headers _div = document . getElementById ( 'compose-headers-div' ) ;
if ( cc _field && cc _field . value != '' )
rcmail _show _header _form ( 'cc' ) ;
if ( bcc _field && bcc _field . value != '' )
rcmail _show _header _form ( 'bcc' ) ;
// prevent from form data loss when pressing ESC key in IE
if ( bw . ie ) {
var form = rcube _find _object ( 'form' ) ;
form . onkeydown = function ( e ) {
if ( rcube _event . get _keycode ( e ) == 27 )
rcube _event . cancel ( e ) ;
} ;
}
$ ( window ) . resize ( function ( ) {
rcmail _ui . resize _compose _body ( ) ;
} ) ;
$ ( '#compose-container' ) . resize ( function ( ) {
rcmail _ui . resize _compose _body ( ) ;
} ) ;
div . style . top = ( parseInt ( headers _div . offsetHeight , 10 ) + 1 ) + 'px' ;
$ ( window ) . resize ( ) ;
} ,
resize _compose _body : function ( )
{
var ed , div = $ ( '#compose-div' ) , w = div . width ( ) , h = div . height ( ) ;
w = w - 4 ;
h = h - 25 ;
$ ( '#compose-body' ) . width ( w - ( bw . ie || bw . opera || bw . safari ? 2 : 0 ) + 'px' ) . height ( h + 'px' ) ;
if ( window . tinyMCE && tinyMCE . get ( 'compose-body' ) ) {
$ ( '#compose-body_tbl' ) . width ( ( w + 4 ) + 'px' ) . height ( '' ) ;
$ ( '#compose-body_ifr' ) . width ( ( w + 2 ) + 'px' ) . height ( ( h - 54 ) + 'px' ) ;
}
} ,
show _header _form : function ( id )
{
var row , s ,
link = document . getElementById ( id + '-link' ) ;
if ( ( s = this . next _sibling ( link ) ) )
s . style . display = 'none' ;
else if ( ( s = this . prev _sibling ( link ) ) )
s . style . display = 'none' ;
link . style . display = 'none' ;
if ( ( row = document . getElementById ( 'compose-' + id ) ) ) {
var div = document . getElementById ( 'compose-div' ) ,
headers _div = document . getElementById ( 'compose-headers-div' ) ;
row . style . display = ( document . all && ! window . opera ) ? 'block' : 'table-row' ;
div . style . top = ( parseInt ( headers _div . offsetHeight , 10 ) + 1 ) + 'px' ;
this . resize _compose _body ( ) ;
}
return false ;
} ,
hide _header _form : function ( id )
{
var row , ns ,
link = document . getElementById ( id + '-link' ) ,
parent = link . parentNode ,
links = parent . getElementsByTagName ( 'a' ) ;
link . style . display = '' ;
for ( var i = 0 ; i < links . length ; i ++ )
if ( links [ i ] . style . display != 'none' )
for ( var j = i + 1 ; j < links . length ; j ++ )
if ( links [ j ] . style . display != 'none' )
if ( ( ns = this . next _sibling ( links [ i ] ) ) ) {
ns . style . display = '' ;
break ;
}
document . getElementById ( '_' + id ) . value = '' ;
if ( ( row = document . getElementById ( 'compose-' + id ) ) ) {
var div = document . getElementById ( 'compose-div' ) ,
headers _div = document . getElementById ( 'compose-headers-div' ) ;
row . style . display = 'none' ;
div . style . top = ( parseInt ( headers _div . offsetHeight , 10 ) + 1 ) + 'px' ;
this . resize _compose _body ( ) ;
}
return false ;
} ,
next _sibling : function ( elm )
{
var ns = elm . nextSibling ;
while ( ns && ns . nodeType == 3 )
ns = ns . nextSibling ;
return ns ;
} ,
prev _sibling : function ( elm )
{
var ps = elm . previousSibling ;
while ( ps && ps . nodeType == 3 )
ps = ps . previousSibling ;
return ps ;
}
}
} ;
} ;
var rcmail _ui ;
var rcmail _ui ;
function rcube _init _mail _ui ( )
function rcube _init _mail _ui ( )
@ -436,7 +434,11 @@ function rcube_init_mail_ui()
rcmail . addEventListener ( 'menu-open' , 'open_listmenu' , rcmail _ui ) ;
rcmail . addEventListener ( 'menu-open' , 'open_listmenu' , rcmail _ui ) ;
rcmail . addEventListener ( 'menu-save' , 'save_listmenu' , rcmail _ui ) ;
rcmail . addEventListener ( 'menu-save' , 'save_listmenu' , rcmail _ui ) ;
rcmail . addEventListener ( 'aftersend-attachment' , 'show_uploadform' , rcmail _ui ) ;
rcmail . addEventListener ( 'aftersend-attachment' , 'show_uploadform' , rcmail _ui ) ;
rcmail . addEventListener ( 'aftertoggle-editor' , 'resize_compose_body' , rcmail _ui ) ;
rcmail . gui _object ( 'message_dragmenu' , 'dragmessagemenu' ) ;
rcmail . gui _object ( 'message_dragmenu' , 'dragmessagemenu' ) ;
if ( rcmail . env . action == 'compose' )
rcmail _ui . init _compose _form ( ) ;
}
}
}
}