diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e6efca1e8..110974b77 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -482,14 +482,19 @@ class ApplicationController < ActionController::Base # Renders an error response def render_error(arg) arg = {:message => arg} unless arg.is_a?(Hash) - @message = arg[:message] + @lay = arg[:layout] @message = l(@message) if @message.is_a?(Symbol) @status = arg[:status] || 500 respond_to do |format| format.html { - render :template => 'common/error', :layout => use_layout, :status => @status + if @lay + render :template => 'common/error', :layout => @lay,:status => @status + else + render :template => 'common/error', :layout => use_layout, :status => @status + end + } format.any { head @status } end diff --git a/app/controllers/zipdown_controller.rb b/app/controllers/zipdown_controller.rb index 16e6ea870..a5506be93 100644 --- a/app/controllers/zipdown_controller.rb +++ b/app/controllers/zipdown_controller.rb @@ -1,4 +1,5 @@ class ZipdownController < ApplicationController + #查找项目(课程) before_filter :find_project_by_bid_id, :only => [:assort] #检查权限 @@ -43,14 +44,15 @@ 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 + render_403 :message => :no_file_dowmload ,:layout => "course_base" end else - render_403 :message =>:notice_file_not_found + render_403 :message =>:notice_file_not_found ,:layout => "course_base" end else - render_403 :message => :notice_not_authorized + render_403 :message => :notice_not_authorized ,:layout => "course_base" end + rescue => e render file: 'public/file_not_found.html' end