Merge branch 'hjq_new_course' into develop

This commit is contained in:
huang 2016-03-25 16:32:21 +08:00
commit 2d23a357b8
55 changed files with 383 additions and 865 deletions

View File

@ -70,31 +70,16 @@ class BoardsController < ApplicationController
def show
# 讨论区消息状态更新(已读和未读)
if @project
query_forge_messages = @board.messages
query_forge_messages.each do |query_forge_message|
query = query_forge_message.forge_messages
query.each do |forge_message|
if User.current.id == forge_message.user_id
forge_message.update_attributes(:viewed => true)
end
end
end
ForgeMessage.where("user_id =? and project_id =? and viewed =?", User.current.id, @project.id, 0).update_all(:viewed => true)
# 更新@消息为已读
@project.boards.each do |board|
board.messages.each do |m|
User.current.at_messages.unviewed('Message', m.id).each {|x| x.viewed!}
end
end
# 注释掉这句是因为和上面的方法代码重复,一个类型的消息,已经更新就不需要再更新
# @project.boards.each do |board|
# board.messages.each do |m|
# User.current.at_messages.unviewed('Message', m.id).each {|x| x.viewed!}
# end
# end
elsif @course
query_course_messages = @board.messages
query_course_messages.each do |query_course_message|
query = query_course_message.course_messages
query.each do |course_message|
if User.current.id == course_message.user_id
course_message.update_attributes(:viewed => true)
end
end
end
CourseMessage.where("user_id =? and course_id =? and viewed =?", User.current.id, @course.id, 0).update_all(:viewed => true)
end
sort_init 'updated_on', 'desc'

View File

@ -852,7 +852,7 @@ class CoursesController < ApplicationController
# return
# end
# 统计访问量
@course.update_attribute(:visits, @course.visits.to_i + 1)
@course.update_column(:visits, @course.visits.to_i + 1)
#更新创建课程消息状态
create_course_messages = @course.course_messages.where("user_id =? and course_message_type =? and course_id =? and viewed =?", User.current.id, 'Course', @course.id, 0)
create_course_messages.update_all(:viewed => true)

View File

@ -458,10 +458,16 @@ class FilesController < ApplicationController
if params[:in_project_toolbar]
@in_project_toolbar = params[:in_project_toolbar]
end
# 发送邮件
attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type])
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
# 发送邮件
Mailer.run.attachments_added(attachments[:files])
# 生成动态
attachments[:files].each do |file|
ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment")
end
# 更新资源总数, 根据上传的附件数累加
@project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count) unless @project.project_score.nil?
end
# end
if params[:project_attachment_type] && params[:project_attachment_type].is_a?(Array)
@ -485,11 +491,6 @@ class FilesController < ApplicationController
end
end
end
# 更新资源总数, 根据上传的附件数累加
unless @project.project_score.nil?
@project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count)
end
# end
# TODO: 临时用 nyan
sort_init 'created_on', 'desc'
sort_update 'created_on' => "#{Attachment.table_name}.created_on",

View File

@ -37,16 +37,6 @@ class MessagesController < ApplicationController
# Show a topic and its replies
def show
=begin
if @course
topic_id = params[:r]?params[:r]:params[:id]
parent_id = params[:id]
url = course_boards_path(@course,:topic_id => topic_id,:parent_id=>parent_id);
redirect_to url
return;
end
=end
@isReply = true
page = params[:page]
# Find the page of the requested reply
@ -54,16 +44,7 @@ class MessagesController < ApplicationController
offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i])
page = 1 + offset / REPLIES_PER_PAGE
end
@reply_count = @topic.children.count
# @reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page
# @replies = @topic.children.
# includes(:author, :attachments, {:board => :project}).
# reorder("#{Message.table_name}.created_on DESC").
# limit(@reply_pages.per_page).
# offset(@reply_pages.offset).
# all
@reply = Message.new(:subject => "RE: #{@message.subject}")
if @course
messages_replies = @topic.children.

View File

@ -295,34 +295,32 @@ class ProjectsController < ApplicationController
def show
# 更新消息为已读
update_message_status(User.current, @project)
# over
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return
end
# 统计访问量
@project.update_attribute(:visits, @project.visits.to_i + 1)
@project.update_column(:visits, @project.visits + 1)
# over
@author = params[:user_id].blank? ? nil : User.active.find(params[:user_id])
@page = params[:page] ? params[:page].to_i + 1 : 0
# 根据私密性,取出符合条件的所有数据
if User.current.member_of?(@project) || User.current.admin?
case params[:type]
when nil
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'ProjectCreateInfo', 'Attachment')",@project).order("updated_at desc").limit(10).offset(@page * 10)
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type in ('Issue', 'Message','News', 'Project', 'Attachment')", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
when 'issue'
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'",@project).order("updated_at desc").limit(10).offset(@page * 10)
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Issue'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
when 'news'
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'",@project).order("updated_at desc").limit(10).offset(@page * 10)
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'News'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
when 'message'
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Message'",@project).order("updated_at desc").limit(10).offset(@page * 10)
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Message'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
when 'attachment'
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Attachment'",@project).order("updated_at desc").limit(10).offset(@page * 10)
@events_pages = ForgeActivity.where("project_id = ? and forge_act_type = 'Attachment'", @project).includes(:forge_act).order("updated_at desc").limit(10).offset(@page * 10)
end
else
@events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public
= ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc")
.page(params['page'|| 1]).per(10);
@events_pages = ForgeActivity.includes(:project).where("forge_activities.project_id = ? and projects.is_public = ? and forge_act_type != ? ",@project,1, "Document").order("created_at desc").page(params['page'|| 1]).per(10);
end
boards = @project.boards.includes(:last_message => :author).all
@topic_count = @project.boards.count
# 根据对应的请求,返回对应的数据
respond_to do |format|
format.html
@ -560,18 +558,9 @@ class ProjectsController < ApplicationController
end
def update_message_status(user, project)
project_invite_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type =?", user, project, "ProjectInvite")
project_invite_messages.each do |project_invite_message|
project_invite_message.update_attribute(:viewed, true)
end
#更新被加入项目消息的viewed字段
join_project_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type=?", user, project, "JoinProject")
join_project_messages.each do |join_project|
join_project.update_attribute(:viewed, true)
end
#更新被移出项目消息的viewed字段
remove_project_messages = ForgeMessage.where("user_id =? and project_id =? and forge_message_type=?", user, project, "RemoveFromProject")
remove_project_messages.update_all(:viewed => true)
# 更新加入项目消息
project__messages = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'JoinProject', 'RemoveFromProject') and user_id =? and project_id =? ", user, project)
project__messages.update_all(:viewed => true) unless project__messages.blank?
end
def message_invite(message_id, key)

View File

@ -230,12 +230,12 @@ class StudentWorkController < ApplicationController
render_403
return
end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as score").order("#{@order} #{@b_sort}"),@name).count
end
@score = @b_sort == "desc" ? "asc" : "desc"
# 消息传过来的ID
@message_student_work_id = params[:student_work_id]
respond_to do |format|
format.js
format.html

View File

