Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

Conflicts:
	public/stylesheets/public.css
This commit is contained in:
cxt 2016-03-04 11:11:25 +08:00
commit b333c40ce0
32 changed files with 818 additions and 306 deletions

View File

@ -66,6 +66,7 @@ class ProjectsController < ApplicationController
helper :words
helper :project_score
helper :user_score
include UsersHelper
### added by william
include ActsAsTaggableOn::TagsHelper

View File

@ -107,7 +107,7 @@ class UsersController < ApplicationController
redirect_to signin_url
return
elsif @user != User.current && !User.current.admin?
return render_403
return render_403
end
# 初始化/更新 点击按钮时间
# 24小时内显示系统消息
@ -683,7 +683,7 @@ class UsersController < ApplicationController
student_work.save
flash[:notice] = l(:notice_successful_create)
redirect_to student_work_index_url(:homework => params[:homework])
else
else
render_403
end
end
@ -797,19 +797,23 @@ class UsersController < ApplicationController
render_403
return
end
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
# user_org_ids = User.current.organizations.map {|o| o.id}
if(params[:type].blank? || params[:type] == "1") #全部
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
elsif params[:type] == "2" #课程资源
user_course_ids = User.current.courses.map { |c| c.id}
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) ").order("created_on desc")
elsif params[:type] == "3" #项目资源
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc")
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
elsif params[:type] == "2" # 课程资源
@attachments = get_course_resources(params[:id], user_course_ids)
elsif params[:type] == "3" # 项目资源
@attachments = get_project_resources(params[:id], user_project_ids)
elsif params[:type] == "4" #附件
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")
@attachments = get_attch_resources params[:id]
elsif params[:type] == "5" #用户资源
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Principal'").order("created_on desc")
@attachments = get_principal_resources params[:id]
elsif params[:type] == "6" # 公共资源
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids)
end
@type = params[:type]
@limit = 7
@ -842,6 +846,8 @@ class UsersController < ApplicationController
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like '%#{search}%')").order("created_on desc")
elsif params[:type] == "5" #用户资源
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Principal' and (filename like '%#{search}%')").order("created_on desc")
elsif params[:type] == "6" #公共资源
@attachments = Attachment.where("(is_public =1 and is_publish = 1 and container_id is not null)" + "or (author_id = #{params[:id]} and is_publish = 0)").order("created_on desc")
end
@type = params[:type]
@limit = 7
@ -882,7 +888,7 @@ class UsersController < ApplicationController
def store_selected_resource
session[:seleted_resource_ids] = [] if session[:seleted_resource_ids].nil?
if params[:save] == 'y'
session[:seleted_resource_ids] << params[:res_id]
session[:seleted_resource_ids] << params[:res_id]
else
session[:seleted_resource_ids].delete( params[:res_id])
end
@ -1188,12 +1194,12 @@ class UsersController < ApplicationController
else
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
end
else
# @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)
# @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
@ -1516,48 +1522,27 @@ class UsersController < ApplicationController
# 上传用户资源
def user_resource_create
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
# user_org_ids = User.current.organizations.map {|o| o.id}
@user = User.find(params[:id])
#@user.save_attachments(params[:attachments],User.current)
# Container_type为Principal
Attachment.attach_filesex(@user, params[:attachments], params[:attachment_type])
if(params[:type].blank?|| params[:type] == "1") #全部
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " +
"and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
end
elsif params[:type] == "2" #课程资源
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id}
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) ").order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
end
elsif params[:type] == "3" #项目资源
if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc")
else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' ").order("created_on desc")
end
if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
elsif params[:type] == "2" # 课程资源
@attachments = get_course_resources(params[:id], user_course_ids)
elsif params[:type] == "3" # 项目资源
@attachments = get_project_resources(params[:id], user_project_ids)
elsif params[:type] == "4" #附件
if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")
else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")
end
elsif params[:type] == "5" #附件
if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type ='Principal'").order("created_on desc")
else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type ='Principal'").order("created_on desc")
end
@attachments = get_attch_resources params[:id]
elsif params[:type] == "5" #用户资源
@attachments = get_principal_resources params[:id]
elsif params[:type] == "6" # 公共资源
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids)
end
@type = params[:type] || 1
@limit = 25
@ -1581,45 +1566,23 @@ class UsersController < ApplicationController
Attachment.where("author_id = #{User.current.id}").delete(id)
end
end
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
# user_org_ids = User.current.organizations.map {|o| o.id}
if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') #全部
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 " +
"and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
end
elsif params[:type] == "2" #课程资源
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id}
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course') or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})) ").order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course')"+
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
end
elsif params[:type] == "3" #项目资源
if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc")
else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' ").order("created_on desc")
end
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
elsif params[:type] == "2" # 课程资源
@attachments = get_course_resources(params[:id], user_course_ids)
elsif params[:type] == "3" # 项目资源
@attachments = get_project_resources(params[:id], user_project_ids)
elsif params[:type] == "4" #附件
if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")
else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon')").order("created_on desc")
end
@attachments = get_attch_resources params[:id]
elsif params[:type] == "5" #用户资源
if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type ='Principal'").order("created_on desc")
else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type ='Principal'").order("created_on desc")
end
@attachments = get_principal_resources params[:id]
elsif params[:type] == "6" # 公共资源
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids)
end
@type = params[:type]
@limit = 25
@ -1883,30 +1846,30 @@ class UsersController < ApplicationController
end
ori = Attachment.find_by_id(send_id)
unless subfield_id.nil?
attach_copied_obj = ori.copy
@exist = false
OrgSubfield.find(subfield_id).attachments.each do |att| #如果课程中包含该资源
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
att.created_on = Time.now
att.save
@exist = true
break
end
attach_copied_obj = ori.copy
@exist = false
OrgSubfield.find(subfield_id).attachments.each do |att| #如果课程中包含该资源
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
att.created_on = Time.now
att.save
@exist = true
break
end
if @exist == false #如果不存在该资源
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
attach_copied_obj.container = OrgSubfield.find(subfield_id)
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
attach_copied_obj.is_public = 0
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 1
end
if attach_copied_obj.save
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
end
end
if @exist == false #如果不存在该资源
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
attach_copied_obj.container = OrgSubfield.find(subfield_id)
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
attach_copied_obj.is_public = 0
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 1
end
if attach_copied_obj.save
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
end
end
end
elsif params[:send_ids].present?
send_ids = params[:send_ids].split(" ")
@ -1918,30 +1881,30 @@ class UsersController < ApplicationController
ori = Attachment.find_by_id(send_id)
unless subfield_id.nil?
next if ori.blank?
@exist = false
OrgSubfield.find(subfield_id).attachments.each do |att| #如果课程中包含该资源
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
att.created_on = Time.now
att.save
@exist = true
break
end
end
next if @exist
attach_copied_obj = ori.copy
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
attach_copied_obj.container = OrgSubfield.find(subfield_id)
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
attach_copied_obj.is_public = 0
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 1
end
if attach_copied_obj.save
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
next if ori.blank?
@exist = false
OrgSubfield.find(subfield_id).attachments.each do |att| #如果课程中包含该资源
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
att.created_on = Time.now
att.save
@exist = true
break
end
end
next if @exist
attach_copied_obj = ori.copy
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
attach_copied_obj.container = OrgSubfield.find(subfield_id)
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
attach_copied_obj.is_public = 0
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 1
end
if attach_copied_obj.save
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
end
end
end
else
@ -1976,8 +1939,8 @@ class UsersController < ApplicationController
end
news.attachments.each do |attach|
course_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
:is_public => attach.is_public, :quotes => 0)
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
:is_public => attach.is_public, :quotes => 0)
end
end
end
@ -1996,8 +1959,8 @@ class UsersController < ApplicationController
end
news.attachments.each do |attach|
message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
:is_public => attach.is_public, :quotes => 0)
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
:is_public => attach.is_public, :quotes => 0)
end
end
end
@ -2013,8 +1976,8 @@ class UsersController < ApplicationController
end
news.attachments.each do |attach|
org_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
:is_public => attach.is_public, :quotes => 0)
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
:is_public => attach.is_public, :quotes => 0)
end
OrgActivity.create(:container_type => 'OrgSubfield', :container_id => field_id.to_i, :org_act_type=>'News', :org_act_id => org_news.id, :user_id => User.current.id)
end
@ -2282,53 +2245,64 @@ class UsersController < ApplicationController
end
end
# 获取公共资源
def get_public_resources user_course_ids, user_project_ids
attachments = Attachment.where("(is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) "+
"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)" +
"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("created_on desc")
end
# 获取我的资源
def get_my_resources author_id, user_course_ids, user_project_ids
attachments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"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)" +
"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("created_on desc")
end
# 获取我的课程资源
def get_course_resources author_id, user_course_ids
attchments = Attachment.where("(author_id = #{author_id} and container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
end
# 获取我的项目资源
def get_project_resources author_id, user_project_ids
attchments = Attachment.where("author_id = #{author_id} and container_type = 'Project'").order("created_on desc")
end
# 获取我上传的附件
def get_attch_resources author_id
attchments = Attachment.where("author_id = #{author_id} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
end
# 获取我的用户类型资源
def get_principal_resources author_id
attchments = Attachment.where("author_id = #{author_id} and container_type = 'Principal'").order("created_on desc")
end
# 资源库 分为全部 课程资源 项目资源 附件
def user_resource
#确定container_type
# @user = User.find(params[:id])
# 别人的资源库是没有权限去看的
if User.current.id.to_i != params[:id].to_i
render_403
return
end
if(params[:type].blank? || params[:type] == "1") #全部
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
@attachments = Attachment.where("(author_id = #{params[:id]} and is_publish = 1 and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)").order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #Ta的资源库的话应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and is_publish = 1 " +
"and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
"or (container_type = 'Course' and is_public = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1)").order("created_on desc")
end
elsif params[:type] == "2" #课程资源
if User.current.id.to_i == params[:id].to_i
user_course_ids = User.current.courses.map { |c| c.id}
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
else
user_course_ids = User.find(params[:id]).courses.visible.map { |c| c.id} #如果课程私有资源,那么要看这个资源的课程是不是在 这个user的所有我可见的课程中
@attachments = Attachment.where("(author_id = #{params[:id]} and is_public = 1 and container_type = 'Course' and is_publish = 1)"+
"or (container_type = 'Course' and is_public = 1 and is_publish = 1 and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
end
elsif params[:type] == "3" #项目资源
if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Project'").order("created_on desc")
else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' ").order("created_on desc")
end
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
# user_org_ids = User.current.organizations.map {|o| o.id}
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
elsif params[:type] == "2" # 课程资源
@attachments = get_course_resources(params[:id], user_course_ids)
elsif params[:type] == "3" # 项目资源
@attachments = get_project_resources(params[:id], user_project_ids)
elsif params[:type] == "4" #附件
if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
end
@attachments = get_attch_resources params[:id]
elsif params[:type] == "5" #用户资源
if User.current.id.to_i == params[:id].to_i
@attachments = Attachment.where("author_id = #{params[:id]} and container_type = 'Principal'").order("created_on desc")
else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Principal'").order("created_on desc")
end
@attachments = get_principal_resources params[:id]
elsif params[:type] == "6" # 公共资源
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids)
end
@type = params[:type]
@limit = 25
@ -2340,7 +2314,98 @@ class UsersController < ApplicationController
@attachments = paginateHelper @attachments,25
respond_to do |format|
format.js
format.html {render :layout => 'new_base_user'}
format.html {render :layout => 'new_base'}
end
end
# 导入资源
def import_resources
# 别人的资源库是没有权限去看的
if User.current.id.to_i != params[:id].to_i
render_403
return
end
user_course_ids = User.current.courses.map { |c| c.id}
user_project_ids = User.current.projects.map {|p| p.id}
# user_org_ids = User.current.organizations.map {|o| o.id}
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
elsif params[:type] == "6" # 公共资源
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = get_public_resources(user_course_ids, user_project_ids)
end
@type = params[:type]
@limit = 10
@is_remote = true
@atta_count = @attachments.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
#@curse_attachments_all = @all_attachments[@offset, @limit]
@attachments = paginateHelper @attachments,10
respond_to do |format|
format.js
format.html {render :layout => 'new_base'}
end
end
# 内容导入到对象中
def import_into_container
# attachments = Attachment.where("id in (#{params[:checkbox1].join(',')})")
# if params[:mul_type] == "Project"
#
# elsif params[:mul_type] == "Course"
# Attachment.create(:container_id => params[:mul_id], :container_type => "Course", :name => attachment.name)
# elsif params[:mul_type] == "SubfieldFile"
# end
unless params[:checkbox1].blank?
send_ids = params[:checkbox1]
# mul_id为当前课程id、项目id、组织id的多种形态
mul_id = params[:mul_id]
if params[:mul_type] == "Course"
mul_container = Course.find(mul_id)
elsif params[:mul_type] == "Project"
mul_container = Project.find(mul_id)
elsif params[:mul_type] == "SubfieldFile"
mul_container = OrgSubfield.find(mul_id)
end
send_ids.each do |send_id|
ori = Attachment.find_by_id(send_id)
# 如果该附件已经存课程中,则只更新附件创建时间
mul_container.attachments.each do |att|
if att.id == ori.id || (!att.copy_from.nil? && !ori.copy_from.nil? && att.copy_from == ori.copy_from) || att.copy_from == ori.id || att.id == ori.copy_from
att.created_on = Time.now
att.save
@exist = true
break
end
end
next if @exist
attach_copied_obj = ori.copy
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
attach_copied_obj.container = mul_container
attach_copied_obj.created_on = Time.now
attach_copied_obj.author_id = User.current.id
attach_copied_obj.is_public = 0
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from #发送要添加copy_from
if attach_copied_obj.attachtype == nil
attach_copied_obj.attachtype = 4
end
attach_copied_obj.save
@save_message = attach_copied_obj.errors.full_messages
end
end
respond_to do |format|
format.html {
if params[:mul_type] == "Course"
redirect_to course_files_url(mul_container)
elsif params[:mul_type] == "Project"
redirect_to project_files_url(mul_container)
elsif params[:mul_type] == "SubfieldFile"
redirect_to org_subfield_files_url(mul_container)
end
}
end
end
@ -2387,6 +2452,10 @@ class UsersController < ApplicationController
else
@attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Principal' and (filename like :p)",:p=>search).order("created_on desc")
end
elsif params[:type] == "6" #全部资源
# 公共资源库:所有公开资源或者我上传的私有资源
@attachments = Attachment.where("((is_public =1 and is_publish = 1 and container_id is not null)" +
"or (author_id = #{params[:id]} and is_publish = 0)) and (filename like :p) ", :p => search).order("created_on desc")
end
@type = params[:type]
@limit = 25

View File

@ -115,6 +115,15 @@ module ApplicationHelper
def course_member_score(course_id,user_id,type)
course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course_id, user_id).first
case type
when "HomeworkCommon"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :homework_journal_num => 1 , :total_score => 1)
else
score = course_contributor_score.homework_journal_num + 1
total_score = course_contributor_score.total_score + 1
course_contributor_score.update_attributes(:homework_journal_num => score, :total_score => total_score)
end
when "JournalForMessage"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,

