end\r
\r
def add_attachment\r
- # Save the attachment\r
- if params[:attachment][:file].size > 0\r
- @attachment = @issue.attachments.build(params[:attachment]) \r
- @attachment.author_id = self.logged_in_user.id if self.logged_in_user\r
+ # Save the attachments\r
+ params[:attachments].each { |a|\r
+ @attachment = @issue.attachments.build(:file => a, :author => self.logged_in_user) unless a.size == 0\r
@attachment.save\r
- end\r
+ } if params[:attachments] and params[:attachments].is_a? Array\r
redirect_to :action => 'show', :id => @issue\r
end\r
\r
else\r
@issue.attributes = params[:issue]\r
@issue.author_id = self.logged_in_user.id if self.logged_in_user\r
- # Create the document if a file was sent\r
- if params[:attachment][:file].size > 0\r
- @attachment = @issue.attachments.build(params[:attachment]) \r
- @attachment.author_id = self.logged_in_user.id if self.logged_in_user\r
- end\r
+ # Multiple file upload\r
+ params[:attachments].each { |a|\r
+ @attachment = @issue.attachments.build(:file => a, :author => self.logged_in_user) unless a.size == 0\r
+ } if params[:attachments] and params[:attachments].is_a? Array\r
@custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) }\r
@issue.custom_values = @custom_values \r
if @issue.save\r
</p>\r
</div>\r
\r
-<% if authorize_for('issues', 'add_note') %>\r
- <div class="box">\r
- <h3><%= l(:label_add_note) %></h3>\r
- <%= start_form_tag ({:controller => 'issues', :action => 'add_note', :id => @issue}, :class => "tabular" ) %>\r
- <p><label for="history_notes"><%=l(:field_notes)%></label>\r
- <%= text_area 'history', 'notes', :cols => 60, :rows => 10 %></p>\r
- <%= submit_tag l(:button_add) %>\r
- <%= end_form_tag %>\r
- </div>\r
-<% end %>\r
-\r
-<div class="splitcontentleft">\r
<div class="box">\r
<h3><%=l(:label_history)%></h3>\r
<table width="100%">\r
<% end %>
</table>\r
</div>\r
-</div>\r
\r
-<div class="splitcontentright">\r
<div class="box">\r
<h3><%=l(:label_attachment_plural)%></h3>\r
<table width="100%">\r
</table>\r
<br />\r
<% if authorize_for('issues', 'add_attachment') %>\r
- <%= start_form_tag ({ :controller => 'issues', :action => 'add_attachment', :id => @issue }, :multipart => true) %>\r
- <%=l(:label_attachment_new)%>: <%= file_field 'attachment', 'file' %>\r
+ <%= start_form_tag ({ :controller => 'issues', :action => 'add_attachment', :id => @issue }, :multipart => true, :class => "tabular") %>\r
+ <p id="attachments_p"><label><%=l(:label_attachment_new)%>\r
+ <%= link_to_function image_tag('add', :align => "top"), "addFileField()" %></label>\r
+ <%= file_field_tag 'attachments[]', :size => 30 %></p>\r
<%= submit_tag l(:button_add) %>\r
<%= end_form_tag %> \r
<% end %>\r
</div>\r
-</div>\r
\r
+<% if authorize_for('issues', 'add_note') %>\r
+ <div class="box">\r
+ <h3><%= l(:label_add_note) %></h3>\r
+ <%= start_form_tag ({:controller => 'issues', :action => 'add_note', :id => @issue}, :class => "tabular" ) %>\r
+ <p><label for="history_notes"><%=l(:field_notes)%></label>\r
+ <%= text_area 'history', 'notes', :cols => 60, :rows => 10 %></p>\r
+ <%= submit_tag l(:button_add) %>\r
+ <%= end_form_tag %>\r
+ </div>\r
+<% end %>\r
<p><%= custom_field_tag_with_label @custom_value %></p>
<% end %>\r
\r
-<p><label for="attachment_file"><%=l(:label_attachment)%></label>
-<%= file_field 'attachment', 'file' %></p>\r
+<p id="attachments_p"><label for="attachment_file"><%=l(:label_attachment)%>
+<%= link_to_function image_tag('add', :align => "top"), "addFileField()" %></label>
+<%= file_field_tag 'attachments[]', :size => 30 %></p>
<!--[eoform:issue]-->\r
</div>