diff options
author | Thomas Bruederli <thomas@roundcube.net> | 2014-03-02 19:26:09 +0100 |
---|---|---|
committer | Thomas Bruederli <thomas@roundcube.net> | 2014-03-02 19:26:09 +0100 |
commit | d27a4f8f9e2f7c89534b7532c964b4fb7c364363 (patch) | |
tree | 474606a71dbb7cd53d147e81118edee6cb36ff28 | |
parent | fb5255e2f0bcd69b7fd45889bcda0fd4ad332ca1 (diff) |
Fix opening compose screen in new window after saving as draft (#1489643)
-rw-r--r-- | program/js/app.js | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/program/js/app.js b/program/js/app.js index dad4223b2..28a1b38ab 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -650,11 +650,16 @@ function rcube_webmail() var form = this.gui_objects.messageform, win = this.open_window(''); - this.save_compose_form_local(); - $("input[name='_action']", form).val('compose'); - form.action = this.url('mail/compose', { _id: this.env.compose_id, _extwin: 1 }); - form.target = win.name; - form.submit(); + if (win) { + this.save_compose_form_local(); + $("input[name='_action']", form).val('compose'); + form.action = this.url('mail/compose', { _id: this.env.compose_id, _extwin: 1 }); + form.target = win.name; + form.submit(); + } + else { + // this.display_message(this.get_label('windowopenerror'), 'error'); + } } else { this.open_window(this.env.permaurl, true); @@ -3094,7 +3099,12 @@ function rcube_webmail() // close compose step in opener if (opener_rc && opener_rc.env.action == 'compose') { - setTimeout(function(){ opener.history.back(); }, 100); + setTimeout(function(){ + if (opener.history.length > 1) + opener.history.back(); + else + opener_rc.redirect(opener_rc.get_task_url('mail')); + }, 100); this.env.opened_extwin = true; } @@ -3618,6 +3628,10 @@ function rcube_webmail() this.env.draft_id = id; $("input[name='_draft_saveid']").val(id); + // reset history of hidden iframe used for saving draft (#1489643) + if (window.frames['savetarget'] && window.frames['savetarget'].history) { + window.frames['savetarget'].history.back(); + } } // always remove local copy upon saving as draft |