@ -119,49 +119,46 @@ class UsersController < ApplicationController
# @new_message_count = forge_querys.count + forum_querys.count + course_querys.count + user_querys.count
case params[:type]
when nil
# 系统消息为管理员发送,我的消息中包含有系统消息
@message_alls = []
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user, "SystemMessage", "SystemMessage").order("created_at desc")
messages = MessageAll.where("(user_id =? and message_type !=?) or message_type =?" ,@user.id, "SystemMessage", "SystemMessage").includes(:message).order("created_at desc")
messages.each do |message_all|
@message_alls << message_all.message
end
when 'unviewed'
@message_alls = []
messages = MessageAll.where("user_id =?", @user).order("created_at desc")
messages = MessageAll.where("user_id =?", @user.id).includes(:message).order("created_at desc")
messages.each do |message_all|
# 在点击或者刷新消息列表后未读的消息存放在数组
if message_all.message_type != "SystemMessage"&& !message_all.message.nil? && message_all.message.viewed == 0
@message_alls << message_all.message
end
end
#课程相关消息
when 'homework'
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =?", @user).order("created_at desc")
@message_alls = CourseMessage.where("course_message_type in ('HomeworkCommon','StudentWorksScore','JournalsForMessage','StudentWork','Exercise') and user_id =?", @user.id).order("created_at desc")
when 'course_message'
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user).order("created_at desc")
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Message", @user.id).order("created_at desc")
when 'course_news'
# 课程通知包含发布的通知和回复的通知
@message_alls = CourseMessage.where("course_message_type in (?, ? ,?)", "News", "Comment", "Course").where("user_id =?", @user).order("created_at desc")
@message_alls = CourseMessage.where("course_message_type in ('News', 'Comment') and user_id =?", @user.id).order("created_at desc")
when 'poll'
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user).order("created_at desc")
@message_alls = CourseMessage.where("course_message_type =? and user_id =?", "Poll", @user.id).order("created_at desc")
#项目相关消息
when 'issue'
@message_alls = ForgeMessage.where("forge_message_type =? or forge_message_type =?" , "Issue", "Journal").where("user_id=?", @user).order("created_at desc")
@message_alls = ForgeMessage.where("forge_message_type in ('Issue', 'Journal') and user_id =?" , @user.id).order("created_at desc")
when 'forge_message'
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user).order("created_at desc")
@message_alls = ForgeMessage.where("forge_message_type =? and user_id =?", "Message", @user.id).order("created_at desc")
when 'forge_news'
@message_alls = ForgeMessage.where("forge_message_type in (?,?) and user_id =?", "News", "Comment", @user).order("created_at desc")
@message_alls = ForgeMessage.where("forge_message_type in (?,?) and user_id =?", "News", "Comment", @user.id).order("created_at desc")
when 'apply'
@message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject', 'JoinProject', 'RemoveFromProject') and user_id =?", @user).order("created_at desc")
@message_alls = ForgeMessage.where("forge_message_type in ('ProjectInvite', 'AppliedProject', 'JoinProject', 'RemoveFromProject') and user_id =?", @user.id).order("created_at desc")
#贴吧消息
when 'forum'
@message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user).order("created_at desc")
@message_alls = MemoMessage.where("memo_type =? and user_id =?", "Memo", @user.id).order("created_at desc")
#用户留言
when 'user_feedback'
@message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user).order("created_at desc")
@message_alls = UserFeedbackMessage.where("journals_for_message_type =? and user_id =?", "JournalsForMessage", @user.id).order("created_at desc")
else
render_404
return
@ -1209,9 +1206,7 @@ class UsersController < ApplicationController
def show
# 统计访问量
unless User.current == @user
@user.update_attribute(:visits, @user.visits.to_i + 1)
end
@user.update_column(:visits, @user.visits.to_i + 1) unless User.current == @user
#更新用户申请成为课程老师或教辅消息的状态
if params[:course_id] != nil
join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",
@ -1253,7 +1248,12 @@ class UsersController < ApplicationController
end
else
# @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
# blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
# 减少数据库交互
user_ids = "(" + @user.id.to_s + "," + User.watched_by(@user.id).map{|u| u.id }.join(',') + ")"
watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",")
blog_ids = "(" + watched_user_blog_ids + ")"
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +

View File

@ -764,7 +764,7 @@ module ApplicationHelper
# 判断版本库是否初始为gitlab
def rep_is_gitlab?(project)
rep = Repository.where("project_id =? and type =?", project, "Repository::Gitlab")
rep = project.repositories.where("type =?", "Repository::Gitlab")
return rep.blank? ? true :false
end

View File

@ -24,40 +24,20 @@ module CoursesHelper
def find_excelletn_course keywords, current_course
# 获取tag匹配结果ID
a_tags = []
# kc = keywords.to_a
Course.visible.where("is_excellent =? and is_public =?", 1, 1).each do |ec|
Course.where("is_excellent =? and is_public =?", 1, 1).includes(:tags).each do |ec|
if ec.tags.any?{|value| current_course.name.include?(value.to_s)}
a_tags << ec.id
end
end
# sql = "SELECT distinct c.* FROM `courses` c, tags t, taggings ts where t.id = ts.tag_id and ts.taggable_id = c.id and c.is_excellent = 1 and is_delete = 0 and
# ts.taggable_type = 'Course' and t.name like '%#{keywords}%'"
# a_tags = Course.find_by_sql(sql).select{|course| course.is_public ==1 unless User.current.member_of_course?(course)}
# 通过elastic结果获取精品课程
a_courses = []
#courses = Course.search(keywords)
#courses.each do |c|
# a_courses << c.id
#end
a_courses << a_tags unless a_tags.length == 0
# 课程本身不能搜索显示自己
excellent_ids = a_courses.flatten.uniq.delete_if{|i| i == current_course.id}
limit = 5 - excellent_ids.length.to_i
excellent_ids = a_tags.uniq.delete_if{|i| i == current_course.id}
sql = "SELECT distinct c.id FROM course_activities cs, courses c where cs.course_id = c.id
and c.is_excellent =1 and c.is_public = 1 and c.id != #{current_course.id} order by cs.updated_at desc;"
default_ecourse_ids = Course.find_by_sql(sql).flatten
# REDO:时间紧,待优化
default_ids =[]
default_ecourse_ids.each do |de|
default_ids << de.id
end
default_ids = default_ids - excellent_ids
#default_ecourse = Course.where("id is not in (?)", ids).find_by_sql(sql).flatten.delete_if{|i| i == current_course.id}.flatten
arr_result = excellent_ids << default_ids
arr_result = arr_result.flatten.first(5)
return arr_result
# 过滤条件:精品课程、本身不在搜索范围
#e_courses = Course.where("is_excellent =? and id in (?)",1, arr_result).where("id !=?", current_course.id)
and (c.is_excellent =1 or c.excellent_option =1) and c.is_public = 1 and c.id != #{current_course.id} order by cs.updated_at desc;"
default_ids = Course.find_by_sql(sql).flatten.map { |c| c.id }
excellent_ids << default_ids.flatten
arr_result = excellent_ids.flatten.uniq.first(5)
excellent_courses = Course.find(arr_result)
return excellent_courses
end
# 判断精品课程是否可见,非课程成员无法查看私有课程
@ -258,7 +238,7 @@ module CoursesHelper
# 学生人数计算
# add by nwb
def studentCount course
course ? course.student.count.to_s : 0#course.student.count
course ? course.student.count.to_i : 0#course.student.count
end
#课程成员数计算
@ -293,12 +273,17 @@ module CoursesHelper
def searchTeacherAndAssistant project
#searchPeopleByRoles(project, TeacherRoles)
members = []
project.members.each do |m|
project.members.includes(:user).each do |m|
members << m if m && m.user && m.user.allowed_to?(:as_teacher,project)
end
members
end
def TeacherAndAssistantCount course
students_count = course.student.count
number = course.members.count - students_count
end
def search_student_in_group(project, course_group_id)
#searchPeopleByRoles(project, StudentRoles)
members = []
@ -766,7 +751,7 @@ module CoursesHelper
#加入课程、退出课程按钮
def join_in_course_header(course, user, options=[])
if user.logged?
joined = course.members.map{|member| member.user_id}.include? user.id
joined = course.members.includes(:user).map{|member| member.user_id}.include? user.id
text = joined ? l(:label_course_exit_student) : l(:label_course_join_student)
url = joined ? join_path(:object_id => course.id) : try_join_path(:object_id => course.id)
method = joined ? 'delete' : 'post'

View File

@ -111,9 +111,9 @@ module IssuesHelper
def principals_options_for_isuue_list(project)
if User.current.member_of?(project)
project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0])
project.members.includes(:user).order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0])
else
project.members.order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给", 0])
project.members.includes(:user).order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给", 0])
end
end

View File

@ -90,7 +90,7 @@ 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,:act_as_forge_activity
after_save :act_as_course_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

View File

@ -108,7 +108,8 @@ class Project < ActiveRecord::Base
has_many :tags, :through => :project_tags, :class_name => 'Tag'
has_many :project_tags, :class_name => 'ProjectTags'
# 动态级联删除
has_many :forge_activities, :class_name => 'ForgeActivity', :dependent => :destroy
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
#has_many :forge_activities, :class_name => 'ForgeActivity', :as =>:forge_act, :dependent => :destroy
# 关联虚拟表
has_many :forge_messages, :class_name =>'ForgeMessage', :as => :forge_message, :dependent => :destroy
@ -1212,9 +1213,7 @@ class Project < ActiveRecord::Base
# Author lizanle
# Description 新建项目要在ForgeActivities中加一条数据。
def acts_as_forge_activities
fa = ForgeActivity.new(:user_id => User.current.id,:project_id => self.id,
:forge_act_id => self.id,:forge_act_type => "ProjectCreateInfo")
fa.save!
self.forge_acts << ForgeActivity.new(:user_id => User.current.id, :project_id => self.id)
end

View File

@ -339,13 +339,15 @@ class User < Principal
message_new_time.onclick_time = User.current.last_login_on.nil? ? Time.now : User.current.last_login_on
message_new_time.save
end
course_count = CourseMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
system_messages_count = SystemMessage.where("created_at >?", User.current.onclick_time.onclick_time).count
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", User.current.id, 0, User.current.onclick_time.onclick_time).count
org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", User.current.id,0, User.current.onclick_time.onclick_time).count
user = User.current
onclick_time = user.onclick_time.onclick_time
course_count = CourseMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
forge_count = ForgeMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
user_memo_count = MemoMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
system_messages_count = SystemMessage.where("created_at >?", onclick_time).count
at_count = AtMessage.where("user_id =? and viewed =? and created_at >?", user.id, 0, onclick_time).count
org_count = OrgMessage.where("user_id=? and viewed =? and created_at >?", user.id,0, onclick_time).count
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + system_messages_count + at_count + org_count
end

View File