View File

@ -25,7 +25,7 @@ module CoursesHelper
# 获取tag匹配结果ID
a_tags = []
# kc = keywords.to_a
Course.visible.where("is_excellent =?", 1).each do |ec|
Course.visible.where("is_excellent =? and is_public =?", 1, 1).each do |ec|
if ec.tags.any?{|value| current_course.name.include?(value.to_s)}
a_tags << ec.id
end
@ -44,7 +44,7 @@ module CoursesHelper
excellent_ids = a_courses.flatten.uniq.delete_if{|i| i == current_course.id}
limit = 5 - excellent_ids.length.to_i
sql = "SELECT distinct c.id FROM course_activities cs, courses c where cs.course_id = c.id
and c.is_excellent =1 and c.id != #{current_course.id} order by cs.updated_at desc;"
and c.is_excellent =1 and c.is_public = 1 and c.id != #{current_course.id} order by cs.updated_at desc;"
default_ecourse_ids = Course.find_by_sql(sql).flatten
# REDO:时间紧,待优化
default_ids =[]

View File

@ -54,6 +54,61 @@ module UsersHelper
end
end
def get_resource_origin attach
type = attach.container_type
content = attach.container
unless content.nil?
case type
when 'Course'
result = current_time_and_term_resource content
when 'Project'
result = content.name
when 'Issue'
result = content.subject
when 'Message'
result = content.subject
when 'News'
result = content.title
when 'HomewCommon'
result = content.name
when 'StudentWorkScore'
result = content.name
when 'Principal'
result = content.name
when 'OrgSubfield'
result = content.name
end
end
end
def current_time_and_term_resource course
str = ""
term = cur_course_term_resource
name = course.name
if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year
str = name + "(" + course.time.to_s + course.term.to_s + ")"
elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term)
str = name + "(" + course.time.to_s + course.term.to_s + ")"
elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term))
str = name + "(" + course.end_time.to_s + course.end_term.to_s + ")"
else
str = name + "(" + Time.now.year.to_s + cur_course_term_resource.to_s + ")"
end
str
end
def cur_course_term_resource
month = Time.now.month
if month >= 9 || month < 2
term = ""
elsif (month >= 7 && Time.now.day >= 15) || month == 8
term = ""
else
term = ""
end
term
end
def title_for_message type
case type
when nil

