mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 09:56:38 +02:00
MDL-31656 Open files in a new window when downloading with the filemanager
We need to open files in a new window rather than the existing window to prevent warning messages when files are uploaded and then downloaded without the form being saved first.
This commit is contained in:
parent
0dde394db5
commit
f0a163ed6d
1 changed files with 6 additions and 1 deletions
|
@ -450,7 +450,7 @@ M.form_filemanager.init = function(Y, options) {
|
|||
var scope = this;
|
||||
|
||||
var menuitems = [
|
||||
{text: M.str.moodle.download, url:file.url}
|
||||
{text: M.str.moodle.download, onclick:{fn:open_file_in_new_window, obj:file, scope:this}}
|
||||
];
|
||||
function setmainfile(type, ev, obj) {
|
||||
var file = obj[node.get('id')];
|
||||
|
@ -467,6 +467,11 @@ M.form_filemanager.init = function(Y, options) {
|
|||
}
|
||||
});
|
||||
}
|
||||
function open_file_in_new_window(type, ev, obj) {
|
||||
// We open in a new window rather than changing the current windows URL as we don't
|
||||
// want to navigate away from the page
|
||||
window.open(obj.url, 'fm-download-file');
|
||||
}
|
||||
if (this.enablemainfile && (file.sortorder != 1)) {
|
||||
var mainid = '#id_'+this.enablemainfile;
|
||||
var menu = {text: M.str.repository.setmainfile, onclick:{fn: setmainfile, obj:data, scope:this}};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue