修复老师角色在没有任何附件情况下点击打包下载报500错误的BUG #1209

解决方案:增加判断是否有一个以上附件,当没有任何附件时,跳转到相应页面,提示用户没有任何文件可以下载
course_group
sw 11 years ago
parent dec8b70895
commit f70edc1a0b

@ -44,15 +44,14 @@ class ZipdownController < ApplicationController
zipfile = zip_homework_by_user homework
send_file zipfile, :filename => homework.name+".zip", :type => detect_content_type(zipfile) if(zipfile)
else
render_403 :message => :no_file_dowmload ,:layout => "course_base"
render file: 'public/no_file_found.html' , :layout => 'course_base'
end
else
render_403 :message =>:notice_file_not_found ,:layout => "course_base"
render file: 'public/file_not_found.html' , :layout => 'course_base'
end
else
render_403 :message => :notice_not_authorized ,:layout => "course_base"
end
rescue => e
render file: 'public/file_not_found.html' , :layout => 'course_base'
end
@ -86,9 +85,9 @@ class ZipdownController < ApplicationController
has_file = true if has_file == false
end
end
render_403 :message => :no_file_dowmload ,:layout => "course_base" if has_file == false
if has_file == false
render file: 'public/no_file_fond.html.erb' , :layout => 'course_base'
end
zipping "#{Time.now.to_i}_#{bid.name}.zip", user_zip_paths, OUTPUT_FOLDER
#@paths = homeworks_attach_path

@ -2109,7 +2109,7 @@ zh:
label_school_no_course: 该学校未开设任何课程,您可以查看其他学校课程
label_school_less_course: 该学校开设课程较少,您可以查看其他学校课程
label_file_not_found: 对不起,该文件现在不能下载!
label_file_not_found: 对不起,该文件现在不能下载
label_goto_homepage: 返回主页
label_trustie_team: Trustie开发团队

@ -0,0 +1,42 @@
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>File not found</title>
<style>
body{
font-family: Trebuchet MS,Georgia,"Times New Roman",serif;
color:#303030;
}
div.container{
margin: 0 auto;
width: 80%;
}
h1{
font-size:1.5em;
}
p{
font-size:0.8em;
}
.hidden{
display: none;
}
</style>
</head>
<body>
<div class="container" >
<!--<h1>Sorry, this file can not be downloaded now. </h1>-->
<h1>该作业没有任何的附件可以下载</h1>
<h3> <a href="http://forge.trustie.net" style="">返回主页</a> </h3>
<div class="container" style="">
<div style="position: relative; right:0;text-align: right;">
<h4>Trustie开发团队.</h4>
</div>
</div>
<p class="hidden" >
<a href="javascript:history.back()">Back</a>
</p>
</div>
</body>
</html>
Loading…
Cancel
Save