From 76bab839c7e5ebbd00757025f5251e1c3b42591c Mon Sep 17 00:00:00 2001
From: z9hang
Date: Wed, 15 Oct 2014 17:26:58 +0800
Subject: [PATCH 1/2] =?UTF-8?q?1=E3=80=81=E6=A0=B9=E6=8D=AE=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81=E8=AF=84=E5=AE=A1=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?=
=?UTF-8?q?=E3=80=822=E3=80=81=E4=BF=AE=E6=AD=A3=E9=83=A8=E5=88=86?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=A0=87=E9=A2=98=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/application_controller.rb | 23 +++++++++++++----------
app/controllers/attachments_controller.rb | 2 +-
app/models/attachment.rb | 12 ++----------
app/views/courses/new.html.erb | 1 +
app/views/school/index.html.erb | 2 +-
app/views/stores/index.html.erb | 3 ++-
6 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 380baab0c..0947301ae 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -256,16 +256,19 @@ class ApplicationController < ActionController::Base
end
def authorize_attachment_download(ctrl = params[:controller], action = params[:action], global = false)
- if @attachment.container_type == "Memo"
- allowed = User.current.allowed_to?(:memos_attachments_download,nil,:global => true)
- elsif @attachment.container_type == "Message" && !@project.nil?
- allowed = User.current.allowed_to?(:projects_attachments_download,@project,:global => false)
- elsif @attachment.container_type == "Message" && !@course.nil?
- allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false)
- elsif @attachment.container_type == "contest"
- return true
- else
- return true
+ case @attachment.container_type
+ when "Memo"
+ allowed = User.current.allowed_to?(:memos_attachments_download,nil,:global => true)
+ when "Message"
+ if @project
+ allowed = User.current.allowed_to?(:projects_attachments_download,@project,:global => false)
+ elsif @course
+ allowed = User.current.allowed_to?(:course_attachments_download, @course, :global => false)
+ end
+ when "contest"
+ return true
+ else
+ return true
end
if allowed
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 08469ac48..905bbb0a2 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -61,7 +61,7 @@ class AttachmentsController < ApplicationController
def download
# modify by nwb
# 下载添加权限设置
- candown = false
+ candown = false
if (@attachment.container.has_attribute?(:project) || @attachment.container.has_attribute?(:project_id)) && @attachment.container.project
project = @attachment.container.project
candown= User.current.member_of?(project) || (project.is_public && @attachment.is_public == 1)
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 90cfed429..c934a5ce8 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -402,13 +402,8 @@ class Attachment < ActiveRecord::Base
# Finds an attachment that matches the given token and that has no container
def self.find_by_token(token)
- if token.to_s =~ /^(\d+)\.([0-9a-f]+)$/
- attachment_id, attachment_digest = $1, $2
- attachment = Attachment.where(:id => attachment_id, :digest => attachment_digest).first
- if attachment && attachment.container.nil?
- attachment
- end
- end
+ attachment = find_by_token_only(token)
+ attachment if attachment.container.nil?
end
# Finds an attachment that matches the given token
@@ -416,9 +411,6 @@ class Attachment < ActiveRecord::Base
if token.to_s =~ /^(\d+)\.([0-9a-f]+)$/
attachment_id, attachment_digest = $1, $2
attachment = Attachment.where(:id => attachment_id, :digest => attachment_digest).first
- if attachment
- attachment
- end
end
end
diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb
index 336bca071..8d153a447 100644
--- a/app/views/courses/new.html.erb
+++ b/app/views/courses/new.html.erb
@@ -11,3 +11,4 @@
<%= javascript_tag "$('#course_name').focus();" %>
<% end %>
+<% html_title(l(:label_course_new)) -%>
\ No newline at end of file
diff --git a/app/views/school/index.html.erb b/app/views/school/index.html.erb
index 02b934581..37febe309 100644
--- a/app/views/school/index.html.erb
+++ b/app/views/school/index.html.erb
@@ -98,4 +98,4 @@
-
+<% html_title(l(:label_school_all)) -%>
diff --git a/app/views/stores/index.html.erb b/app/views/stores/index.html.erb
index 5df6ecca8..afd2244af 100644
--- a/app/views/stores/index.html.erb
+++ b/app/views/stores/index.html.erb
@@ -68,4 +68,5 @@
$("#IE_resource_sum_css").children(".line_block").css("width","45%");
}
});
-
\ No newline at end of file
+
+<% html_title(l(:label_stores_index)) -%>
\ No newline at end of file
From ff95178ce75c07d4e27e358680b87f7d59c802ea Mon Sep 17 00:00:00 2001
From: z9hang
Date: Wed, 15 Oct 2014 17:31:02 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E9=A1=B5=E8=84=9A?=
=?UTF-8?q?=E5=90=88=E4=BD=9C=E5=8D=95=E4=BD=8D=E4=B8=8D=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E5=8E=9F=E5=9B=A0=EF=BC=9A=E6=8E=A7?=
=?UTF-8?q?=E5=88=B6=E4=B8=AD=E7=9A=84=E5=8F=98=E9=87=8F=E5=90=8D=E8=A2=AB?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E4=BD=86=E6=9C=AA=E6=94=B9view?=
=?UTF-8?q?=E4=B8=AD=E5=AF=B9=E5=BA=94=E7=9A=84=E5=8F=98=E9=87=8F=E5=90=8D?=
=?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=EF=BC=9A=E6=94=B9=E4=B8=BA=E4=B8=80?=
=?UTF-8?q?=E8=87=B4=E7=9A=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/_base_footer.html.erb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb
index cfe950eae..31175ea6d 100644
--- a/app/views/layouts/_base_footer.html.erb
+++ b/app/views/layouts/_base_footer.html.erb
@@ -10,8 +10,8 @@
<%= @organize.description.html_safe unless @organize.nil?%>
- <% unless @companys.nil?%>
- <% @companys.each do |company| %>
+ <% unless @companies.nil?%>
+ <% @companies.each do |company| %>
<% end %>
<% end %>