diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 808df65dc..4fddec103 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -27,7 +27,7 @@ class ZipdownController < ApplicationController else logger.error "[ZipDown#assort] ===> #{obj.class.to_s.to_sym} unKown !!" end - send_file zipfile, :filename => obj.name, :type => detect_content_type(zipfile) if zipfile + send_file zipfile, :filename => obj.name+".zip", :type => detect_content_type(zipfile) if zipfile #rescue NameError, ActiveRecord::RecordNotFound => e #logger.error "[ZipDown] ===> #{e}" @@ -39,7 +39,7 @@ class ZipdownController < ApplicationController homework = HomeworkAttach.find params[:homework] if homework != nil && (User.current.admin? || User.current.member_of?(homework.bid.courses.first)) zipfile = zip_homework_by_user homework - send_file zipfile, :filename => homework.name, :type => detect_content_type(zipfile) if zipfile + send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if zipfile else render_403 :message => :notice_not_authorized end @@ -88,7 +88,7 @@ class ZipdownController < ApplicationController #length = attach.storage_path.length homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1) end - zipping "#{homeattach.user.name.to_s}.zip", homeworks_attach_path, OUTPUT_FOLDER, true + zipping "#{homeattach.user.name.to_s}_#{Time.now.to_i}.zip", homeworks_attach_path, OUTPUT_FOLDER, true #user_attaches_paths end diff --git a/app/views/bids/_homework.html.erb b/app/views/bids/_homework.html.erb index 4e2681ba6..1a55dc243 100644 --- a/app/views/bids/_homework.html.erb +++ b/app/views/bids/_homework.html.erb @@ -27,7 +27,7 @@ (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) && cur_user_homework_for_bid(@bid).count == 0 %>
<%= l(:label_task_plural)%>(<%= @homework_list.count%>) - <%= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;line-height: 20px;height: 20px;display: inline-block;" if( + <%#= link_to "作业打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), remote: false, class: "button_submit button_submit_font_white", style: "margin: 5px 10px;line-height: 20px;height: 20px;display: inline-block;" if( User.current.admin? || !(User.current.roles_for_project(@bid.courses.first).map(&:id) & ([7,9])).empty? ) || (Rails.env.development?) %> |