View File

@ -1,5 +1,5 @@
class CourseContributorScore < ActiveRecord::Base
attr_accessible :course_id, :journal_num, :journal_reply_num, :message_num, :message_reply_num, :news_reply_num, :resource_num, :user_id, :total_score
attr_accessible :course_id, :journal_num, :journal_reply_num, :message_num, :message_reply_num, :news_reply_num, :resource_num, :user_id, :total_score, :homework_journal_num
belongs_to :course
belongs_to :user
end

View File

@ -285,8 +285,10 @@ class JournalsForMessage < ActiveRecord::Base
# 课程成员得分(英雄榜)
def act_as_student_score
if !self.user.allowed_to?(:as_teacher, self.jour) && self.jour_type == "Course"
if self.jour_type == "Course"
course_member_score(self.jour_id, self.user_id, "JournalForMessage")
elsif self.jour_type == "HomeworkCommon"
course_member_score(self.jour_id, self.user_id, "HomeworkCommon")
end
end

View File

@ -2,7 +2,7 @@
<h2 class="project_h2 fl"><%= @subPage_title%></h2>
<% if User.current.allowed_to?(:as_teacher,@course) %>
<span class="fr f14 fontGrey2" style="height: 40px; line-height: 40px; margin-right: 15px;">
<%=link_to "修改角色", :controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member' %>
<%=link_to "成员管理", :controller => 'courses', :action => 'settings', :id => @course.id, :tab=>'member' %>
</span>
<% end %>
</div>

View File

@ -93,7 +93,8 @@
<%= submit_tag "课内搜索", :class => "blueBtn mr5 fl",:name => "incourse",:id => "incourse" %>
<%= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite" %>
<% if is_course_teacher(User.current,@course) || (@course.publish_resource==1 && User.current.member_of_course?(@course) ) %>
<input class="blueBtn fr mr5" value="上传资源" onclick="course_files_upload();">
<input class="blueBtn fr mr5" value="上传资源" onclick="course_files_upload();">
<%= link_to("导入资源", import_resources_user_path(User.current, :type => 6, :course_id => @course.id), :class => "blue-btn fr mr5", :remote => true) %>
<% end %>
<% end %>

View File

@ -0,0 +1,138 @@
<%#= render :partial => 'users/user_resource_info' %>
<div class="f16 fb fontBlue mb10">选用资源库中的资源</div>
<div class="subjectList fl mr10"> <a href="javascript:void(0);" class="subjectChoose chooseActive fl">公共资源</a> <a href="javascript:void(0);" class="subjectChoose fl">我的资源</a>
<input type="text" name="serach" placeholder="输入关键词进行搜索" class="subjectSearch fr" />
<div class="cl"></div>
<div style="height:441px; min-height:441px; max-height:441px;">
<ul class="subjectBanner mt10">
<li class="subjectName fl hidden"><span style="padding-left:15px;">资源名称</span></li>
<li class="subjectType fl">类别</li>
<li class="subjectCount fl">大小</li>
<li class="subjectPublisher fl">上传者</li>
<li class="fl subjectDate">上传时间</li>
</ul>
<ul class="subjectRow">
<li class="subjectName fl hidden">
<label>
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
</ul>
<ul class="subjectRow">
<li class="subjectName fl hidden">
<label>
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">项目资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
</ul>
<ul class="subjectRow">
<li class="subjectName fl hidden">
<label>
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">附件</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
</ul>
<ul class="subjectRow">
<li class="subjectName fl hidden">
<label>
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
</ul>
<ul class="subjectRow">
<li class="subjectName fl hidden">
<label>
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
</ul>
<ul class="subjectRow">
<li class="subjectName fl hidden">
<label>
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
</ul>
<ul class="subjectRow">
<li class="subjectName fl hidden">
<label>
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
</ul>
<ul class="subjectRow">
<li class="subjectName fl hidden">
<label>
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
</ul>
<ul class="subjectRow">
<li class="subjectName fl hidden">
<label>
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
</ul>
<ul class="subjectRow">
<li class="subjectName fl hidden">
<label>
<input type="checkbox" name="subjectName" class="mr5" style="vertical-align:middle;" />
<span>123456.jpg</span></label>
</li>
<li class="subjectType fl">课程资源</li>
<li class="subjectCount fl">123.0KB</li>
<li class="subjectPublisher fl">尹刚</li>
<li class="fl subjectDate">2016-01-21</li>
</ul>
</div>
<div class="courseSendSubmit mr15"><a href="javascript:void(0);" class="sendSourceText">选用</a></div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText">取消</a></div>
<div class="pageRoll mt0">
<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">上一页</a></div>
<div class="pageCell pageCellActive"><a href="javascript:void(0);" class="c_white">1</a></div>
<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">2</a></div>
<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">3</a></div>
<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">...</a></div>
<div class="pageCell"><a href="javascript:void(0);" class="fontBlue">14</a></div>
<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">下一页</a></div>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>

