没有附件时打包下载500错误问题
This commit is contained in:
parent
3a9ef1cfff
commit
dd95335a67
|
@ -32,7 +32,7 @@ class ZipdownController < ApplicationController
|
|||
send_file zipfile, :filename => obj.name+".zip", :type => detect_content_type(zipfile) if zipfile
|
||||
|
||||
rescue Exception => e
|
||||
render file: 'public/no_file_found.html' , :layout => 'course_base'
|
||||
render file: 'public/no_file_found.html'
|
||||
end
|
||||
|
||||
#下载某一学生的作业的所有文件
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
(<span id="jours_count" class="c_red f_12"><%= @jours_count %></span>)
|
||||
</li>
|
||||
<li >
|
||||
<! -- <%#= link_to "作品打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), class: "tb_all" unless @bid.homeworks.empty? %> -->
|
||||
<%= link_to "作品打包下载", zipdown_assort_path(obj_class: @bid.class, obj_id: @bid), class: "tb_all" unless @bid.homeworks.empty? %>
|
||||
</li>
|
||||
</ul>
|
||||
<% else %>
|
||||
|
|
|
@ -1,82 +1,82 @@
|
|||
<%
|
||||
# Code Review plugin for Redmine
|
||||
# Copyright (C) 2010 Haruyuki Iida
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
-%>
|
||||
|
||||
<%
|
||||
is_target = false
|
||||
|
||||
if project and controller and project.module_enabled?(:code_review)
|
||||
is_target = true
|
||||
is_target = false unless User.current.allowed_to?({:controller => 'code_review', :action => 'update_diff_view'}, project)
|
||||
setting = CodeReviewProjectSetting.find(:first, :conditions => ['project_id = ?', project.id])
|
||||
is_target = false unless setting
|
||||
is_target = false if(setting && setting.tracker_id == nil)
|
||||
action_name = controller.action_name
|
||||
is_target = false unless action_name
|
||||
is_target = false unless (controller.class.name == 'RepositoriesController' or controller.class.name == 'AttachmentsController')
|
||||
if (is_target == true)
|
||||
context = {:project => project, :controller => controller, :requrest => request}
|
||||
%>
|
||||
<% if (controller.class.name == 'AttachmentsController') %>
|
||||
<%= render :partial => 'code_review/change_attachement_view', :locals => context %>
|
||||
<% elsif (action_name == 'show' or action_name == 'revisions') %>
|
||||
<%= render :partial => 'code_review/change_repository_view', :locals => context %>
|
||||
<% elsif (action_name == 'revision') %>
|
||||
<%= render :partial => 'code_review/change_revision_view', :locals => context %>
|
||||
<% elsif (action_name == 'diff' or action_name == 'entry' or action_name == 'annotate')%>
|
||||
<%if (controller.params[:rev].blank? or controller.params[:rev] == 'master')%>
|
||||
<%= render :partial => 'code_review/change_entry_norevision_view', :locals => context %>
|
||||
<% else
|
||||
changeset = @repository.find_changeset_by_name(controller.params[:rev])
|
||||
%>
|
||||
<% unless changeset %>
|
||||
<%= render :partial => 'code_review/change_entry_norevision_view', :locals => context %>
|
||||
<% else
|
||||
parameters = request.parameters
|
||||
rev_to = parameters['rev_to'] unless parameters['rev_to'].blank?
|
||||
review_id = parameters['review_id']
|
||||
rev = parameters['rev']
|
||||
path = parameters['path']
|
||||
|
||||
|
||||
repository_id = @repository.identifier_param if @repository.respond_to?("identifier_param")
|
||||
url = url_for :controller => 'code_review', :action => 'update_diff_view', :id => project, :repository_id => repository_id
|
||||
%>
|
||||
<div id="code_review">
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('#code_review').load('<%=url%>', {
|
||||
rev: '<%=rev%>',
|
||||
path:'<%=path%>',
|
||||
review_id: '<%=review_id%>',
|
||||
action_type:'<%=action_name%>',
|
||||
rev_to: '<%=rev_to%>'});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%
|
||||
end
|
||||
end
|
||||
-%>
|
||||
|
||||
|
||||
|
||||
<%
|
||||
# Code Review plugin for Redmine
|
||||
# Copyright (C) 2010 Haruyuki Iida
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
-%>
|
||||
|
||||
<%
|
||||
is_target = false
|
||||
|
||||
if project and project.is_a?(Project) and controller and project.module_enabled?(:code_review)
|
||||
is_target = true
|
||||
is_target = false unless User.current.allowed_to?({:controller => 'code_review', :action => 'update_diff_view'}, project)
|
||||
setting = CodeReviewProjectSetting.find(:first, :conditions => ['project_id = ?', project.id])
|
||||
is_target = false unless setting
|
||||
is_target = false if(setting && setting.tracker_id == nil)
|
||||
action_name = controller.action_name
|
||||
is_target = false unless action_name
|
||||
is_target = false unless (controller.class.name == 'RepositoriesController' or controller.class.name == 'AttachmentsController')
|
||||
if (is_target == true)
|
||||
context = {:project => project, :controller => controller, :requrest => request}
|
||||
%>
|
||||
<% if (controller.class.name == 'AttachmentsController') %>
|
||||
<%= render :partial => 'code_review/change_attachement_view', :locals => context %>
|
||||
<% elsif (action_name == 'show' or action_name == 'revisions') %>
|
||||
<%= render :partial => 'code_review/change_repository_view', :locals => context %>
|
||||
<% elsif (action_name == 'revision') %>
|
||||
<%= render :partial => 'code_review/change_revision_view', :locals => context %>
|
||||
<% elsif (action_name == 'diff' or action_name == 'entry' or action_name == 'annotate')%>
|
||||
<%if (controller.params[:rev].blank? or controller.params[:rev] == 'master')%>
|
||||
<%= render :partial => 'code_review/change_entry_norevision_view', :locals => context %>
|
||||
<% else
|
||||
changeset = @repository.find_changeset_by_name(controller.params[:rev])
|
||||
%>
|
||||
<% unless changeset %>
|
||||
<%= render :partial => 'code_review/change_entry_norevision_view', :locals => context %>
|
||||
<% else
|
||||
parameters = request.parameters
|
||||
rev_to = parameters['rev_to'] unless parameters['rev_to'].blank?
|
||||
review_id = parameters['review_id']
|
||||
rev = parameters['rev']
|
||||
path = parameters['path']
|
||||
|
||||
|
||||
repository_id = @repository.identifier_param if @repository.respond_to?("identifier_param")
|
||||
url = url_for :controller => 'code_review', :action => 'update_diff_view', :id => project, :repository_id => repository_id
|
||||
%>
|
||||
<div id="code_review">
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('#code_review').load('<%=url%>', {
|
||||
rev: '<%=rev%>',
|
||||
path:'<%=path%>',
|
||||
review_id: '<%=review_id%>',
|
||||
action_type:'<%=action_name%>',
|
||||
rev_to: '<%=rev_to%>'});
|
||||
});
|
||||
</script>
|
||||
<% end %>
|
||||
|
||||
<% end %>
|
||||
<% end %>
|
||||
<%
|
||||
end
|
||||
end
|
||||
-%>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
<%
|
||||
# Code Review plugin for Redmine
|
||||
# Copyright (C) 2010-2012 Haruyuki Iida
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
-%>
|
||||
<% if @project and @project.module_enabled?('code_review') %>
|
||||
<%
|
||||
baseurl = Redmine::Utils.relative_url_root
|
||||
|
||||
-%>
|
||||
<%= javascript_include_tag(baseurl + "/plugin_assets/redmine_code_review/javascripts/code_review.js") %>
|
||||
<%= javascript_include_tag(baseurl + '/javascripts/jstoolbar/jstoolbar.js') %>
|
||||
<%= javascript_include_tag(baseurl + '/javascripts/jstoolbar/textile.js') %>
|
||||
<%= javascript_include_tag(baseurl + "/javascripts/jstoolbar/lang/jstoolbar-#{@project.current_language}.js") %>
|
||||
<%= stylesheet_link_tag(baseurl + "/plugin_assets/redmine_code_review/stylesheets/code_review.css") %>
|
||||
<%= stylesheet_link_tag(baseurl + "/stylesheets/jstoolbar.css") %>
|
||||
<%
|
||||
# Code Review plugin for Redmine
|
||||
# Copyright (C) 2010-2012 Haruyuki Iida
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
-%>
|
||||
<% if @project and @project.is_a?(Project) and @project.module_enabled?('code_review') %>
|
||||
<%
|
||||
baseurl = Redmine::Utils.relative_url_root
|
||||
|
||||
-%>
|
||||
<%= javascript_include_tag(baseurl + "/plugin_assets/redmine_code_review/javascripts/code_review.js") %>
|
||||
<%= javascript_include_tag(baseurl + '/javascripts/jstoolbar/jstoolbar.js') %>
|
||||
<%= javascript_include_tag(baseurl + '/javascripts/jstoolbar/textile.js') %>
|
||||
<%= javascript_include_tag(baseurl + "/javascripts/jstoolbar/lang/jstoolbar-#{@project.current_language}.js") %>
|
||||
<%= stylesheet_link_tag(baseurl + "/plugin_assets/redmine_code_review/stylesheets/code_review.css") %>
|
||||
<%= stylesheet_link_tag(baseurl + "/stylesheets/jstoolbar.css") %>
|
||||
<% end %>
|
Loading…
Reference in New Issue