@ -2,20 +2,7 @@
<%= import_ke(enable_at: false, prettify: false) %>
<%= javascript_include_tag "create_kindeditor" %>
<% end %>
<style type="text/css">
/*回复框*/
/*.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}*/
/*.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-outline {border: none;}*/
/*.homepagePostReplyInputContainer .ke-inline-block {display: none;}*/
/*.homepagePostReplyInputContainer .ke-container {float: left;}*/
</style>
<% if topics%>
<% if topics %>
<% topics.each do |topic| %>
<script>
function expand_reply(container, btnid) {
@ -44,19 +31,12 @@
});
</script>
<% if topic %>
<%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id,:is_course=>1,:is_board=>1} %>
<%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id, :is_course => 1, :is_board=>1} %>
<% end %>
<% end %>
<% if topics.count == 10 %>
<!--<div id="show_more_course_topic" class="loadMore mt10 f_grey">展开更多<%#= link_to "", boards_topic_path(@board, :course_id => @board.course.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %></div>-->
<%= link_to "点击展开更多",boards_topic_path(@board, :course_id => @board.course.id ,:page => page),:id => "show_more_course_topic",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end %>
<% end%>
<!--
<script type="text/javascript">
$("#show_more_course_topic").mouseover(function () {
$("#more_topic_link").click();
});
</script>-->

View File

@ -192,6 +192,4 @@ function nh_init_board(params){
});
}
}
</script>

View File

@ -50,7 +50,7 @@
</script>
<style type="text/css">
</style>
<% course_activities.each do |activity| if course_activities %>
<% course_activities.includes(:course_act).each do |activity| if course_activities %>
<script>
function expand_reply(container, btnid) {
var target = $(container);
@ -73,7 +73,7 @@
sd_create_editor_from_data(<%= activity.id%>, null, "100%", "<%= activity.class.to_s %>");
});
</script>
<% if activity && activity.course_act%>
<% if activity && activity.course_act %>
<% act = activity.course_act %>
<% case activity.course_act_type.to_s %>
<% when 'HomeworkCommon' %>

View File

@ -0,0 +1,59 @@
<% unless contributor_course_scor(course.id).count == 0 %>
<ul class="rankList">
<h4>课程活跃度
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor: pointer; position:relative;">积分规则</a>
</h4>
<div class="numIntro undis" style="cursor:pointer;">
<div class="active-degree-rule">
积分规则<br/>
资源发布:资源数 x 5 <br/>
问答发布:发帖数 x 2 <br/>
通知发布:通知数 x 1 <br/>
问答回复:回复数 x 1 <br/>
作业留言:留言数 x 1 <br/>
通知留言:留言数 x 1 <br/>
课程留言:留言数 x 1 <br/>
总得分为以上得分之和</div>
</div>
<% contributor_course_scor(course.id).each do |contributor_score| %>
<% total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 +
contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 +
+ contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 +
contributor_score.news_num.to_i * 1 %>
<% unless total_score ==0 %>
<li><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %>
<p><%=link_to contributor_score.user.show_name, user_path(contributor_score.user.id), :title => contributor_score.user.show_name %></p>
<p><span class="c_green" style="cursor:pointer">
<a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="c_green">
<%=total_score %></a></span></p>
<div style="display: none" class="numIntro">
<div class="contributor-course-calculate">积分计算</div>
<%# unless contributor_score.resource_num.to_i == 0 %>
<div style="padding-left: 2px;padding-bottom: 2px;padding-right: 2px">
资源发布数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %></br>
<%# end %>
<%# unless contributor_score.message_num.to_i == 0 %>
问答发布数 x 2 = <%= contributor_score.message_num.to_i %> x 2 = <%= contributor_score.message_num.to_i * 2 %></br>
通知发布数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %></br>
<%# end %>
<%# unless contributor_score.message_reply_num.to_i == 0 %>
问答回帖数 x 1 = <%= contributor_score.message_reply_num.to_i %> x 1 = <%= contributor_score.message_reply_num.to_i %></br>
作业留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %></br>
通知留言数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %></br>
<%# end %>
<%# unless contributor_score.journal_num.to_i == 0 %>
课程留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %></br>
<%# end %>
<%# unless contributor_score.homework_journal_num.to_i == 0 %>
<%# end %>
<%# unless contributor_score.news_reply_num.to_i == 0 %>
<%# end %>
总得分:<%=total_score %>
</div>
</div>
</li>
<% end %>
<% end %>
<div class="cl"></div>
</ul>
<% end %>

View File

@ -0,0 +1,21 @@
<% hero_homework_scores = hero_homework_score(course, "desc") %>
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
<ul class="rankList">
<h4><span>课程英雄榜</span>
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor:pointer;">积分规则</a></h4>
<div style="cursor:pointer;" class="numIntro undis">
<div class="hero-degree-rule">积分规则<br/>
英雄榜的得分是每个同学作业的得分总和
</div>
</div>
<% hero_homework_scores.each do |student_score| %>
<% if student_score.score.to_i != 0 %>
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a>
<p><a href="javascript:void:(0);"><%=link_to student_score.user.show_name, user_path(student_score.user), :title => student_score.user.show_name %></a></p>
<p><span class="c_red" style="cursor:pointer" ><%= student_score.score<0 ? 0 : student_score.score.to_i %></span></p>
</li>
<% end %>
<% end %>
<div class="cl"></div>
</ul>
<% end %>

View File

@ -1,22 +1,21 @@
<% unless excellent_course_recommend(course).length == 0 %>
<% exc_course = excellent_course_recommend(course) %>
<% unless exc_course.length == 0 %>
<ul class="courseR mb10">
<h4 class="mb5" ><%= l(:label_homework_recommendation) %></h4>
<% excellent_course_recommend(course).each do |e_course| %>
<% e_course = Course.find(e_course) %>
<% exc_course.each do |e_course| %>
<li class="mt15"> <%= image_tag(url_to_avatar(e_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %>
<div class="fl">
<p class="f12 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %><div class="cl"></div> </p>
<p class="f12">
<% if visable_attachemnts_incourse(e_course).count > 0 %>
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to visable_attachemnts_incourse(e_course).count, course_files_path(e_course), :class => "linkBlue2" %>)</span>
<% if course_file_num > 0 %>
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to course_file_num, course_files_path(e_course), :class => "linkBlue2" %>)</span>
<% end %>
<% if e_course.homework_commons.where("publish_time <= '#{Date.today}'").count > 0 %>
<span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.where("publish_time <= '#{Date.today}'").count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)</span>
<% end %>
<div class="cl"></div>
</p>
</div>
</p>
</div>
<div class="cl"></div>
</li>
<% end %>

View File

