0001-misc-check-file-size-before-upload-13395.patch
wcs/qommon/form.py | ||
---|---|---|
718 | 718 |
self.get_widget('token').set_value(self.value.token) |
719 | 719 | |
720 | 720 |
def add_media(self): |
721 |
get_response().add_javascript(['jquery.js', 'jquery-ui.js', |
|
722 |
'jquery.iframe-transport.js', 'jquery.fileupload.js', |
|
723 |
'qommon.fileupload.js']) |
|
721 |
get_response().add_javascript(['qommon.fileupload.js']) |
|
724 | 722 |
if not self.readonly and get_request().user and self.allow_portfolio_picking: |
725 | 723 |
get_response().add_javascript(['fargo.js']) |
726 | 724 |
wcs/qommon/http_response.py | ||
---|---|---|
88 | 88 |
self.add_javascript(['jquery.js', |
89 | 89 |
'../ckeditor/ckeditor/ckeditor.js', |
90 | 90 |
'../ckeditor/ckeditor/adapters/jquery.js']) |
91 |
if script_name == 'qommon.fileupload.js': |
|
92 |
self.add_javascript(['../../i18n.js', |
|
93 |
'jquery.js', |
|
94 |
'jquery-ui.js', |
|
95 |
'jquery.iframe-transport.js', |
|
96 |
'jquery.fileupload.js', |
|
97 |
]) |
|
91 | 98 |
self.javascript_scripts.append(str(mapped_script_name)) |
92 | 99 |
if script_name == 'afterjob.js': |
93 | 100 |
self.add_javascript_code('var QOMMON_ROOT_URL = "%s";\n' % \ |
wcs/qommon/static/js/qommon.fileupload.js | ||
---|---|---|
316 | 316 |
}, |
317 | 317 | |
318 | 318 |
upload: function(base_widget, data) { |
319 |
var max_file_size = $(base_widget).find('input[type=file]').data('max-file-size'); |
|
320 |
if (max_file_size && data.files[0].size > max_file_size) { |
|
321 |
$(base_widget).find('.fileprogress').addClass('upload-error'); |
|
322 |
$(base_widget).find('.fileprogress .bar').text(WCS_I18N.file_size_error); |
|
323 |
return; |
|
324 |
} |
|
319 | 325 |
$(base_widget).find('.fileprogress').removeClass('upload-error'); |
320 | 326 |
$(base_widget).find('.fileprogress .bar').text( |
321 | 327 |
$(base_widget).find('.fileprogress .bar').data('upload')); |
wcs/root.py | ||
---|---|---|
363 | 363 |
get_response().set_content_type('text/javascript') |
364 | 364 |
strings = { |
365 | 365 |
'confirmation': _('Are you sure?'), |
366 |
'file_size_error': _('File size exceeds limits'), |
|
366 | 367 |
'geoloc_unknown_error': _('Geolocation: unknown error'), |
367 | 368 |
'geoloc_permission_denied': _('Geolocation: permission denied'), |
368 | 369 |
'geoloc_position_unavailable': _('Geolocation: position unavailable'), |
369 |
- |