This commit is contained in:
yanxd 2014-06-17 18:03:50 +08:00
parent 1cb1eeeb1d
commit 9b707f2b5a
3 changed files with 5 additions and 5 deletions

View File

@ -27,7 +27,7 @@ class ZipdownController < ApplicationController
else else
logger.error "[ZipDown#assort] ===> #{obj.class.to_s.to_sym} unKown !!" logger.error "[ZipDown#assort] ===> #{obj.class.to_s.to_sym} unKown !!"
end 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 #rescue NameError, ActiveRecord::RecordNotFound => e
#logger.error "[ZipDown] ===> #{e}" #logger.error "[ZipDown] ===> #{e}"
@ -39,7 +39,7 @@ class ZipdownController < ApplicationController
homework = HomeworkAttach.find params[:homework] homework = HomeworkAttach.find params[:homework]
if homework != nil && (User.current.admin? || User.current.member_of?(homework.bid.courses.first)) if homework != nil && (User.current.admin? || User.current.member_of?(homework.bid.courses.first))
zipfile = zip_homework_by_user homework 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 else
render_403 :message => :notice_not_authorized render_403 :message => :notice_not_authorized
end end
@ -88,7 +88,7 @@ class ZipdownController < ApplicationController
#length = attach.storage_path.length #length = attach.storage_path.length
homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1) homeworks_attach_path << attach.diskfile#.to_s.slice((length+1)..-1)
end 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 #user_attaches_paths
end end

View File

@ -27,7 +27,7 @@
(Member.where('user_id = ? and project_id = ?', User.current.id, (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 %> @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 %>
<div class='icon icon-add'> <div class='icon icon-add'>
<!-- <%= link_to l(:label_commit_homework), new_submit_homework_path, :onclick => "$('#put-bid-form').slideToggle(); this.blur(); return false;" %> --> <%#= link_to l(:label_commit_homework), new_submit_homework_path, :onclick => "$('#put-bid-form').slideToggle(); this.blur(); return false;" %>
<%= link_to l(:label_course_new_homework),new_homework_attach_path %> <%= link_to l(:label_course_new_homework),new_homework_attach_path %>
</div> </div>
<% end %> <% end %>

View File

@ -8,7 +8,7 @@
<table width="100%" valign="center"> <table width="100%" valign="center">
<tr> <tr>
<td ><span style="margin-left:0px"><%= l(:label_task_plural)%>(<%= @homework_list.count%>)</span> <td ><span style="margin-left:0px"><%= l(:label_task_plural)%>(<%= @homework_list.count%>)</span>
<%= 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.admin? ||
!(User.current.roles_for_project(@bid.courses.first).map(&:id) & ([7,9])).empty? ) || !(User.current.roles_for_project(@bid.courses.first).map(&:id) & ([7,9])).empty? ) ||
(Rails.env.development?) %> (Rails.env.development?) %>