@ -24,19 +24,6 @@
</ul>
</div>
<script>
<%# type = type%>
// $(function (){
// if('<%#= type %>' != null && '<%#= type %>' == 'courses' ){
// $('input:radio[value="courses"]').attr('checked','checked');
// }
// if('<%#= type %>' != null && '<%#= type %>' == 'projects' ){
// $('input:radio[value="projects"]').attr('checked','checked');
// }
// if('<%#= type %>' != null && '<%#= type %>' == 'users' ){
// $('input:radio[value="users"]').attr('checked','checked');
// }
// });
$(function(){
$("#navHomepageSearchInput").keypress(function(e){
var name = $.trim($('#navHomepageSearchInput').val());
@ -65,23 +52,6 @@
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
<% end %>
<!--<div class="navSearchTypeBox" id="navHomepageSearchType">-->
<!--<div class="fl mr15 mt8">-->
<!--<input type="radio" value="courses" name="search_type" checked/>-->
<!--课程-->
<!--</div>-->
<!--<div class="fl mr15 mt8">-->
<!--<input type="radio" value="projects" name="search_type" />-->
<!--项目-->
<!--</div>-->
<!--<div class="fl mr15 mt8">-->
<!--<input type="radio" value="users" name="search_type" />-->
<!--用户-->
<!--</div>-->
<!--<div id="navSearchAlert" class="fr mr10">-->
<!--<span class="c_red">请选择搜索类型</span>-->
<!--</div>-->
<!--</div>-->
</div>
<div class="navHomepageProfile" id="navHomepageProfile">

View File

@ -1,80 +1,39 @@
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) %>
<% teacher_num = searchTeacherAndAssistant(@course).count %>
<% student_num = studentCount(@course) %>
<% course_file_num = visable_attachemnts_incourse(@course).count%>
<% teacher_num = 0 %>
<% student_num = 0 %>
<div class="pr_info_logo fl mr10 mb5">
<% if is_excellent_course(@course) %>
<img src="/images/course/boutique.png" width="50" height="auto" alt="精品" class="boutiqueP" />
<% end %>
<!--<a href="#"><img src="images/courses/pic_courses.jpg" width="60" height="60" alt="logo" /></a>-->
<%= image_tag(url_to_avatar(@course), :width => "60", :height => "60") %>
</div>
<div class="pr_info_id fl mb5 f14">ID:<%= @course.id%><%= @course.is_public == 0 ? "(私有)" : "(公开)" %>
<div class="pr_info_id fl mb5 f14">ID:<%= @course.id %><%= @course.is_public == 0 ? "(私有)" : "(公开)" %>
<% if is_excellent_course(@course) %>
<img src="/images/course/medal.png" alt="精品课程" style="vertical-align:bottom;" class="ml5" />
<% end %>
</div>
<div class="pr_info_id fl f14">
<% unless is_teacher %>
<!--<a href="" class="pr_join_a f12">加入课程</a>-->
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
<div id="join_in_course_header"><%= join_in_course_header(@course, User.current) %></div>
<% end %>
</div>
<!--<div class="pr_info_id fl mb5 f14">
ID:<%#= @course.id%>
</div>
<div class="pr_info_join fl">
<%# if is_teacher%>
<%#= link_to "<span class='pr_setting'></span>#{l(:button_configure)}".html_safe, {:controller => 'courses', :action => 'settings', :id => @course}, :class => "pr_join_a" %>
<%#= set_course_time @course%>
<%#= link_to "<span class='pr_copy'></span>#{l(:button_copy)}".html_safe, copy_course_course_path(@course.id), :class => "pr_join_a" %>
<%# else%>
<div id="join_in_course_header"><%#= join_in_course_header(@course, User.current) %></div>
<%# end%>
</div>-->
<div class="cl"></div>
<!--<div >-->
<!--<a class="pr_info_name fl c_dark fb break_word" href="http://<%#= Setting.host_course%>/courses/<%#= @course.id%>" target="_blank">-->
<!--<%#= @course.name %>-->
<!--</a>-->
<!--<%# if @course.is_public == 0%>-->
<!--<span class="img_private ">-->
<!--<%#= l(:field_is_private)%>-->
<!--</span>-->
<!--<%# end %>-->
<!--<%#if @course.tea_id == User.current.id && @course.outline == 0 %>-->
<!--<span>-->
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
<!--</span>-->
<!--<%# else%>-->
<!--<span>-->
<!--<a href="javascript:void(0)" onclick="course_outline('<%#= @course.id%>');">设置大纲</a>-->
<!--</span>-->
<!--<%# end %>-->
<!--</div>-->
<div >
<a class="pr_info_name fl c_dark fb break_word" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank"></a>
<div>
<a class="pr_info_name c_dark fb break_word fl" href="http://<%= Setting.host_course%>/courses/<%= @course.id%>" target="_blank">
<%= @course.name %>
</a>
<%# if @course.is_public == 0%>
<!--<span class="img_private "></span>-->
<!--<span class="img_private mr5 fl">
<%#= l(:field_is_private)%>
</span>-->
<%# end %>
<span id="course_outline_bar">
<%if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %>
<% if User.current && @course.tea_id == User.current.id && (@course.outline == 0 || BlogComment.where(:id=>@course.outline).count == 0) %>
<a href="javascript:void(0);" title="设置课程大纲" onclick="course_outline('<%= @course.id%>')" class="mr5 syllabusSetting fl"> </a>
<% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0%>
<% elsif User.current && @course.tea_id == User.current.id && @course.outline != 0 && BlogComment.where(:id=>@course.outline).count != 0 %>
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course) && @course.outline != 0%>
<% elsif User.current && @course.tea_id != User.current.id && !@course.is_public? && User.current.member_of_course?(@course) && @course.outline != 0 %>
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<% elsif User.current && @course.tea_id != User.current.id && @course.is_public? && @course.outline != 0%>
<% elsif User.current && @course.tea_id != User.current.id && @course.is_public? && @course.outline != 0 %>
<a href="<%=syllabus_course_path(@course) %>" title="课程大纲" class="mr5 syllabusIcon fl"> </a>
<%else%>
<%else %>
<%end %>
</span>
</div>

View File

@ -55,7 +55,8 @@
<div id="content">
<div id="LSide" class="fl">
<div class="project_info" style="position: relative" id="project_info_<%=@course.id %>">
<%=render :partial=>'layouts/project_info' %>
<% course_file_num = visable_attachemnts_incourse(@course).count %>
<%=render :partial=>'layouts/project_info', :locals => {:course_file_num => course_file_num} %>
</div><!--课程信息 end-->
<div class="info_box">
<ul>
@ -138,94 +139,11 @@
</ul>
<% end %>
</div><!--项目侧导航 end-->
<%# 课程贡献榜 %>
<%# 课程活跃度 %>
<div class="cl"></div>
<% unless contributor_course_scor(@course.id).count == 0 %>
<ul class="rankList">
<h4>课程活跃度
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor: pointer; position:relative;">积分规则</a>
</h4>
<div class="numIntro undis" style="cursor:pointer;">
<div class="active-degree-rule">
积分规则<br/>
资源发布:资源数 x 5 <br/>
问答发布:发帖数 x 2 <br/>
通知发布:通知数 x 1 <br/>
问答回复:回复数 x 1 <br/>
作业留言:留言数 x 1 <br/>
通知留言:留言数 x 1 <br/>
课程留言:留言数 x 1 <br/>
总得分为以上得分之和</div>
</div>
<% contributor_course_scor(@course.id).each do |contributor_score| %>
<% total_score = contributor_score.resource_num.to_i * 5 + contributor_score.message_num.to_i * 2 +
contributor_score.message_reply_num.to_i * 1 + contributor_score.journal_num.to_i * 1 +
+ contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_num.to_i * 1 +
contributor_score.news_num.to_i * 1 %>
<% unless total_score ==0 %>
<li><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %>
<p><%=link_to contributor_score.user.show_name, user_path(contributor_score.user.id), :title => contributor_score.user.show_name %></p>
<p><span class="c_green" style="cursor:pointer">
<a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="c_green">
<%=total_score %></a></span></p>
<div style="display: none" class="numIntro">
<div class="contributor-course-calculate">积分计算</div>
<%# unless contributor_score.resource_num.to_i == 0 %>
<div style="padding-left: 2px;padding-bottom: 2px;padding-right: 2px">
资源发布数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %></br>
<%# end %>
<%# unless contributor_score.message_num.to_i == 0 %>
问答发布数 x 2 = <%= contributor_score.message_num.to_i %> x 2 = <%= contributor_score.message_num.to_i * 2 %></br>
通知发布数 x 1 = <%= contributor_score.news_num.to_i %> x 1 = <%= contributor_score.news_num.to_i %></br>
<%# end %>
<%# unless contributor_score.message_reply_num.to_i == 0 %>
问答回帖数 x 1 = <%= contributor_score.message_reply_num.to_i %> x 1 = <%= contributor_score.message_reply_num.to_i %></br>
作业留言数 x 1 = <%= contributor_score.homework_journal_num.to_i %> x 1 = <%= contributor_score.homework_journal_num.to_i %></br>
通知留言数 x 1 = <%= contributor_score.news_reply_num.to_i %> x 1 = <%= contributor_score.news_reply_num.to_i %></br>
<%# end %>
<%# unless contributor_score.journal_num.to_i == 0 %>
课程留言数 x 1 = <%= contributor_score.journal_num.to_i %> x 1 = <%= contributor_score.journal_num.to_i %></br>
<%# end %>
<%# unless contributor_score.homework_journal_num.to_i == 0 %>
<%# end %>
<%# unless contributor_score.news_reply_num.to_i == 0 %>
<%# end %>
总得分:<%=total_score %>
</div>
</div>
</li>
<% end %>
<% end %>
<div class="cl"></div>
</ul>
<% end %>
<% hero_homework_scores = hero_homework_score(@course, "desc") %>
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
<ul class="rankList">
<h4><span>课程英雄榜</span>
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor:pointer;">积分规则</a></h4>
<div style="cursor:pointer;" class="numIntro undis">
<div class="hero-degree-rule">积分规则<br/>
英雄榜的得分是每个同学作业的得分总和
</div>
</div>
<% hero_homework_scores.each do |student_score| %>
<% if student_score.score.to_i != 0 %>
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(student_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(student_score.user) %></a>
<p><a href="javascript:void:(0);"><%=link_to student_score.user.show_name, user_path(student_score.user), :title => student_score.user.show_name %></a></p>
<p><span class="c_red" style="cursor:pointer" ><%= student_score.score<0 ? 0 : student_score.score.to_i %></span></p>
</li>
<% end %>
<% end %>
<div class="cl"></div>
</ul>
<% end %>
<%= render :partial => 'courses/course_activity_users', :locals => {:course => @course} %>
<%# 课程英雄榜 %>
<%= render :partial => 'courses/course_heroes', :locals => {:course => @course} %>
<% if @course.description && !@course.description.blank? %>
<div class="project_intro">
@ -251,7 +169,7 @@
<div class="cl"></div>
</div><!--项目标签 end-->
<!--课程推荐-->
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
<%= render :partial => 'courses/recommendation', :locals => {:course => @course, :course_file_num => course_file_num} %>
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @course.visits.to_i %></div>
</div><!--LSide end-->

View File

@ -29,7 +29,7 @@
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
</script>
</head>
<!--add by huang-->
@ -44,8 +44,6 @@
<div class="cl"></div>
<div id="Container">
<%#= render :partial => 'layouts/new_header'%>
<div class="cl"></div>
<div id="content">
@ -104,20 +102,6 @@
<!--邀请加入-->
<div class="subNavBox">
<%# if User.current.member_of?(@project) %>
<!--<div class="subNav currentDd currentDt subNav_jiantou" id="expand_tools_expand_invit" nhtype="toggle4cookie" data-id="expand_invit" data-target="#navContent_invit" data-val="expand">-->
<!--<%#= l(:label_invite)%>-->
<!--</div>-->
<!--<ul class="navContent " style="display:block" id="navContent_invit">-->
<!--<li><%#= link_to l(:label_invite_new_user), :controller=>"projects", :action=>"invite_members_by_mail", :id => @project %></li>-->
<!--&lt;!&ndash;<%# if User.current.allowed_to?(:manage_members, @project) %>&ndash;&gt;-->
<!--<li><%#= link_to l(:label_invite_trustie_user), :controller=>"projects", :action=>"invite_members", :id => @project %></li>-->
<!--<%# end %>-->
<!--</ul>-->
<%# end %><!--end-->
<!--menu 左侧工具栏 -->
<%#--project_new_type: 1为开发组2为科研组3为朋友圈子--%>
<div id="project_memu_list">
<% if @project.project_new_type == 1 || @project.project_new_type.nil? %>
<%= render :partial => 'projects/development_group', :locals => {:project => @project} %>

View File

@ -204,7 +204,13 @@
<% end%>
<% end%>
</div>
<% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
<% course_order_ids = "(" +
CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM
(SELECT ca.course_id, MAX(ca.updated_at) AS updated_at FROM course_activities ca WHERE ca.course_id IN (" + @user.courses.visible.select('courses.id').map{|c| c.id}.join(',') + ")
GROUP BY ca.course_id) AS c
ORDER BY c.updated_at DESC limit 5").map {|c| c.course_id}.join(",") + ")"%>
<% courses = Course.where("id in #{course_order_ids}")%>
<%# courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" id="homepageLeftMenuCourses">
<ul>
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>
@ -217,7 +223,14 @@
<%=link_to "", new_project_path(:host=> Setting.host_name), :class => "homepageMenuSetting fr", :style => "margin-right:10px;", :title => "新建项目"%>
<% end%>
</div>
<% projects = @user.projects.visible.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
<% project_order_ids = "(" +
ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM
(SELECT fa.project_id, MAX(fa.created_at) AS created_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ")
GROUP BY fa.project_id) AS p
ORDER BY p.created_at DESC limit 5").map {|p| p.project_id}.join(",") + ")"%>
<%# project_order_ids = "(" + ForgeActivity.select("DISTINCT project_id, max(created_at) as max_created_at").where("project_id in #{"(" + @user.projects.visible.select("projects.id").map{|p| p.id}.join(",") + ")"}").order("max_created_at desc").map {|p| p.project_id}.join(",") + ")"%>
<% projects = Project.where("projects.id in #{project_order_ids}")%>
<%# projects = @user.projects.visible.select("projects.*, (SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
<div class="homepageLeftMenuCourses <%= projects.empty? ? 'none' : ''%>" id="homepageLeftMenuForge">
<ul>
<%= render :partial => 'layouts/user_projects', :locals => {:projects => projects,:user => @user, :page => 0} %>

View File

@ -48,7 +48,7 @@
</script>
<% unless forge_acts.empty? %>
<% forge_acts.each do |activity| -%>
<% forge_acts.includes(:forge_act).each do |activity| -%>
<script>
function expand_reply(container, btnid) {
var target = $(container);
@ -73,15 +73,14 @@
</script>
<!--创建-->
<% case activity.forge_act_type %>
<% when "ProjectCreateInfo" %>
<% when "Project" %>
<%= render :partial => 'projects/project_create', :locals => {:activity => activity, :user_activity_id => activity.id} %>
<!--缺陷动态-->
<% when "Issue" %>
<%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
<!--message -->
<% when "Message" %>
<%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id,:is_course=>1,:is_board=>0} %>
<%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :is_course => 1, :is_board => 0} %>
<!--new 新闻-->
<% when "News" %>
<% if !activity.forge_act.nil? and activity.forge_act.project %>

