diff --git a/Gemfile b/Gemfile
index 645c7b849..c739e1085 100644
--- a/Gemfile
+++ b/Gemfile
@@ -36,7 +36,6 @@ gem 'chinese_pinyin'
# gem 'progress_bar'
gem 'ansi'
-gem 'debugger'
gem 'kaminari'
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index b878a14ac..e974f26b4 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -572,6 +572,15 @@ class AttachmentsController < ApplicationController
end
end
+ #找到文件的所有的历史版本及当前版本
+ def attachment_history_download
+ @attachment = Attachment.find(params[:id])
+ @attachment_histories = @attachment.attachment_histories
+ respond_to do |format|
+ format.js
+ end
+ end
+
private
def find_project
@attachment = Attachment.find(params[:id])
diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb
index f250b46de..d1a8b23dd 100644
--- a/app/controllers/org_document_comments_controller.rb
+++ b/app/controllers/org_document_comments_controller.rb
@@ -1,6 +1,6 @@
class OrgDocumentCommentsController < ApplicationController
before_filter :find_organization, :only => [:new, :create, :show, :index]
- helper :attachments
+ helper :attachments,:organizations
layout 'base_org'
def new
diff --git a/app/controllers/org_subfields_controller.rb b/app/controllers/org_subfields_controller.rb
index 9337c5fd2..ba4c1f18f 100644
--- a/app/controllers/org_subfields_controller.rb
+++ b/app/controllers/org_subfields_controller.rb
@@ -5,9 +5,8 @@ class OrgSubfieldsController < ApplicationController
def create
if OrgSubfield.where("organization_id=#{params[:organization_id]} and name=?",params[:name]).count == 0
@res = true
- @subfield = OrgSubfield.create(:name => params[:name])
@organization = Organization.find(params[:organization_id])
- @organization.org_subfields << @subfield
+ @subfield = OrgSubfield.create(:name => params[:name], :organization_id => params[:organization_id],:priority => @organization.org_subfields.order("priority").last.priority + 1)
if !params[:sub_dir].blank?
sql = "select subfield_subdomain_dirs.* from subfield_subdomain_dirs, org_subfields where subfield_subdomain_dirs.org_subfield_id = org_subfields.id "+
"and org_subfields.organization_id=#{@organization.id} and subfield_subdomain_dirs.name='#{params[:sub_dir]}'"
@@ -15,7 +14,7 @@ class OrgSubfieldsController < ApplicationController
SubfieldSubdomainDir.create(:org_subfield_id => @subfield.id, :name => params[:sub_dir])
end
end
- @subfield.update_attributes(:priority => @subfield.id, :field_type => params[:field_type])
+ @subfield.update_attributes(:field_type => params[:field_type])
else
@res = false
end
@@ -125,6 +124,12 @@ class OrgSubfieldsController < ApplicationController
end
end
+ def update_priority
+ @org_subfield = OrgSubfield.find(params[:id])
+ @org_subfield.update_attribute(:priority, params[:priority].to_i)
+ @organization = @org_subfield.organization
+ end
+
def show_attachments obj
@attachments = []
obj.each do |container|
diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb
index 711663c3d..239253d82 100644
--- a/app/controllers/organizations_controller.rb
+++ b/app/controllers/organizations_controller.rb
@@ -317,7 +317,7 @@ class OrganizationsController < ApplicationController
@organization = Organization.find(params[:id])
admins = User.where("admin=1")
admins.each do |admin|
- OrgMessage.create(:user_id => admin.id, :organization_id => @organization.id, :message_type => 'ApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:domain])
+ OrgMessage.create(:user_id => admin.id, :organization_id => @organization.id, :message_type => 'ApplySubdomain', :message_id => @organization.id, :sender_id => User.current.id, :viewed => 0, :content => params[:domain].downcase)
end
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index adb4eb91e..33b6e8643 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -110,8 +110,7 @@ class UsersController < ApplicationController
elsif @user != User.current && !User.current.admin?
return render_403
end
- # 初始化/更新 点击按钮时间
- # 24小时内显示系统消息
+ # 初始化/更新 点击按钮时间, 24小时内显示系统消息
update_onclick_time
# 全部设为已读
if params[:viewed] == "all"
@@ -190,17 +189,19 @@ class UsersController < ApplicationController
# 消息设置为已读
def update_message_viewed(user)
- course_querys = CourseMessage.where("user_id =? and viewed =?", user, 0)
- forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0)
- user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0)
- forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0)
- org_querys = OrgMessage.where("user_id=? and viewed=0", user)
if User.current.id == @user.id
- course_querys.update_all(:viewed => true)
- forge_querys.update_all(:viewed => true)
- user_querys.update_all(:viewed => true)
- forum_querys.update_all(:viewed => true)
- org_querys.update_all(:viewed => true)
+ course_querys = CourseMessage.where("user_id =? and viewed =?", user, 0)
+ forge_querys = ForgeMessage.where("user_id =? and viewed =?", user, 0)
+ user_querys = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0)
+ forum_querys = MemoMessage.where("user_id =? and viewed =?", user, 0)
+ org_querys = OrgMessage.where("user_id=? and viewed=0", user)
+ at_querys = AtMessage.where("user_id=? and viewed=0", user)
+ course_querys.update_all(:viewed => true) unless course_querys.nil?
+ forge_querys.update_all(:viewed => true) unless forge_querys.nil?
+ user_querys.update_all(:viewed => true) unless user_querys.nil?
+ forum_querys.update_all(:viewed => true) unless forum_querys.nil?
+ org_querys.update_all(:viewed => true) unless org_querys.nil?
+ at_querys.update_all(:viewed => true) unless at_querys.nil?
end
end
@@ -840,20 +841,33 @@ class UsersController < ApplicationController
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") #全部
+ 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" #附件
- @attachments = get_attch_resources params[:id]
- elsif params[:type] == "5" #用户资源
- @attachments = get_principal_resources params[:id]
+ if params[:status] == "2"
+ @attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
+ elsif params[:status] == "3"
+ @attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
+ elsif params[:status] == "4"
+ @attachments = get_attch_resources(params[:id], @order, @score)
+ elsif params[:status] == "5"
+ @attachments = get_principal_resources(params[:id], @order, @score)
+ else
+ # 公共资源库:所有公开资源或者我上传的私有资源
+ @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
+ end
elsif params[:type] == "6" # 公共资源
- # 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ if params[:status] == "2"
+ @attachments = get_course_resources_public( user_course_ids, @order, @score)
+ elsif params[:status] == "3"
+ @attachments = get_project_resources_public(user_project_ids, @order, @score)
+ elsif params[:status] == "4"
+ @attachments = get_attch_resources_public(@order, @score)
+ elsif params[:status] == "5"
+ @attachments = get_principal_resources_public(@order, @score)
+ else
+ # 公共资源库:所有公开资源或者我上传的私有资源
+ @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
+ end
end
@type = params[:type]
@limit = 7
@@ -963,12 +977,7 @@ class UsersController < ApplicationController
return
end
# 自己访问自己的页面才更新消息状态
- if User.current == @user
- journals_messages = UserFeedbackMessage.where("user_id =? and journals_for_message_type =? and viewed =?", User.current.id, "JournalsForMessage", 0)
- journals_messages.each do |journals_message|
- journals_message.update_attributes(:viewed => true)
- end
- end
+ UserFeedbackMessage.where("user_id =? and viewed =? and journals_for_message_type =? ", User.current.id, 0, "JournalsForMessage").update_all(:viewed => true)
# end
@page = params[:page] ? params[:page].to_i + 1 : 0
if params[:type].present?
@@ -1570,43 +1579,39 @@ class UsersController < ApplicationController
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
+ # 保存文件
attach = Attachment.attach_filesex_public(@user, params[:attachments], params[:attachment_type], is_public = true)
+ @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
+ @score = @b_sort == "desc" ? "asc" : "desc"
+ 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") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
- if params[:status] == 2
- @attachments = get_course_resources(params[:id], user_course_ids)
+ if params[:status] == "2"
+ @attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
elsif params[:status] == "3"
- @attachments = get_project_resources(params[:id], user_project_ids)
+ @attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
elsif params[:status] == "4"
- @attachments = get_attch_resources params[:id]
+ @attachments = get_attch_resources(params[:id], @order, @score)
elsif params[:status] == "5"
- @attachments = get_principal_resources params[:id]
+ @attachments = get_principal_resources(params[:id], @order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
+ @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
- 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 = get_attch_resources params[:id]
- elsif params[:type] == "5" #用户资源
- @attachments = get_principal_resources params[:id]
elsif params[:type] == "6" # 公共资源
if params[:status] == "2"
- @attachments = get_course_resources_public( user_course_ids)
+ @attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
- @attachments = get_project_resources_public(user_project_ids)
+ @attachments = get_project_resources_public(user_project_ids, @order, @score)
elsif params[:status] == "4"
- @attachments = get_attch_resources_public
+ @attachments = get_attch_resources_public(@order, @score)
elsif params[:status] == "5"
- @attachments = get_principal_resources_public
+ @attachments = get_principal_resources_public(@order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
end
@status = params[:status]
@@ -1626,49 +1631,44 @@ class UsersController < ApplicationController
# 删除用户资源,分为批量删除 和 单个删除,只能删除自己上传的资源
def user_resource_delete
if params[:resource_id].present?
- Attachment.where("author_id = #{User.current.id}").delete(params[:resource_id])
+ Attachment.where("author_id =? and id =?", User.current.id, params[:resource_id]).first.destroy
elsif params[:checkbox1].present?
params[:checkbox1].each do |id|
- Attachment.where("author_id = #{User.current.id}").delete(id)
+ Attachment.where("author_id =? and id =?", User.current.id, id).first.destroy
end
end
+ @user = User.current
+ @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
+ @score = @b_sort == "desc" ? "asc" : "desc"
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") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
- if params[:status] == 2
- @attachments = get_course_resources(params[:id], user_course_ids)
+ if params[:status] == "2"
+ @attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
elsif params[:status] == "3"
- @attachments = get_project_resources(params[:id], user_project_ids)
+ @attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
elsif params[:status] == "4"
- @attachments = get_attch_resources params[:id]
+ @attachments = get_attch_resources(params[:id], @order, @score)
elsif params[:status] == "5"
- @attachments = get_principal_resources params[:id]
+ @attachments = get_principal_resources(params[:id], @order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
+ @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
- 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 = get_attch_resources params[:id]
- elsif params[:type] == "5" #用户资源
- @attachments = get_principal_resources params[:id]
elsif params[:type] == "6" # 公共资源
if params[:status] == "2"
- @attachments = get_course_resources_public( user_course_ids)
+ @attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
- @attachments = get_project_resources_public(user_project_ids)
+ @attachments = get_project_resources_public(user_project_ids, @order, @score)
elsif params[:status] == "4"
- @attachments = get_attch_resources_public
+ @attachments = get_attch_resources_public(@order, @score)
elsif params[:status] == "5"
- @attachments = get_principal_resources_public
+ @attachments = get_principal_resources_public(@order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
end
@status = params[:status]
@@ -1691,10 +1691,10 @@ class UsersController < ApplicationController
if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%"
@course = @user.courses.where(" #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search)
- .select { |course| @user.allowed_to?(:as_teacher,course)}
+ .select { |course| @user.allowed_to?(:as_teacher,course) and course.is_delete == 0 }
else
@course = @user.courses
- .select { |course| @user.allowed_to?(:as_teacher,course)}
+ .select { |course| @user.allowed_to?(:as_teacher,course) and course.is_delete == 0 }
end
@search = params[:search]
#这里仅仅是传递需要发送的资源id
@@ -1712,7 +1712,7 @@ class UsersController < ApplicationController
search = "%#{params[:search].to_s.strip.downcase}%"
@projects = @user.projects.where(" #{Project.table_name}.id = #{params[:search].to_i } or #{Project.table_name}.name like :p",:p=>search)
else
- @projects = @user.projects
+ @projects = @user.projects.visible
end
@search = params[:search]
#这里仅仅是传递需要发送的资源id
@@ -2356,59 +2356,125 @@ class UsersController < ApplicationController
end
# 获取公共资源
- def get_public_resources user_course_ids, user_project_ids
- 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("created_on desc")
+ 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}")
+ 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}")
end
# 获取我的资源
- def get_my_resources author_id, user_course_ids, user_project_ids
+ def get_my_resources author_id, user_course_ids, user_project_ids, order, score
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")
+ "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
+
+ # 获取我的资源查询结果
+ def get_my_resources_search (author_id, user_course_ids, user_project_ids, order, score, search)
+ @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)) and (filename like :p)" ,:p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
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")
+ 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(',')})
+ and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
+ end
+
+ # 获取我的课程资源中搜索结果
+ def get_course_resources_search author_id, user_course_ids, order, score, search
+ 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(',')})
+ and is_publish = 1 and container_id is not null)) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
- # 获取公共资源课程
- def get_course_resources_public user_course_ids
- attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1)").order("created_on desc")
+ # 获取公共资源中课程资源
+ 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}")
+ 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}")
end
# 获取我的项目资源
- def get_project_resources author_id, user_project_ids
- attchments = Attachment.where("(author_id = #{author_id} and container_type = 'Project') or (container_type = 'Course' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
+ 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(',')})
+ and is_publish = 1 and container_id is not null)").order("#{order.nil? ? 'created_on' : order} #{score}")
+ end
+
+ # 获取我的项目资源搜索
+ def get_project_resources_search author_id, user_project_ids, order, score, search
+ 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(',')})
+ and is_publish = 1 and container_id is not null)) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源的项目资源
- def get_project_resources_public user_project_ids
- attchments = Attachment.where("container_type = 'Project' and container_id is not null and is_public =1").order("created_on desc")
+ 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}")
+ 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}")
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")
+ def get_attch_resources author_id, order, score
+ attchments = 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'))").order("#{order.nil? ? 'created_on' : order} #{score}")
+ end
+
+ # 获取我上传的附件搜索结果
+ def get_attch_resources_search author_id, order, score, search
+ attchments = 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')) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取公共资源中我上传的附件
- def get_attch_resources_public
- 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("created_on desc")
+ 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}")
+ 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}")
+ end
+
+ # 获取我的用户类型资源
+ def get_principal_resources author_id, order, score
+ attchments = Attachment.where("author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal'").order("#{order.nil? ? 'created_on' : order} #{score}")
+ end
+
+ # 获取我的用户类型资源搜索
+ def get_principal_resources_search author_id, order, score, search
+ attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal') and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源
- def get_principal_resources author_id
- attchments = Attachment.where("author_id = #{author_id} and container_type = 'Principal'").order("created_on desc")
+ def get_principal_resources_public order, score
+ attchments = Attachment.where("container_type = 'Principal'and container_id is not null and is_public =1").order("#{order.nil? ? 'created_on' : order} #{score}")
end
# 获取我的用户类型资源
- def get_principal_resources_public
- attchments = Attachment.where("container_type = 'Principal'and container_id is not null and is_public =1").order("created_on desc")
+ 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}")
end
# 资源库 分为全部 课程资源 项目资源 附件
def user_resource
+ @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
+ @score = @b_sort == "desc" ? "asc" : "desc"
# 别人的资源库是没有权限去看的
if User.current.id.to_i != params[:id].to_i
render_403
@@ -2420,37 +2486,29 @@ class UsersController < ApplicationController
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
if params[:status] == "2"
- @attachments = get_course_resources(params[:id], user_course_ids)
+ @attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
elsif params[:status] == "3"
- @attachments = get_project_resources(params[:id], user_project_ids)
+ @attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
elsif params[:status] == "4"
- @attachments = get_attch_resources params[:id]
+ @attachments = get_attch_resources(params[:id], @order, @score)
elsif params[:status] == "5"
- @attachments = get_principal_resources params[:id]
+ @attachments = get_principal_resources(params[:id], @order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids)
+ @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
end
- 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 = get_attch_resources params[:id]
- elsif params[:type] == "5" #用户资源
- @attachments = get_principal_resources params[:id]
elsif params[:type] == "6" # 公共资源
if params[:status] == "2"
- @attachments = get_course_resources_public( user_course_ids)
+ @attachments = get_course_resources_public( user_course_ids, @order, @score)
elsif params[:status] == "3"
- @attachments = get_project_resources_public(user_project_ids)
+ @attachments = get_project_resources_public(user_project_ids, @order, @score)
elsif params[:status] == "4"
- @attachments = get_attch_resources_public
+ @attachments = get_attch_resources_public(@order, @score)
elsif params[:status] == "5"
- @attachments = get_principal_resources_public
+ @attachments = get_principal_resources_public(@order, @score)
else
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
end
@status = params[:status]
@@ -2475,16 +2533,19 @@ class UsersController < ApplicationController
render_403
return
end
+ @user = User.find(params[:id])
+ @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
+ @score = @b_sort == "desc" ? "asc" : "desc"
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_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)
+ @attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
elsif params[:type] == "6" # 公共资源
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ @attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
end
+ @status = params[:status]
@type = params[:type]
@limit = 10
@is_remote = true
@@ -2500,26 +2561,25 @@ class UsersController < ApplicationController
end
def import_resources_search
- search = "%#{params[:search].strip.downcase}%"
+ @order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
+ @score = @b_sort == "desc" ? "asc" : "desc"
+ @user = User.current
+ @switch_search = params[:name].nil? ? " " : params[:name]
+ search = "%#{@switch_search.strip.downcase}%"
# 别人的资源库是没有权限去看的
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") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
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}
- @attachments = Attachment.where("((author_id = #{params[: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)) and (filename like :p)" ,:p => search).order("created_on desc")
+ @attachments = get_my_resources_search(params[:id], user_course_ids, user_project_ids, @order, @score, search)
elsif params[:type] == "6" # 公共资源
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = get_public_resources(user_course_ids, user_project_ids)
+ @attachments = get_public_resources_search(user_course_ids, user_project_ids, @order, @score, search)
end
@type = params[:type]
@limit = 10
@@ -2528,10 +2588,10 @@ class UsersController < ApplicationController
@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
+ @attachments = paginateHelper @attachments, 10
respond_to do |format|
format.js
- format.html {render :layout => 'new_base'}
+ # format.html {render :layout => 'new_base'}
end
end
@@ -2589,55 +2649,41 @@ class UsersController < ApplicationController
# 根据资源关键字进行搜索
def resource_search
- search = "%#{params[:search].strip.downcase}%"
- user_course_ids = User.current.courses.map { |c| c.id}
+ @order, @b_sort = params[:order] || "created_on", params[:sort] || "desc"
+ @score = @b_sort == "desc" ? "asc" : "desc"
+ @user = User.current
+ @switch_search = params[:search].nil? ? " " : params[:search]
+ search = "%#{@switch_search.strip.downcase}%"
+ 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
-
- @attachments = Attachment.where("((author_id = #{params[: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)) and (filename like :p)" ,:p => search).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 in" +
- " ('Project','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 (filename like :p) ",:p=>search).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(',')})) and (filename like :p) ",:p=>search).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(',')})) )"+
- " and (filename like :p) ",:p=>search).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' and (filename like :p)",:p=>search).order("created_on desc")
- else
- @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type = 'Project' and (filename like :p) ",:p=>search).order("created_on desc")
- end
- 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('Project','Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like :p)",:p=>search).order("created_on desc")
+ if(params[:type].nil? || params[:type].blank? || params[:type] == "1" || params[:type] == 'all') # 全部
+ if params[:status] == "2"
+ @attachments = get_course_resources_search(params[:id], user_course_ids, @order, @score, search)
+ elsif params[:status] == "3"
+ @attachments = get_project_resources_search(params[:id], user_project_ids, @order, @score, search)
+ elsif params[:status] == "4"
+ @attachments = get_attch_resources_search(params[:id], @order, @score, search)
+ elsif params[:status] == "5"
+ @attachments = get_principal_resources_search(params[:id], @order, @score, search)
else
- @attachments = Attachment.where("author_id = #{params[:id]} and is_public = 1 and container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon') and (filename like :p)",:p=>search).order("created_on desc")
+ # 公共资源库:所有公开资源或者我上传的私有资源
+ @attachments = get_my_resources_search(params[:id], user_course_ids, user_project_ids, @order, @score, search)
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' and (filename like :p)",:p=>search).order("created_on desc")
+ elsif params[:type] == "6" # 公共资源
+ if params[:status] == "2"
+ @attachments = get_course_resources_public_search(user_course_ids, @order, @score, search)
+ elsif params[:status] == "3"
+ @attachments = get_project_resources_public_search(user_project_ids, @order, @score, search)
+ elsif params[:status] == "4"
+ @attachments = get_attch_resources_public_search(@order, @score, search)
+ elsif params[:status] == "5"
+ @attachments = get_principal_resources_public_search(@order, @score, search)
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")
+ # 公共资源库:所有公开资源或者我上传的私有资源
+ @attachments = get_public_resources_search(user_course_ids, user_project_ids, @order, @score, search)
end
- elsif params[:type] == "6" #全部资源
- # 公共资源库:所有公开资源或者我上传的私有资源
- @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("created_on desc")
end
+ @status = params[:status]
@type = params[:type]
@limit = 25
@is_remote = true
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index cc093ad7a..42911cc33 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -2069,7 +2069,7 @@ module ApplicationHelper
candown = User.current.member_of?(project) || (project.is_public && attachment_history.is_public == 1)
elsif attachment_history.container_type == "OrgSubfield"
org = OrgSubfield.find(attachment_history.container_id)
- candown = User.current.member_of_org?(org) || (org.organization.is_public && attachment_history.is_public == 1)
+ candown = User.current.member_of_org?(org) || (org.organization.is_public && attachment_history.is_public == 1 && (User.current.logged? || org.organization.allow_guest_download?))
end
end
@@ -2943,37 +2943,86 @@ int main(int argc, char** argv){
end
def user_url_in_org(user_id)
- if Rails.env.development?
- return "http://localhost:3000/users/" + user_id.to_s
- else
- return "https://" + Setting.host_name + "/users/" + user_id.to_s
- end
+ Setting.protocol + "://" + Setting.host_name + "/users/" + user_id.to_s
+end
+
+def project_issues_url_in_org(project_id)
+ Setting.protocol + "://" + Setting.host_name + "/projects/" + project_id.to_s + "/issues"
+end
+
+def issue_url_in_org(id)
+ Setting.protocol + "://" + Setting.host_name + "/issues/" + id.to_s
+end
+
+def project_boards_url_in_org(id)
+ Setting.protocol + "://" + Setting.host_name + "/projects/" + id.to_s + "/boards"
+end
+
+def board_message_url_in_org(board_id, message_id)
+ Setting.protocol + "://" + Setting.host_name + "/boards/" + board_id.to_s + "/topics/" + message_id.to_s
+end
+
+def project_url_in_org(id)
+ Setting.protocol + "://" + Setting.host_name + "/projects/" + id.to_s
+end
+
+def homework_common_index_url_in_org(course_id)
+ Setting.protocol + "://" + Setting.host_name + "/homework_common?course=" + course_id.to_s
+end
+
+def student_work_index_url_in_org(homework_id)
+ Setting.protocol + "://" + Setting.host_name + "/student_work?homework=" + homework_id.to_s
+end
+
+def course_url_in_org(course_id)
+ Setting.protocol + "://" + Setting.host_name + "/courses/" + course_id.to_s
+end
+
+def user_watchlist_url_in_org(id)
+ Setting.protocol + "://" + Setting.host_name + "/users/" + id.to_s + "/user_watchlist"
+end
+
+def user_fanslist_url_in_org(id)
+ Setting.protocol + "://" + Setting.host_name + "/users/" + id.to_s + "/user_fanslist"
+end
+
+def user_blogs_url_in_org(user_id)
+ Setting.protocol + "://" + Setting.host_name + "/users/" + user_id.to_s + "/blogs"
+end
+
+def feedback_url_in_org(user_id)
+ Setting.protocol + "://" + Setting.host_name + "/users/" + user_id.to_s + "/user_newfeedback"
+end
+
+def user_activities_url_in_org(user_id)
+ Setting.protocol + "://" + Setting.host_name + "/users/" + user_id.to_s + "/user_activities"
+end
+
+def course_news_index_url_in_org(course_id)
+ Setting.protocol + "://" + Setting.host_name + "/courses/" + course_id.to_s + "/news"
+end
+
+def news_url_in_org(news_id)
+ Setting.protocol + "://" + Setting.host_name + "/news/" + news_id.to_s
+end
+
+def course_boards_url_in_org(course_id)
+ Setting.protocol + "://" + Setting.host_name + "/courses/" + course_id.to_s + "/boards"
end
def logout_url_without_domain
- if Rails.env.development?
- return "http://localhost:3000/logout"
- else
- return "https://" + Setting.host_name + "/logout"
- end
+ Setting.protocol + "://" + Setting.host_name + "/logout"
end
def signin_url_without_domain
- if Rails.env.development?
- return "http://localhost:3000/login?login=true"
- elsif Rails.env.test?
- return "https://test.forge.trustie.net/login?login=true"
- else
- return "https://www.trustie.net/login?login=true"
- end
+ Setting.protocol + "://" + Setting.host_name + "/login?login=true"
end
def register_url_without_domain
- if Rails.env.development?
- return "http://localhost:3000/login?login=false"
- elsif Rails.env.test?
- return "https://test.forge.trustie.net/login?login=false"
- else
- return "https://www.trustie.net/login?login=false"
- end
+ Setting.protocol + "://" + Setting.host_name + "/login?login=false"
end
+#判断是否为默认的组织栏目
+def is_default_field? field
+ (field.name == 'activity' || field.name == 'course' || field.name == 'project') && field.field_type == 'default'
+end
+
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index 44b919121..bdd34d80d 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -62,7 +62,7 @@ module UsersHelper
when 'Course'
result = current_time_and_term_resource content
when 'Project'
- result = content.name
+ result = content.name + "(" + content.id.to_s + ")"
when 'Issue'
result = content.subject
when 'Message'
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 1cc0d3b7a..714da9920 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -90,8 +90,8 @@ class Attachment < ActiveRecord::Base
@@thumbnails_storage_path = File.join(Rails.root, "tmp", "thumbnails")
before_save :files_to_final_location
- after_save :act_as_course_activity
- after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index
+ after_save :act_as_course_activity,:act_as_forge_activity
+ after_create :office_conver, :be_user_score,:create_attachment_ealasticsearch_index
after_update :office_conver, :be_user_score,:update_attachment_ealasticsearch_index
after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count, :down_course_score
@@ -606,7 +606,7 @@ class Attachment < ActiveRecord::Base
# Author lizanle
# Description 上传该项目的文档资料也要保存一份在公共表中
def act_as_forge_activity
- if self.container_type == 'Project'
+ if self.container_type == 'Project' && self.forge_acts.empty?
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
:project_id => self.container_id)
end
diff --git a/app/models/course_activity.rb b/app/models/course_activity.rb
index 94eb097b8..a02eb750c 100644
--- a/app/models/course_activity.rb
+++ b/app/models/course_activity.rb
@@ -5,7 +5,7 @@ class CourseActivity < ActiveRecord::Base
belongs_to :course
belongs_to :user
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
- after_save :add_user_activity, :add_course_activity
+ after_save :add_user_activity, :add_org_activity
after_create :add_course_lead
before_destroy :destroy_user_activity, :destroy_org_activity
@@ -31,14 +31,16 @@ class CourseActivity < ActiveRecord::Base
end
end
- def add_course_activity
+ def add_org_activity
org_activity = OrgActivity.where("org_act_type = '#{self.course_act_type.to_s}' and org_act_id = '#{self.course_act_id}'").first
if org_activity
+ org_activity.updated_at = self.updated_at
org_activity.save
else
if self.course_act_type == 'Message' && !self.course_act.parent_id.nil?
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.course_act.parent.id}").first
org_activity.created_at = self.created_at
+ org_activity.updated_at = self.updated_at
org_activity.save
else
OrgActivity.create(:user_id => self.user_id,
@@ -66,7 +68,7 @@ class CourseActivity < ActiveRecord::Base
# 导语要放置在课程创建信息之后
# 导语
def add_course_lead
- if self.course_act_type == "Course"
+ if self.course_act_type == "Course" and Message.where("id=12440").any?
lead_message = Message.find(12440)
name = lead_message.subject
content = lead_message.content
diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb
index c98c5475b..c044392a0 100644
--- a/app/models/forge_activity.rb
+++ b/app/models/forge_activity.rb
@@ -48,7 +48,7 @@ class ForgeActivity < ActiveRecord::Base
def add_org_activity
org_activity = OrgActivity.where("org_act_type = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first
if org_activity
- org_activity.created_at = self.created_at
+ org_activity.updated_at = self.updated_at
org_activity.save
else
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
diff --git a/app/models/org_subfield.rb b/app/models/org_subfield.rb
index c62cbf4f8..8cec49686 100644
--- a/app/models/org_subfield.rb
+++ b/app/models/org_subfield.rb
@@ -9,6 +9,7 @@ class OrgSubfield < ActiveRecord::Base
has_many :news, :dependent => :destroy
acts_as_attachable
after_create :create_board_sync
+ after_destroy :update_priority
# 创建资源栏目讨论区
def create_board_sync
@board = self.boards.build
@@ -25,4 +26,11 @@ class OrgSubfield < ActiveRecord::Base
def project
end
+
+ def update_priority
+ OrgSubfield.where("organization_id=? and priority>?", self.organization_id, self.priority).each do |field|
+ field.decrement(:priority)
+ field.save
+ end
+ end
end
\ No newline at end of file
diff --git a/app/models/organization.rb b/app/models/organization.rb
index fcb777fb6..248783a26 100644
--- a/app/models/organization.rb
+++ b/app/models/organization.rb
@@ -16,8 +16,8 @@ class Organization < ActiveRecord::Base
end
def add_default_subfields
- OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default')
- OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default')
- OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default')
+ OrgSubfield.create(:organization_id => self.id, :name => 'activity', :field_type => 'default', :priority => 1)
+ OrgSubfield.create(:organization_id => self.id, :name => 'course', :field_type => 'default', :priority => 2)
+ OrgSubfield.create(:organization_id => self.id, :name => 'project', :field_type => 'default', :priority => 3)
end
end
diff --git a/app/models/user.rb b/app/models/user.rb
index abae2438a..78d823ea7 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -822,6 +822,9 @@ class User < Principal
end
def member_of_org?(org)
+ if !self.logged?
+ return false
+ end
OrgMember.where("user_id =? and organization_id =?", self.id, org.id).count > 0
end
diff --git a/app/views/attachments/_attachment_history_download.html.erb b/app/views/attachments/_attachment_history_download.html.erb
new file mode 100644
index 000000000..c805960f0
--- /dev/null
+++ b/app/views/attachments/_attachment_history_download.html.erb
@@ -0,0 +1,30 @@
+
+选择版本
+
注:该文件有历史版本,请选择您需要的文件,点击文件名下载。
+版本及序号
+
+
+
+ <%= link_to truncate(@attachment.filename,length: 35, omission: '...'),
+ download_named_attachment_path(@attachment.id, @attachment.filename),
+ :title => @attachment.filename+"\n"+@attachment.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f14 fb link_file_a2 fl" %>
+
+
版本号:当前
+
+ <% @attachment_histories.each do |history| %>
+
+ <%= link_to truncate(history.filename,length: 35, omission: '...'),
+ download_history_attachment_path(history.id, history.filename),
+ :title => history.filename+"\n"+history.description.to_s,
+ :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis; max-width:300px;",:class => "linkBlue f14 fb link_file_a2 fl" %>
+
+
版本号:<%= history.version %>
+
+ <% end %>
+
diff --git a/app/views/attachments/attachment_history_download.js.erb b/app/views/attachments/attachment_history_download.js.erb
new file mode 100644
index 000000000..352a2ef93
--- /dev/null
+++ b/app/views/attachments/attachment_history_download.js.erb
@@ -0,0 +1,7 @@
+$("#ajax-modal").html('<%= escape_javascript( render :partial => 'attachments/attachment_history_download' )%>');
+showModal('ajax-modal', '452px');
+$('#ajax-modal').siblings().remove();
+$('#ajax-modal').before(" ");
+$('#ajax-modal').parent().css("top","40%").css("left","50%");
+$('#ajax-modal').parent().addClass("resourceUploadPopup");
+$('#ajax-modal').css("padding-left","16px").css("padding-bottom","16px");
\ No newline at end of file
diff --git a/app/views/courses/private_or_public.js.erb b/app/views/courses/private_or_public.js.erb
index 10b787dd4..4e512a6a0 100644
--- a/app/views/courses/private_or_public.js.erb
+++ b/app/views/courses/private_or_public.js.erb
@@ -9,10 +9,10 @@
}
<% else %>
<% if @course.is_public? %>
- $("#set_course_public_<%= @course.id %>").text("设为私有");
$("#show_course_<%= @course.id %>").attr("title","公开课程:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)");
<% else %>
- $("#set_course_public_<%= @course.id %>").text("设为公开");
$("#show_course_<%= @course.id %>").attr("title","私有课程:<%= @course.name %>(<%= @course.time.to_s+ @course.term %>)");
<% end %>
+ $("#set_course_public_<%= @course.id %>").replaceWith('<%= escape_javascript(link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => "courses", :action => "private_or_public", :id => @course,:user_page => true},
+ :id => "set_course_public_#{@course.id.to_s}",:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗") %>');
<% end %>
\ No newline at end of file
diff --git a/app/views/files/_org_subfield_list.html.erb b/app/views/files/_org_subfield_list.html.erb
index 70214b721..ab547db87 100644
--- a/app/views/files/_org_subfield_list.html.erb
+++ b/app/views/files/_org_subfield_list.html.erb
@@ -9,9 +9,17 @@
- <%= link_to file.is_public? ? truncate(file.filename, length: 45) : truncate(file.filename,length: 35, omission: '...'),
- download_named_attachment_path(file.id, file.filename),
- :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14 f_l" %>
+ <%# 如果有历史版本则提供历史版本下载 %>
+ <% if file.attachment_histories.count == 0 %>
+ <%= link_to file.is_public? ? truncate(file.filename, length: 45) : truncate(file.filename,length: 35, omission: '...'),
+ download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
+ <% else %>
+ <%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id),
+ :title => file.filename+"\n"+file.description.to_s,
+ :class => "linkGrey3 f_14",
+ :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :remote=>true %>
+ <% end %>
<%= file_preview_eye(file, class: 'preview') %>
<% if file.is_public? == false%>
diff --git a/app/views/files/_project_list.html.erb b/app/views/files/_project_list.html.erb
index a2a1670d1..2ee726d77 100644
--- a/app/views/files/_project_list.html.erb
+++ b/app/views/files/_project_list.html.erb
@@ -8,9 +8,17 @@
- <%= link_to truncate(file.filename,length: 35, omission: '...'),
- download_named_attachment_path(file.id, file.filename),
- :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
+ <%# 如果有历史版本则提供历史版本下载 %>
+ <% if file.attachment_histories.count == 0 %>
+ <%= link_to truncate(file.filename,length: 35, omission: '...'),
+ download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
+ <% else %>
+ <%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id),
+ :title => file.filename+"\n"+file.description.to_s,
+ :class => "linkGrey3 f_14",
+ :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :remote=>true %>
+ <% end %>
<%= file_preview_eye(file, class: 'preview') %>
<% if file.is_public? == false%>
diff --git a/app/views/files/_resource_detail.html.erb b/app/views/files/_resource_detail.html.erb
index 317bb7dd8..20ffb1e50 100644
--- a/app/views/files/_resource_detail.html.erb
+++ b/app/views/files/_resource_detail.html.erb
@@ -6,9 +6,17 @@
- <%= link_to truncate(file.filename,length: 35, omission: '...'),
- download_named_attachment_path(file.id, file.filename),
- :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
+ <%# 如果有历史版本则提供历史版本下载 %>
+ <% if file.attachment_histories.count == 0 %>
+ <%= link_to truncate(file.filename,length: 35, omission: '...'),
+ download_named_attachment_path(file.id, file.filename),
+ :title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
+ <% else %>
+ <%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id),
+ :title => file.filename+"\n"+file.description.to_s,
+ :class => "linkGrey3 f_14",
+ :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;", :remote=>true %>
+ <% end %>
<%= file_preview_eye(file, class: 'preview') %>
<% if file.is_public? == false%>
@@ -38,31 +46,28 @@
<%= render :partial => 'tags/tag_add', :locals => {:obj => file, :object_flag => "6",:tag_name => @tag_name} %>
-
<% if User.current.logged? %>
-
<% if (is_course_teacher(User.current,@course) || file.author_id == User.current.id) && course_contains_attachment?(@course,file) %>
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" %>
-
<%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %>
<%= link_to '延期发布',file_hidden_course_file_path(@course,file),:class => "postOptionLink",:remote=>true %>
<%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %>
<% if @course.is_public? %>
-
- <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
-
+
+ <%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
+
<%end%>
<%= link_to( '删除资源', attachment_path(file),
- :data => {:confirm => l(:text_are_you_sure)}, :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
+ :data => {:confirm => l(:text_are_you_sure)},
+ :method => :delete,:class => "postOptionLink") if (delete_allowed || User.current.id == file.author_id) && file.container_id == @course.id && file.container_type == "Course" && file.destroyable %>
-
<% end %>
<%else%>
diff --git a/app/views/files/_subfield_files.html.erb b/app/views/files/_subfield_files.html.erb
index 7fb9e2e0a..9e0dd41d0 100644
--- a/app/views/files/_subfield_files.html.erb
+++ b/app/views/files/_subfield_files.html.erb
@@ -41,9 +41,10 @@
<%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%>
<%= 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()" %>
-
- <%= 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 %>
+ <% if User.current.member_of_org?(org_subfield.organization) %>
+
+ <%= link_to("导入资源", import_resources_user_path(User.current, :type => 6, :subfield_file_id => @org_subfield.id), :class => "blue-btn fr mr5", :remote => true) %>
+ <% end %>
<% end %>
diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb
index 8ab1851e4..315b1d300 100644
--- a/app/views/layouts/_logined_header.html.erb
+++ b/app/views/layouts/_logined_header.html.erb
@@ -109,7 +109,7 @@
<%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon", :target =>"_Blank", :title => "您的所有消息" %>
- <% if User.current.count_new_message >0 %>
+ <% if User.current.count_new_message.to_i >0 %>
<%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target =>"_Blank" %>
<% end %>
<%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
diff --git a/app/views/layouts/_org_courses.html.erb b/app/views/layouts/_org_courses.html.erb
index 648f62ecf..282447f0f 100644
--- a/app/views/layouts/_org_courses.html.erb
+++ b/app/views/layouts/_org_courses.html.erb
@@ -1,7 +1,7 @@
<% courses.each do |course|%>
<%# pro = Project.find course.course_id %>
<% if User.current.logged? %>
<% else %>
-
-
+
+
<% end %>
- <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%>
+ <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_url_in_org(activity.course.id), :class => "newsBlue ml15"%>
- <%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%>
+ <%= link_to activity.name.to_s, student_work_index_url_in_org(activity.id), :class => "postGrey"%>
<% if activity.homework_detail_manual%>
<% if activity.homework_detail_manual.comment_status == 1%>
@@ -47,7 +47,7 @@
<% end%>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%>
-
系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
+
系统提示:该作业要求各组长<%=link_to "创建项目", "https://www.trustie.net/projects/new",:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
<% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%>
系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!
<% end %>
@@ -73,7 +73,7 @@
<% if activity.homework_type == 2 && is_teacher%>
- <%= link_to "模拟答题", new_user_commit_homework_users_path(homework_id: activity.id, is_test: true), class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
+ <%= link_to "模拟答题", "https://www.trustie.net/new_user_commit_homework?homework_id="+activity.id.to_s + "&is_test=true", class: 'c_blue test-program-btn', title: '教师可以通过模拟答题设置作业的标准答案' %>
<% end %>
<% if activity.homework_type == 2%>
@@ -129,7 +129,7 @@
<% if activity.student_works.count != 0 %>
<% sw = activity.student_works.reorder("created_at desc").first %>
- # <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
+ # <%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_url_in_org(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
<% end %>
@@ -141,7 +141,7 @@
<% last_score = student_work_scores.first %>
# <%=time_from_now last_score.created_at %>
- <%= link_to last_score.user.show_name, user_activities_path(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
+ <%= link_to last_score.user.show_name, user_activities_url_in_org(last_score.user_id), :class => "newsBlue ml5 mr5"%>评阅了作品,优秀排行:
<% end %>
@@ -154,18 +154,8 @@
<% end %>
<% student_works.each_with_index do |sw, i| %>
-
- <% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>
- <%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
-
- <%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%>
-
- <% else %>
- <%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>
-
- <%=sw.user.show_name %>
-
- <% end %>
+ <%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
+ <%= link_to sw.user.show_name, student_work_index_url_in_org(activity.id)%>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
分数:<%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分
@@ -175,7 +165,7 @@
<% end %>
<% end %>
<% if student_works.count > 5 %>
- <%= link_to "更多>>", student_work_index_path(:homework => activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
+ <%= link_to "更多>>", student_work_index_url_in_org(activity.id),:class=>'linkGrey2 fl ml50',:style=>'margin-top:60px;'%>
<% end %>
@@ -187,7 +177,7 @@
<% sort_projects = project_sort_update projects %>
- # <%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_path(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
+ # <%=time_from_now sort_projects.first.updated_at %><%= link_to User.find(sort_projects.first.user_id).show_name, user_activities_url_in_org(sort_projects.first.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
<% sort_projects.each_with_index do |pro, i| %>
@@ -204,7 +194,7 @@
<% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
- <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %>
+ <%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_url_in_org(project.id),:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像" %>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s+"_"+activity.id.to_s,:alt =>"项目头像") %>
<% end %>
@@ -237,17 +227,17 @@
- <%= link_to l(:button_edit),edit_homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity), :class => "postOptionLink"%>
+ <%= link_to l(:button_edit),Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "/edit?", :class => "postOptionLink"%>
- <%= link_to(l(:label_bid_respond_delete), homework_common_path(activity,:is_in_course => -1,:course_activity=>course_activity),:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
+ <%= link_to(l(:label_bid_respond_delete), Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "?is_in_course=-1&course_activity=" + course_activity.to_s,:method => 'delete', :confirm => l(:text_are_you_sure), :class => "postOptionLink") %>
- <%= link_to("评分设置", score_rule_set_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => 0),:class => "postOptionLink", :remote => true) %>
+ <%= link_to("评分设置", Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "/score_rule_set?is_in_course=0&user_activity_id=" + user_activity_id.to_s,:class => "postOptionLink", :remote => true) %>
<% if activity.anonymous_comment == 0 %>
- <%= link_to("匿评设置", start_evaluation_set_homework_common_path(activity),:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
+ <%= link_to("匿评设置", Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "/start_evaluation_set",:class => "postOptionLink", :remote => true) if activity.homework_detail_manual.comment_status == 1%>
<%= homework_anonymous_comment activity,-1,user_activity_id,course_activity %>
@@ -255,17 +245,17 @@
<% end %>
<% if activity.anonymous_comment == 0 && (comment_status == 0 || comment_status == 1)%>
- <%= link_to("禁用匿评", alert_forbidden_anonymous_comment_homework_common_path(activity,:user_activity_id => user_activity_id,:course_activity=>course_activity),:class => "postOptionLink",
+ <%= link_to("禁用匿评", Setting.host_name + "/homework_common/" + activity.id.to_s + "/alert_forbidden_anonymous_comment?user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s,:class => "postOptionLink",
:title => "匿评是同学之间的双盲互评过程:每个同学将评阅系统分配给他/她的若干个作品",:remote => true)%>
<% end %>
<% if (activity.anonymous_comment == 1 && activity.is_open == 0) || (activity.anonymous_comment == 0 && comment_status == 3 && activity.is_open == 0) %>
- <%= link_to("公开作品", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
+ <%= link_to("公开作品", Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "/alert_open_student_works?is_in_course=-1&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s,:class => "postOptionLink", :remote => true)%>
<% elsif activity.is_open == 1 %>
- <%= link_to("取消公开", alert_open_student_works_homework_common_path(activity,:user_activity_id => user_activity_id, :is_in_course => -1,:course_activity=>course_activity),:class => "postOptionLink", :remote => true)%>
+ <%= link_to("取消公开", Setting.protocol + "://" + Setting.host_name + "/homework_common/" + activity.id.to_s + "/alert_open_student_works?is_in_course=-1&user_activity_id=" + user_activity_id.to_s + "&course_activity=" + course_activity.to_s,:class => "postOptionLink", :remote => true)%>
<% end %>
@@ -356,7 +346,7 @@
<%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
- 发送
+ 发送
<% end%>
diff --git a/app/views/organizations/_org_course_message.html.erb b/app/views/organizations/_org_course_message.html.erb
index 4873fbba9..9a9943e9b 100644
--- a/app/views/organizations/_org_course_message.html.erb
+++ b/app/views/organizations/_org_course_message.html.erb
@@ -12,13 +12,13 @@
<%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% end %>
TO
- <%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
+ <%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_url_in_org(activity.course.id), :class => "newsBlue ml15 mr5"%>
<% if activity.parent_id.nil? %>
- <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey" %>
+ <%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :class=> "postGrey" %>
<% else %>
- <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "postGrey"%>
+ <%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board_id, activity.id), :class=> "postGrey"%>
<% end %>
<% if activity.sticky == 1%>
diff --git a/app/views/organizations/_org_course_news.html.erb b/app/views/organizations/_org_course_news.html.erb
index 3da0887ed..7f50b3725 100644
--- a/app/views/organizations/_org_course_news.html.erb
+++ b/app/views/organizations/_org_course_news.html.erb
@@ -1,123 +1,123 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
-
-
-
- <% if @ctivity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% end %> TO
- <%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_path(activity.course), :class => "newsBlue ml15" %>
-
-
- <%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
-
- <% if activity.sticky == 1%>
-
置顶
- <% end%>
-
-
- 发布时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
-
-
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
- <% count=activity.comments.count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#= format_date(activity.updated_on) %>
- <%if count>3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.comments.reorder("created_on desc").each do |comment| %>
-
- <% replies_all_i = replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_url_in_org(comment.author_id), :alt => "用户头像" %>
-
-
-
- <% if comment.try(:author).try(:realname) == ' ' %>
- <%= link_to comment.try(:author), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(comment.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+
+
+
+ <% if @ctivity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %> TO
+ <%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_url_in_org(activity.course.id), :class => "newsBlue ml15" %>
+
+
+ <%= link_to activity.title.to_s, news_url_in_org(activity.id), :class => "postGrey" %>
+
+ <% if activity.sticky == 1%>
+
置顶
+ <% end%>
+
+
+ 发布时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
+
+
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+ <% count=activity.comments.count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#= format_date(activity.updated_on) %>
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.comments.reorder("created_on desc").each do |comment| %>
+
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_url_in_org(comment.author_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:author).try(:realname) == ' ' %>
+ <%= link_to comment.try(:author), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
diff --git a/app/views/organizations/_org_course_poll.html.erb b/app/views/organizations/_org_course_poll.html.erb
index c124e829f..cfd2fcb65 100644
--- a/app/views/organizations/_org_course_poll.html.erb
+++ b/app/views/organizations/_org_course_poll.html.erb
@@ -16,7 +16,7 @@
<%= link_to activity.try(:user).try(:realname), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %>
<% end %>
TO
- <%= link_to Course.find(activity.polls_group_id).name.to_s+" | 问卷", poll_index_path(:polls_type => "Course", :polls_group_id => activity.polls_group_id), :class => "newsBlue ml15" %>
+ <%= link_to Course.find(activity.polls_group_id).name.to_s+" | 问卷", Setting.protocol + "://" + Setting.host_name + "/poll?polls_type=Course&polls_group_id=" + activity.polls_group_id.to_s, :class => "newsBlue ml15" %>
diff --git a/app/views/organizations/_org_left_subfield_list.html.erb b/app/views/organizations/_org_left_subfield_list.html.erb
index 449d95f4c..3db6ffb13 100644
--- a/app/views/organizations/_org_left_subfield_list.html.erb
+++ b/app/views/organizations/_org_left_subfield_list.html.erb
@@ -34,71 +34,76 @@
})
})
-<% org_activity_field = organization.org_subfields.where('field_type="default" and name="activity" and field_type="default"').first %>
-<% org_course_field = organization.org_subfields.where('field_type="default" and name="course" and field_type="default"').first %>
-<% org_project_field = organization.org_subfields.where('field_type="default" and name="project" and field_type="default"').first %>
-
-
-
-
-
-
-
-
-
-<% organization.org_subfields.where("field_type != 'default'").each do |field| %>
-
+
+ <% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/organizations/_org_members.html.erb b/app/views/organizations/_org_members.html.erb
index 53618fc92..b846b940f 100644
--- a/app/views/organizations/_org_members.html.erb
+++ b/app/views/organizations/_org_members.html.erb
@@ -14,7 +14,7 @@
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :width => 32, :height => 32)) %>
<%= l(:label_username)%>
- <%= link_to(member.user.show_name, user_path(member.user),:class => "ml5 c_blue02") %>
+ <%= link_to(member.user.show_name, user_url_in_org(member.user_id),:class => "ml5 c_blue02") %>
身份:<%= member.user.admin_of_org?(organization)?"组织管理员":"组织成员" %>
<% if member.created_at %>
<%= format_time(member.created_at) %>
diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb
index 782412e43..9b7dbfa8f 100644
--- a/app/views/organizations/_org_project_issue.html.erb
+++ b/app/views/organizations/_org_project_issue.html.erb
@@ -1,141 +1,141 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
-
-
-
- <% if activity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% end %> TO
- <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%>
-
-
- <%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %>
-
- <%#= get_issue_priority(activity.priority_id)[1] %>
-
-
-
-
指派给
- <% unless activity.assigned_to_id.nil? %>
- <% if activity.try(:assigned_to).try(:realname) == ' ' %>
- <%= link_to activity.try(:assigned_to), user_url_in_org(activity.assigned_to_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:assigned_to).try(:realname), user_url_in_org(activity.assigned_to_id), :class => "newsBlue mr15" %>
- <% end %>
- <% end %>
-
-
- 发布时间:
- <%=format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
-
-
-
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
- <% count = activity.journals.count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#= format_date(activity.updated_on) %>
- <% if count > 3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.journals.reorder("created_on desc").each do |reply| %>
-
- <% replies_all_i=replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_url_in_org(reply.user_id), :alt => "用户头像" %>
-
-
-
- <% if reply.try(:user).try(:realname) == ' ' %>
- <%= link_to reply.try(:user), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:user).try(:realname), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(reply.created_on) %>
-
- <% if reply.user == User.current %>
- 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
- <% end %>
-
-
-
- <% if reply.details.any? %>
- <% details_to_strings(reply.details).each do |string| %>
-
<%= string %>
- <% end %>
- <% end %>
-
<%= reply.notes.nil? ? "" : reply.notes.html_safe %>
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => add_journal_in_org_issue_path(activity.id),:method => "post", :remote => true) do |f|%>
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %> TO
+ <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_url_in_org(activity.project.id), :class => "newsBlue ml15"%>
+
+
+ <%= link_to activity.subject.to_s, issue_url_in_org(activity.id), :class => "postGrey" %>
+
+ <%#= get_issue_priority(activity.priority_id)[1] %>
+
+
+
+
指派给
+ <% unless activity.assigned_to_id.nil? %>
+ <% if activity.try(:assigned_to).try(:realname) == ' ' %>
+ <%= link_to activity.try(:assigned_to), user_url_in_org(activity.assigned_to_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:assigned_to).try(:realname), user_url_in_org(activity.assigned_to_id), :class => "newsBlue mr15" %>
+ <% end %>
+ <% end %>
+
+
+ 发布时间:
+ <%=format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
+
+
+
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+ <% count = activity.journals.count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#= format_date(activity.updated_on) %>
+ <% if count > 3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.journals.reorder("created_on desc").each do |reply| %>
+
+ <% replies_all_i=replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_url_in_org(reply.user_id), :alt => "用户头像" %>
+
+
+
+ <% if reply.try(:user).try(:realname) == ' ' %>
+ <%= link_to reply.try(:user), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:user).try(:realname), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(reply.created_on) %>
+
+ <% if reply.user == User.current %>
+ 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
+ <% end %>
+
+
+
+ <% if reply.details.any? %>
+ <% details_to_strings(reply.details).each do |string| %>
+
<%= string %>
+ <% end %>
+ <% end %>
+
<%= reply.notes.nil? ? "" : reply.notes.html_safe %>
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => add_journal_in_org_issue_path(activity.id),:method => "post", :remote => true) do |f|%>
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
+
diff --git a/app/views/organizations/_project_create.html.erb b/app/views/organizations/_project_create.html.erb
index e13f4128b..5003fd0e2 100644
--- a/app/views/organizations/_project_create.html.erb
+++ b/app/views/organizations/_project_create.html.erb
@@ -3,21 +3,21 @@
- <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user), :alt => "用户头像" %>
+ <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user.id), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => user} %>
<% if user.try(:realname) == ' ' %>
- <%= link_to user, user_url_in_org(user), :class => "newsBlue mr15" %>
+ <%= link_to user, user_url_in_org(user.id), :class => "newsBlue mr15" %>
<% else %>
- <%= link_to user.try(:realname), user_url_in_org(user), :class => "newsBlue mr15" %>
+ <%= link_to user.try(:realname), user_url_in_org(user.id), :class => "newsBlue mr15" %>
<% end %>
TO
- <%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %>
+ <%= link_to project.to_s+" | 项目", project_url_in_org(project.id), :class => "newsBlue ml15" %>
- <%= link_to project.name, project_path(project.id,:host=>Setting.host_course), :class => "postGrey" %>
+ <%= link_to project.name, project_url_in_org(project.id), :class => "postGrey" %>
创建时间:<%= format_time(project.created_on) %>
diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb
index 99a067dfb..a818939d6 100644
--- a/app/views/organizations/_project_message.html.erb
+++ b/app/views/organizations/_project_message.html.erb
@@ -1,136 +1,135 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
-
-
-
- <% if activity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% end %>
- TO
- <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%>
-
-
-
- <% if activity.parent_id.nil? %>
- <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
- %>
- <% else %>
- <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
- %>
- <% end %>
-
-
- 发帖时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
-
-
- <% if activity.parent_id.nil? %>
- <% content = activity.content%>
- <% else %>
- <% content = activity.parent.content%>
- <% end %>
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
- <% count = 0 %>
- <% if activity.parent %>
- <% count=activity.parent.children.count%>
- <% else %>
- <% count=activity.children.count%>
- <% end %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#=format_date(activity.updated_on)%>
- <%if count>3 %>
-
- <% end %>
-
-
- <% activity= activity.parent_id.nil? ? activity : activity.parent %>
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.children.reorder("created_on desc").each do |reply| %>
-
- <% replies_all_i=replies_all_i+1 %>
-
-
- <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
-
-
-
- <% if reply.try(:author).try(:realname) == ' ' %>
- <%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(reply.created_on) %>
-
- <% if reply.author == User.current %>
- 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
- <% end %>
-
-
-
- <%= reply.content.html_safe %>
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
-
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %>
+ TO
+ <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_url_in_org(activity.project.id), :class => "newsBlue ml15 mr5"%>
+
+
+
+ <% if activity.parent_id.nil? %>
+ <%= link_to activity.subject.to_s.html_safe, board_message_url_in_org(activity.board.id,activity.id), :class=> "postGrey"
+ %>
+ <% else %>
+ <%= link_to activity.parent.subject.to_s.html_safe, board_message_url_in_org(activity.board.id,activity.id), :class=> "postGrey" %>
+ <% end %>
+
+
+ 发帖时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
+
+
+ <% if activity.parent_id.nil? %>
+ <% content = activity.content%>
+ <% else %>
+ <% content = activity.parent.content%>
+ <% end %>
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+ <% count = 0 %>
+ <% if activity.parent %>
+ <% count=activity.parent.children.count%>
+ <% else %>
+ <% count=activity.children.count%>
+ <% end %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#=format_date(activity.updated_on)%>
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% activity= activity.parent_id.nil? ? activity : activity.parent %>
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.children.reorder("created_on desc").each do |reply| %>
+
+ <% replies_all_i=replies_all_i+1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
+
+
+
+ <% if reply.try(:author).try(:realname) == ' ' %>
+ <%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(reply.created_on) %>
+
+ <% if reply.author == User.current %>
+ 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
+ <% end %>
+
+
+
+ <%= reply.content.html_safe %>
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
+
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
+
diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb
index ed6e1e092..e3ed492a0 100644
--- a/app/views/organizations/_show_org_document.html.erb
+++ b/app/views/organizations/_show_org_document.html.erb
@@ -1,152 +1,152 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(document.creator_id) %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(document.creator_id)} %>
-
-
-
- <%= link_to User.find(document.creator_id), user_url_in_org(document.creator.id), :class => "newsBlue mr15" %>
- TO <%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %>
- |
- <%= document.org_subfield_id.nil? ? "组织文章" :"#{OrgSubfield.find(document.org_subfield_id).name}" %>
-
-
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
-
- 发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>
-
-
- 更新时间:<%= format_time(OrgActivity.where("org_act_type='#{document.class}' and org_act_id =#{document.id}").first.updated_at) %>
-
-
- <% unless document.content.blank? %>
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>document.id, :content=>document.content} %>
- <% end %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => document} %>
-
-
- <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id)) || User.current.id == document.creator_id %>
-
-
-
-
-
- <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => document.organization_id, :home_id => document.id, :show_homepage => 1}, :method => "put", :remote => true) do |f| %>
- 设为首页
- <% end %>
-
-
- <%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => flag, :org_subfield_id => params[:org_subfield_id] ), :class => "postOptionLink" %>
-
-
- <%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete',
- :data => {:confirm => l(:text_are_you_sure)},
- :remote => true, :class => 'postOptionLink' %>
-
-
-
-
-
-
- <% end %>
-
-
- <% comments_for_doc = document.children.reorder("created_at desc") %>
- <% count = document.children.count() %>
-
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if document.creator_id.to_i == User.current.id.to_i %>
- 赞 <%= get_praise_num(document) > 0 ? "(#{get_praise_num(document)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>document, :user_activity_id=>document.id,:type=>"activity"}%>
- <% end %>
-
-
- <% if count > 3 %>
-
- <% end %>
-
-
-
- <% reply_id = 0 %>
- <% comments_for_doc.each do |comment| %>
- <% reply_id += 1 %>
-
- <%= link_to image_tag(url_to_avatar(User.find(comment.creator_id)), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_id) %>
-
-
- <%= link_to User.find(comment.creator_id), user_url_in_org(comment.creator_id), :class => "newsBlue mr10 f14" %>
- <%= format_activity_day(comment.created_at) %> <%= format_time(comment.created_at, false) %>
-
-
- <% unless comment.content.blank? %>
-
<%= comment.content.html_safe %>
- <% end %>
-
-
-
- <% end %>
-
-
-
-
- <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current) %>
-
-
-
- <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %>
-
-
-
-
发送
-
-
-
- <% end %>
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb
index eed0dabf6..0d490df77 100644
--- a/app/views/organizations/_subfield_list.html.erb
+++ b/app/views/organizations/_subfield_list.html.erb
@@ -1,4 +1,5 @@
+ 顺序
已有栏目
状态
类型
@@ -6,48 +7,64 @@
-<% default_fields.each do |field| %>
- <% name = get_default_name(field) %>
-
-<% end %>
-
<% subfields.each do |field| %>
-
-
- <%= field.name %>
-
-
-
-
- 新增
- <%= field.field_type == "Post" ? "帖子" : "资源" %>
-
- <% if Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 %>
-
- <%= field.subfield_subdomain_dir.nil? ? '未设置': field.subfield_subdomain_dir.name %>
+ <% if is_default_field?(field) %>
+ <% name = get_default_name(field) %>
+
+ <% else %>
+
+
+
+ <%= field.priority %>
+
+
+
+
+
+
+ <%= field.name %>
+
+
- <% else %>
-
- <%= field.subfield_subdomain_dir.nil? ? '未设置': field.subfield_subdomain_dir.name %>
+
+
新增
+
<%= field.field_type == "Post" ? "帖子" : "资源" %>
+
+ <% if Secdomain.where("sub_type=2 and pid=?", @organization.id).count > 0 %>
+
+ <%= field.subfield_subdomain_dir.nil? ? '未设置': field.subfield_subdomain_dir.name %>
+
+ <% else %>
+
+ <%= field.subfield_subdomain_dir.nil? ? '未设置': field.subfield_subdomain_dir.name %>
+
+ <% end %>
+
+
- <% end %>
-
-
-
-
- <%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %>
-
<%= field.hide==0?"设为隐藏":"设为可见" %>
- <%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %>
-
编辑
+
+ <%#= link_to "隐藏", hide_org_subfield_organizations_path(field), :method => 'post', :remote => true, :id => "hide_#{field.id}", :class => "linkBlue fr mr5" %>
+
<%= field.hide==0?"设为隐藏":"设为可见" %>
+ <%= link_to "删除", org_subfield_path(field), :method => 'delete', :remote => true, :confirm => "您确定删除吗?", :class => "linkBlue fr mr10" %>
+
编辑
-
-
+
+
+ <% end %>
<% end %>
+<% unless @project.repositories.any? %>
+
温馨提示:<%= l(:label_repository_no_data) %>
+<% end %>
<%= str = error_messages_for 'repository' %>
<% project_path_cut = RepositoriesHelper::PROJECT_PATH_CUT %>
<% ip = RepositoriesHelper::REPO_IP_ADDRESS %>
@@ -87,8 +90,6 @@
<% end %>
-<% else %>
-
温馨提示:<%= l(:label_repository_no_data) %>
<% end %>
diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb
index a58aeb281..f2b6cadeb 100644
--- a/app/views/projects/show.html.erb
+++ b/app/views/projects/show.html.erb
@@ -18,7 +18,7 @@
<%= link_to "问题动态", {:controller => "projects", :action => "show", :type => "issue"}, :class => "homepagePostTypeMessage postTypeGrey" %>
<%= link_to "新闻动态", {:controller => "projects", :action => "show", :type => "news"}, :class => "homepagePostTypeNotice postTypeGrey" %>
-
+
<%= link_to "资源库动态", {:controller => "projects", :action => "show", :type => "attachment"}, :class => "homepagePostTypeResource resourcesGrey" %>
<%= link_to "讨论区动态", {:controller => "projects", :action => "show", :type => "message"}, :class => "homepagePostTypeForum postTypeGrey" %>
diff --git a/app/views/users/_import_resource_info.html.erb b/app/views/users/_import_resource_info.html.erb
index bc1152ce4..4ea56ad9f 100644
--- a/app/views/users/_import_resource_info.html.erb
+++ b/app/views/users/_import_resource_info.html.erb
@@ -26,11 +26,14 @@
公共资源
我的资源
<% end %>
- <%#= form_tag( url_for(:controller => 'users', :action => 'import_resources_search', :id => User.current.id, :type => 1),
- :remote => true , :method => 'get', :id => 'resource_search_form') do %>
+
+ <%=render :partial=>'users/user_import_resource_search', :locals => {:type => @type, :search => ''} %>
+
+
- <%#= hidden_field_tag(:type,type.nil? ? 1 : type) %>
- <%# end %>
+
+
+
@@ -42,25 +45,10 @@
上传者
上传时间
- <%= 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| %>
-
- <% end %>
- <% end %>
+
+ <%= render :partial => 'users/user_import_resource_list',:locals => {:project_id => params[:project_id], :subfield_file_id => params[:subfield_file_id], :course_id => params[:course_id]} %>
+
+
diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb
index f679f9c8c..a545038f1 100644
--- a/app/views/users/_resources_list.html.erb
+++ b/app/views/users/_resources_list.html.erb
@@ -16,7 +16,7 @@
<%= attach.quotes.nil? ? 0 : attach.quotes %>
<%= attach.downloads %>
<%= attach.author_id %>
- <%= number_to_human_size(attach.filesize) %>
+ <%= (number_to_human_size(attach.filesize)).gsub("ytes", "") %>
<%=User.find(attach.author_id).realname.blank? ? User.find(attach.author_id).nickname : User.find(attach.author_id).realname %>
<%= get_resource_type(attach.container_type)%>
<%= get_resource_origin(attach) %>
diff --git a/app/views/users/_show_detail_info.html.erb b/app/views/users/_show_detail_info.html.erb
index 3ebcab21e..7d4919149 100644
--- a/app/views/users/_show_detail_info.html.erb
+++ b/app/views/users/_show_detail_info.html.erb
@@ -21,18 +21,18 @@
-
<%= link_to User.watched_by(user.id).count, {:controller=>"users", :action=>"user_watchlist",:id=>user.id}, :class => 'homepageImageNumber',:target => "_blank" %>
-
<%= link_to '关注',{:controller=>"users", :action=>"user_watchlist",:id=>user.id},:target => "_blank" %>
+
<%= link_to User.watched_by(user.id).count, user_watchlist_url_in_org(user.id), :class => 'homepageImageNumber',:target => "_blank" %>
+
<%= link_to '关注',user_watchlist_url_in_org(user.id),:target => "_blank" %>
-
<%= link_to user.watcher_users.count,{:controller=>"users", :action=>"user_fanslist",:id=>user.id}, :class => "homepageImageNumber fans_count_#{user.id}",:target => "_blank" %>
-
<%= link_to '粉丝', {:controller=>"users", :action=>"user_fanslist",:id=>user.id},:target => "_blank" %>
+
<%= link_to user.watcher_users.count,user_fanslist_url_in_org(user.id), :class => "homepageImageNumber fans_count_#{user.id}",:target => "_blank" %>
+
<%= link_to '粉丝', user_fanslist_url_in_org(user.id),:target => "_blank" %>
-
<%= link_to user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count, user_blogs_path(user), :class => 'homepageImageNumber',:target => "_blank" %>
-
<%= link_to '博客', user_blogs_path(user),:target => "_blank" %>
+
<%= link_to user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count, user_blogs_url_in_org(user.id), :class => 'homepageImageNumber',:target => "_blank" %>
+
<%= link_to '博客', user_blogs_url_in_org(user.id),:target => "_blank" %>
<% if User.current != user %>
@@ -40,8 +40,8 @@
<%= render :partial => 'users/watch_btn_for_picture', :locals => {:user => user} %>
- <%= link_to "留言", feedback_path(user), :class => 'greyBtn fr', :target => "_blank" %>
- <%= link_to "私信", feedback_path(user), :class => 'greyBtn fr', :style => 'margin-right:20px;', :target => "_blank" %>
+ <%= link_to "留言", feedback_url_in_org(user.id), :class => 'greyBtn fr', :target => "_blank" %>
+ <%= link_to "私信", feedback_url_in_org(user.id), :class => 'greyBtn fr', :style => 'margin-right:20px;', :target => "_blank" %>
<% end %>
diff --git a/app/views/users/_user_import_resource_list.html.erb b/app/views/users/_user_import_resource_list.html.erb
new file mode 100644
index 000000000..af4f951e0
--- /dev/null
+++ b/app/views/users/_user_import_resource_list.html.erb
@@ -0,0 +1,19 @@
+<%= form_tag( url_for({:controller => 'users', :action => 'import_into_container',
+ :mul_id => project_id.nil? ? (course_id.nil? ? subfield_file_id : course_id) : project_id,
+ :mul_type => project_id.nil? ? (course_id.nil? ? "SubfieldFile" : "Course") : "Project"}),
+ :method => 'post', :id => 'resource_import_container_form') do %>
+ <% @attachments.each do |attach| %>
+
+ <% end %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_import_resource_search.html.erb b/app/views/users/_user_import_resource_search.html.erb
new file mode 100644
index 000000000..b048675dd
--- /dev/null
+++ b/app/views/users/_user_import_resource_search.html.erb
@@ -0,0 +1,29 @@
+
+
\ No newline at end of file
diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb
index 458ba4551..3b035179b 100644
--- a/app/views/users/_user_message_course.html.erb
+++ b/app/views/users/_user_message_course.html.erb
@@ -1,707 +1,707 @@
-<% if ma.class == CourseMessage %>
- <% if ma.course_message_type == "News" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author) %>
- <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">发布了通知:
-
- <%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id },
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
标题: <%= ma.course_message.title %>
- <% unless ma.course_message.description.nil? %>
-
内容:
-
<%= ma.course_message.description.html_safe %>
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "Comment" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
- <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">评论了通知:
-
- <%= link_to ma.course_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
评论对象: <%= ma.course_message.commented.title %>
- <% unless ma.course_message.comments.nil? %>
-
评论内容:
-
<%= ma.course_message.comments.html_safe %>
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil?%>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">发布了课程作业:
-
-
- <% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %>
- <%= link_to "作业标题:" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id),
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
-
-
- <% else %>
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
- :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
-
-
- <% end %>
-
-
- <% if User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
-
- <%= User.current.lastname + User.current.firstname %>老师您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.show_name + "老师")%>刚刚发布了一个作业:
-
-
- 课程名称:<%= ma.course_message.course.name %>
- (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 发布时间:<%= DateTime.parse(ma.course_message.created_at.to_s).strftime('%Y-%m-%d %H:%M').to_s %>
- 提交截止:<%= ma.course_message.end_time %> 23:59
- 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
- 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
- 迟交扣分:<%= ma.course_message.late_penalty %>分
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
-
-
- 您可以修改作业内容、评分规则、匿评过程等,谢谢!
-
- <% else %>
-
<%= User.current.lastname + User.current.firstname %>同学您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业:
-
- 课程名称:<%= ma.course_message.course.name %>
- (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 提交截止:<%= ma.course_message.end_time %> 23:59
- 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
- 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
- 迟交扣分:<%= ma.course_message.late_penalty %>分
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
-
-
- 请抓紧时间提交您的作品,谢谢!
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + '老师',
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :title => "#{ma.course_message.user.lastname + ma.course_message.user.firstname}老师" %>
- ">发布的作业:
-
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
- :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
- <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
-
- <%= User.current.lastname + User.current.firstname %>同学您好!
- <%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 提交截止:<%= ma.course_message.end_time %> 23:59
- 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
- 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
- 迟交扣分:<%= ma.course_message.late_penalty %>分
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
- 请抓紧时间提交您的作品,谢谢!
-
- <% end %>
-
- 截止时间快到啦
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
-
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
-
- <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">启动了作业匿评:
-
-
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师' : '同学' %>您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>开启了匿评,作业详情如下:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
- 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
-
- <% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
-
请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。
-
例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分
- <% end%>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">关闭了作业匿评:
-
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
- 该作业已经关闭了匿评。作业信息如下:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
-
-
-
注:缺省情况下,系统将在作业提交截止日期后14天自动关闭匿评。
-
- <% if User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
-
祝您的教学活动高效、顺利、愉快!
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 %>
-
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
-
- <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">启动作业匿评失败
-
-
- <%= link_to truncate(ma.course_message.name,:length=>25)+'(失败原因:提交作品的人数低于2人)', student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "c_red" : "newsGrey "}" %>
-
-
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
- <%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败啦
-
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年' + ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 提交截止:<%= ma.course_message.end_time%> 23:59
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "Poll" %>
-
- <% end %>
- <% if ma.course_message_type == "Message" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
-
- <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">
- <%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %>
- <% if ma.course_message.parent_id.nil? %>
-
- <%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
主题: <%= ma.course_message.subject %>
- <% unless ma.course_message.content.nil? %>
-
内容:
-
<%= ma.course_message.content.html_safe %>
- <% end %>
-
- <% else %>
-
- <%= link_to ma.course_message.content.html_safe, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
主题: <%= ma.course_message.subject %>
- <% unless ma.course_message.content.nil? %>
-
内容:
-
<%= ma.course_message.content.html_safe %>
- <% end %>
-
- <% end %>
- <%= time_tag(ma.created_at).html_safe %>
-
-
- <% end %>
- <% if ma.course_message_type == "StudentWorksScore" %>
-
-
- <% if ma.course_message.reviewer_role == 3 %>
- <%=link_to image_tag(url_to_avatar(""), :width => "30", :height => "30") %>
- <% else %>
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
- <% end %>
-
-
- <% if ma.course_message.reviewer_role == 3 %>
- 匿名用户
- <% else %>
- <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- <% end %>
- ">
- <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %>
-
-
-
- <% unless ma.content.nil? %>
- <%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id),
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
- <%= User.current.show_name %>同学您好!
- <%= ma.course_message.reviewer_role == 3? "匿名用户" : (ma.course_message.user.show_name + "老师")%><%= ma.status == 0? "评阅了您的作品":"重新评阅了您的作品"%>。详情如下:
-
-
- 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
- 作业标题:<%=ma.course_message.student_work.homework_common.name %>
- <% content = ma.content.gsub("作业评分:","").split(" 评语:")%>
- 作品评分:<%= content[0] %>分
- <% if content.size > 1 %>
-
作品评语:
- <%= content[1] %>
- <% end %>
-
-
- 本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %> 23:59结束匿评,到时您将可以看到所有其他同学的作品啦!大家可以进一步互相学习。 期待您取得更大的进步!
-
-
- <% end %>
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "JournalsForMessage" %>
- <% if ma.course_message.jour_type == 'Course' %>
- <% if params[:type] != 'homework' %>
-
- <% end %>
- <% else %>
-
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
-
- <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname +
- "#{ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"}",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">回复了作品评论:
-
-
- <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
-
- <%= User.current.show_name %>老师您好!
- <%= ma.course_message.user.show_name%><%= ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"%>回复了您的作品评论。详情如下:
-
-
- 回复内容:<%= ma.course_message.notes %>
- 您的评论:<%= ma.course_message.jour.comment %>
- 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
- 作业标题:<%=ma.course_message.jour.student_work.homework_common.name %>
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% end %>
-
- <% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? %>
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.homework_common.user), :width => "30", :height => "30"), user_path(ma.course_message.homework_common.user) %>
-
- <%=link_to ma.course_message.homework_common.user.show_name+"老师", user_path(ma.course_message.homework_common.user), :class => "newsBlue homepageNewsPublisher" %>
- ">发布的作业:
-
-
- <%= link_to "作业标题:" + ma.course_message.homework_common.name, student_work_index_path(:homework => ma.course_message.homework_common_id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
-
- <%= User.current.lastname + User.current.firstname %>
- <%= User.current.allowed_to?(:as_teacher,ma.course_message.homework_common.course) ? '老师':'同学'%>您好!由于迟交作业,您及您的作品都不能参与以下作业的匿评。作业详情如下:
-
-
- 课程名称:<%= ma.course_message.homework_common.course.name %>(<%= ma.course_message.homework_common.course.time.to_s + '年' + ma.course_message.homework_common.course.term %>)
- 作业标题:<%= ma.course_message.homework_common.name %>
- 提交截止:<%= ma.course_message.homework_common.end_time %> 23:59
- 提交时间:<%= format_time(ma.course_message.created_at) %>
- 迟交扣分:<%= ma.course_message.homework_common.late_penalty %>分
-
-
如需获得最终成绩,请您联系主讲老师对您的作品进行单独评分!
-
- 您成功提交了作品(但被标记为迟交啦)
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "Course" %>
-
-
- <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
-
-
- 系统提示
- ">您成功创建了课程:
-
-
- <%= link_to "课程名称:" + ma.course_message.name, course_path(ma.course_message),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
- <%= User.current.lastname + User.current.firstname %>老师您好!您成功创建了一个课程,详情如下:
-
-
课程名称:<%= ma.course_message.name %>
-
开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %>
-
课程ID:<%= ma.course_message.id %>
-
课程密码:<%= ma.course_message.password %>
-
学时总数:<%= ma.course_message.class_period %>
-
创建时间:<%= format_time(ma.course_message.created_at) %>
-
您可以点击左上角的“配置”按钮,修改课程基本信息,添加及删除课程成员。您也可以把课程ID及密码告诉学生和其他成员,让他们输入ID及密码加入课程。
- <% if ma.course_message.is_public %>
-
您的课程是公开的,所有人都能访问您的课程。若不想设置为公开,您可以在配置中设置。
- <% else %>
-
您的课程是私有的,非课程成员不能访问您的课程。如果想设置为公开,您可以在配置中设置。
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "JoinCourseRequest" %>
-
- <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
-
- 系统提示
- ">您有了新的课程成员申请:
-
-
- <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
-
- <%= User.current.lastname + User.current.firstname %>老师您好!您有了新的课程成员申请,信息如下:
-
-
真实姓名:<%= User.find(ma.course_message_id).realname %>
-
申请课程:<%= Course.find(ma.course_id).name%>
-
课程描述:
-
<%= Course.find(ma.course_id).description.html_safe %>
-
申请职位:<%= ma.content == '9' ? "教师" : "教辅"%>
-
-
-
- <% if ma.status == 0 || ma.status.nil?%>
- <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%>
- |
- <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%>
- <% elsif ma.status == 1%>
- 您已经同意了该申请
- <% elsif ma.status == 2%>
- 您已经拒绝了该申请
- <%end %>
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "CourseRequestDealResult" %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "JoinCourse" and ma.status == 0 %>
-
-
- <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
-
-
- <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
- ">将您加入了课程:
-
-
- <%= link_to ma.course.name, course_member_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
- <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
- <% teacher = User.find(ma.course_message_id) %>
-
<%= teacher.show_name %>(<%= teacher %>)老师把您加入了课程,详情如下:
-
课程名称:<%= ma.course.name %>
-
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
-
课程ID:<%= ma.course.id %>
-
课时总数:<%= ma.course.class_period %>
- <% else %>
-
- 您已经被移出该私有课程,非课程成员没有权限访问私有课程
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
-
-
- <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
-
-
- 系统提示
- ">您增加了新的课程成员:
-
-
- <%= link_to User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")", user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
- <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
-
您增加了新的课程成员,详情如下:
-
成员:<%= User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")" %>
-
课程名称:<%= ma.course.name %>
-
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
-
课程ID:<%= ma.course.id %>
-
课时总数:<%= ma.course.class_period %>
- <% else %>
-
- 您已经被移出该私有课程,非课程成员没有权限访问私有课程
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "RemoveFromCourse" %>
-
-
- <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
-
-
- <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
- ">将您移出了课程:
-
-
- <%= link_to ma.course.name, member_course_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
- <% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %>
-
您已被<%= User.find(ma.course_message_id).show_name %>老师移出了课程,详情如下:
-
课程名称:<%= ma.course.name %>
-
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
- <% if !ma.content.nil? %>
-
担任角色:<%= ma.content %>
- <% end %>
-
学时总数:<%= ma.course.class_period %>
- <% else %>
-
- 您已经被移出该私有课程,非课程成员没有权限访问私有课程
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "Exercise" && ma.status == 2 %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布了课程测验 :
-
- <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布了课程测验 ,测验详情如下:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 测验标题:<%= ma.course_message.exercise_name %>
-
-
-
-
-
- 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
- 答题时长:<%= ma.course_message.time == -1 ? '不限时' : ma.course_message.time.to_s + '分钟' %>
- <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
- 请记得在截止时间前完成测验噢,辛苦啦!
- <% end %>
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "Exercise" && ma.status == 3 %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布的测验:
-
- <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
-
-
-
-
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布的课程测验截止时间快到了,测验详情如下:
-
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 测验标题:<%= ma.course_message.exercise_name %>
- 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
- 答题时长:<%= ma.course_message.time == -1 ? '无限制' : ma.course_message.time.to_s + '分钟' %>
- 请及时完成课程测验,辛苦啦!
-
-
- 截止时间快到啦
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
+<% if ma.class == CourseMessage %>
+ <% if ma.course_message_type == "News" %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author) %>
+ <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">发布了通知:
+
+ <%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id },
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
标题: <%= ma.course_message.title %>
+ <% unless ma.course_message.description.nil? %>
+
内容:
+
<%= ma.course_message.description.html_safe %>
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "Comment" %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
+ <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">评论了通知:
+
+ <%= link_to ma.course_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
评论对象: <%= ma.course_message.commented.title %>
+ <% unless ma.course_message.comments.nil? %>
+
评论内容:
+
<%= ma.course_message.comments.html_safe %>
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil?%>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">发布了课程作业:
+
+
+ <% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %>
+ <%= link_to "作业标题:" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id),
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+ <% else %>
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
+ :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+ <% end %>
+
+
+ <% if User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
+
+ <%= User.current.lastname + User.current.firstname %>老师您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.show_name + "老师")%>刚刚发布了一个作业:
+
+
+ 课程名称:<%= ma.course_message.course.name %>
+ (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 发布时间:<%= DateTime.parse(ma.course_message.created_at.to_s).strftime('%Y-%m-%d %H:%M').to_s %>
+ 提交截止:<%= ma.course_message.end_time %> 23:59
+ 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+ 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+ 迟交扣分:<%= ma.course_message.late_penalty %>分
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+
+
+ 您可以修改作业内容、评分规则、匿评过程等,谢谢!
+
+ <% else %>
+
<%= User.current.lastname + User.current.firstname %>同学您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业:
+
+ 课程名称:<%= ma.course_message.course.name %>
+ (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 提交截止:<%= ma.course_message.end_time %> 23:59
+ 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+ 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+ 迟交扣分:<%= ma.course_message.late_penalty %>分
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+
+
+ 请抓紧时间提交您的作品,谢谢!
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + '老师',
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :title => "#{ma.course_message.user.lastname + ma.course_message.user.firstname}老师" %>
+ ">发布的作业:
+
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
+ :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+ <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
+
+ <%= User.current.lastname + User.current.firstname %>同学您好!
+ <%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 提交截止:<%= ma.course_message.end_time %> 23:59
+ 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+ 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+ 迟交扣分:<%= ma.course_message.late_penalty %>分
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+ 请抓紧时间提交您的作品,谢谢!
+
+ <% end %>
+
+ 截止时间快到啦
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
+
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+
+ <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">启动了作业匿评:
+
+
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师' : '同学' %>您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>开启了匿评,作业详情如下:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+ 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+
+ <% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
+
请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。
+
例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分
+ <% end%>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">关闭了作业匿评:
+
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
+ 该作业已经关闭了匿评。作业信息如下:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+
+
+
注:缺省情况下,系统将在作业提交截止日期后14天自动关闭匿评。
+
+ <% if User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
+
祝您的教学活动高效、顺利、愉快!
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 %>
+
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+
+ <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">启动作业匿评失败
+
+
+ <%= link_to truncate(ma.course_message.name,:length=>25)+'(失败原因:提交作品的人数低于2人)', student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "c_red" : "newsGrey "}" %>
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
+ <%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败啦
+
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年' + ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 提交截止:<%= ma.course_message.end_time%> 23:59
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "Poll" %>
+
+ <% end %>
+ <% if ma.course_message_type == "Message" %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
+
+ <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">
+ <%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %>
+ <% if ma.course_message.parent_id.nil? %>
+
+ <%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
主题: <%= ma.course_message.subject %>
+ <% unless ma.course_message.content.nil? %>
+
内容:
+
<%= ma.course_message.content.html_safe %>
+ <% end %>
+
+ <% else %>
+
+ <%= link_to ma.course_message.content.html_safe, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
主题: <%= ma.course_message.subject %>
+ <% unless ma.course_message.content.nil? %>
+
内容:
+
<%= ma.course_message.content.html_safe %>
+ <% end %>
+
+ <% end %>
+ <%= time_tag(ma.created_at).html_safe %>
+
+
+ <% end %>
+ <% if ma.course_message_type == "StudentWorksScore" %>
+
+
+ <% if ma.course_message.reviewer_role == 3 %>
+ <%=link_to image_tag(url_to_avatar(""), :width => "30", :height => "30") %>
+ <% else %>
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+ <% end %>
+
+
+ <% if ma.course_message.reviewer_role == 3 %>
+ 匿名用户
+ <% else %>
+ <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ <% end %>
+ ">
+ <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %>
+
+
+
+ <% unless ma.content.nil? %>
+ <%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id),
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+ <%= User.current.show_name %>同学您好!
+ <%= ma.course_message.reviewer_role == 3? "匿名用户" : (ma.course_message.user.show_name + "老师")%><%= ma.status == 0? "评阅了您的作品":"重新评阅了您的作品"%>。详情如下:
+
+
+ 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
+ 作业标题:<%=ma.course_message.student_work.homework_common.name %>
+ <% content = ma.content.gsub("作业评分:","").split(" 评语:")%>
+ 作品评分:<%= content[0] %>分
+ <% if content.size > 1 %>
+
作品评语:
+ <%= content[1] %>
+ <% end %>
+
+
+ 本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %> 23:59结束匿评,到时您将可以看到所有其他同学的作品啦!大家可以进一步互相学习。 期待您取得更大的进步!
+
+
+ <% end %>
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "JournalsForMessage" %>
+ <% if ma.course_message.jour_type == 'Course' %>
+ <% if params[:type] != 'homework' %>
+
+ <% end %>
+ <% else %>
+
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+
+ <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname +
+ "#{ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"}",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">回复了作品评论:
+
+
+ <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+
+ <%= User.current.show_name %>老师您好!
+ <%= ma.course_message.user.show_name%><%= ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"%>回复了您的作品评论。详情如下:
+
+
+ 回复内容:<%= ma.course_message.notes %>
+ 您的评论:<%= ma.course_message.jour.comment %>
+ 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
+ 作业标题:<%=ma.course_message.jour.student_work.homework_common.name %>
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% end %>
+
+ <% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? %>
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.homework_common.user), :width => "30", :height => "30"), user_path(ma.course_message.homework_common.user) %>
+
+ <%=link_to ma.course_message.homework_common.user.show_name+"老师", user_path(ma.course_message.homework_common.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">发布的作业:
+
+
+ <%= link_to "作业标题:" + ma.course_message.homework_common.name, student_work_index_path(:homework => ma.course_message.homework_common_id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %>
+ <%= User.current.allowed_to?(:as_teacher,ma.course_message.homework_common.course) ? '老师':'同学'%>您好!由于迟交作业,您及您的作品都不能参与以下作业的匿评。作业详情如下:
+
+
+ 课程名称:<%= ma.course_message.homework_common.course.name %>(<%= ma.course_message.homework_common.course.time.to_s + '年' + ma.course_message.homework_common.course.term %>)
+ 作业标题:<%= ma.course_message.homework_common.name %>
+ 提交截止:<%= ma.course_message.homework_common.end_time %> 23:59
+ 提交时间:<%= format_time(ma.course_message.created_at) %>
+ 迟交扣分:<%= ma.course_message.homework_common.late_penalty %>分
+
+
如需获得最终成绩,请您联系主讲老师对您的作品进行单独评分!
+
+ 您成功提交了作品(但被标记为迟交啦)
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "Course" %>
+
+
+ <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
+
+
+ 系统提示
+ ">您成功创建了课程:
+
+
+ <%= link_to "课程名称:" + ma.course_message.name, course_path(ma.course_message),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %>老师您好!您成功创建了一个课程,详情如下:
+
+
课程名称:<%= ma.course_message.name %>
+
开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %>
+
课程ID:<%= ma.course_message.id %>
+
课程密码:<%= ma.course_message.password %>
+
学时总数:<%= ma.course_message.class_period %>
+
创建时间:<%= format_time(ma.course_message.created_at) %>
+
您可以点击左上角的“配置”按钮,修改课程基本信息,添加及删除课程成员。您也可以把课程ID及密码告诉学生和其他成员,让他们输入ID及密码加入课程。
+ <% if ma.course_message.is_public %>
+
您的课程是公开的,所有人都能访问您的课程。若不想设置为公开,您可以在配置中设置。
+ <% else %>
+
您的课程是私有的,非课程成员不能访问您的课程。如果想设置为公开,您可以在配置中设置。
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "JoinCourseRequest" %>
+
+ <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
+
+ 系统提示
+ ">您有了新的课程成员申请:
+
+
+ <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %>老师您好!您有了新的课程成员申请,信息如下:
+
+
真实姓名:<%= User.find(ma.course_message_id).realname %>
+
申请课程:<%= Course.find(ma.course_id).name%>
+
课程描述:
+
<%= Course.find(ma.course_id).description.html_safe %>
+
申请职位:<%= ma.content == '9' ? "教师" : "教辅"%>
+
+
+
+ <% if ma.status == 0 || ma.status.nil?%>
+ <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%>
+ |
+ <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%>
+ <% elsif ma.status == 1%>
+ 您已经同意了该申请
+ <% elsif ma.status == 2%>
+ 您已经拒绝了该申请
+ <%end %>
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "CourseRequestDealResult" %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "JoinCourse" and ma.status == 0 %>
+
+
+ <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
+
+
+ <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
+ ">将您加入了课程:
+
+
+ <%= link_to ma.course.name, course_member_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+ <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
+ <% teacher = User.find(ma.course_message_id) %>
+
<%= teacher.show_name %>(<%= teacher %>)老师把您加入了课程,详情如下:
+
课程名称:<%= ma.course.name %>
+
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
+
课程ID:<%= ma.course.id %>
+
课时总数:<%= ma.course.class_period %>
+ <% else %>
+
+ 您已经被移出该私有课程,非课程成员没有权限访问私有课程
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
+
+
+ <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
+
+
+ 系统提示
+ ">您增加了新的课程成员:
+
+
+ <%= link_to User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")", user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+ <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
+
您增加了新的课程成员,详情如下:
+
成员:<%= User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")" %>
+
课程名称:<%= ma.course.name %>
+
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
+
课程ID:<%= ma.course.id %>
+
课时总数:<%= ma.course.class_period %>
+ <% else %>
+
+ 您已经被移出该私有课程,非课程成员没有权限访问私有课程
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "RemoveFromCourse" %>
+
+
+ <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
+
+
+ <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
+ ">将您移出了课程:
+
+
+ <%= link_to ma.course.name, member_course_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+ <% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %>
+
您已被<%= User.find(ma.course_message_id).show_name %>老师移出了课程,详情如下:
+
课程名称:<%= ma.course.name %>
+
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
+ <% if !ma.content.nil? %>
+
担任角色:<%= ma.content %>
+ <% end %>
+
学时总数:<%= ma.course.class_period %>
+ <% else %>
+
+ 您已经被移出该私有课程,非课程成员没有权限访问私有课程
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "Exercise" && ma.status == 2 %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布了课程测验 :
+
+ <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布了课程测验 ,测验详情如下:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 测验标题:<%= ma.course_message.exercise_name %>
+
+
+
+
+
+ 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
+ 答题时长:<%= ma.course_message.time == -1 ? '不限时' : ma.course_message.time.to_s + '分钟' %>
+ <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
+ 请记得在截止时间前完成测验噢,辛苦啦!
+ <% end %>
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "Exercise" && ma.status == 3 %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布的测验:
+
+ <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
+
+
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布的课程测验截止时间快到了,测验详情如下:
+
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 测验标题:<%= ma.course_message.exercise_name %>
+ 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
+ 答题时长:<%= ma.course_message.time == -1 ? '无限制' : ma.course_message.time.to_s + '分钟' %>
+ 请及时完成课程测验,辛苦啦!
+
+
+ 截止时间快到啦
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_message_userfeedaback.html.erb b/app/views/users/_user_message_userfeedaback.html.erb
index 1f200eaed..894eedbfc 100644
--- a/app/views/users/_user_message_userfeedaback.html.erb
+++ b/app/views/users/_user_message_userfeedaback.html.erb
@@ -1,30 +1,30 @@
-<% if ma.class == UserFeedbackMessage %>
- <% if ma.journals_for_message_type == "JournalsForMessage" %>
-
-
- <%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"), user_path(ma.journals_for_message.user) %>
-
-
- <%=link_to ma.journals_for_message.user, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher" %>
- "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>
-
-
- <%= link_to ma.journals_for_message.notes.gsub("","").gsub("
","").gsub(" ","").html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}"%>
-
-
-
-
- <% if ma.journals_for_message.reply_id == 0 %>
- <%= ma.journals_for_message.notes.html_safe %>
- <% else %>
-
您的留言:
-
<%= JournalsForMessage.find(ma.journals_for_message.m_reply_id).notes.html_safe %>
-
回复内容:
-
<%= ma.journals_for_message.notes.html_safe %>
- <% end %>
-
- <%= time_tag(ma.journals_for_message.created_on).html_safe %>
-
-
- <% end %>
+<% if ma.class == UserFeedbackMessage %>
+ <% if ma.journals_for_message_type == "JournalsForMessage" %>
+
+
+ <%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"), user_path(ma.journals_for_message.user) %>
+
+
+ <%=link_to ma.journals_for_message.user, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>
+
+
+ <%= link_to ma.journals_for_message.notes.gsub("","").gsub("
","").gsub(" ","").html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}"%>
+
+
+
+
+ <% if ma.journals_for_message.reply_id == 0 %>
+ <%= ma.journals_for_message.notes.html_safe %>
+ <% else %>
+
您的留言:
+
<%= JournalsForMessage.find(ma.journals_for_message.m_reply_id).notes.html_safe %>
+
回复内容:
+
<%= ma.journals_for_message.notes.html_safe %>
+ <% end %>
+
+ <%= time_tag(ma.journals_for_message.created_on).html_safe %>
+
+
+ <% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb
index 6eddf1e05..bea78130a 100644
--- a/app/views/users/_user_resource_info.html.erb
+++ b/app/views/users/_user_resource_info.html.erb
@@ -1,21 +1,11 @@
- <%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type} %>
+ <%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type, :order => @order, :sort => @score, :status => @status} %>
-
-
- 资源名称
- 上传时间
- 引用数
- 下载数
- 大小
- 上传者
- 类别
- 来源
-
+<%= render :partial => 'users/user_resource_tip_list', :locals => { :type => @type, :status => @status} %>