mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
MDL-46834 filepicker: dnd upload should respect the current context id
This commit is contained in:
parent
457f818026
commit
7b22e2ab54
@ -30,7 +30,7 @@ M.form_dndupload.init = function(Y, options) {
|
||||
Y: null,
|
||||
// URL for upload requests
|
||||
url: M.cfg.wwwroot + '/repository/repository_ajax.php?action=upload',
|
||||
// options may include: itemid, acceptedtypes, maxfiles, maxbytes, clientid, repositoryid, author
|
||||
// options may include: itemid, acceptedtypes, maxfiles, maxbytes, clientid, repositoryid, author, contextid
|
||||
options: {},
|
||||
// itemid used for repository upload
|
||||
itemid: null,
|
||||
@ -69,6 +69,7 @@ M.form_dndupload.init = function(Y, options) {
|
||||
* maxbytes: maximum size of files allowed in this form
|
||||
* areamaxbytes: maximum combined size of files allowed in this form
|
||||
* clientid: unqiue id of this form field used for html elements
|
||||
* contextid: id of the current cotnext
|
||||
* containerid: htmlid of container
|
||||
* repositories: array of repository objects passed from filepicker
|
||||
* filemanager: filemanager element we are working with
|
||||
@ -888,6 +889,9 @@ M.form_dndupload.init = function(Y, options) {
|
||||
if (overwrite) {
|
||||
formdata.append('overwrite', 1);
|
||||
}
|
||||
if (this.options.contextid) {
|
||||
formdata.append('ctx_id', this.options.contextid);
|
||||
}
|
||||
|
||||
// Accepted types can be either a string or an array, but an array is
|
||||
// expected in the processing script, so make sure we are sending an array
|
||||
|
@ -1066,7 +1066,8 @@ M.form_filemanager.init = function(Y, options) {
|
||||
areamaxbytes: options.areamaxbytes,
|
||||
itemid: options.itemid,
|
||||
repositories: manager.filepicker_options.repositories,
|
||||
containerid: manager.dndcontainer.get('id')
|
||||
containerid: manager.dndcontainer.get('id'),
|
||||
contextid: options.context.id
|
||||
};
|
||||
M.form_dndupload.init(Y, dndoptions);
|
||||
};
|
||||
|
@ -57,7 +57,8 @@ M.form_filepicker.init = function(Y, options) {
|
||||
repositories: options.repositories,
|
||||
formcallback: options.formcallback,
|
||||
containerprefix: '#file_info_',
|
||||
containerid: 'file_info_'+options.client_id
|
||||
containerid: 'file_info_'+options.client_id,
|
||||
contextid: options.context.id
|
||||
};
|
||||
M.form_dndupload.init(Y, dndoptions);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user