View File

@ -47,42 +47,44 @@
<script type="text/javascript">
$(function(){
<% if !@is_evaluation && !@is_teacher %>
<% work=@homework.student_works.where("user_id = ?",User.current.id).first %>
<% unless work.nil? %>
<% if @homework.homework_type == 2 %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
<% work = @homework.student_works.where("user_id = ?",User.current.id).first %>
<% elsif !@message_student_work_id.nil? %>
<% work = @homework.student_works.where("id =?", @message_student_work_id).first %>
<% end %>
<% unless work.nil? %>
<% if @homework.homework_type == 2 %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>work,:score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
var program_name = "text/x-csrc";
var language = <%= @homework.language %>;
if (language == 1) {
program_name = 'text/x-csrc';
} else if(language==2){
program_name = 'text/x-c++src';
}else if(language==3){
program_name = 'text/x-cython';
} else if(language==4){
program_name = 'text/x-java';
}
var editor = CodeMirror(document.getElementById("work-code_<%= work.id%>"), {
mode: {name: program_name,
version: 2,
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 2,
matchBrackets: true,
readOnly: true,
value: $("#work-src_<%= work.id%>").text()
});
<% elsif @homework.homework_type == 1 %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
<% elsif @homework.homework_type == 3 %>
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
<% if pro && pro.student_work_id == work.id %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
<% end %>
<% end %>
$('#score_<%= work.id%>').peSlider({range: 'min'});
<% end %>
var program_name = "text/x-csrc";
var language = <%= @homework.language %>;
if (language == 1) {
program_name = 'text/x-csrc';
} else if(language==2){
program_name = 'text/x-c++src';
}else if(language==3){
program_name = 'text/x-cython';
} else if(language==4){
program_name = 'text/x-java';
}
var editor = CodeMirror(document.getElementById("work-code_<%= work.id%>"), {
mode: {name: program_name,
version: 2,
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 2,
matchBrackets: true,
readOnly: true,
value: $("#work-src_<%= work.id%>").text()
});
<% elsif @homework.homework_type == 1 %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
<% elsif @homework.homework_type == 3 %>
<% pro = @homework.student_work_projects.where(:user_id => User.current.id).first %>
<% if pro && pro.student_work_id == work.id %>
$("#about_hwork_<%= work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work => work, :score =>student_work_score(work,User.current),:student_work_scores => work.student_works_scores.order("updated_at desc")}) %>");
<% end %>
<% end %>
$('#score_<%= work.id%>').peSlider({range: 'min'});
<% end %>
});
</script>

View File

@ -151,7 +151,7 @@
<% else %>
<% student_works = activity.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("score desc") %>
<% end %>
<% student_works.each_with_index do |sw, i| %>
<% student_works.includes(:user).each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue">
<% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>

View File

@ -2,14 +2,14 @@
<div class="homepagePostBrief">
<div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
<%#= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4">
<% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<%= link_to activity.try(:author), user_path(activity.author_id, :host=>Setting.host_user), :class => "newsBlue mr15" %>
<% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id, :host=>Setting.host_user), :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"%>
@ -18,15 +18,15 @@
<% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
<%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :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_path(activity.board_id, activity), :class=> "postGrey" %>
<% end %>
</div>
<% if activity.sticky == 1%>
<% if activity.sticky == 1 %>
<span class="sticky_btn_cir ml10">置顶</span>
<% end%>
<% if activity.locked%>
<% if activity.locked %>
<span class="locked_btn_cir ml10 fl" title="已锁定">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
<% end%>
<% end %>
<div class="cl"></div>
<div class="homepagePostDate fl">
发帖时间:<%= format_time(activity.created_on) %>
@ -36,9 +36,9 @@
</div>
<div class="cl"></div>
<% if activity.parent_id.nil? %>
<% content = activity.content%>
<% content = activity.content %>
<% else %>
<% content = activity.parent.content%>
<% content = activity.parent.content %>
<% end %>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
<div class="cl"></div>
@ -113,7 +113,7 @@
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<ul>
<% activity.children.reorder("created_on desc").each do |reply|%>
<% activity.children.includes(:author).reorder("created_on desc").each do |reply|%>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= reply.id %>');

View File

@ -1,5 +1,3 @@
<div class="resources mt10">
<div class="homepagePostBrief">
<div class="homepagePostPortrait">

View File

@ -73,10 +73,9 @@
</div>
<div class="cl"></div>
</div>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id => user_activity_id, :content => activity.description} %>
<div id="intro_content_show_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id %>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
<%# 局部刷新修改xissue属性 %>
<% if User.current.member_of?(activity.project) %>

View File

@ -54,6 +54,10 @@
</li>
<% end %>
<div class="cl"></div>
<%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "assigned"},:remote=>'true', :method => :put, :id=>"issue_query_assign_form_#{activity.id}", :class => 'query_form') do %>
<li>
<p class="label03">&nbsp;指派&nbsp;&nbsp;:&nbsp;</p>
@ -66,6 +70,10 @@
</li>
<% end %>
<div class="cl"></div>
</ul>
<ul class="fl">
<%= form_tag({:controller => 'issues', :action => 'update', :id => activity.id, :issue_detail => true, :type => "prior"},:remote=>'true', :method => :put, :id=>"issue_query_prior_form_#{activity.id}", :class => 'query_form') do %>

