mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-31642 added 'max attachments' to filemanager and 'drag and drop' message inside the box
This commit is contained in:
parent
5bbf3cb72b
commit
adce023069
@ -455,6 +455,7 @@ $string['displayonpage'] = 'Display on page';
|
||||
$string['dndenabled'] = 'Drag and drop available';
|
||||
$string['dndenabled_help'] = 'You can drag one or more files from your desktop and drop them onto the box below to upload them.<br />Note: this may not work with other web browsers';
|
||||
$string['dndenabled_insentence'] = 'drag and drop available';
|
||||
$string['dndenabled_inbox'] = 'drag and drop files here to upload them';
|
||||
$string['documentation'] = 'Moodle documentation';
|
||||
$string['down'] = 'Down';
|
||||
$string['download'] = 'Download';
|
||||
@ -970,6 +971,7 @@ $string['manageroles'] = 'Roles and permissions';
|
||||
$string['markedthistopic'] = 'This topic is highlighted as the current topic';
|
||||
$string['markthistopic'] = 'Highlight this topic as the current topic';
|
||||
$string['matchingsearchandrole'] = 'Matching \'{$a->search}\' and {$a->role}';
|
||||
$string['maxsizeandattachments'] = 'Maximum size for new files: {$a->size}, maximum attachments: {$a->attachments}';
|
||||
$string['maxfilesreached'] = 'You are allowed to attach a maximum of {$a} file(s) to this item';
|
||||
$string['maximumgrade'] = 'Maximum grade';
|
||||
$string['maximumgradex'] = 'Maximum grade: {$a}';
|
||||
|
@ -95,6 +95,15 @@ M.form_dndupload.init = function(Y, options) {
|
||||
// Needed to tell the filemanager to redraw when files uploaded
|
||||
// and to check how many files are already uploaded
|
||||
this.filemanager = options.filemanager;
|
||||
// Add a callback to show the 'drag and drop enabled' message
|
||||
// within the filemanager box once it has finished loading,
|
||||
// if there are no files yet uploaded
|
||||
this.filemanager.emptycallback = function(clientid) {
|
||||
var el = Y.one('#dndenabled2-'+clientid);
|
||||
if (el) {
|
||||
el.setStyle('display', 'inline');
|
||||
}
|
||||
}
|
||||
} else if (options.formcallback) {
|
||||
|
||||
// Needed to tell the filepicker to update when a new
|
||||
|
@ -61,6 +61,7 @@ M.form_filemanager.init = function(Y, options) {
|
||||
this.currentpath = '/';
|
||||
this.maxfiles = options.maxfiles;
|
||||
this.maxbytes = options.maxbytes;
|
||||
this.emptycallback = null; // Used by drag and drop upload
|
||||
|
||||
this.filepicker_options = options.filepicker?options.filepicker:{};
|
||||
this.filepicker_options.client_id = this.client_id;
|
||||
@ -264,7 +265,15 @@ M.form_filemanager.init = function(Y, options) {
|
||||
}, this);
|
||||
},
|
||||
empty_filelist: function(container) {
|
||||
container.set('innerHTML', '<div class="mdl-align">'+M.str.repository.nofilesattached+'</div>'+this.upload_message());
|
||||
var content = '<div class="mdl-align">'+M.str.repository.nofilesattached;
|
||||
content += '<span id="dndenabled2-'+this.client_id+'" style="display: none">';
|
||||
content += ' - '+M.util.get_string('dndenabled_inbox', 'moodle')+'</span>';
|
||||
content += '</div>';
|
||||
content += this.upload_message();
|
||||
container.set('innerHTML', content);
|
||||
if (this.emptycallback) {
|
||||
this.emptycallback(this.client_id);
|
||||
}
|
||||
},
|
||||
upload_message: function() {
|
||||
var div = '<div id="filemanager-uploadmessage'+this.client_id+'" style="display:none" class="dndupload-target">';
|
||||
|
@ -376,7 +376,13 @@ function form_filemanager_render($options) {
|
||||
$extra = '';
|
||||
}
|
||||
|
||||
$maxsize = get_string('maxfilesize', 'moodle', display_size(get_max_upload_file_size($CFG->maxbytes, $course_maxbytes, $options->maxbytes)));
|
||||
$maxbytes = display_size(get_max_upload_file_size($CFG->maxbytes, $course_maxbytes, $options->maxbytes));
|
||||
if (empty($options->maxfiles) || $options->maxfiles == -1) {
|
||||
$maxsize = get_string('maxfilesize', 'moodle', $maxbytes);
|
||||
} else {
|
||||
$strparam = (object)array('size' => $maxbytes, 'attachments' => $options->maxfiles);
|
||||
$maxsize = get_string('maxsizeandattachments', 'moodle', $strparam);
|
||||
}
|
||||
$strdndenabled = get_string('dndenabled_insentence', 'moodle').$OUTPUT->help_icon('dndenabled');
|
||||
$loading = get_string('loading', 'repository');
|
||||
$html .= <<<FMHTML
|
||||
|
@ -2018,7 +2018,7 @@ class core_renderer extends renderer_base {
|
||||
$strsaved = get_string('filesaved', 'repository');
|
||||
$straddfile = get_string('openpicker', 'repository');
|
||||
$strloading = get_string('loading', 'repository');
|
||||
$strdndenabled = get_string('dndenabled_insentence', 'moodle');
|
||||
$strdndenabled = get_string('dndenabled_inbox', 'moodle');
|
||||
$icon_progress = $OUTPUT->pix_icon('i/loading_small', $strloading).'';
|
||||
|
||||
$currentfile = $options->currentfile;
|
||||
|
@ -501,7 +501,7 @@ class page_requirements_manager {
|
||||
$module = array('name' => 'core_dndupload',
|
||||
'fullpath' => '/lib/form/dndupload.js',
|
||||
'requires' => array('node', 'event', 'json'),
|
||||
'strings' => array(array('uploadformlimit', 'moodle'), array('droptoupload', 'moodle'), array('maxfilesreached', 'moodle')));
|
||||
'strings' => array(array('uploadformlimit', 'moodle'), array('droptoupload', 'moodle'), array('maxfilesreached', 'moodle'), array('dndenabled_inbox', 'moodle')));
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user