View File

@ -62,10 +62,12 @@
<%= form_tag( search_project_project_files_path(@project), method: 'get',:class => "re_search",:remote=>true) do %>
<%= text_field_tag 'name', params[:name], name: "name", :class => 're_schbox',:style=>"padding: 0px"%>
<%= submit_tag "项目内搜索", :class => "re_schbtn b_lblue",:name => "incourse",:id => "incourse", :onmouseover => "presscss('incourse')",:onmouseout =>"buttoncss()", :style =>"width:72px;" %>
<%= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
<%#= submit_tag "全站搜索", :class => "re_schbtn b_lblue",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
<!--REDO: 权限测试-->
<% if User.current.member_of?(@project) %>
<input class="blueBtn fr mr5" value="上传资源" onclick="project_files_upload();">
<%= link_to("导入资源", import_resources_user_path(User.current, :type => 6, :project_id => @project.id), :class => "blue-btn fr mr5", :remote => true) %>
<!--<input class="blueBtn fr mr5" value="导入资源" onclick="project_files_import();">-->
<% end %>
<% end %>
</div>

View File

@ -42,6 +42,7 @@
<%= submit_tag "栏目内搜索", :class => "blueBtn mr5 fl",:style => 'width:72px;',:name => "inorg_subfield",:id => "inorg_subfield", :onmouseover => "presscss('inorg_subfield')",:onmouseout =>"buttoncss()" %>
<%= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite",:onmouseover => "presscss('insite')",:onmouseout =>"buttoncss()" %>
<input class="blueBtn fr mr5" value="上传资源" onclick="org_upload_files(<%= org_subfield.id %>);">
<%= link_to("导入资源", import_resources_user_path(User.current, :type => 6, :subfield_file_id => @org_subfield.id), :class => "blue-btn fr mr5", :remote => true) %>
<%#= link_to "上传资源",subfield_upload_file_org_subfield_files_path(@org_subfield.id, :in_org => 1),:method => "post",:class=>"blueBtn fr mr5",:remote => true %>
<% end %>
</div><!---re_top end-->

View File

@ -8,11 +8,11 @@
<%= link_to "首页",user_activities_path(User.current.id), :class => "c_white f16 db p10", :title => "回到个人首页"%>
</li>
<li class="navHomepageMenu fl">
<a href="<%=url_for(:controller => 'users', :action => 'user_resource',:id=>User.current.id,:type=>1)%>" class="c_white f16 db p10">资源库</a></li>
<a href="<%=url_for(:controller => 'users', :action => 'user_resource', :id => User.current.id, :type => 6) %>" class="c_white f16 db p10">资源库</a></li>
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
<li class="navHomepageMenu fl">
<li class="navHomepageMenu fl">
<%= link_to "题库", user_homeworks_user_path(User.current.id), :class => "c_white f16 db p10"%>
</li>
</li>
<% else %>
<li class="navHomepageMenu fl">
<%= link_to "我的作业", student_homeworks_user_path(User.current.id), :class => "c_white f16 db p10"%>

View File

@ -162,6 +162,9 @@
<% unless contributor_score.journal_num == 0 %>
课程留言:<%= contributor_score.journal_num %><br />
<% end %>
<% unless contributor_score.homework_journal_num == 0 %>
作业留言:<%= contributor_score.homework_journal_num %><br />
<% end %>
<% unless contributor_score.news_reply_num == 0 %>
课程通知:<%= contributor_score.news_reply_num %><br />
<% end %>

View File

@ -66,7 +66,7 @@
<!-- 项目得分 -->
<div class="cl"></div>
<div>
<%= link_to l(:label_project_name)+"#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %>
<%= link_to "#{@project.name}", project_path(@project.id), :class=>"pr_info_name fl c_dark fb break_word" %>
<% if @project.is_public? %>
<span class="img_private"><%= l(:label_public)%></span>
<% else %>

View File

@ -1,5 +1,10 @@
<div class="project_r_h">
<h2 class="project_h2"><%= @subPage_title %></h2>
<h2 class="project_h2 fl"><%= @subPage_title%></h2>
<% if is_project_manager?(User.current, @project) %>
<span class="fr f14 fontGrey2" style="height: 40px; line-height: 40px; margin-right: 15px;">
<%=link_to "成员管理", :controller => 'projects', :action => 'settings', :id => @project.id, :tab => 'members' %>
</span>
<% end %>
</div>
<div class="member_content">
<%= error_messages_for 'member' %>

View File