View File

@ -25,7 +25,7 @@
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<ul>
<% activity.journals.reorder("created_on desc").each do |reply| %>
<% activity.journals.includes(:user, :details).reorder("created_on desc").each do |reply| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= reply.id %>');
@ -44,7 +44,7 @@
<%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%=reply.id %>">
<span id="reply_praise_count_<%= reply.id %>">
<% if reply.user == User.current %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% else %>

View File

@ -108,7 +108,7 @@
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<ul>
<% activity.children.reorder("created_on desc").each do |reply| %>
<% activity.children.includes(:author).reorder("created_on desc").each do |reply| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= reply.id %>');

View File

@ -21,13 +21,6 @@
<%= link_to ma.subject.html_safe, ma.url, :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}", :onmouseover =>"message_titile_show($(this),event)", :onmouseout => "message_titile_hide($(this))" %>
<% end %>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p><strong>标题:</strong><%= ma.subject %></p>
<% unless ma.description.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.description.html_safe %></div>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>

View File

@ -155,7 +155,7 @@
<% else %>
<% student_works = homework_common.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("score desc") %>
<% end %>
<% student_works.each_with_index do |sw, i| %>
<% student_works.includes(:user).each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue">
<% if User.current.member_of_course?(homework_common.course) || User.current.admin? || homework_common.is_open == 1 %>

View File

@ -9,13 +9,6 @@
<!--:onmouseover =>"message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</li>
<div style="display: none" class="message_title_red system_message_style">
<p><strong>标题:</strong><%= ma.course_message.title %></p>
<% unless ma.course_message.description.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.course_message.description.html_safe %></div>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -29,13 +22,6 @@
<!--:onmouseover =>"message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</li>
<div style="display: none" class="message_title_red system_message_style">
<p><strong>评论对象:</strong><%= ma.course_message.commented.title %></p>
<% unless ma.course_message.comments.nil? %>
<div class="fl"><strong>评论内容:</strong></div>
<div class="ml60"><%= ma.course_message.comments.html_safe %></div>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -58,43 +44,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
<% end %>
</a></li>
<div style="display: none" class="message_title_red system_message_style">
<% if User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
<p>
<%= User.current.lastname + User.current.firstname %>老师您好!
<%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.show_name + "老师")%>刚刚发布了一个作业:
</p>
<ul class="ul_normal_color">
<li>课程名称:<%= ma.course_message.course.name %>
(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>
<li>作业标题:<span style="color:Red"><%= ma.course_message.name %></span></li>
<li>发布时间:<span style="color:Red;"><%= DateTime.parse(ma.course_message.created_at.to_s).strftime('%Y-%m-%d %H:%M').to_s %></span></li>
<li>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;23:59</span></li>
<li>匿评开始:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_start %>&nbsp;23:59</span></li>
<li>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;23:59</span></li>
<li>迟交扣分:<span style="color:Red;"><%= ma.course_message.late_penalty %>分</span></li>
<li>缺评扣分:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.absence_penalty %>分</span></li>
</ul>
<p>
您可以修改作业内容、评分规则、匿评过程等,谢谢!
</p>
<% else %>
<p><%= User.current.lastname + User.current.firstname %>同学您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业:</p>
<ul class="ul_normal_color">
<li>课程名称:<%= ma.course_message.course.name %>
(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>
<li>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></li>
<li>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;23:59</span></li>
<li>匿评开始:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_start %>&nbsp;&nbsp;23:59</span></li>
<li>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;23:59</span></li>
<li>迟交扣分:<span style="color:Red;"><%= ma.course_message.late_penalty %>分</span></li>
<li>缺评扣分:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.absence_penalty %>分</span></li>
</ul>
<p>
请抓紧时间提交您的作品,谢谢!
</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -110,24 +59,6 @@
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</li>
<div style="display: none" class="message_title_red system_message_style">
<% if !User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
<p>
<%= User.current.lastname + User.current.firstname %>同学您好!
<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:
</p>
<ul class="ul_normal_color">
<li>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>
<li>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></li>
<li>提交截止:<span style="color:Red;"><%= ma.course_message.end_time %>&nbsp;&nbsp;23:59</span></li>
<li>匿评开始:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_start %>&nbsp;&nbsp;23:59</span></li>
<li>匿评关闭:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;23:59</span></li>
<li>迟交扣分:<span style="color:Red;"><%= ma.course_message.late_penalty %>分</span></li>
<li>缺评扣分:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.absence_penalty %>分</span></li>
<p>请抓紧时间提交您的作品,谢谢!</p>
</ul>
<% end %>
</div>
<li class="homepageHomeworkContentWarn fl"> &nbsp;&nbsp; 截止时间快到啦</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
@ -148,22 +79,6 @@
:onmouseover => "message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= 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+"老师") %>开启了匿评,作业详情如下:
</p>
<ul class="ul_normal_color">
<li>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>
<li>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></li>
<li>缺评扣分:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.absence_penalty %>分</span></li>
<li>匿评截止:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;23:59</span></li>
</ul>
<% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
<p>请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。</p>
<p>例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分</p>
<% end%>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -179,22 +94,6 @@
<!--:onmouseover =>"message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))"%>-->
</li>
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
该作业已经关闭了匿评。作业信息如下:
</p>
<ul class="ul_grey">
<li>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>
<li>作业标题:<%= ma.course_message.name %></li>
</ul>
<p></p>
<p class="c_red">注缺省情况下系统将在作业提交截止日期后14天自动关闭匿评。</p>
<p></p>
<% if User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
<p>祝您的教学活动高效、顺利、愉快!</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -214,18 +113,6 @@
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</li>
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= 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 + "老师") %>启动作业匿评失败啦
</p>
<ul class="ul_normal_color">
<li>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年' + ma.course_message.course.term %>)</li>
<li>作业标题:<span style="color:Red;"><%= ma.course_message.name %></span></li>
<li>提交截止:<span style="color:Red;"><%= ma.course_message.end_time%>&nbsp;&nbsp;23:59</span></li>
</ul>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -240,9 +127,6 @@
<!--:onmouseover =>"message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a></li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.polls_name %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -252,37 +136,13 @@
<li class="homepageNewsPubType fl">
<%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">
<%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %></span></li>
<% if ma.course_message.parent_id.nil? %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= 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"}" %>
<!--:onmouseover =>"message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a></li>
<div style="display: none" class="message_title_red system_message_style" >
<p><strong>主题:</strong><%= ma.course_message.subject %></p>
<% unless ma.course_message.content.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.course_message.content.html_safe %></div>
<% end %>
</div>
<% else %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= 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"}" %>
<!--:onmouseover =>"message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a></li>
<div style="display: none" class="message_title_red system_message_style" >
<p><strong>主题:</strong><%= ma.course_message.subject %></p>
<% unless ma.course_message.content.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.course_message.content.html_safe %></div>
<% end %>
</div>
<% end %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= 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"}" %>
<!--:onmouseover =>"message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a></li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "StudentWorksScore" %>
@ -307,33 +167,14 @@
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<% unless ma.content.nil? %>
<%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id),
<%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id, :student_work_id => ma.course_message.student_work),
:class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
<!--:onmouseover =>"message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a></li>
<div style="display: none" class="message_title_red system_message_style" >
<p>
<%= User.current.show_name %>同学您好!
<%= ma.course_message.reviewer_role == 3? "匿名用户" : (ma.course_message.user.show_name + "老师")%><%= ma.status == 0? "评阅了您的作品":"重新评阅了您的作品"%>。详情如下:
</p>
<ul class="ul_normal_color">
<li>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</li>
<li>作业标题:<span style="color:Red;"><%=ma.course_message.student_work.homework_common.name %></span></li>
<% content = ma.content.gsub("作业评分:","").split("&nbsp;&nbsp;&nbsp; 评语:")%>
<li>作品评分:<span style="color:Red;"><%= content[0] %>分</span></li>
<% if content.size > 1 %>
<div class="fl" style="width:74px;"><li>作品评语:</li></div>
<div style="margin-left:74px"><span style="color:Red;"><%= content[1] %></span></div>
<% end %>
</ul>
<p>
本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %>&nbsp;&nbsp;23:59结束匿评到时您将可以看到所有其他同学的作品啦大家可以进一步互相学习。 期待您取得更大的进步!
</p>
</div>
<% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "JournalsForMessage" %>
<% if ma.course_message.jour_type == 'Course' %>
@ -352,9 +193,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.course_message.notes.html_safe %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -370,23 +208,11 @@
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl" : "homepageNewsType fl" %>">回复了作品评论:</span>
</li>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= 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"}" %>
<%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id, :student_work_id => ma.course_message.jour.student_work), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= User.current.show_name %>老师您好!
<%= ma.course_message.user.show_name%><%= ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"%>回复了您的作品评论。详情如下:
</p>
<ul class="ul_normal_color">
<li>回复内容:<span style="color:red;"><%= ma.course_message.notes %></span></li>
<li>您的评论:<span style="color:red;"><%= ma.course_message.jour.comment %></span></li>
<li>课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)</li>
<li>作业标题:<span style="color:Red;"><%=ma.course_message.jour.student_work.homework_common.name %></span></li>
</ul>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -406,20 +232,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= User.current.lastname + User.current.firstname %>
<%= User.current.allowed_to?(:as_teacher,ma.course_message.homework_common.course) ? '老师':'同学'%>您好!由于迟交作业,您及您的作品都不能参与以下作业的匿评。作业详情如下:
</p>
<ul class="ul_grey">
<li>课程名称:<%= ma.course_message.homework_common.course.name %>(<%= ma.course_message.homework_common.course.time.to_s + '年' + ma.course_message.homework_common.course.term %>)</li>
<li>作业标题:<%= ma.course_message.homework_common.name %></li>
<li>提交截止:<%= ma.course_message.homework_common.end_time %>&nbsp;23:59</li>
<li>提交时间:<%= format_time(ma.course_message.created_at) %></li>
<li>迟交扣分:<%= ma.course_message.homework_common.late_penalty %>分</li>
</ul>
<p>如需获得最终成绩,请您联系主讲老师对您的作品进行单独评分!</p>
</div>
<li class="homepageHomeworkContentWarn fl"> &nbsp;&nbsp;您成功提交了作品(但被标记为迟交啦)</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
@ -440,23 +252,6 @@
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a></li>
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= User.current.lastname + User.current.firstname %>老师您好!您成功创建了一个课程,详情如下:
</p>
<p>课程名称:<%= ma.course_message.name %></p>
<p>开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %></p>
<p>课程ID<span style="color:red;"><%= ma.course_message.id %></span></p>
<p>课程密码:<span style="color:red;"><%= ma.course_message.password %></span></p>
<p>学时总数:<%= ma.course_message.class_period %></p>
<p>创建时间:<%= format_time(ma.course_message.created_at) %></p>
<p>您可以点击左上角的“配置”按钮修改课程基本信息添加及删除课程成员。您也可以把课程ID及密码告诉学生和其他成员让他们输入ID及密码加入课程。</p>
<% if ma.course_message.is_public %>
<p>您的课程是公开的,所有人都能访问您的课程。若不想设置为公开,您可以在配置中设置。</p>
<% else %>
<p>您的课程是私有的,非课程成员不能访问您的课程。如果想设置为公开,您可以在配置中设置。</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -474,16 +269,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= User.current.lastname + User.current.firstname %>老师您好!您有了新的课程成员申请,信息如下:
</p>
<p>真实姓名:<%= User.find(ma.course_message_id).realname %></p>
<p>申请课程:<%= Course.find(ma.course_id).name%></p>
<div class="fl">课程描述:</div>
<div class="ml60"><%= Course.find(ma.course_id).description.html_safe %></div>
<p>申请职位:<%= ma.content == '9' ? "教师" : "教辅"%></p>
</div>
<li class="homepageHomeworkContentWarn fl">
<span id="deal_info_<%=ma.id%>">
<% if ma.status == 0 || ma.status.nil?%>
@ -519,15 +304,6 @@
</a>
</span>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= User.current.lastname + User.current.firstname %>老师您好!您已成功加入课程<%= Course.find(ma.course_id).name%>。
</p>
<p>申请课程:<%= Course.find(ma.course_id).name%></p>
<div class="fl">课程描述:</div>
<div class="ml60"><%= Course.find(ma.course_id).description.html_safe %></div>
<p>申请职位:<%= ma.content == '9' ? "教师" : "教辅"%></p>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -548,20 +324,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
<% teacher = User.find(ma.course_message_id) %>
<p><%= teacher.show_name %>(<%= teacher %>)老师把您加入了课程,详情如下:</p>
<p>课程名称:<%= ma.course.name %></p>
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
<p>课程ID<%= ma.course.id %></p>
<p>课时总数:<%= ma.course.class_period %></p>
<% else %>
<p>
您已经被移出该私有课程,非课程成员没有权限访问私有课程
</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -582,20 +344,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
<p>您增加了新的课程成员,详情如下:</p>
<p>成员:<%= 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) +")" %></p>
<p>课程名称:<%= ma.course.name %></p>
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
<p>课程ID<%= ma.course.id %></p>
<p>课时总数:<%= ma.course.class_period %></p>
<% else %>
<p>
您已经被移出该私有课程,非课程成员没有权限访问私有课程
</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -616,21 +364,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %>
<p>您已被<%= User.find(ma.course_message_id).show_name %>老师移出了课程,详情如下:</p>
<p>课程名称:<%= ma.course.name %></p>
<p>开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %></p>
<% if !ma.content.nil? %>
<p>担任角色:<%= ma.content %></p>
<% end %>
<p>学时总数:<%= ma.course.class_period %></p>
<% else %>
<p>
您已经被移出该私有课程,非课程成员没有权限访问私有课程
</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -647,27 +380,6 @@
<!--:onmouseover =>"message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))"%>-->
</li>
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= 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+"老师") %>发布了课程测验 ,测验详情如下:
</p>
<ul class="ul_normal_color">
<li>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>
<li>测验标题:<%= ma.course_message.exercise_name %></li>
<!--<li>测验描述:<%#= ma.course_message.exercise_description %></li>-->
<!--<li>测验状态:<%#= ma.course_message.exercise_status == 1 ? '未发布':'已发布'%></li>-->
<!--<%# if ma.course_message.publish_time %>-->
<!--<li>发布时间:<%#= ma.course_message.publish_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %></li>-->
<!--<%# end %>-->
<li>截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %></li>
<li>答题时长:<%= ma.course_message.time == -1 ? '不限时' : ma.course_message.time.to_s + '分钟' %></li>
<% if !User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
<p>请记得在截止时间前完成测验噢,辛苦啦!</p>
<% end %>
</ul>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -683,23 +395,7 @@
<%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
<!--:onmouseover =>"message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))"%>-->
</li>
<div style="display: none" class="message_title_red system_message_style">
<p>
<%= 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+"老师") %>发布的课程测验截止时间快到了,测验详情如下:
</p>
<ul class="ul_normal_color">
<li>课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)</li>
<li>测验标题:<%= ma.course_message.exercise_name %></li>
<li>截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %></li>
<li>答题时长:<%= ma.course_message.time == -1 ? '无限制' : ma.course_message.time.to_s + '分钟' %></li>
<p>请及时完成课程测验,辛苦啦!</p>
</ul>
</div>
<li class="homepageHomeworkContentWarn fl">截止时间快到啦 </li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>

