@ -593,6 +593,7 @@ function rcube_webmail()
// remove copy from local storage if compose screen is left intentionally
this . remove _compose _data ( this . env . compose _id ) ;
this . compose _skip _unsavedcheck = true ;
}
// process external commands
@ -652,6 +653,7 @@ function rcube_webmail()
if ( win ) {
this . save _compose _form _local ( ) ;
this . compose _skip _unsavedcheck = true ;
$ ( "input[name='_action']" , form ) . val ( 'compose' ) ;
form . action = this . url ( 'mail/compose' , { _id : this . env . compose _id , _extwin : 1 } ) ;
form . target = win . name ;
@ -1325,7 +1327,7 @@ function rcube_webmail()
var url = this . get _task _url ( task ) ;
if ( task == 'mail' )
url += '&_mbox=INBOX' ;
else if ( task == 'logout' )
else if ( task == 'logout' && ! this . env . server _error )
this . clear _compose _data ( ) ;
this . redirect ( url ) ;
@ -3261,6 +3263,7 @@ function rcube_webmail()
form . _draft . value = draft ? '1' : '' ;
form . action = this . add _url ( form . action , '_unlock' , msgid ) ;
form . action = this . add _url ( form . action , '_lang' , lang ) ;
form . action = this . add _url ( form . action , '_framed' , 1 ) ;
// register timer to notify about connection timeout
this . submit _timer = setTimeout ( function ( ) {
@ -3655,6 +3658,7 @@ function rcube_webmail()
// always remove local copy upon saving as draft
this . remove _compose _data ( this . env . compose _id ) ;
this . compose _skip _unsavedcheck = false ;
} ;
this . auto _save _start = function ( )
@ -3679,6 +3683,21 @@ function rcube_webmail()
ref . compose _type _activity _last = ref . compose _type _activity ;
}
} , 5000 ) ;
$ ( window ) . unload ( function ( ) {
// remove copy from local storage if compose screen is left after warning
if ( ! ref . env . server _error )
ref . remove _compose _data ( ref . env . compose _id ) ;
} ) ;
}
// check for unsaved changes before leaving the compose page
if ( ! window . onbeforeunload ) {
window . onbeforeunload = function ( ) {
if ( ! ref . compose _skip _unsavedcheck && ref . cmp _hash != ref . compose _field _hash ( ) ) {
return ref . get _label ( 'notsentwarning' ) ;
}
} ;
}
// Unlock interface now that saving is complete
@ -4216,6 +4235,7 @@ function rcube_webmail()
this . sent _successfully = function ( type , msg , folders )
{
this . display _message ( msg , type ) ;
this . compose _skip _unsavedcheck = true ;
if ( this . env . extwin ) {
this . lock _form ( this . gui _objects . messageform ) ;
@ -7131,6 +7151,7 @@ function rcube_webmail()
// save message in local storage and do not redirect
if ( this . env . action == 'compose' ) {
this . save _compose _form _local ( ) ;
this . compose _skip _unsavedcheck = true ;
}
else if ( redirect _url ) {
window . setTimeout ( function ( ) { ref . redirect ( redirect _url , true ) ; } , 2000 ) ;