1、根据代码评审修改代码。2、修正部分页面标题。
This commit is contained in:
parent
2ed4ace7c9
commit
76bab839c7
|
@ -256,16 +256,19 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def authorize_attachment_download(ctrl = params[:controller], action = params[:action], global = false)
|
def authorize_attachment_download(ctrl = params[:controller], action = params[:action], global = false)
|
||||||
if @attachment.container_type == "Memo"
|
case @attachment.container_type
|
||||||
allowed = User.current.allowed_to?(:memos_attachments_download,nil,:global => true)
|
when "Memo"
|
||||||
elsif @attachment.container_type == "Message" && !@project.nil?
|
allowed = User.current.allowed_to?(:memos_attachments_download,nil,:global => true)
|
||||||
allowed = User.current.allowed_to?(:projects_attachments_download,@project,:global => false)
|
when "Message"
|
||||||
elsif @attachment.container_type == "Message" && !@course.nil?
|
if @project
|
||||||
allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false)
|
allowed = User.current.allowed_to?(:projects_attachments_download,@project,:global => false)
|
||||||
elsif @attachment.container_type == "contest"
|
elsif @course
|
||||||
return true
|
allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false)
|
||||||
else
|
end
|
||||||
return true
|
when "contest"
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if allowed
|
if allowed
|
||||||
|
|
|
@ -61,7 +61,7 @@ class AttachmentsController < ApplicationController
|
||||||
def download
|
def download
|
||||||
# modify by nwb
|
# modify by nwb
|
||||||
# 下载添加权限设置
|
# 下载添加权限设置
|
||||||
candown = false
|
candown = false
|
||||||
if (@attachment.container.has_attribute?(:project) || @attachment.container.has_attribute?(:project_id)) && @attachment.container.project
|
if (@attachment.container.has_attribute?(:project) || @attachment.container.has_attribute?(:project_id)) && @attachment.container.project
|
||||||
project = @attachment.container.project
|
project = @attachment.container.project
|
||||||
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
|
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
|
||||||
|
|
|
@ -402,13 +402,8 @@ class Attachment < ActiveRecord::Base
|
||||||
|
|
||||||
# Finds an attachment that matches the given token and that has no container
|
# Finds an attachment that matches the given token and that has no container
|
||||||
def self.find_by_token(token)
|
def self.find_by_token(token)
|
||||||
if token.to_s =~ /^(\d+)\.([0-9a-f]+)$/
|
attachment = find_by_token_only(token)
|
||||||
attachment_id, attachment_digest = $1, $2
|
attachment if attachment.container.nil?
|
||||||
attachment = Attachment.where(:id => attachment_id, :digest => attachment_digest).first
|
|
||||||
if attachment && attachment.container.nil?
|
|
||||||
attachment
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Finds an attachment that matches the given token
|
# Finds an attachment that matches the given token
|
||||||
|
@ -416,9 +411,6 @@ class Attachment < ActiveRecord::Base
|
||||||
if token.to_s =~ /^(\d+)\.([0-9a-f]+)$/
|
if token.to_s =~ /^(\d+)\.([0-9a-f]+)$/
|
||||||
attachment_id, attachment_digest = $1, $2
|
attachment_id, attachment_digest = $1, $2
|
||||||
attachment = Attachment.where(:id => attachment_id, :digest => attachment_digest).first
|
attachment = Attachment.where(:id => attachment_id, :digest => attachment_digest).first
|
||||||
if attachment
|
|
||||||
attachment
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,3 +11,4 @@
|
||||||
<%= javascript_tag "$('#course_name').focus();" %>
|
<%= javascript_tag "$('#course_name').focus();" %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% html_title(l(:label_course_new)) -%>
|
|
@ -98,4 +98,4 @@
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<% html_title(l(:label_school_all)) -%>
|
||||||
|
|
|
@ -68,4 +68,5 @@
|
||||||
$("#IE_resource_sum_css").children(".line_block").css("width","45%");
|
$("#IE_resource_sum_css").children(".line_block").css("width","45%");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
<% html_title(l(:label_stores_index)) -%>
|
Loading…
Reference in New Issue