View File

@ -15,9 +15,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.project %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -38,21 +35,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<% if ma.project.is_public? || User.current.member_of?(ma.project) || User.current.admin? %>
<p>
项目名称:<%= ma.project.name %>
</p>
<p>
项目描述:<%= ma.project.description %>
</p>
<% else %>
<p>
您已经被移出该私有项目,非项目成员没有权限访问私有项目
</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -74,21 +56,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<% if ma.project.is_public? || User.current.member_of?(ma.project) || User.current.admin? %>
<p>
项目名称:<%= ma.project.name %>
</p>
<p>
项目描述:<%= ma.project.description %>
</p>
<% else %>
<p>
您已经被移出该私有项目,非项目成员没有权限访问私有项目
</p>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -114,9 +81,6 @@
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</li>
<div style="display: none" class="message_title_red system_message_style">
<%= ma.project %>
</div>
<% unless User.current.member_of?(ma.project) %>
<li class="homepageHomeworkContentWarn fl">
<%=link_to "同意加入", {:controller => 'projects', :action => 'member', :id => ma.project_id, :message_id =>ma.id, :key => ma.secret_key},
@ -144,13 +108,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p><strong>主题:</strong><%= ma.forge_message.subject %></p>
<% unless ma.forge_message.description.nil? || ma.forge_message.description == "" %>
<div class="fl"><strong>描述:</strong></div>
<div class="ml36"><%= ma.forge_message.description.html_safe %></div>
<% end %>
</div>
<li class="homepageHomeworkContentWarn fl"> &nbsp;&nbsp; 截止时间快到了!</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
@ -169,13 +126,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p><strong>主题:</strong><%= ma.forge_message.subject %></p>
<% unless ma.forge_message.description.nil? || ma.forge_message.description == "" %>
<div class="fl"><strong>描述:</strong></div>
<div class="ml36"><%= ma.forge_message.description.html_safe %></div>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -197,11 +147,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style" >
<p><strong>问题标题:</strong><%= ma.forge_message.journalized.subject %></p>
<div class="fl"><strong>更新内容:</strong></div>
<div class="ml60"><%= get_issue_des_update(ma.forge_message).html_safe %></div>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -210,37 +155,14 @@
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.forge_message.author), :width => "30", :height => "30"), user_path(ma.forge_message.author) %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.forge_message.author, user_path(ma.forge_message.author), :class => "newsBlue homepageNewsPublisher" %>
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %></span></li>
<% if ma.forge_message.parent_id.nil? %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.forge_message.subject, project_boards_path(ma.forge_message.project,
:parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,
:topic_id => ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a></li>
<div style="display: none" class="message_title_red system_message_style">
<p><strong>主题:</strong><%= ma.forge_message.subject %></p>
<% unless ma.forge_message.content.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.forge_message.content.html_safe %></div>
<% end %>
</div>
<% else %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.forge_message.subject, project_boards_path(ma.forge_message.project,
:parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,
:topic_id => ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a></li>
<div style="display: none" class="message_title_red system_message_style">
<p><strong>帖子主题:</strong><%= ma.forge_message.subject %></p>
<% unless ma.forge_message.content.nil? %>
<div class="fl"><strong>评论内容:</strong></div>
<div class="ml60"><%= ma.forge_message.content.html_safe %></div>
<% end %>
</div>
<% end %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.forge_message.subject, project_boards_path(ma.forge_message.project,
:parent_id => ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id,
:topic_id => ma.forge_message.id), :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}" %>
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -260,13 +182,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p><strong>标题:</strong><%= ma.forge_message.title %></p>
<% unless ma.forge_message.description.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.forge_message.description.html_safe %></div>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
@ -281,11 +196,6 @@
<!--:onmouseover => "message_titile_show($(this),event)",-->
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</li>
<div style="display: none" class="message_title_red system_message_style">
<p><strong>新闻标题:</strong><%= ma.forge_message.commented.title %></p>
<div class="fl"><strong>评论内容:</strong></div>
<div class="ml60"><%= ma.forge_message.comments.html_safe %></div>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>

View File

@ -15,13 +15,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p><strong>标题:</strong><%= ma.memo.subject %></p>
<% unless ma.memo.content.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.memo.content.html_safe %></div>
<% end %>
</div>
<% else %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey">
<%= link_to ma.memo.content.html_safe, forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}" %>
@ -29,13 +22,6 @@
<!--:onmouseout => "message_titile_hide($(this))" %>-->
</a>
</li>
<div style="display: none" class="message_title_red system_message_style">
<p><strong>标题:</strong><%= ma.memo.subject %></p>
<% unless ma.memo.content.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.memo.content.html_safe %></div>
<% end %>
</div>
<% end %>
<li class="homepageNewsTime fl"><%= time_tag(ma.memo.created_at).html_safe %> </li>
</ul>

