Open attachments, print and source in popups for consistency - always use

open_window() instead of window.open(), so plugins/skins can override popup behaviour
pull/79/head
Aleksander Machniak 12 years ago
parent ece3a522d8
commit 2f321c6600

@ -598,11 +598,12 @@ function rcube_webmail()
case 'extwin': case 'extwin':
if (this.env.action == 'compose') { if (this.env.action == 'compose') {
var form = this.gui_objects.messageform; var form = this.gui_objects.messageform,
win = this.open_window('');
$("input[name='_action']", form).val('compose'); $("input[name='_action']", form).val('compose');
form.action = this.url('mail/compose', { _id: this.env.compose_id, _extwin: 1 }); form.action = this.url('mail/compose', { _id: this.env.compose_id, _extwin: 1 });
form.target = this.open_window(''); form.target = win.name;
form.submit(); form.submit();
} }
else { else {
@ -859,11 +860,8 @@ function rcube_webmail()
// open attachment in frame if it's of a supported mimetype // open attachment in frame if it's of a supported mimetype
if (command != 'download-attachment' && mimetype && this.env.mimetypes && $.inArray(mimetype, this.env.mimetypes) >= 0) { if (command != 'download-attachment' && mimetype && this.env.mimetypes && $.inArray(mimetype, this.env.mimetypes) >= 0) {
var attachment_win = window.open(this.env.comm_path+'&_action=get&'+qstring+'&_frame=1', this.html_identifier('rcubemailattachment'+this.env.uid+props)); if (this.open_window(this.env.comm_path+'&_action=get&'+qstring+'&_frame=1', true, true))
if (attachment_win) {
setTimeout(function(){ attachment_win.focus(); }, 10);
break; break;
}
} }
this.goto_url('get', qstring+'&_download=1', false); this.goto_url('get', qstring+'&_download=1', false);
@ -1047,7 +1045,7 @@ function rcube_webmail()
case 'print': case 'print':
if (uid = this.get_single_uid()) { if (uid = this.get_single_uid()) {
ref.printwin = window.open(this.env.comm_path+'&_action=print&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+(this.env.safemode ? '&_safe=1' : '')); ref.printwin = this.open_window(this.env.comm_path+'&_action=print&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)+(this.env.safemode ? '&_safe=1' : ''), true, true);
if (this.printwin) { if (this.printwin) {
setTimeout(function(){ ref.printwin.focus(); }, 20); setTimeout(function(){ ref.printwin.focus(); }, 20);
if (this.env.action != 'show') if (this.env.action != 'show')
@ -1057,11 +1055,8 @@ function rcube_webmail()
break; break;
case 'viewsource': case 'viewsource':
if (uid = this.get_single_uid()) { if (uid = this.get_single_uid())
ref.sourcewin = window.open(this.env.comm_path+'&_action=viewsource&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox)); this.open_window(this.env.comm_path+'&_action=viewsource&_uid='+uid+'&_mbox='+urlencode(this.env.mailbox), true, true);
if (this.sourcewin)
setTimeout(function(){ ref.sourcewin.focus(); }, 20);
}
break; break;
case 'download': case 'download':
@ -1632,7 +1627,7 @@ function rcube_webmail()
}; };
// open popup window // open popup window
this.open_window = function(url, small) this.open_window = function(url, small, toolbar)
{ {
var win = this.is_framed() ? parent.window : window, var win = this.is_framed() ? parent.window : window,
page = $(win), page = $(win),
@ -1644,7 +1639,8 @@ function rcube_webmail()
t = (win.screenTop || win.screenY) + 20, t = (win.screenTop || win.screenY) + 20,
wname = 'rcmextwin' + new Date().getTime(), wname = 'rcmextwin' + new Date().getTime(),
extwin = window.open(url + (url.match(/\?/) ? '&' : '?') + '_extwin=1', wname, extwin = window.open(url + (url.match(/\?/) ? '&' : '?') + '_extwin=1', wname,
'width='+w+',height='+h+',top='+t+',left='+l+',resizable=yes,toolbar=no,status=no,location=no'); 'width='+w+',height='+h+',top='+t+',left='+l+',resizable=yes,location=no,scrollbars=yes'
+(toolbar ? ',toolbar=yes,menubar=yes,status=yes' : ',toolbar=no,menubar=no,status=no'));
// write loading... message to empty windows // write loading... message to empty windows
if (!url && extwin.document) { if (!url && extwin.document) {
@ -1654,7 +1650,7 @@ function rcube_webmail()
// focus window, delayed to bring to front // focus window, delayed to bring to front
window.setTimeout(function() { extwin.focus(); }, 10); window.setTimeout(function() { extwin.focus(); }, 10);
return wname; return extwin;
}; };

Loading…
Cancel
Save