@ -1,17 +1,17 @@
<script type="text/javascript">
$(function(){
<%if @select_tab%>
<%if @select_tab == "modules"%>
<%if @select_tab %>
<% if @select_tab == "modules" %>
project_setting(2);
<% elsif @select_tab == "members"%>
<% elsif @select_tab == "members" %>
project_setting(3);
<% elsif @select_tab == "versions"%>
<% elsif @select_tab == "versions" %>
project_setting(4);
$("#pro_st_edit_ban").toggle();
<% elsif @select_tab == "repositories" %>
project_setting(6);
$("#pro_st_edit_ku").toggle();
<%else%>
<% else %>
project_setting(5);
<% end%>
<% end%>

View File

@ -0,0 +1,70 @@
<script>
$(document).ready(function(){
$(".subjectChoose").click(function(){
$(".subjectChoose").removeClass("chooseActive");
$(this).addClass("chooseActive");
});
$(".popupClose").click(function(){
$(".popupWrap").hide();
});
});
</script>
<div class="f16 fb fontBlue mb10">选用资源库中的资源</div>
<div class="subjectList fl mr10">
<% if !params[:course_id].nil? %>
<a href="<%= import_resources_user_path(User.current, :type => '6', :course_id => params[:course_id]) %>" class="subjectChoose chooseActive fl" data-remote="true">公共资源</a>
<a href="<%= import_resources_user_path(User.current, :type => '1', :course_id => params[:course_id]) %>" class="subjectChoose fl" data-remote="true">我的资源</a>
<% elsif !params[:project_id].nil? %>
<a href="<%= import_resources_user_path(User.current, :type => '6', :project_id => params[:project_id]) %>" class="subjectChoose chooseActive fl" data-remote="true">公共资源</a>
<a href="<%= import_resources_user_path(User.current, :type => '1', :project_id => params[:project_id]) %>" class="subjectChoose fl" data-remote="true">我的资源</a>
<% elsif !params[:subfield_file_id].nil? %>
<a href="<%= import_resources_user_path(User.current, :type => '6', :subfield_file_id => params[:subfield_file_id]) %>" class="subjectChoose chooseActive fl" data-remote="true">公共资源</a>
<a href="<%= import_resources_user_path(User.current, :type => '1', :subfield_file_id => params[:subfield_file_id]) %>" class="subjectChoose fl" data-remote="true">我的资源</a>
<% end %>
<%= form_tag( url_for(:controller => 'users', :action => 'resource_search', :id => User.current.id),
:remote => true , :method => 'get', :id => 'resource_search_form') do %>
<input type="text" name="search" placeholder="输入资源关键词进行搜索" class="subjectSearch fr" />
<%= hidden_field_tag(:type,type.nil? ? 1 : type) %>
<% end %>
<div class="cl"></div>
<div style="height:441px; min-height:441px; max-height:441px;">
<ul class="subjectBanner mt10">
<li class="subjectName fl hidden"><span style="padding-left:15px;">资源名称</span></li>
<li class="subjectType fl">类别</li>
<li class="subjectCount fl">大小</li>
<li class="subjectPublisher fl">上传者</li>
<li class="fl subjectDate">上传时间</li>
</ul>
<%= form_tag( url_for({:controller => 'users', :action => 'import_into_container',
:mul_id => params[:project_id].nil? ? (params[:course_id].nil? ? params[:subfield_file_id] : params[:course_id]) : params[:project_id],
:mul_type => params[:project_id].nil? ? (params[:course_id].nil? ? "SubfieldFile" : "Course") : "Project"}),
:method => 'post', :id => 'resource_import_container_form') do %>
<% @attachments.each do |attach| %>
<ul class="subjectRow">
<li class="subjectName fl hidden">
<label>
<input name="checkbox1[]" type="checkbox" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="mr5" style="vertical-align:middle;" />
<span><%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename%></span>
</label>
</li>
<li class="subjectType fl"><%= get_resource_type(attach.container_type)%></li>
<li class="subjectCount fl"><%= number_to_human_size(attach.filesize) %></li>
<li class="subjectPublisher fl"><%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %></li>
<li class="fl subjectDate"><%= format_date(attach.created_on) %></li>
</ul>
<% end %>
<% end %>
</div>
<div class="courseSendSubmit mr15"><a href="javascript:void(0);" class="sendSourceText" onclick="$('#resource_import_container_form').submit();hideModal()">选用</a></div>
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal()">取消</a></div>
<div class="pageRoll mt0">
<ul class="wlist" id="pages" style="margin-top: 5px;">
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
</ul>
</div>
<div class="cl"></div>
</div>

View File

@ -1,7 +1,7 @@
<%= form_tag( url_for(:controller => 'users',:action => 'resource_search',:id=>user.id),
:remote=>true ,:method => 'get',:class=>'resourcesSearchloadBox',:id=>'resource_search_form') do %>
<%= form_tag( url_for(:controller => 'users', :action => 'resource_search', :id => user.id),
:remote => true , :method => 'get', :class => 'resourcesSearchloadBox mt10', :id => 'resource_search_form') do %>
<input type="text" name="search" placeholder="输入资源关键词进行搜索" class="searchResource" />
<%= hidden_field_tag(:type,type.nil? ? 1 : type) %>
<%= submit_tag '',:class=>'homepageSearchIcon',:onfocus=>'this.blur();',:style=>'border-style:none' %>
<%= submit_tag '', :class => 'homepageSearchIcon', :onfocus => 'this.blur();', :style => 'border-style:none' %>
<!--<a href="javascript:void(0);" onclick='this.parent.submit();return false;' class="searchIcon"></a>-->
<% end %>

View File

@ -1,27 +1,27 @@
<% if attachments.nil? || attachments.empty? %>
<!--<p class="nodata">-->
<!--<%#= l(:label_no_data) %>-->
<!--</p>-->
<% else %>
<% attachments.each do |attach| %>
<ul class="resourcesList" onmouseover="if($('#contextMenu').css('display') != 'block')$(this).children().css('background-color', '#e1e1e1')" onmouseout=" if($('#contextMenu').css('display') == 'none')$(this).children().css('background-color', 'white')">
<li class="resourcesListCheckbox fl">
<ul class="resource-list" onmouseover="if($('#contextMenu').css('display') != 'block')$(this).children().css('background-color', '#e1e1e1')" onmouseout=" if($('#contextMenu').css('display') == 'none')$(this).children().css('background-color', 'white')">
<li class="resource-list-checkbox fl">
<input name="checkbox1[]" type="checkbox" data-has-history="<%= attach.attachment_histories.count == 0 ? 'N' : 'Y' %>" data-deleteble="<%= User.current.id ==attach.author_id ? 'Y' : 'N' %>" onclick="checkAllBox($(this));" value="<%= attach.id%>" class="resourcesCheckbox" />
<!--<input name="checkbox2" type="checkbox" value="" class="resourcesCheckbox" />-->
</li>
<li class="resourcesListName fl">
<!--<a href="javascript:void(0);" class="resourcesBlack"><%#=truncate(attach.filename,:length=>18)%></a>-->
<%= link_to truncate(attach.filename,:length=>30), download_named_attachment_path(attach.id, attach.filename),
:title => attach.filename,:class=>'resourcesBlack'%>
<li class="resource-list-name fl hidden">
<%= link_to truncate(attach.filename, :length => 30), download_named_attachment_path(attach.id, attach.filename), :title => attach.filename, :class => 'resourcesBlack' %>
</li>
<li class="resourcesListSize fl"><%= number_to_human_size(attach.filesize) %></li>
<li class="resourcesListType fl"><%= get_resource_type(attach.container_type)%></li>
<li class="resourcesListUploader fl"><%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %></li>
<li class="resource-list-time fr"><%= format_date(attach.created_on) %></li>
<li class="resource-list-quote fr"><%= attach.quotes.nil? ? 0 : attach.quotes %></li>
<li class="resource-list-download fr"><%= attach.downloads %></li>
<li style="display: none"><%= attach.author_id %></li>
<li class="resourcesListTime fl"><%= format_date(attach.created_on) %></li>
<li class="resource-list-size fr"><%= number_to_human_size(attach.filesize) %></li>
<li class="resource-list-uploader fr hidden"><%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %></li>
<li class="resource-list-type fr"><%= get_resource_type(attach.container_type)%></li>
<li class="resource-list-from fr hidden" title="<%= get_resource_origin(attach) %>"><%= get_resource_origin(attach) %></li>
<li style="display: none"><%= attach.id %></li>
</ul>
<ul class="resourcesListDashLine"></ul>
<div class="cl"></div>
<% end %>
<% end %>

View File

@ -0,0 +1,60 @@
<div id="users_setting">
<div class="resourcesUploadBox mt10"><a href="javascript:void(0);" onclick="show_upload();" class="uploadBoxIcon">上传资源</a></div>
<div id="search_div">
<%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type} %>
</div>
<div style="float: left; margin-top: 7px; font-size: 14px; margin-left: 15px;"><span style="align:center ;font-size: 14px;color: gray;">为您找到<span id="res_all_count"><%= @atta_count %></span>个资源</span></div>
</div>
<div class="cl"></div>
<ul class="resource-list-tab mt10">
<li class="resource-list-checkbox fl"> </li>
<li class="resource-list-name fl">资源名称</li>
<li class="resource-list-time fr">上传时间</li>
<li class="resource-list-quote fr">引用数</li>
<li class="resource-list-download fr">下载数</li>
<li class="resource-list-size fr">大小</li>
<li class="resource-list-uploader fr">上传者</li>
<li class="resource-list-type fr">类别</li>
<li class="resource-list-from fr">来源</li>
</ul>
<div class="cl"></div>
<form id="resources_list_form">
<div id="resources_list">
<%= render :partial => 'users/resources_list' , :locals => { :attachments => @attachments} %>
</div>
<div class="cl"></div>
<div class="resource-list-option fl">
<div class="resource-check-all">
<input id="checkboxAll" type="checkbox" value="" onclick="all_select();" class="resourcesCheckbox" />
</div>
<a href="javascript:void(0);" class="replyGrey mr15" onclick="all_select();">全选</a> <a href="javascript:void(0);" class="replyGrey" onclick="batch_delete();">删除</a> </div>
<div class="cl"></div>
<div class="resourcesSelectSend mt10 fl">
<div class="resourcesSelectSendButton fl mr15 inactive-border" onclick="batch_send();">
<a href="javascript:void(0);" class="sendButtonBlue db inactive-text" data-remote="true">发送至</a>
</div>
<div class="fl">选择&nbsp;<span class="c_red" id="res_count">0</span>&nbsp;个资源</div>
</div>
</form>
<div>
<ul class="wlist" id="pages" style="margin-top: 5px;">
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
</ul>
</div>
<div class="cl"></div>
<!--<div id="upload_box" style="display: none">-->
<!--<%#= render :partial => 'upload_resource' ,:locals => {:user=>@user}%>-->
<!--</div>-->
<ul class="resource-list">
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" id="contextMenu">
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)preview();" onfocus="this.blur()">预览</a></li>
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)rename();" onfocus="this.blur()">重命名</a></li>
<!-- data-remote="true" 这个属性会让ajax请求状态标志就在当前按钮的上方显示就不会滚动浏览器因而弹出框也会在当前窗口中央展示-->
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)show_send_();" data-remote="true" onfocus="this.blur()" >发送</a></li>
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)delete_file();" onfocus="this.blur()">删除</a></li>
</ul>
</ul>