View File

@ -15,14 +15,6 @@
<!--:onmouseover =>"message_titile_show($(this),event);",-->
<!--:onmouseout => "message_titile_hide($(this));"-->
</li>
<div style="display:none;" class="message_title_red system_message_style">
<% unless ma.subject.blank? %>
<p><strong>标题:</strong><%= ma.subject %></p>
<% end %>
<% if (!ma.description.blank?) || (!ma.content.blank?) %>
<div class="fl"><strong>内容:</strong></div><div class="ml36"><%= ma.description.nil? ? ma.content.html_safe : ma.description.html_safe %></div>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<%# end %>

View File

@ -24,7 +24,6 @@
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.journals_for_message.created_on).html_safe %> </li>
</ul>
<% end %>
<% end %>

View File

@ -0,0 +1,5 @@
class AddIndexToMessageAlls < ActiveRecord::Migration
def change
add_index :message_alls, [:user_id, :message_id, :created_at]
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToCourseMessages < ActiveRecord::Migration
def change
add_index :course_messages, [:user_id, :course_id, :created_at]
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToMemoMessages < ActiveRecord::Migration
def change
add_index :memo_messages, [:user_id, :forum_id, :created_at]
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToUserFeedbackMessages < ActiveRecord::Migration
def change
add_index :user_feedback_messages, [:user_id, :created_at]
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToForgeMessages < ActiveRecord::Migration
def change
add_index :forge_messages, [:user_id, :project_id, :created_at]
end
end

View File

@ -0,0 +1,5 @@
class AddForgetypeToForgeMessages < ActiveRecord::Migration
def change
add_index :forge_messages, [:forge_message_id, :forge_message_type]
end
end

View File

@ -0,0 +1,5 @@
class AddUsertypeToUserFeedbackMessages < ActiveRecord::Migration
def change
add_index :user_feedback_messages, [:journals_for_message_id]
end
end

View File

@ -0,0 +1,5 @@
class AddMemotypeToMemoMessages < ActiveRecord::Migration
def change
add_index :memo_messages, [:memo_id, :memo_type]
end
end

View File

@ -0,0 +1,5 @@
class AddFeedToUserFeedbackMessages < ActiveRecord::Migration
def change
add_index :course_messages, [:course_message_type]
end
end

View File

@ -0,0 +1,5 @@
class AddIndexMtyeToMessageAlls < ActiveRecord::Migration
def change
add_index :message_alls, [:message_type]
end
end

View File

@ -0,0 +1,8 @@
class ChangeProjectCreateType < ActiveRecord::Migration
def up
execute("update forge_activities set forge_act_type = 'Project' where forge_act_type = 'ProjectCreateInfo'")
end
def down
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToForgeActivities < ActiveRecord::Migration
def change
add_index :forge_activities, [:project_id, :forge_act_id, :created_at, :forge_act_type], :name => "forge_act_index"
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToCourseActiivities < ActiveRecord::Migration
def change
add_index :course_activities, [:course_id, :course_act_id, :course_act_type, :created_at], :name => "course_act_index"
end
end

View File

@ -0,0 +1,5 @@
class AddIndexToUserActivities < ActiveRecord::Migration
def change
add_index :user_activities, [:act_id, :act_type, :container_id, :created_at], :name => "user_act_index"
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20160317090350) do
ActiveRecord::Schema.define(:version => 20160325030423) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -405,6 +405,8 @@ ActiveRecord::Schema.define(:version => 20160317090350) do
t.datetime "updated_at", :null => false
end
add_index "course_activities", ["course_id", "course_act_id", "course_act_type", "created_at"], :name => "course_act_index"
create_table "course_attachments", :force => true do |t|
t.string "filename"
t.string "disk_filename"
@ -465,6 +467,9 @@ ActiveRecord::Schema.define(:version => 20160317090350) do
t.integer "status"
end
add_index "course_messages", ["course_message_type"], :name => "index_course_messages_on_course_message_type"
add_index "course_messages", ["user_id", "course_id", "created_at"], :name => "index_course_messages_on_user_id_and_course_id_and_created_at"
create_table "course_statuses", :force => true do |t|
t.integer "changesets_count"
t.integer "watchers_count"
@ -728,6 +733,7 @@ ActiveRecord::Schema.define(:version => 20160317090350) do
end
add_index "forge_activities", ["forge_act_id"], :name => "index_forge_activities_on_forge_act_id"
add_index "forge_activities", ["project_id", "forge_act_id", "created_at", "forge_act_type"], :name => "forge_act_index"
create_table "forge_messages", :force => true do |t|
t.integer "user_id"
@ -741,6 +747,9 @@ ActiveRecord::Schema.define(:version => 20160317090350) do
t.integer "status"
end
add_index "forge_messages", ["forge_message_id", "forge_message_type"], :name => "index_forge_messages_on_forge_message_id_and_forge_message_type"
add_index "forge_messages", ["user_id", "project_id", "created_at"], :name => "index_forge_messages_on_user_id_and_project_id_and_created_at"
create_table "forums", :force => true do |t|
t.string "name", :null => false
t.text "description"
@ -1055,6 +1064,9 @@ ActiveRecord::Schema.define(:version => 20160317090350) do
t.datetime "updated_at", :null => false
end
add_index "memo_messages", ["memo_id", "memo_type"], :name => "index_memo_messages_on_memo_id_and_memo_type"
add_index "memo_messages", ["user_id", "forum_id", "created_at"], :name => "index_memo_messages_on_user_id_and_forum_id_and_created_at"
create_table "memos", :force => true do |t|
t.integer "forum_id", :null => false
t.integer "parent_id"
@ -1078,6 +1090,9 @@ ActiveRecord::Schema.define(:version => 20160317090350) do
t.datetime "updated_at", :null => false
end
add_index "message_alls", ["message_type"], :name => "index_message_alls_on_message_type"
add_index "message_alls", ["user_id", "message_id", "created_at"], :name => "index_message_alls_on_user_id_and_message_id_and_created_at"
create_table "messages", :force => true do |t|
t.integer "board_id", :null => false
t.integer "parent_id"
@ -1800,6 +1815,8 @@ ActiveRecord::Schema.define(:version => 20160317090350) do
t.integer "user_id"
end
add_index "user_activities", ["act_id", "act_type", "container_id", "created_at"], :name => "user_act_index"
create_table "user_extensions", :force => true do |t|
t.integer "user_id", :null => false
t.date "birthday"
@ -1830,6 +1847,9 @@ ActiveRecord::Schema.define(:version => 20160317090350) do
t.datetime "updated_at", :null => false
end
add_index "user_feedback_messages", ["journals_for_message_id"], :name => "index_user_feedback_messages_on_journals_for_message_id"
add_index "user_feedback_messages", ["user_id", "created_at"], :name => "index_user_feedback_messages_on_user_id_and_created_at"
create_table "user_grades", :force => true do |t|
t.integer "user_id", :null => false
t.integer "project_id", :null => false