Use improved rcmail.open_window()

This commit is contained in:
Aleksander Machniak 2013-05-31 13:13:05 +02:00
parent b1e5827e48
commit 671bf6eb13
3 changed files with 5 additions and 13 deletions

View file

@ -205,9 +205,7 @@ function rcube_calendar_ui(settings)
// open attachment in frame if it's of a supported mimetype // open attachment in frame if it's of a supported mimetype
if (id && att.mimetype && $.inArray(att.mimetype, settings.mimetypes)>=0) { if (id && att.mimetype && $.inArray(att.mimetype, settings.mimetypes)>=0) {
rcmail.attachment_win = window.open(rcmail.env.comm_path+'&_action=get-attachment&'+qstring+'&_frame=1', 'rcubeeventattachment'); if (rcmail.open_window(rcmail.env.comm_path+'&_action=get-attachment&'+qstring+'&_frame=1', true, true)) {
if (rcmail.attachment_win) {
window.setTimeout(function() { rcmail.attachment_win.focus(); }, 10);
return; return;
} }
} }
@ -1807,8 +1805,7 @@ function rcube_calendar_ui(settings)
var date = fc.fullCalendar('getDate') || new Date(); var date = fc.fullCalendar('getDate') || new Date();
var range = fc.fullCalendar('option', 'listRange'); var range = fc.fullCalendar('option', 'listRange');
var sections = fc.fullCalendar('option', 'listSections'); var sections = fc.fullCalendar('option', 'listSections');
var printwin = window.open(rcmail.url('print', { view: view, date: date2unixtime(date), range: range, sections: sections, search: this.search_query }), "rc_print_calendars", "toolbar=no,location=yes,menubar=yes,resizable=yes,scrollbars=yes,width=800"); rcmail.open_window(rcmail.url('print', { view: view, date: date2unixtime(date), range: range, sections: sections, search: this.search_query }), true, true);
window.setTimeout(function(){ printwin.focus() }, 50);
}; };
// public method to bring up the new event dialog // public method to bring up the new event dialog

View file

@ -1324,10 +1324,7 @@ function kolab_files_ui()
// open file in new window, using file API viewer // open file in new window, using file API viewer
this.file_open = function(file, viewer) this.file_open = function(file, viewer)
{ {
var href = '?' + $.param({_task: 'files', _action: 'open', file: file, viewer: viewer == 2 ? 1 : 0}), var href = '?' + $.param({_task: 'files', _action: 'open', file: file, viewer: viewer == 2 ? 1 : 0});
win = window.open(href, rcmail.html_identifier('rcubefile'+file)); rcmail.open_window(href, false, true);
if (win)
setTimeout(function() { win.focus(); }, 10);
}; };
}; };

View file

@ -1163,9 +1163,7 @@ function rcube_tasklist_ui(settings)
// open attachment in frame if it's of a supported mimetype // open attachment in frame if it's of a supported mimetype
// similar as in app.js and calendar_ui.js // similar as in app.js and calendar_ui.js
if (att.id && att.mimetype && $.inArray(att.mimetype, settings.mimetypes)>=0) { if (att.id && att.mimetype && $.inArray(att.mimetype, settings.mimetypes)>=0) {
rcmail.attachment_win = window.open(rcmail.env.comm_path+'&_action=get-attachment&'+qstring+'&_frame=1', 'rcubetaskattachment'); if (rcmail.open_window(rcmail.env.comm_path+'&_action=get-attachment&'+qstring+'&_frame=1', true, true)) {
if (rcmail.attachment_win) {
window.setTimeout(function() { rcmail.attachment_win.focus(); }, 10);
return; return;
} }
} }