From f70edc1a0be811d58f892001ca517c7cf68aa4cf Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 10 Sep 2014 14:38:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=80=81=E5=B8=88=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E5=9C=A8=E6=B2=A1=E6=9C=89=E4=BB=BB=E4=BD=95=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E6=83=85=E5=86=B5=E4=B8=8B=E7=82=B9=E5=87=BB=E6=89=93?= =?UTF-8?q?=E5=8C=85=E4=B8=8B=E8=BD=BD=E6=8A=A5500=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E7=9A=84BUG=20#1209=20=E8=A7=A3=E5=86=B3=E6=96=B9=E6=A1=88?= =?UTF-8?q?=EF=BC=9A=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E6=9C=89=E4=B8=80=E4=B8=AA=E4=BB=A5=E4=B8=8A=E9=99=84=E4=BB=B6?= =?UTF-8?q?=EF=BC=8C=E5=BD=93=E6=B2=A1=E6=9C=89=E4=BB=BB=E4=BD=95=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=EF=BC=8C=E8=B7=B3=E8=BD=AC=E5=88=B0=E7=9B=B8?= =?UTF-8?q?=E5=BA=94=E9=A1=B5=E9=9D=A2=EF=BC=8C=E6=8F=90=E7=A4=BA=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=B2=A1=E6=9C=89=E4=BB=BB=E4=BD=95=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/zipdown_controller.rb | 11 ++++--- config/locales/zh.yml | 2 +- public/no_file_found.html | 42 +++++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 public/no_file_found.html diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index dac213ff5..8896da38c 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -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 diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 874c9108a..c24787d26 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -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开发团队 diff --git a/public/no_file_found.html b/public/no_file_found.html new file mode 100644 index 000000000..7fc343e50 --- /dev/null +++ b/public/no_file_found.html @@ -0,0 +1,42 @@ + + + + + File not found + + + +
+ +

该作业没有任何的附件可以下载

+

返回主页

+ +
+
+

Trustie开发团队.

+
+
+ +
+ +