From 5f77c97c9ddc4fbdecc5f402418c751f8fc4082a Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Fri, 9 Sep 2016 15:01:46 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E8=AF=BE=E4=BB=B6=E4=B8=8B=E8=BD=BD?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/assets/wechat/class.html | 2 +-
public/assets/wechat/myresource.html | 2 +-
public/javascripts/wechat/controllers/class.js | 3 +++
public/javascripts/wechat/controllers/myresource.js | 3 +++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html
index f81b4f5f0..88ef967e9 100644
--- a/public/assets/wechat/class.html
+++ b/public/assets/wechat/class.html
@@ -230,7 +230,7 @@
diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js
index 1e9fbcb0e..ea394a1ff 100644
--- a/public/javascripts/wechat/controllers/class.js
+++ b/public/javascripts/wechat/controllers/class.js
@@ -6,6 +6,9 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
};
var vm = $scope;
+
+ vm.g_localhost = window.g_localhost;
+
var courseid = $routeParams.id;
var tag = $routeParams.tag;
diff --git a/public/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js
index d920b376a..f6bb1bb00 100644
--- a/public/javascripts/wechat/controllers/myresource.js
+++ b/public/javascripts/wechat/controllers/myresource.js
@@ -3,6 +3,9 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l
var vm = $scope;
// vm.menus = ['课件', '作业', '测验'];
+
+ vm.g_localhost = window.g_localhost;
+
vm.menus = ['课件', '作业'];
vm.resources = [];
From 9997de0d9626ad8dd3acd78c7f9536ef40085e56 Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Fri, 9 Sep 2016 15:14:24 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E8=AF=BE=E4=BB=B6?=
=?UTF-8?q?=E4=B8=8B=E8=BD=BD=E4=B8=8D=E9=9C=80=E8=A6=81=E7=99=BB=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/attachments_controller.rb | 7 ++++++-
public/assets/wechat/class.html | 2 +-
public/assets/wechat/myresource.html | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 5d1345f24..2e85d8a72 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -130,7 +130,12 @@ class AttachmentsController < ApplicationController
def download
# modify by nwb
# 下载添加权限设置
- candown = attachment_candown @attachment
+ if params[:type] == "wechat"
+ candown = true
+ else
+ candown = attachment_candown @attachment
+ end
+
if candown || User.current.admin? || User.current.id == @attachment.author_id
if stale?(:etag => @attachment.digest)
if params[:preview] == 'true'
diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html
index 88ef967e9..836575b90 100644
--- a/public/assets/wechat/class.html
+++ b/public/assets/wechat/class.html
@@ -230,7 +230,7 @@
-
+
暂无课件,
请登录Trustie网站,在PC浏览器中上传课件。
diff --git a/public/assets/wechat/myresource.html b/public/assets/wechat/myresource.html
index 718e3c278..1848dad60 100644
--- a/public/assets/wechat/myresource.html
+++ b/public/assets/wechat/myresource.html
@@ -12,7 +12,7 @@
From 564da2ed72fc535b917f9d8d2129588340776301 Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Fri, 9 Sep 2016 15:36:15 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E8=AF=BE=E4=BB=B6?=
=?UTF-8?q?=E4=B8=8B=E8=BD=BD=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/application_controller.rb | 3 ++-
app/controllers/attachments_controller.rb | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index d14bccc4e..ad0fab173 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -372,7 +372,8 @@ class ApplicationController < ActionController::Base
return true
end
- if allowed
+
+ if allowed || (params[:type] && params[:type] == "wechat" )
true
else
if @project && @project.archived?
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 2e85d8a72..3986acc0a 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -130,7 +130,7 @@ class AttachmentsController < ApplicationController
def download
# modify by nwb
# 下载添加权限设置
- if params[:type] == "wechat"
+ if (params[:type] && params[:type] == "wechat" )
candown = true
else
candown = attachment_candown @attachment
@@ -715,7 +715,7 @@ class AttachmentsController < ApplicationController
def has_login
unless (@attachment && @attachment.container_type == "Organization").nil?
unless (@attachment && @attachment.container_type == "PhoneAppVersion").nil?
- render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download)
+ render_403 if (!User.current.logged? && !(params[:type] && params[:type] == "wechat")) && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download)
end
end
end