From 13676ec9c3eee6d62db3e862c8c3691e6d5af063 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 24 May 2016 09:51:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=9A=84=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/wechat_service.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb index ee45c99dc..6d8c0f234 100644 --- a/app/services/wechat_service.rb +++ b/app/services/wechat_service.rb @@ -5,7 +5,7 @@ class WechatService data = { touser:openid, template_id:template_id, - url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect", + url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect", topcolor:"#FF0000", data:{ first: { @@ -44,7 +44,6 @@ class WechatService end Rails.logger.info "send over. #{req}" end - Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect" end def topic_publish_template(user_id, type, id, first, key1, key2, key3, remark="") @@ -59,7 +58,6 @@ class WechatService end Rails.logger.info "send over. #{req}" end - Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect" end def comment_template(user_id,type, id, first, key1, key2, key3, remark="") @@ -74,7 +72,6 @@ class WechatService end Rails.logger.info "send over. #{req}" end - Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect" end def message_update_template(user_id, type, id, first, key1, key2, remark="") @@ -83,7 +80,7 @@ class WechatService data = { touser:uw.openid, template_id:"YTyNPZnQD8uZFBFq-Q6cCOWaq5LA9vL6RFlF2JuD5Cg", - url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect", + url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect", topcolor:"#FF0000", data:{ first: { @@ -112,6 +109,5 @@ class WechatService end Rails.logger.info "send over. #{req}" end - Rails.logger.info "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect" end end \ No newline at end of file From 7b7f9cf8f2b108777a974955fc62c8aecf97fb84 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 24 May 2016 19:52:51 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=88=A0=E9=99=A4wechat=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/wechats_controller.rb | 1 - lib/wechat/bin/wechat | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/wechats_controller.rb b/app/controllers/wechats_controller.rb index 39be9cef3..7ee0552fb 100644 --- a/app/controllers/wechats_controller.rb +++ b/app/controllers/wechats_controller.rb @@ -178,7 +178,6 @@ class WechatsController < ActionController::Base openid: openid, user: user ) - request.reply.text "欢迎加入Trustie创新实践社区" render :json => {status:0, msg: "绑定成功"} rescue Exception=>e render :json => {status: -1, msg: e.message} diff --git a/lib/wechat/bin/wechat b/lib/wechat/bin/wechat index 8931a2dcb..d5563802e 100755 --- a/lib/wechat/bin/wechat +++ b/lib/wechat/bin/wechat @@ -1,3 +1,4 @@ +#coding=utf-8 #!/usr/bin/env ruby lib = File.expand_path(File.dirname(__FILE__) + '/../lib') From ed2f41394902fc09acfd56507fb3cd2453c918c7 Mon Sep 17 00:00:00 2001 From: cxt Date: Tue, 24 May 2016 20:04:06 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 208 +++++++++--------- app/views/users/_resources_list.html.erb | 45 +++- .../users/_user_import_resource_list.html.erb | 22 +- app/views/users/_user_resource_info.html.erb | 14 +- .../users/_user_resource_tip_list.html.erb | 2 +- app/views/users/user_resource.html.erb | 14 +- 6 files changed, 176 insertions(+), 129 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 853219426..854e604b4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -320,7 +320,7 @@ class UsersController < ApplicationController case params[:agree] when 'Y' ar.update_column('status', 2) - @msg.update_attributes(:apply_result => 1, :viewed => 1) + @msg.update_attributes(:apply_result => 1, :viewed => 1) ar.course_messages << CourseMessage.new(:user_id => ar.user_id, :course_id => -1, :viewed => false, :apply_result => 2, :status => 1) when 'N' ar.update_column('status', 3) @@ -539,28 +539,28 @@ class UsersController < ApplicationController end def student_homeworks - if User.current == @user - @page = params[:page] ? params[:page].to_i + 1 : 0 - user_course_ids = @user.courses.empty? ? "(-1)" :"(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" + if User.current == @user + @page = params[:page] ? params[:page].to_i + 1 : 0 + user_course_ids = @user.courses.empty? ? "(-1)" :"(" + @user.courses.visible.map{|course| course.id}.join(",") + ")" - #判断当前用户在当前课程的身份 - visibleCourse = @user.courses.empty? ? [] : @user.courses.where("is_delete = 0").visible - homework_ids = [] - visibleCourse.each do |course| - homeworks = HomeworkCommon.where("course_id = #{course.id} and publish_time <= '#{Date.today}'") - homework_ids << homeworks.pluck(:id) unless homeworks.empty? - end - visible_homework_ids = homework_ids.size == 0 ? "(-1)" :"(" + homework_ids.join(",") + ")" - @homework_commons = HomeworkCommon.where("id in #{visible_homework_ids}").order("created_at desc").limit(10).offset(@page * 10) - @is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true) - @is_in_course = params[:is_in_course].to_i || 0 - respond_to do |format| - format.js - format.html {render :layout => 'new_base_user'} - end - else - render_403 + #判断当前用户在当前课程的身份 + visibleCourse = @user.courses.empty? ? [] : @user.courses.where("is_delete = 0").visible + homework_ids = [] + visibleCourse.each do |course| + homeworks = HomeworkCommon.where("course_id = #{course.id} and publish_time <= '#{Date.today}'") + homework_ids << homeworks.pluck(:id) unless homeworks.empty? end + visible_homework_ids = homework_ids.size == 0 ? "(-1)" :"(" + homework_ids.join(",") + ")" + @homework_commons = HomeworkCommon.where("id in #{visible_homework_ids}").order("created_at desc").limit(10).offset(@page * 10) + @is_teacher = User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true) + @is_in_course = params[:is_in_course].to_i || 0 + respond_to do |format| + format.js + format.html {render :layout => 'new_base_user'} + end + else + render_403 + end end def choose_user_course @@ -2058,18 +2058,18 @@ class UsersController < ApplicationController # 公共资源库:所有公开资源或者我上传的私有资源 @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) end - # elsif params[:type] == "2" - # apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id} - # if params[:status] == "2" - # resource_type = "'Course'" - # elsif params[:status] == "3" - # resource_type = "'Project'" - # elsif params[:status] == "5" - # resource_type = "'Principal'" - # else - # resource_type = "'Project','OrgSubfield','Principal','Course'" - # end - # @attachments = get_my_private_resources(apply_ids, resource_type, @order, @score) + elsif params[:type] == "2" + apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id} + if params[:status] == "2" + resource_type = "'Course'" + elsif params[:status] == "3" + resource_type = "'Project'" + elsif params[:status] == "5" + resource_type = "'Principal'" + else + resource_type = "'Project','OrgSubfield','Principal','Course'" + end + @attachments = get_my_private_resources(apply_ids, resource_type, @order, @score) end @type = params[:type] @limit = 25 @@ -2211,18 +2211,18 @@ class UsersController < ApplicationController # 公共资源库:所有公开资源或者我上传的私有资源 @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) end - # elsif params[:type] == "2" - # apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id} - # if params[:status] == "2" - # resource_type = "'Course'" - # elsif params[:status] == "3" - # resource_type = "'Project'" - # elsif params[:status] == "5" - # resource_type = "'Principal'" - # else - # resource_type = "'Project','OrgSubfield','Principal','Course'" - # end - # @attachments = get_my_private_resources(apply_ids, resource_type, @order, @score) + elsif params[:type] == "2" + apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id} + if params[:status] == "2" + resource_type = "'Course'" + elsif params[:status] == "3" + resource_type = "'Project'" + elsif params[:status] == "5" + resource_type = "'Principal'" + else + resource_type = "'Project','OrgSubfield','Principal','Course'" + end + @attachments = get_my_private_resources(apply_ids, resource_type, @order, @score) end @status = params[:status] @type = params[:type] @@ -2352,18 +2352,18 @@ class UsersController < ApplicationController # 公共资源库:所有公开资源或者我上传的私有资源 @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) end - # elsif params[:type] == "2" - # apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id} - # if params[:status] == "2" - # resource_type = "'Course'" - # elsif params[:status] == "3" - # resource_type = "'Project'" - # elsif params[:status] == "5" - # resource_type = "'Principal'" - # else - # resource_type = "'Project','OrgSubfield','Principal','Course'" - # end - # @attachments = get_my_private_resources(apply_ids, resource_type, @order, @score) + elsif params[:type] == "2" + apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id} + if params[:status] == "2" + resource_type = "'Course'" + elsif params[:status] == "3" + resource_type = "'Project'" + elsif params[:status] == "5" + resource_type = "'Principal'" + else + resource_type = "'Project','OrgSubfield','Principal','Course'" + end + @attachments = get_my_private_resources(apply_ids, resource_type, @order, @score) end @type = params[:type] @limit = 25 @@ -2700,12 +2700,12 @@ class UsersController < ApplicationController # 获取公共资源 def get_public_resources user_course_ids, user_project_ids, order, score - attachments = Attachment.where("(is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) ").order("#{order.nil? ? 'created_on' : order} #{score}") + attachments = Attachment.where("(is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) ").order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取公共资源搜索 def get_public_resources_search user_course_ids, user_project_ids, order, score, search - attachments = Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}") + attachments = Attachment.where("is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取我的资源 @@ -2725,19 +2725,19 @@ class UsersController < ApplicationController # 获取我的课程资源 def get_course_resources author_id, user_course_ids, order, score attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Course')"+ - "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) + "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}") end - # # 获取我的私有资源分享结果 - # def get_my_private_resources apply_ids, resource_type, order, score - # attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type})").order("#{order.nil? ? 'created_on' : order} #{score}") - # end - # - # # 获取我的私有资源分享搜索结果 - # def get_my_private_resources_search apply_ids, resource_type, order, score, search - # attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type}) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}") - # end + # 获取我的私有资源分享结果 + def get_my_private_resources apply_ids, resource_type, order, score + attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type})").order("#{order.nil? ? 'created_on' : order} #{score}") + end + + # 获取我的私有资源分享搜索结果 + def get_my_private_resources_search apply_ids, resource_type, order, score, search + attachments = Attachment.where("id in (#{apply_ids.empty? ? '0': apply_ids.join(',')}) and container_type in(#{resource_type}) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}") + end # 获取我的课程资源中搜索结果 def get_course_resources_search author_id, user_course_ids, order, score, search @@ -2748,18 +2748,18 @@ class UsersController < ApplicationController # 获取公共资源中课程资源 def get_course_resources_public user_course_ids, order, score - attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1)").order("#{order.nil? ? 'created_on' : order} #{score}") + attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1)").order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取公共资源中课程资源搜索结果 def get_course_resources_public_search user_course_ids, order, score, search - attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}") + attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取我的项目资源 def get_project_resources author_id, user_project_ids, order, score attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Project') "+ - "or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) + "or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)").order("#{order.nil? ? 'created_on' : order} #{score}") end @@ -2772,12 +2772,12 @@ class UsersController < ApplicationController # 获取公共资源的项目资源 def get_project_resources_public user_project_ids, order, score - attchments = Attachment.where("container_type = 'Project' and container_id is not null and is_public =1").order("#{order.nil? ? 'created_on' : order} #{score}") + attchments = Attachment.where("container_type = 'Project' and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取公共资源的项目资源搜索 def get_project_resources_public_search user_project_ids, order, score, search - attchments = Attachment.where("(container_type = 'Project' and container_id is not null and is_public =1) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}") + attchments = Attachment.where("(container_type = 'Project' and container_id is not null) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取我上传的附件 @@ -2795,13 +2795,13 @@ class UsersController < ApplicationController # 获取公共资源中我上传的附件 def get_attch_resources_public order, score attchments = Attachment.where("container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal') - and container_id is not null and is_public =1").order("#{order.nil? ? 'created_on' : order} #{score}") + and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取公共资源中我上传的附件 def get_attch_resources_public_search order, score, search attchments = Attachment.where("(container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal') - and container_id is not null and is_public =1) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}") + and container_id is not null) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取我的用户类型资源 @@ -2816,12 +2816,12 @@ class UsersController < ApplicationController # 获取我的用户类型资源 def get_principal_resources_public order, score - attchments = Attachment.where("container_type = 'Principal' and is_public =1 and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}") + attchments = Attachment.where("container_type = 'Principal' and container_id is not null").order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取我的用户类型资源 def get_principal_resources_public_search order, score, search - attchments = Attachment.where("(container_type = 'Principal'and container_id is not null and is_public =1) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}") + attchments = Attachment.where("(container_type = 'Principal'and container_id is not null) and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}") end # 资源库 分为全部 课程资源 项目资源 附件 @@ -2863,18 +2863,18 @@ class UsersController < ApplicationController # 公共资源库:所有公开资源或者我上传的私有资源 @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score) end - # elsif params[:type] == "2" # 私有资源 - # apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id} - # if params[:status] == "2" - # resource_type = "'Course'" - # elsif params[:status] == "3" - # resource_type = "'Project'" - # elsif params[:status] == "5" - # resource_type = "'Principal'" - # else - # resource_type = "'Project','OrgSubfield','Principal','Course'" - # end - # @attachments = get_my_private_resources(apply_ids, resource_type, @order, @score) + elsif params[:type] == "2" # 私有资源 + apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id} + if params[:status] == "2" + resource_type = "'Course'" + elsif params[:status] == "3" + resource_type = "'Project'" + elsif params[:status] == "5" + resource_type = "'Principal'" + else + resource_type = "'Project','OrgSubfield','Principal','Course'" + end + @attachments = get_my_private_resources(apply_ids, resource_type, @order, @score) end @status = params[:status] @type = params[:type] @@ -3052,21 +3052,21 @@ class UsersController < ApplicationController @attachments = get_principal_resources_public_search(@order, @score, search) else # 公共资源库:所有公开资源或者我上传的私有资源 - @attachments = get_public_resources_search(user_course_ids, user_project_ids, @order, @score, search) + @attachments = get_public_resources_search(user_course_ids, user_project_ids, @order, @score, search) end - # elsif params[:type] == "2" # 私有资源 - # apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id} - # if params[:status] == "2" - # resource_type = "'Course'" - # elsif params[:status] == "3" - # resource_type = "'Project'" - # elsif params[:status] == "5" - # resource_type = "'Principal'" - # else - # resource_type = "'Project','OrgSubfield','Principal','Course'" - # end - # @attachments = get_my_private_resources_search(apply_ids, resource_type, @order, @score, search) - # @attachments + elsif params[:type] == "2" # 私有资源 + apply_ids = ApplyResource.where("user_id =? and status =?", params[:id], 2).map { |ar| ar.attachment_id} + if params[:status] == "2" + resource_type = "'Course'" + elsif params[:status] == "3" + resource_type = "'Project'" + elsif params[:status] == "5" + resource_type = "'Principal'" + else + resource_type = "'Project','OrgSubfield','Principal','Course'" + end + @attachments = get_my_private_resources_search(apply_ids, resource_type, @order, @score, search) + @attachments end @status = params[:status] @type = params[:type] diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index d22b69760..3aaed7594 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -6,20 +6,55 @@ <% attachments.each do |attach| %>
  • - + <% if private_attachment_allow(attach.id) && (@type == "6" || @type == "2") %> + + <% else %> + + <% end %>
  • - <%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack resource-list-middle hidden mw280' %> + <% if private_attachment_allow(attach.id) %> + + <% else %> + <%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack resource-list-middle hidden mw280' %> + <% end %> + <% if private_attachment_allow(attach.id) && (@type == "6" || @type == "2") %> + 私有 + <% end %> +
  • +
  • + <% if private_attachment_allow(attach.id) && (@type == "6" || @type == "2") %> + <% ah = attach.get_status_by_attach(User.current.id) %> + <% if ah.nil? %> + <%= link_to("请求分享", apply_resource_user_path(User.current.id, :attachment_id => attach.id), :class => 'green_btn_share c_white', :remote => true) %> + <% elsif ah == 1 %> + 等待回复 + <% elsif ah == 2 %> + 可引用 + <% elsif ah == 3 %> + 已拒绝 + <% end %> + <% else %> + <% ah = attach.get_status_by_attach(User.current.id) %> + <% if ah == 2 %> + 可引用 + <% else %> + -- + <% end %> + <% end %>
  • <%= format_date(attach.created_on) %>
  • <%= attach.quotes.nil? ? 0 : attach.quotes %>
  • <%= attach.downloads %>
  • <%= attach.author_id %>
  • <%= (number_to_human_size(attach.filesize)).gsub("ytes", "") %>
  • - +
  • <%= get_resource_type(attach.container_type)%>
  • +
  • <%= private_attachment_allow(attach.id) %>
  • +
  • <%= attach.get_apply_resource_status(attach.id, User.current.id) %>
  • +
  • <%= private_attachment_allow(attach.id) ? 0 : 1 %>
  • <%= attach.id %>
@@ -184,7 +219,7 @@ } line.children().css("background-color", 'white'); id = line.children().last().html(); - user_id = line.children().eq(5).html(); + user_id = line.children().eq(6).html(); if(user_id === '<%= User.current.id%>') { if(line.children().first().children().data('hasHistory') == 'Y'){ alert('该资源存在历史版本,不能删除'); @@ -193,7 +228,7 @@ if (confirm('确定要删除资源"' + line.children().eq(1).children().attr('title').trim() + '"么?')) { $.ajax({ type: 'post', - url: '<%= user_resource_delete_user_path(User.current.id) %>' + '?resource_id=' + id + '&type=<%= @type %>&status=<%= @status %>' + url: '<%= user_resource_delete_user_path(User.current.id)%>' + '?resource_id=' + id + '&type=<%=@type %>&status=<%=@status %>' }); } diff --git a/app/views/users/_user_import_resource_list.html.erb b/app/views/users/_user_import_resource_list.html.erb index 97366832b..26118f3f4 100644 --- a/app/views/users/_user_import_resource_list.html.erb +++ b/app/views/users/_user_import_resource_list.html.erb @@ -1,15 +1,27 @@ <%= form_tag( url_for({:controller => 'users', :action => 'import_into_container', - :mul_id => @resource_id, - :mul_type => @resource_type}), - :method => 'post', :id => 'resource_import_container_form') do %> + :mul_id => @resource_id, + :mul_type => @resource_type}), + :method => 'post', :id => 'resource_import_container_form') do %> <% @attachments.each do |attach| %>
  • <%= get_resource_type(attach.container_type)%>
  • diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb index a140f803c..9c321cdb5 100644 --- a/app/views/users/_user_resource_info.html.erb +++ b/app/views/users/_user_resource_info.html.erb @@ -1,6 +1,6 @@
    - <%= render :partial => "show_new_upload", :locals => {:type => @type, :status => @status} %> + <%= render :partial => "show_new_upload", :locals => {:type => @type, :status => @status} %>
    <%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type, :order => @order, :sort => @score, :status => @status} %> @@ -19,13 +19,13 @@
    - 全选 + 删除
    -
    - 发送至 -
    + + +
    选择 0 个资源
    @@ -215,7 +215,7 @@ document.oncontextmenu = function() {return true;} line.children().css("background-color",'white'); id = line.children().last().html(); - user_id = line.children().eq(5).html(); + user_id = line.children().eq(6).html(); if(user_id === '<%= User.current.id %>') { res_name = line.children().eq(1).children().attr('title'); res_link = line.children().eq(1).html(); @@ -232,7 +232,7 @@ } } - //发送至按钮控制 + //发送至按钮控制 $("input[name='checkbox1[]']").click(function(){ if($("input[name='checkbox1[]']:checked").length >= 1){ $(".resourcesSelectSendButton").removeClass("inactive-border"); diff --git a/app/views/users/_user_resource_tip_list.html.erb b/app/views/users/_user_resource_tip_list.html.erb index 35ca130dd..67fe292ee 100644 --- a/app/views/users/_user_resource_tip_list.html.erb +++ b/app/views/users/_user_resource_tip_list.html.erb @@ -1,7 +1,7 @@
    • 资源名称
    • - +
    • 操作
    • <%= link_to "上传时间", resource_search_user_path(:type => @type, :status => @status, :sort => @score, :order => "created_on", :search => " "), :class => "fl", :remote => true %> <% if @order == "created_on" %> diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb index 43f06b93d..a8bd96859 100644 --- a/app/views/users/user_resource.html.erb +++ b/app/views/users/user_resource.html.erb @@ -8,11 +8,11 @@ } $(document).ready(function(){ - $(".resource-switch").click(function(){ - $(".resource-switch").children().removeClass("resource-tab-active"); - $(this).children().addClass("resource-tab-active"); - }); + $(".resource-switch").click(function(){ + $(".resource-switch").children().removeClass("resource-tab-active"); + $(this).children().addClass("resource-tab-active"); }); + }); function remote_search(){ $("#resource_search_form").submit(); } @@ -55,9 +55,9 @@
    • 我的资源
    • - - - +
    • + 申请资源 +
    •