Merge branch 'szzh' of http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into szzh
This commit is contained in:
commit
8217e37516
|
@ -41,7 +41,7 @@ class UsersController < ApplicationController
|
|||
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
|
||||
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index]
|
||||
before_filter :auth_user_extension, only: :show
|
||||
before_filter :rest_user_score, only: :show
|
||||
#before_filter :rest_user_score, only: :show
|
||||
#before_filter :select_entry, only: :user_projects
|
||||
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save , :tag_saveEx
|
||||
|
||||
|
|
|
@ -7,17 +7,6 @@ class ZipdownController < ApplicationController
|
|||
SAVE_FOLDER = "#{Rails.root}/files"
|
||||
OUTPUT_FOLDER = "#{Rails.root}/tmp/archiveZip"
|
||||
|
||||
#通过作业Id找到项目(课程)
|
||||
def find_project_by_bid_id
|
||||
obj_class = params[:obj_class]
|
||||
obj_id = params[:obj_id]
|
||||
obj = obj_class.constantize.find(obj_id)
|
||||
case obj.class.to_s.to_sym
|
||||
when :Bid
|
||||
@project = obj.courses[0]
|
||||
end
|
||||
end
|
||||
|
||||
def assort
|
||||
if params[:obj_class] == "Bid"
|
||||
bid = Bid.find params[:obj_id]
|
||||
|
@ -33,8 +22,8 @@ class ZipdownController < ApplicationController
|
|||
end
|
||||
send_file zipfile, :filename => bid.name + ".zip", :type => detect_content_type(zipfile) if zipfile
|
||||
|
||||
rescue Exception => e
|
||||
render file: 'public/no_file_found.html'
|
||||
#rescue Exception => e
|
||||
# render file: 'public/no_file_found.html'
|
||||
end
|
||||
|
||||
#下载某一学生的作业的所有文件
|
||||
|
@ -56,12 +45,23 @@ class ZipdownController < ApplicationController
|
|||
else
|
||||
render_403
|
||||
end
|
||||
rescue => e
|
||||
render file: 'public/file_not_found.html'
|
||||
#rescue => e
|
||||
# render file: 'public/file_not_found.html'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
#通过作业Id找到项目(课程)
|
||||
def find_project_by_bid_id
|
||||
obj_class = params[:obj_class]
|
||||
obj_id = params[:obj_id]
|
||||
obj = obj_class.constantize.find(obj_id)
|
||||
case obj.class.to_s.to_sym
|
||||
when :Bid
|
||||
@project = obj.courses[0]
|
||||
end
|
||||
end
|
||||
|
||||
def zip_bid(bid)
|
||||
# Todo: User Access Controll
|
||||
bid_homework_path = []
|
||||
|
@ -101,10 +101,20 @@ class ZipdownController < ApplicationController
|
|||
|
||||
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
|
||||
input_filename.each do |filename|
|
||||
flag = true
|
||||
index = 1
|
||||
rename_file = ic.iconv( (File.basename(filename)) ).to_s
|
||||
rename_file = ic.iconv( filename_to_real( File.basename(filename))).to_s if is_attachment
|
||||
|
||||
zipfile.add(rename_file, filename)
|
||||
begin
|
||||
zipfile.add(rename_file, filename)
|
||||
flag = false
|
||||
rescue Exception => e
|
||||
zipfile.get_output_stream('FILE_NOTICE.txt') do |os|
|
||||
os.write l(:label_file_exist)
|
||||
end
|
||||
next
|
||||
end
|
||||
end
|
||||
unless not_exist_file.empty?
|
||||
zipfile.get_output_stream('FILE_LOST.txt') do |os|
|
||||
|
@ -113,9 +123,9 @@ class ZipdownController < ApplicationController
|
|||
end
|
||||
end
|
||||
zipfile_name
|
||||
rescue Errno => e
|
||||
logger.error "[zipdown#zipping] ===> #{e}"
|
||||
@error = e
|
||||
#rescue Errno => e
|
||||
# logger.error "[zipdown#zipping] ===> #{e}"
|
||||
# @error = e
|
||||
end
|
||||
def detect_content_type(name)
|
||||
content_type = Redmine::MimeType.of(name)
|
||||
|
|
|
@ -2239,5 +2239,6 @@ zh:
|
|||
label_course_prompt: 课程:
|
||||
label_contain_resource: 已包含资源:
|
||||
label_quote_resource_failed: ",此资源引用失败! "
|
||||
label_file_lost: 以下文件在服务器丢失,请联系相关人员重新上传:
|
||||
label_file_lost: 以下无法成功下载,请联系相关人员重新上传:
|
||||
label_file_exist: 该作品中有重复命名文件,请通过文件名学号和姓名信息进入该作业详细界面手动下载
|
||||
|
||||
|
|
|
@ -831,8 +831,9 @@ ActiveRecord::Schema.define(:version => 20150112024820) do
|
|||
t.integer "user_id"
|
||||
t.datetime "published_at"
|
||||
t.datetime "closed_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.text "polls_description"
|
||||
end
|
||||
|
||||
create_table "praise_tread_caches", :force => true do |t|
|
||||
|
|
Loading…
Reference in New Issue