View File

@ -0,0 +1,3 @@
<% if @flag == true%>
alert("发送成功")
<% end %>

View File

@ -0,0 +1,18 @@
<% if params[:project_id] %>
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :project_id => params[:project_id]} ) %>');
<% elsif params[:course_id] %>
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :course_id => params[:course_id]} ) %>');
<% elsif params[:subfield_file_id] %>
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'users/import_resource_info', :locals => {:user => User.current, :type => 1, :subfield_file_id => params[:subfield_file_id]} ) %>');
<% end %>
showModal('ajax-modal', '615px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 580px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
<% if params[:project_id] %>
$('#ajax-modal').parent().css("top","10%").css("left","34%").css("border","3px solid #269ac9");
<% else %>
$('#ajax-modal').parent().css("top","20%").css("left","42%").css("border","3px solid #269ac9");
<% end %>
$('#ajax-modal').parent().addClass("popbox_polls");

View File

@ -1,4 +1,3 @@
<%= javascript_include_tag 'bootstrap'%>
<%= stylesheet_link_tag 'project' %>
<%= stylesheet_link_tag 'leftside' %>
@ -12,6 +11,12 @@
function remote_get_resources(user_id,type){
}
$(document).ready(function(){
$(".resource-switch").click(function(){
$(".resource-switch").children().removeClass("resource-tab-active");
$(this).children().addClass("resource-tab-active");
});
});
function remote_search(){
$("#resource_search_form").submit();
}
@ -21,11 +26,19 @@
showModal('ajax-modal', '452px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal();' style='margin-left: 435px;' class='resourceClose'></a>");
$('#ajax-modal').parent().css("top","50%").css("left","50%");
$('#ajax-modal').parent().css("top","50%").css("left","50%").css("position","absolute");
$('#ajax-modal').parent().addClass("resourceUploadPopup");
$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
}
function show_public_resource(){
$("#resource_remote").html('<%= escape_javascript( render :partial => 'user_resource_info' ,:locals => { :tpye => 6}) %>');
}
function show_public_resource(){
$("#resource_remote").html('<%= escape_javascript( render :partial => 'user_resource_info' ,:locals => { :tpye => 1}) %>');
}
function closeModal()
{
hideModal($(".uploadBoxContainer"));
@ -56,94 +69,48 @@
}
}
</script>
<div class="homepageRightBanner">
<div class="NewsBannerName">资源库</div>
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="resourcesType">
<li>
<%= link_to '全部' ,user_resource_user_path(:id=>@user.id,:type=>1),:remote=>true,:method => 'get',:class=>'resourcesTypeAll resourcesGrey' %>
</li>
<li>
<%= link_to '课程资源' ,user_resource_user_path(:id=>@user.id,:type=>2),:remote=>true,:method => 'get',:class=>'homepagePostTypeAssignment postTypeGrey' %>
</li>
<li>
<%= link_to '项目资源' ,user_resource_user_path(:id=>@user.id,:type=>3),:remote=>true,:method => 'get',:class=>'homepagePostTypeQuiz postTypeGrey' %>
</li>
<li>
<%= link_to '用户资源' ,user_resource_user_path(:id=>@user.id,:type=>5),:remote=>true,:method => 'get',:class=>'resourcesTypeUser resourcesGrey' %>
</li>
<li>
<%= link_to '附件' ,user_resource_user_path(:id=>@user.id,:type=>4),:remote=>true,:method => 'get',:class=>'resourcesTypeAtt resourcesGrey' %>
</li>
</ul>
</li>
</ul>
</div>
<div class="resources mt10" id="users_setting">
<div class="resourcesSearchBanner mt10">
<div class="resourcesUploadBox">
<a href="javascript:void(0);" onclick="show_upload();" class="uploadBoxIcon">上传资源</a></div>
<div id="search_div">
<%= render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} %>
</div>
<div style="
float: left;
margin-top: 7px;
font-size: 14px;
margin-left: 15px;
"><span style="align:center ;font-size: 14px;color: gray;">为您找到<span id="res_all_count"><%= @atta_count%></span>个资源</span></div>
</div>
<div class="resourcesListBanner">
<ul class="resourcesListTab">
<li class="resourcesListCheckbox fl"> </li>
<li class="resourcesListName fl">资源名称</li>
<li class="resourcesListSize fl">大小</li>
<li class="resourcesListType fl">类别</li>
<li class="resourcesListUploader fl">上传者</li>
<li class="resourcesListTime fl">上传时间</li>
</ul>
</div>
<form id="resources_list_form">
<div id="resources_list">
<%= render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments} %>
</div>
<div class="resourcesListOption">
<div class="resourcesCheckAll">
<input id="checkboxAll" type="checkbox" value="" onclick="all_select();" class="resourcesCheckbox" />
</div>
<a href="javascript:void(0);" class="replyGrey1 mr15" onclick="all_select();">全选</a>
<a href="javascript:void(0);" class="replyGrey1" onclick="batch_delete();">删除</a>
<div class="resourcesSelectSend">
<div class="fl">选择&nbsp;<span class="c_red" id="res_count">0</span>&nbsp;个资源</div>
<div class="resourcesSelectSendButton" onclick="batch_send();">
<a href="javascript:void(0);" class="sendButtonBlue db" data-remote="true" >发送</a>
</div>
</div>
</div>
</form>
<div>
<ul class="resource-banner">
<li class="fl resource-switch">
<a href="<%= user_resource_user_path(@user, :type => '6') %>" class="resource-tab resource-tab-active" data-remote="true">公共资源</a>
</li>
<li class="fl resource-switch">
<a href="<%= user_resource_user_path(@user, :type => '1') %>" class="resource-tab" data-remote="true">我的资源</a>
</li>
<li class="fl w770 border-bottom h34">&nbsp;</li>
<li class="fr resource-banner-li border-bottom h34">
<ul class="resourcesSelect">
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
<ul class="resourcesType">
<li>
<%= link_to '全部' ,user_resource_user_path(:id => @user.id, :type => 1), :remote => true, :method => 'get', :class => 'resourcesTypeAll resourcesGrey' %>
</li>
<li>
<%= link_to '课程资源' ,user_resource_user_path(:id => @user.id, :type => 2), :remote => true, :method => 'get', :class=> 'homepagePostTypeAssignment postTypeGrey' %>
</li>
<li>
<%= link_to '项目资源' ,user_resource_user_path(:id => @user.id, :type => 3), :remote => true, :method => 'get', :class => 'homepagePostTypeQuiz postTypeGrey' %>
</li>
<li>
<%= link_to '用户资源' ,user_resource_user_path(:id=>@user.id,:type=>5),:remote=>true,:method => 'get', :class=>'resourcesTypeUser resourcesGrey' %>
</li>
<li>
<%= link_to '附件' ,user_resource_user_path(:id=>@user.id,:type=>4),:remote=>true,:method => 'get',:class=>'resourcesTypeAtt resourcesGrey' %>
</li>
</ul>
</li>
</ul>
</li>
<div class="cl"></div>
</ul>
<div class="cl"></div>
<div>
<ul class="wlist" id="pages" style="margin-top: 5px;">
<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>
<div id ="resource_remote">
<%= render :partial => 'user_resource_info' %>
</div>
</div>
<div class="cl"></div>
<!--<div id="upload_box" style="display: none">-->
<!--<%#= render :partial => 'upload_resource' ,:locals => {:user=>@user}%>-->
<!--</div>-->
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu" id="contextMenu">
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)preview();" onfocus="this.blur()">预览</a></li>
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)rename();" onfocus="this.blur()">重命名</a></li>
<!-- data-remote="true" 这个属性会让ajax请求状态标志就在当前按钮的上方显示就不会滚动浏览器因而弹出框也会在当前窗口中央展示-->
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)show_send_();" data-remote="true" onfocus="this.blur()" >发送</a></li>
<li><a tabindex="-1" href="#" onclick="if(<%= User.current.logged?%>)delete_file();" onfocus="this.blur()">删除</a></li>
</ul>
<script>
var pageX = 0;
@ -388,7 +355,7 @@
line.children().css("background-color",'white');
id = line.children().last().html();
user_id = line.children().eq(5).html();
if(user_id === '<%= User.current.id%>') {
if(user_id === '<%= User.current.id %>') {
res_name = line.children().eq(1).children().attr('title');
res_link = line.children().eq(1).html();
line.children().eq(1).html(

View File

@ -1,5 +1,5 @@
$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>');
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form', :locals => {:user => @user, :type => @type} ) %>');
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' , :locals => { :attachments => @attachments}) %>');
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#res_count").html(0);
$("#checkboxAll").attr('checked',false);

View File

@ -537,6 +537,8 @@ RedmineApp::Application.routes.draw do
match 'user_act_issue_assign_to', :to => 'users#user_act_issue_assign_to', :via => [:get, :post]
get 'edit_brief_introduction'
get "user_resource"
get "import_resources"
post "import_into_container"
get "resource_search"
post "user_resource_create"
post "user_resource_delete"

View File

@ -0,0 +1,5 @@
class AddHomeworkJournalToCourseContributorScores < ActiveRecord::Migration
def change
add_column :course_contributor_scores, :homework_journal_num, :integer, :default => 0
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160224074034) do
ActiveRecord::Schema.define(:version => 20160303103231) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -432,9 +432,10 @@ ActiveRecord::Schema.define(:version => 20160224074034) do
t.integer "resource_num"
t.integer "journal_num"
t.integer "journal_reply_num"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "total_score"
t.integer "homework_journal_num", :default => 0
end
create_table "course_groups", :force => true do |t|

