@ -176,10 +176,10 @@ function rcube_webmail()
}
}
// enable general commands
// enable general commands
this . enable _command ( ' logout', 'mail' , 'addressbook' , 'settings' , 'save-pref' , 'compose' , 'undo' , 'about' , 'switch-task' , true ) ;
this . enable _command ( ' close', ' logout', 'mail' , 'addressbook' , 'settings' , 'save-pref' , 'compose' , 'undo' , 'about' , 'switch-task' , true ) ;
if ( this . env . permaurl )
if ( this . env . permaurl )
this . enable _command ( 'permaurl' , true ) ;
this . enable _command ( 'permaurl' , 'extwin' , true ) ;
switch ( this . task ) {
switch ( this . task ) {
@ -249,7 +249,7 @@ function rcube_webmail()
}
}
}
}
else if ( this . env . action == 'compose' ) {
else if ( this . env . action == 'compose' ) {
this . env . compose _commands = [ 'send-attachment' , 'remove-attachment' , 'send' , 'cancel' , 'toggle-editor' , 'list-adresses' ];
this . env . compose _commands = [ 'send-attachment' , 'remove-attachment' , 'send' , 'cancel' , 'toggle-editor' , 'list-adresses' , 'extwin' ];
if ( this . env . drafts _mailbox )
if ( this . env . drafts _mailbox )
this . env . compose _commands . push ( 'savedraft' )
this . env . compose _commands . push ( 'savedraft' )
@ -570,6 +570,19 @@ function rcube_webmail()
parent . location . href = this . env . permaurl ;
parent . location . href = this . env . permaurl ;
break ;
break ;
case 'extwin' :
if ( this . env . action == 'compose' ) {
var prevstate = this . env . compose _extwin ;
$ ( "input[name='_action']" , this . gui _objects . messageform ) . val ( 'compose' ) ;
this . gui _objects . messageform . action = this . url ( 'mail/compose' , { _id : this . env . compose _id , _extwin : 1 } ) ;
this . gui _objects . messageform . target = this . open _window ( '' , 1150 , 900 ) ;
this . gui _objects . messageform . submit ( ) ;
}
else {
this . open _window ( this . env . permaurl , 1000 , 1200 ) ;
}
break ;
case 'menu-open' :
case 'menu-open' :
case 'menu-save' :
case 'menu-save' :
this . triggerEvent ( command , { props : props } ) ;
this . triggerEvent ( command , { props : props } ) ;
@ -582,10 +595,18 @@ function rcube_webmail()
}
}
break ;
break ;
case 'close' :
if ( this . env . extwin )
window . close ( ) ;
break ;
case 'list' :
case 'list' :
if ( props && props != '' )
if ( props && props != '' )
this . reset _qsearch ( ) ;
this . reset _qsearch ( ) ;
if ( this . task == 'mail' ) {
if ( this . env . action == 'compose' && this . env . extwin ) {
window . close ( ) ;
}
else if ( this . task == 'mail' ) {
this . list _mailbox ( props ) ;
this . list _mailbox ( props ) ;
this . set _button _titles ( ) ;
this . set _button _titles ( ) ;
}
}
@ -640,7 +661,7 @@ function rcube_webmail()
uid = this . get _single _uid ( ) ;
uid = this . get _single _uid ( ) ;
if ( uid && ( ! this . env . uid || uid != this . env . uid ) ) {
if ( uid && ( ! this . env . uid || uid != this . env . uid ) ) {
if ( this . env . mailbox == this . env . drafts _mailbox )
if ( this . env . mailbox == this . env . drafts _mailbox )
this . goto_url ( 'compose' , { _draft _uid : uid , _mbox : this . env . mailbox } , true ) ;
this . open_compose _step ( { _draft _uid : uid , _mbox : this . env . mailbox } ) ;
else
else
this . show _message ( uid ) ;
this . show _message ( uid ) ;
}
}
@ -669,7 +690,7 @@ function rcube_webmail()
else if ( this . task == 'mail' && ( cid = this . get _single _uid ( ) ) ) {
else if ( this . task == 'mail' && ( cid = this . get _single _uid ( ) ) ) {
url = { _mbox : this . env . mailbox } ;
url = { _mbox : this . env . mailbox } ;
url [ this . env . mailbox == this . env . drafts _mailbox && props != 'new' ? '_draft_uid' : '_uid' ] = cid ;
url [ this . env . mailbox == this . env . drafts _mailbox && props != 'new' ? '_draft_uid' : '_uid' ] = cid ;
this . goto_url ( 'compose' , url , true ) ;
this . open_compose _step ( url ) ;
}
}
break ;
break ;
@ -862,25 +883,23 @@ function rcube_webmail()
break ;
break ;
case 'compose' :
case 'compose' :
url = this . url ( 'mail/compose' ) ;
url = { } ;
if ( this . task == 'mail' ) {
if ( this . task == 'mail' ) {
url += '&_mbox=' + urlencode ( this . env . mailbox ) ;
url . _mbox = this . env . mailbox ;
if ( props )
if ( props )
url += '&_to=' + urlencode ( props ) ;
url . _to = props ;
// also send search request so we can go back to search result after message is sent
// also send search request so we can go back to search result after message is sent
if ( this . env . search _request )
if ( this . env . search _request )
url += '&_search=' + this . env . search _request ;
url . _search = this . env . search _request ;
}
}
// modify url if we're in addressbook
// modify url if we're in addressbook
else if ( this . task == 'addressbook' ) {
else if ( this . task == 'addressbook' ) {
// switch to mail compose step directly
// switch to mail compose step directly
if ( props && props . indexOf ( '@' ) > 0 ) {
if ( props && props . indexOf ( '@' ) > 0 ) {
url = this . get _task _url ( 'mail' , url ) ;
url . _to = props ;
this . redirect ( url + '&_to=' + urlencode ( props ) ) ;
break ;
}
}
else {
// use contact_id passed as command parameter
// use contact_id passed as command parameter
var n , len , a _cids = [ ] ;
var n , len , a _cids = [ ] ;
if ( props )
if ( props )
@ -893,16 +912,17 @@ function rcube_webmail()
}
}
if ( a _cids . length )
if ( a _cids . length )
this . http _post ( 'mailto' , { _cid : a _cids . join ( ',' ) , _source : this . env . source } , true ) ;
this . http _post ( 'mailto' , { _cid : a _cids . join ( ',' ) , _source : this . env . source , } , true ) ;
else if ( this . env . group )
else if ( this . env . group )
this . http _post ( 'mailto' , { _gid : this . env . group , _source : this . env . source } , true ) ;
this . http _post ( 'mailto' , { _gid : this . env . group , _source : this . env . source } , true ) ;
break ;
break ;
}
}
}
else if ( props )
else if ( props )
url += '&_to=' + urlencode ( props ) ;
url . _to = props ;
this . redirect ( url ) ;
this . open_compose _step ( url ) ;
break ;
break ;
case 'spellcheck' :
case 'spellcheck' :
@ -977,7 +997,7 @@ function rcube_webmail()
else if ( command == 'reply-list' )
else if ( command == 'reply-list' )
url . _all = 'list' ;
url . _all = 'list' ;
this . goto_url ( 'compose' , url , true ) ;
this . open_compose _step ( url ) ;
}
}
break ;
break ;
@ -987,7 +1007,7 @@ function rcube_webmail()
url = { _forward _uid : uid , _mbox : this . env . mailbox } ;
url = { _forward _uid : uid , _mbox : this . env . mailbox } ;
if ( command == 'forward-attachment' || ( ! props && this . env . forward _attachment ) )
if ( command == 'forward-attachment' || ( ! props && this . env . forward _attachment ) )
url . _attachment = 1 ;
url . _attachment = 1 ;
this . goto_url ( 'compose' , url , true ) ;
this . open_compose _step ( url ) ;
}
}
break ;
break ;
@ -1561,7 +1581,7 @@ function rcube_webmail()
var uid = list . get _single _selection ( ) ;
var uid = list . get _single _selection ( ) ;
if ( uid && this . env . mailbox == this . env . drafts _mailbox )
if ( uid && this . env . mailbox == this . env . drafts _mailbox )
this . goto_url ( 'compose' , { _draft _uid : uid , _mbox : this . env . mailbox } , true ) ;
this . open_compose _step ( { _draft _uid : uid , _mbox : this . env . mailbox } ) ;
else if ( uid )
else if ( uid )
this . show _message ( uid , false , false ) ;
this . show _message ( uid , false , false ) ;
} ;
} ;
@ -1643,6 +1663,28 @@ function rcube_webmail()
return allow ? ( copy ? 2 : 1 ) : 0 ;
return allow ? ( copy ? 2 : 1 ) : 0 ;
} ;
} ;
this . open _window = function ( url , width , height )
{
var w = Math . min ( width , screen . width - 10 ) ,
h = Math . min ( height , screen . height - 100 ) ,
l = ( screen . width - w ) / 2 + ( screen . left || 0 ) ,
t = Math . max ( 0 , ( screen . height - h ) / 2 + ( screen . top || 0 ) - 20 ) ;
var wname = 'rcmextwin' + new Date ( ) . getTime ( ) ,
extwin = window . open ( url + '&_extwin=1' , wname , 'width=' + w + ',height=' + h + ',top=' + t + ',left=' + l + ',resizable=yes,toolbar=no,status=no' ) ;
extwin . moveTo ( l , t ) ;
// write loading... message to empty windows
if ( ! url && extwin . document ) {
extwin . document . write ( '<html><body>' + this . get _label ( 'loading' ) + '</body></html>' ) ;
}
// focus window, delayed to bring to front
window . setTimeout ( function ( ) { extwin . focus ( ) ; } , 10 ) ;
return wname ;
} ;
/*********************************************************/
/*********************************************************/
/********* (message) list functionality *********/
/********* (message) list functionality *********/
@ -1906,7 +1948,7 @@ function rcube_webmail()
this . list _mailbox ( '' , '' , sort _col + '_' + sort _order , post _data ) ;
this . list _mailbox ( '' , '' , sort _col + '_' + sort _order , post _data ) ;
} ;
} ;
// when user do ble-clicks on a row
// when user do u ble-clicks on a row
this . show _message = function ( id , safe , preview )
this . show _message = function ( id , safe , preview )
{
{
if ( ! id )
if ( ! id )
@ -1931,9 +1973,16 @@ function rcube_webmail()
// add browser capabilities, so we can properly handle attachments
// add browser capabilities, so we can properly handle attachments
url += '&_caps=' + urlencode ( this . browser _capabilities ( ) ) ;
url += '&_caps=' + urlencode ( this . browser _capabilities ( ) ) ;
if ( preview && String ( target . location . href ) . indexOf ( url ) >= 0 )
if ( this . env . extwin )
url += '&_extwin=1' ;
if ( preview && String ( target . location . href ) . indexOf ( url ) >= 0 ) {
this . show _contentframe ( true ) ;
this . show _contentframe ( true ) ;
}
else {
else {
if ( ! preview && this . env . message _extwin && ! this . env . extwin )
this . open _window ( this . env . comm _path + url , 1000 , 1200 ) ;
else
this . location _href ( this . env . comm _path + url , target , true ) ;
this . location _href ( this . env . comm _path + url , target , true ) ;
// mark as read and change mbox unread counter
// mark as read and change mbox unread counter
@ -2962,6 +3011,17 @@ function rcube_webmail()
/********* message compose methods *********/
/********* message compose methods *********/
/*********************************************************/
/*********************************************************/
this . open _compose _step = function ( p )
{
var url = this . url ( 'mail/compose' , p ) ;
// open new compose window
if ( this . env . compose _extwin )
this . open _window ( url , 1150 , 900 ) ;
else
this . redirect ( url ) ;
} ;
// init message compose form: set focus and eventhandlers
// init message compose form: set focus and eventhandlers
this . init _messageform = function ( )
this . init _messageform = function ( )
{
{
@ -2976,6 +3036,11 @@ function rcube_webmail()
ac _fields = [ 'cc' , 'bcc' , 'replyto' , 'followupto' ] ,
ac _fields = [ 'cc' , 'bcc' , 'replyto' , 'followupto' ] ,
ac _props ;
ac _props ;
// close compose step in opener
if ( window . opener && opener . rcmail && opener . rcmail . env . action == 'compose' ) {
setTimeout ( function ( ) { opener . history . back ( ) ; } , 100 ) ;
}
// configure parallel autocompletion
// configure parallel autocompletion
if ( this . env . autocomplete _threads > 0 ) {
if ( this . env . autocomplete _threads > 0 ) {
ac _props = {
ac _props = {
@ -3630,8 +3695,16 @@ function rcube_webmail()
this . sent _successfully = function ( type , msg )
this . sent _successfully = function ( type , msg )
{
{
this . display _message ( msg , type ) ;
this . display _message ( msg , type ) ;
if ( this . env . extwin && window . opener && opener . rcmail ) {
this . lock _form ( this . gui _objects . messageform ) ;
opener . rcmail . display _message ( msg , type ) ;
setTimeout ( function ( ) { window . close ( ) } , 1000 ) ;
}
else {
// before redirect we need to wait some time for Chrome (#1486177)
// before redirect we need to wait some time for Chrome (#1486177)
setTimeout ( function ( ) { ref . list _mailbox ( ) ; } , 500 ) ;
setTimeout ( function ( ) { ref . list _mailbox ( ) ; } , 500 ) ;
}
} ;
} ;