Check attachment size when the user selects a file (#9667).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7926 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
fe45251349
commit
7ed7d8984d
|
@ -1,6 +1,7 @@
|
|||
<span id="attachments_fields">
|
||||
<span>
|
||||
<%= file_field_tag 'attachments[1][file]', :size => 30, :id => nil, :class => 'file' -%>
|
||||
<%= file_field_tag 'attachments[1][file]', :size => 30, :id => nil, :class => 'file',
|
||||
:onchange => "checkFileSize(this, #{Setting.attachment_max_size.to_i.kilobytes}, '#{escape_javascript(l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)))}');" -%>
|
||||
<label class="inline"><%= l(:label_optional_description) %><%= text_field_tag 'attachments[1][description]', '', :size => 60, :id => nil, :class => 'description' %></label>
|
||||
<%= link_to_function(image_tag('delete.png'), 'removeFileField(this)', :title => (l(:button_delete))) %>
|
||||
</span>
|
||||
|
|
|
@ -1003,3 +1003,4 @@ bg:
|
|||
description_date_range_interval: Изберете диапазон чрез задаване на начална и крайна дати
|
||||
description_date_from: Въведете начална дата
|
||||
description_date_to: Въведете крайна дата
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1019,3 +1019,4 @@ bs:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1008,3 +1008,4 @@ ca:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1009,3 +1009,4 @@ cs:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1022,3 +1022,4 @@ da:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1026,3 +1026,4 @@ de:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1005,3 +1005,4 @@ el:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1008,3 +1008,4 @@ en-GB:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -190,6 +190,7 @@ en:
|
|||
error_workflow_copy_target: 'Please select target tracker(s) and role(s)'
|
||||
error_unable_delete_issue_status: 'Unable to delete issue status'
|
||||
error_unable_to_connect: "Unable to connect (%{value})"
|
||||
error_attachment_too_big: "This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})"
|
||||
warning_attachments_not_saved: "%{count} file(s) could not be saved."
|
||||
|
||||
mail_subject_lost_password: "Your %{value} password"
|
||||
|
|
|
@ -1042,3 +1042,4 @@ es:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1009,3 +1009,4 @@ eu:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1008,3 +1008,4 @@ fa:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1026,3 +1026,4 @@ fi:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -197,6 +197,7 @@ fr:
|
|||
error_workflow_copy_source: 'Veuillez sélectionner un tracker et/ou un rôle source'
|
||||
error_workflow_copy_target: 'Veuillez sélectionner les trackers et rôles cibles'
|
||||
error_issue_done_ratios_not_updated: L'avancement des demandes n'a pas pu être mis à jour.
|
||||
error_attachment_too_big: Ce fichier ne peut pas être attaché car il excède la taille maximale autorisée (%{max_size})
|
||||
|
||||
warning_attachments_not_saved: "%{count} fichier(s) n'ont pas pu être sauvegardés."
|
||||
|
||||
|
|
|
@ -1017,3 +1017,4 @@ gl:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1010,3 +1010,4 @@ he:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1012,3 +1012,4 @@ hr:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1024,3 +1024,4 @@
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1013,3 +1013,4 @@ id:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1006,3 +1006,4 @@ it:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1035,3 +1035,4 @@ ja:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1057,3 +1057,4 @@ ko:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1065,3 +1065,4 @@ lt:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1000,3 +1000,4 @@ lv:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1005,3 +1005,4 @@ mk:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1006,3 +1006,4 @@ mn:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -987,3 +987,4 @@ nl:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -995,3 +995,4 @@
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1022,3 +1022,4 @@ pl:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1026,3 +1026,4 @@ pt-BR:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1010,3 +1010,4 @@ pt:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -998,3 +998,4 @@ ro:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1118,3 +1118,4 @@ ru:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1000,3 +1000,4 @@ sk:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1005,3 +1005,4 @@ sl:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1005,3 +1005,4 @@ sr-YU:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1006,3 +1006,4 @@ sr:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1046,3 +1046,4 @@ sv:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1002,3 +1002,4 @@ th:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1024,3 +1024,4 @@ tr:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1001,3 +1001,4 @@ uk:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1056,3 +1056,4 @@ vi:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1085,3 +1085,4 @@
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -1007,3 +1007,4 @@ zh:
|
|||
description_all_columns: All Columns
|
||||
button_export: Export
|
||||
label_export_options: "%{export_format} export options"
|
||||
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size})
|
||||
|
|
|
@ -106,6 +106,18 @@ function removeFileField(el) {
|
|||
}
|
||||
}
|
||||
|
||||
function checkFileSize(el, maxSize, message) {
|
||||
var files = el.files;
|
||||
if (files) {
|
||||
for (var i=0; i<files.length; i++) {
|
||||
if (files[i].size > maxSize) {
|
||||
alert(message);
|
||||
el.value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showTab(name) {
|
||||
var f = $$('div#content .tab-content');
|
||||
for(var i=0; i<f.length; i++){
|
||||
|
|
Loading…
Reference in New Issue