View File

@ -1263,3 +1263,25 @@ div.disable_link {background-color: #c1c1c1 !important;}
.mh18 {max-height: 18px;}
.relatePWrap{max-height: 210px;overflow:hidden;}/*160114课程推荐*/
.courseR {width:220px; padding:10px; background-color:#ffffff; margin-top:10px;}
/*导入题库样式*/
.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;}
.subjectList {width:585px;}
.subjectDetail {width:385px;}
a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;}
a.chooseActive {background-color:#269ac9; color:#ffffff;}
.subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
.subjectBanner li {height:40px; line-height:40px; vertical-align:middle;}
.subjectName {width:270px; padding-left:10px; padding-right:10px;}
.subjectPublisher {width:80px; text-align:center;}
.subjectDate {width:80px; text-align:center;}
.subjectRow {width:585px; height:40px; color:#7a7a7a; font-size:12px;}
.subjectRow li {height:40px; line-height:40px; vertical-align:middle;}
.subjectSearch {border:1px solid #dddddd; height:32px; width:250px;}
.subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:460px; overflow-y:auto;}
.subjectIntro {color:#585858; line-height:18px; font-size:12px;}
.subjectContent {color:#888888; line-height:18px; font-size:12px;}
.popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;}
.subjectType {width:70px; text-align:center;}
.subjectCount {width:65px; text-align:center;}

View File

@ -117,4 +117,33 @@ div.flash {margin-top :0px !important}
.maxh360 {max-height: 810px;}
.lh18 { line-height: 18px;}
a.link_file_a2{ background:url(../images/pic_file.png) 0 -15px no-repeat; padding-left: 20px;}
a.link_file_a2{ background:url(../images/pic_file.png) 0 -15px no-repeat; padding-left: 20px;}
/*导入题库样式*/
.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;}
.subjectList {width:585px;}
.subjectDetail {width:385px;}
a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;}
a.chooseActive {background-color:#269ac9; color:#ffffff;}
.subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
.subjectBanner li {height:40px; line-height:40px; vertical-align:middle;}
.subjectName {width:270px; padding-left:10px; padding-right:10px;}
.subjectPublisher {width:80px; text-align:center;}
.subjectDate {width:80px; text-align:center;}
.subjectRow {width:585px; height:40px; color:#7a7a7a; font-size:12px;}
.subjectRow li {height:40px; line-height:40px; vertical-align:middle;}
.subjectSearch {border:1px solid #dddddd; height:32px; width:250px;}
.subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:460px; overflow-y:auto;}
.subjectIntro {color:#585858; line-height:18px; font-size:12px;}
.subjectContent {color:#888888; line-height:18px; font-size:12px;}
.popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;}
.subjectType {width:70px; text-align:center;}
.subjectCount {width:65px; text-align:center;}
a.blue-btn {
padding: 4px 7px;
color: #FFF;
border: none;
background-color: #269ac9;
cursor: pointer;
text-align: center;
}

View File

@ -1177,4 +1177,26 @@ div.disable_link {background-color: #c1c1c1 !important;}
.number-line-old {background-color:#ffdddd; border-color:#f1c0c0;}
.code-line-new {background-color:#eaffea;}
.number-line-new {background-color:#dbffdb; border-color:#c1e9c1;}
.branch-label {padding-right: 5px; border-radius:2px; color:#888888; display:inline-block; background-color:#f8fafc;}
.branch-label {padding-right: 5px; border-radius:2px; color:#888888; display:inline-block; background-color:#f8fafc;}
/*导入题库样式*/
.popupWrap {border:3px solid #269ac9; padding:15px; background-color:#ffffff; position:relative; z-index:1000;}
.subjectList {width:585px;}
.subjectDetail {width:385px;}
a.subjectChoose {padding:8px 20px; background-color:#f1f1f1; color:#888888;}
a.chooseActive {background-color:#269ac9; color:#ffffff;}
.subjectBanner {width:585px; height:40px; background-color:#f1f1f1; border-top:1px solid #eaeaea; color:#7a7a7a; font-size:14px;}
.subjectBanner li {height:40px; line-height:40px; vertical-align:middle;}
.subjectName {width:270px; padding-left:10px; padding-right:10px;}
.subjectPublisher {width:80px; text-align:center;}
.subjectDate {width:80px; text-align:center;}
.subjectRow {width:585px; height:40px; color:#7a7a7a; font-size:12px;}
.subjectRow li {height:40px; line-height:40px; vertical-align:middle;}
.subjectSearch {border:1px solid #dddddd; height:32px; width:250px;}
.subjectInfo {width:385px; background-color:#f1f1f1; border:1px solid #dddddd; height:32px; line-height:32px; vertical-align:middle; text-align:center; color:#7a7a7a;}
.subjectWrap {border:1px solid #dddddd; border-top:none; padding:10px; width:365px; height:460px; overflow-y:auto;}
.subjectIntro {color:#585858; line-height:18px; font-size:12px;}
.subjectContent {color:#888888; line-height:18px; font-size:12px;}
.popupClose {background:url(../images/resource_icon_list.png) 0px -40px no-repeat; width:20px; height:20px; display:inline-block; position: absolute; z-index: 1000; right:10px; top:5px;}
.subjectType {width:70px; text-align:center;}
.subjectCount {width:65px; text-align:center;}

View File

@ -909,7 +909,7 @@ a.resourcesBlack:hover {font-size:12px; color:#000000;}
.resourcesList {width:710px; height:39px; background-color:#ffffff; border-bottom:1px dashed #eaeaea; color:#9a9a9a; font-size:12px; margin-left:auto; margin-right:auto;}
.resourcesListOption {width:710px; height:40px; line-height:40px; vertical-align:middle; margin-left:auto; margin-right:auto; background-color:#f6f6f6;}
.resourcesCheckAll {width:20px; height:40px; line-height:40px; text-align:center; vertical-align:middle; float:left;}
.resourcesSelectSend {float:right;}
.resourcesSelectSend {vertical-align: middle;height: 28px;line-height: 28px;}
.resourcesSelectSendButton {width:75px; height:28px; background-color:#ffffff; line-height:28px; vertical-align:middle; text-align:center; border:1px solid #269ac9; border-radius:5px; }
a.sendButtonBlue {color:#269ac9;}
a.sendButtonBlue:hover {color:#ffffff;}
@ -996,6 +996,8 @@ span.at a{color:#269ac9;text-decoration: none;}
.researchBox { width:240px; height:24px; border:1px solid #dddddd; color:#666666; outline:none;}
.blueBtn{ width:60px; height:26px; color:#FFF; border:none; background-color:#269ac9; cursor:pointer; padding-left:0px; text-align:center;}
.blueBtn:hover {background-color:#298fbd;}
a.blue-btn{ padding:4px 7px; color:#FFF; border:none; background-color:#269ac9; cursor:pointer; text-align:center;}
a.blue-btn:hover {background-color:#298fbd;}
/*文本描述展开高度*/
.maxh360 {max-height: 810px;}
@ -1098,7 +1100,32 @@ a.resource-tab-active {color:#fff; background-color:#269ac9; border-bottom:1px s
.resource-pop-size {width:65px; text-align:center;}
.resource-pop-from {width:120px; text-align:center;}
.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;}
.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}
.course-search {border: 1px solid #dddddd; height: 25px; width: 200px;outline: none;}
/*20160226新资源库*/
.resource-wrapper {width:980px; background-color:#fff; float:left;}
.resource-list-tab {width:980px; height:40px; background-color:#f6f6f6; border-bottom:1px solid #eaeaea; font-size:14px; color:#7a7a7a;}
.resource-list-checkbox {width:20px; height:40px; line-height:40px; text-align:center; vertical-align:middle;}
.resource-checkbox {margin-top:14px; width:12px; height:12px;}
.resource-list-name {width:380px; height:40px; line-height:40px; text-align:left;}
.resource-list-from {width:150px; height:40px; line-height:40px; text-align:center;}
.resource-list-size {width:80px; height:40px; line-height:40px; text-align:center;}
.resource-list-type {width:80px; height:40px; line-height:40px; text-align:center;}
.resource-list-uploader {width:80px; height:40px; line-height:40px; text-align:center;}
.resource-list-time {width:70px; height:40px; line-height:40px; text-align:center;}
.resource-list-quote {width:60px; height:40px; line-height:40px; text-align:center;}
.resource-list-download {width:60px; height:40px; line-height:40px; text-align:center;}
.resource-list {width:980px; height:39px; background-color:#ffffff; border-bottom:1px dashed #eaeaea; color:#9a9a9a; font-size:12px; margin-left:auto; margin-right:auto; cursor:pointer;}
.resource-list:hover {background-color:#e1e1e1;}
.resource-list-option {width:980px; height:40px; line-height:40px; vertical-align:middle; margin-left:auto; margin-right:auto; background-color:#f6f6f6;}
.resource-check-all {width:20px; height:40px; line-height:40px; text-align:center; vertical-align:middle; float:left;}
.border-bottom {border-bottom:1px solid #ddd;}
.h34 {height:34px;}
.resource-tab {font-size:16px; color:#4d4d4d; width:70px; padding:5px 10px; display:inline-block; text-align:left; border-bottom:1px solid #ddd;}
a.resource-tab-active {color:#fff; background-color:#269ac9; border-bottom:1px solid #269ac9;}
a.group-btn{ background: url(../images/course/hwork_icon.png) -2px -58px no-repeat !important; height:20px; display:block; padding-left:23px; color:#888888; -moz-transition :all 0s linear 0s; -webkit-transition :all 0s linear 0s; -o-transition:all 0s linear 0s; transition:all 0s linear 0s;}
a.program-btn{background: url(../images/homepage_icon.png) -86px -393px no-repeat; width:30px; height:20px; display:block; padding-left:23px; color:#888888;}