MDL-59954 mod_course: Remove file size restriction on D&D on course page

Remove file size restrictions for teachers on course page.
Use user_max_upload_file_size instead of the max_file_size
This commit is contained in:
Peter 2018-12-07 12:26:46 +08:00
parent 33a388eff7
commit 6afbdf2778
2 changed files with 3 additions and 3 deletions

View File

@ -744,7 +744,7 @@ M.course_dndupload = {
var xhr = new XMLHttpRequest();
var self = this;
if (file.size > this.maxbytes) {
if (this.maxbytes > 0 && file.size > this.maxbytes) {
new M.core.alert({message: M.util.get_string('namedfiletoolarge', 'moodle', {filename: file.name})});
return;
}

View File

@ -73,7 +73,7 @@ function dndupload_add_to_course($course, $modnames) {
);
$vars = array(
array('courseid' => $course->id,
'maxbytes' => get_max_upload_file_size($CFG->maxbytes, $course->maxbytes),
'maxbytes' => get_user_max_upload_file_size($PAGE->context, $CFG->maxbytes, $course->maxbytes),
'handlers' => $handler->get_js_data(),
'showstatus' => $showstatus)
);
@ -488,7 +488,7 @@ class dndupload_ajax_processor {
// Add the file to a draft file area.
$draftitemid = file_get_unused_draft_itemid();
$maxbytes = get_max_upload_file_size($CFG->maxbytes, $this->course->maxbytes);
$maxbytes = get_user_max_upload_file_size($this->context, $CFG->maxbytes, $this->course->maxbytes);
$types = $this->dnduploadhandler->get_handled_file_types($this->module->name);
$repo = repository::get_instances(array('type' => 'upload', 'currentcontext' => $this->context));
if (empty($repo)) {