diff --git a/lang/en/moodle.php b/lang/en/moodle.php index f9371e34bb8..fd18d930630 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -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.
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}'; diff --git a/lib/form/dndupload.js b/lib/form/dndupload.js index 20fd98498a1..385440ab7a6 100644 --- a/lib/form/dndupload.js +++ b/lib/form/dndupload.js @@ -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 diff --git a/lib/form/filemanager.js b/lib/form/filemanager.js index d97546bba0c..915fe90627b 100644 --- a/lib/form/filemanager.js +++ b/lib/form/filemanager.js @@ -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; @@ -268,7 +269,15 @@ M.form_filemanager.init = function(Y, options) { }, this); }, empty_filelist: function(container) { - container.set('innerHTML', '
'+M.str.repository.nofilesattached+'
'+this.upload_message()); + var content = '
'+M.str.repository.nofilesattached; + content += ''; + content += '
'; + content += this.upload_message(); + container.set('innerHTML', content); + if (this.emptycallback) { + this.emptycallback(this.client_id); + } }, upload_message: function() { var div = '