Merge branch 'wip-MDL-46834-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE

This commit is contained in:
Dan Poltawski
2014-09-09 08:11:12 +01:00
3 changed files with 12 additions and 4 deletions
+8 -2
View File
@@ -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
@@ -82,15 +83,17 @@ M.form_dndupload.init = function(Y, options) {
Y.one('body').addClass('dndnotsupported');
return; // Browser does not support the required functionality
}
Y.one('body').addClass('dndsupported');
// try and retrieve enabled upload repository
this.repositoryid = this.get_upload_repositoryid(options.repositories);
if (!this.repositoryid) {
Y.one('body').addClass('dndnotsupported');
return; // no upload repository is enabled to upload to
}
Y.one('body').addClass('dndsupported');
this.options = options;
this.acceptedtypes = options.acceptedtypes;
this.clientid = options.clientid;
@@ -888,6 +891,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
+2 -1
View File
@@ -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);
};
+2 -1
View File
@@ -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);
};