diff options
Diffstat (limited to 'phpBB/assets/javascript/plupload.js')
-rw-r--r-- | phpBB/assets/javascript/plupload.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/phpBB/assets/javascript/plupload.js b/phpBB/assets/javascript/plupload.js index 495d756c79..5e8db8b035 100644 --- a/phpBB/assets/javascript/plupload.js +++ b/phpBB/assets/javascript/plupload.js @@ -21,7 +21,9 @@ phpbb.plupload.initialize = function() { // Only execute if Plupload initialized successfully. phpbb.plupload.uploader.bind('Init', function() { phpbb.plupload.form = $(phpbb.plupload.config.form_hook)[0]; - phpbb.plupload.rowTpl = $('#attach-row-tpl')[0].outerHTML; + let $attachRowTemplate = $('#attach-row-tpl'); + $attachRowTemplate.removeClass('attach-row-tpl'); + phpbb.plupload.rowTpl = $attachRowTemplate[0].outerHTML; // Hide the basic upload panel and remove the attach row template. $('#attach-row-tpl, #attach-panel-basic').remove(); @@ -88,6 +90,12 @@ phpbb.plupload.getSerializedData = function() { obj['attachment_data[' + i + '][' + key + ']'] = datum[key]; } } + + // Insert form data + var $pluploadForm = $(phpbb.plupload.config.form_hook).first(); + obj.creation_time = $pluploadForm.find('input[type=hidden][name="creation_time"]').val(); + obj.form_token = $pluploadForm.find('input[type=hidden][name="form_token"]').val(); + return obj; }; @@ -262,6 +270,17 @@ phpbb.plupload.deleteFile = function(row, attachId) { return; } + + // Handle errors while deleting file + if (typeof response.error !== 'undefined') { + phpbb.alert(phpbb.plupload.lang.ERROR, response.error.message); + + // We will have to assume that the deletion failed. So leave the file status as uploaded. + row.find('.file-status').toggleClass('file-uploaded'); + + return; + } + phpbb.plupload.update(response, 'removal', index); // Check if the user can upload files now if he had reached the max files limit. phpbb.plupload.handleMaxFilesReached(); |