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

This commit is contained in:
linchun 2016-03-14 17:41:14 +08:00
commit a1bef60bb5
64 changed files with 650 additions and 287 deletions

View File

@ -251,7 +251,7 @@ class AttachmentsController < ApplicationController
@history.version = @old_history.nil? ? 1 : @old_history.version + 1 @history.version = @old_history.nil? ? 1 : @old_history.version + 1
@history.save #历史记录保存完毕 @history.save #历史记录保存完毕
#将最新保存的记录 数据替换到 需要修改的文件记录 #将最新保存的记录 数据替换到 需要修改的文件记录
@old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads") @old_attachment.attributes = @attachment.attributes.dup.except("id","container_id","container_type","is_public","downloads", "quotes")
@old_attachment.save @old_attachment.save
#删除当前记录 #删除当前记录
@attachment.delete @attachment.delete

View File

@ -240,6 +240,18 @@ class CoursesController < ApplicationController
# req[:message] = l(:modal_valid_passing) if req[:message].blank? # req[:message] = l(:modal_valid_passing) if req[:message].blank?
render :json => req render :json => req
end end
def teacher_assign_group
member = Member.where(:course_id => @course.id, :user_id => params[:user_id]).first
member.course_group_id = params[:course_group_id].to_i
member.save
@course_groups = @course.course_groups
@canShowCode = isCourseTeacher(User.current.id,@course) && params[:role] != '1'
respond_to do |format|
format.js
end
end
def join_group def join_group
@subPage_title = l :label_student_list @subPage_title = l :label_student_list
group = CourseGroup.find(params[:object_id]) group = CourseGroup.find(params[:object_id])
@ -838,6 +850,8 @@ class CoursesController < ApplicationController
# render_403 # render_403
# return # return
# end # end
# 统计访问量
@course.update_attribute(: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 = @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) create_course_messages.update_all(:viewed => true)
@ -1067,7 +1081,7 @@ class CoursesController < ApplicationController
sql_select = "" sql_select = ""
if groupid == 0 if groupid == 0
sql_select = "SELECT members.*,( sql_select = "SELECT members.*,(
SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)))
FROM student_works,homework_commons FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = #{@course.id} AND homework_commons.course_id = #{@course.id}
@ -1079,7 +1093,7 @@ class CoursesController < ApplicationController
WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}" WHERE members.course_id = #{@course.id} ORDER BY score #{score_sort_by}"
else else
sql_select = "SELECT members.*,( sql_select = "SELECT members.*,(
SELECT SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)) SELECT SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)))
FROM student_works,homework_commons FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = #{@course.id} AND homework_commons.course_id = #{@course.id}

View File

@ -559,7 +559,8 @@ class FilesController < ApplicationController
end end
end end
# 更新课程英雄榜得分 # 更新课程英雄榜得分
update_contributor_score(@course, attachments[:files].first) course_member_score(@course.id, attachments[:files].first.author_id, "Attachment")
# end
# end # end
# TODO: 临时用 nyan # TODO: 临时用 nyan
sort_init 'created_on', 'desc' sort_init 'created_on', 'desc'
@ -632,18 +633,6 @@ class FilesController < ApplicationController
end end
end end
def update_contributor_score(course, file )
course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course.id, file.author.id).first
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course.id, :user_id => file.author.id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 5, :journal_num => 0, :journal_reply_num => 0, :total_score => 5)
else
score = course_contributor_score.resource_num + 5
total_score = course_contributor_score.total_score + 5
course_contributor_score.update_attributes(:resource_num => score, :total_score => total_score)
end
end
def get_project_tag_name_by_type_nmuber type def get_project_tag_name_by_type_nmuber type
case type case type
when "1" when "1"

View File

@ -17,9 +17,9 @@ class HomeworkCommonController < ApplicationController
@page = params[:page] ? params[:page].to_i + 1 : 0 @page = params[:page] ? params[:page].to_i + 1 : 0
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course)) @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
if @is_teacher if @is_teacher
@homeworks = @course.homework_commons.order("created_at desc").limit(10).offset(@page * 10) @homeworks = @course.homework_commons.order("updated_at desc").limit(10).offset(@page * 10)
else else
@homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("created_at desc").limit(10).offset(@page * 10) @homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("updated_at desc").limit(10).offset(@page * 10)
end end
@is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher)) @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
@is_new = params[:is_new] @is_new = params[:is_new]

View File

@ -107,32 +107,18 @@ class NewsController < ApplicationController
def show def show
# 更新news对应的forge_messages的消息viewed字段 # 更新news对应的forge_messages的消息viewed字段
ids = @news.comments.map { |comment| comment.id }.join(",") unless @news.comments.nil?
if @project if @project
query_message_news = @news.forge_messages # 更新新闻
query_message_news = ForgeMessage.where("forge_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
# 更新新闻的时候一并更新回复
ForgeMessage.where("forge_message_id in (#{ids}) and forge_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
else else
query_message_news = @news.course_messages query_message_news = CourseMessage.where("course_message_id =? and user_id =? and viewed =?", @news.id, User.current.id, 0).first
CourseMessage.where("course_message_id in (#{ids}) and course_message_type = 'Comment' and user_id = #{User.current.id}").update_all(:viewed => true) unless ids.blank?
end end
query_message_news.each do |query| query_message_news.update_attribute(:viewed, true) unless query_message_news.nil?
if User.current.id == query.user_id # over
query.update_attributes(:viewed => true)
end
end
# 更新项目新闻的评阅的消息viewed字段
current_message_comments = @news.comments
current_message_comments.each do |current_message_comment|
if @project
query_message_comment = current_message_comment.forge_messages
else
query_message_comment = current_message_comment.course_messages
end
query_message_comment.each do |query|
if User.current.id == query.user_id
query.update_attributes(:viewed => true)
end
end
end
# end
cs = CoursesService.new cs = CoursesService.new
result = cs.show_course_news params,User.current result = cs.show_course_news params,User.current
@news = result[:news] @news = result[:news]

View File

@ -69,6 +69,8 @@ class OrganizationsController < ApplicationController
def show def show
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization) if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
@organization = Organization.find(params[:id]) @organization = Organization.find(params[:id])
# 统计访问量
@organization.update_attribute(:visits, @organization.visits.to_i + 1)
if params[:org_subfield_id] if params[:org_subfield_id]
@org_subfield = OrgSubfield.find(params[:org_subfield_id]) @org_subfield = OrgSubfield.find(params[:org_subfield_id])
@org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0 @org_subfield_ids = @org_subfield.org_document_comments.map(&:id) << 0

View File

@ -298,6 +298,8 @@ class ProjectsController < ApplicationController
if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) if params[:jump] && redirect_to_project_menu_item(@project, params[:jump])
return return
end end
# 统计访问量
@project.update_attribute(:visits, @project.visits.to_i + 1)
=begin =begin
cond = @project.project_condition(Setting.display_subprojects_issues?) cond = @project.project_condition(Setting.display_subprojects_issues?)
has = { has = {
@ -406,6 +408,7 @@ class ProjectsController < ApplicationController
end end
flash.now[:error] = html if !html.to_s.blank? flash.now[:error] = html if !html.to_s.blank?
end end
# for设置默认分支
scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first scm = params[:repository_scm] || (Redmine::Scm::Base.all & Setting.enabled_scm).first
@repository = Repository.factory(scm) @repository = Repository.factory(scm)
@repository.is_default = @project.repository.nil? @repository.is_default = @project.repository.nil?

View File

@ -140,7 +140,7 @@ class RepositoriesController < ApplicationController
attrs = {:parent_id => project.parent_id}.reject {|k,v| v.nil?} attrs = {:parent_id => project.parent_id}.reject {|k,v| v.nil?}
redirect_to new_project_url(attrs, :course => '0') redirect_to new_project_url(attrs, :course => '0')
else else
redirect_to settings_project_url(project) redirect_to project_path(project)
end end
} }
format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => project.id) } format.api { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => project.id) }
@ -431,8 +431,11 @@ update
def entry def entry
entry_and_raw(false) entry_and_raw(false)
@content = @repository.cat(@path, @rev)
if is_entry_text_data?(@content, @path)
render :layout => 'base_projects' render :layout => 'base_projects'
end end
end
def entry_and_raw(is_raw) def entry_and_raw(is_raw)
@entry = @repository.entry(@path, @rev) @entry = @repository.entry(@path, @rev)
@ -443,9 +446,7 @@ update
@content = @repository.cat(@path, @rev) @content = @repository.cat(@path, @rev)
(show_error_not_found; return) unless @content (show_error_not_found; return) unless @content
if is_raw || if is_raw || (@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) || !is_entry_text_data?(@content, @path)
(@content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte) ||
! is_entry_text_data?(@content, @path)
# Force the download # Force the download
send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) } send_opt = { :filename => filename_for_content_disposition(@path.split('/').last) }
send_type = Redmine::MimeType.of(@path) send_type = Redmine::MimeType.of(@path)

View File

@ -36,6 +36,14 @@ class StudentWorkController < ApplicationController
unless student_work.save unless student_work.save
resultObj[:status] = 200 resultObj[:status] = 200
else else
student_work.name = params[:title]
student_work.description = params[:src]
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
student_work.late_penalty = @homework.late_penalty
else
student_work.late_penalty = 0
end
student_work.save
resultObj[:status] = result["status"].to_i resultObj[:status] = result["status"].to_i
resultObj[:time] = student_work_test.created_at.to_s(:db) resultObj[:time] = student_work_test.created_at.to_s(:db)
resultObj[:index] = student_work.student_work_tests.count resultObj[:index] = student_work.student_work_tests.count
@ -93,12 +101,12 @@ class StudentWorkController < ApplicationController
end end
#老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表 #老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
if @homework.is_open == 1 if @homework.is_open == 1
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name @stundet_works = 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").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
@show_all = true @show_all = true
elsif @homework.is_open == 0 && User.current.member_of_course?(@course) || User.current.admin? elsif @homework.is_open == 0 && User.current.member_of_course?(@course) || User.current.admin?
if @is_teacher || @homework.homework_detail_manual.nil? || if @is_teacher || @homework.homework_detail_manual.nil? ||
(@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) (@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name @stundet_works = 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").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
@show_all = true @show_all = true
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3 if @homework.homework_type == 3
@ -106,10 +114,10 @@ class StudentWorkController < ApplicationController
if pro.nil? if pro.nil?
@stundet_works = [] @stundet_works = []
else else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) @stundet_works = @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").where(:id => pro.student_work_id)
end end
else else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) @stundet_works = @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").where(:user_id => User.current.id)
end end
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
if @homework.homework_type == 3 if @homework.homework_type == 3
@ -129,15 +137,15 @@ class StudentWorkController < ApplicationController
if pro.nil? if pro.nil?
my_work = [] my_work = []
else else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) my_work = @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").where(:id => pro.student_work_id)
end end
else else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) my_work = @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").where(:user_id => User.current.id)
end end
if my_work.empty? if my_work.empty?
@stundet_works = [] @stundet_works = []
else else
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name @stundet_works = 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").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
@show_all = true @show_all = true
end end
else else
@ -148,14 +156,14 @@ class StudentWorkController < ApplicationController
return return
end end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count @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").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
else else
if @homework.is_open == 1 if @homework.is_open == 1
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name @stundet_works = 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
@show_all = true @show_all = true
elsif @homework.is_open == 0 && User.current.member_of_course?(@course) || User.current.admin? elsif @homework.is_open == 0 && User.current.member_of_course?(@course) || User.current.admin?
if @is_teacher || @homework.homework_detail_manual.nil? || (@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) #老师 || 超级管理员 显示所有列表 if @is_teacher || @homework.homework_detail_manual.nil? || (@homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?) #老师 || 超级管理员 显示所有列表
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name @stundet_works = 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
@show_all = true @show_all = true
elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的 elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3 if @homework.homework_type == 3
@ -163,10 +171,10 @@ class StudentWorkController < ApplicationController
if pro.nil? if pro.nil?
@stundet_works = [] @stundet_works = []
else else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) @stundet_works = @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").where(:id => pro.student_work_id)
end end
else else
@stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) @stundet_works = @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").where(:user_id => User.current.id)
end end
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表 elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
if @homework.homework_type == 3 if @homework.homework_type == 3
@ -186,15 +194,15 @@ class StudentWorkController < ApplicationController
if pro.nil? if pro.nil?
my_work = [] my_work = []
else else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:id => pro.student_work_id) my_work = @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").where(:id => pro.student_work_id)
end end
else else
my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) my_work = @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").where(:user_id => User.current.id)
end end
if my_work.empty? if my_work.empty?
@stundet_works = [] @stundet_works = []
else else
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name @stundet_works = 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
@show_all = true @show_all = true
end end
else else
@ -205,7 +213,7 @@ class StudentWorkController < ApplicationController
return return
end end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name).count @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 end
@score = @b_sort == "desc" ? "asc" : "desc" @score = @b_sort == "desc" ? "asc" : "desc"
@ -303,6 +311,7 @@ class StudentWorkController < ApplicationController
stu_project.save stu_project.save
end end
end end
@homework.update_attributes(:updated_at => Time.now)
update_course_activity(@homework.class,@homework.id) update_course_activity(@homework.class,@homework.id)
update_user_activity(@homework.class,@homework.id) update_user_activity(@homework.class,@homework.id)
update_org_activity(@homework.class,@homework.id) update_org_activity(@homework.class,@homework.id)
@ -500,6 +509,10 @@ class StudentWorkController < ApplicationController
when 3 #学生评分 学生评分显示平均分 when 3 #学生评分 学生评分显示平均分
@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f @work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
end end
@homework.update_attributes(:updated_at => Time.now)
update_course_activity(@homework.class,@homework.id)
update_user_activity(@homework.class,@homework.id)
update_org_activity(@homework.class,@homework.id)
if @work.save if @work.save
respond_to do |format| respond_to do |format|
format.js format.js

View File

@ -58,6 +58,7 @@ class UsersController < ApplicationController
helper :sort helper :sort
helper :attachments helper :attachments
include SortHelper include SortHelper
include ApplicationHelper
helper :custom_fields helper :custom_fields
include CustomFieldsHelper include CustomFieldsHelper
include AvatarHelper include AvatarHelper
@ -422,7 +423,7 @@ class UsersController < ApplicationController
end end
def choose_user_course def choose_user_course
homework = HomeworkCommon.find params[:homework].to_i homework = HomeworkCommon.find params[:send_id].to_i
if !params[:search].nil? if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%" search = "%#{params[:search].to_s.strip.downcase}%"
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)} @course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)}
@ -690,6 +691,11 @@ class UsersController < ApplicationController
end end
student_work.save student_work.save
homework.update_attributes(:updated_at => Time.now)
update_course_activity(homework.class,homework.id)
update_user_activity(homework.class,homework.id)
update_org_activity(homework.class,homework.id)
flash[:notice] = l(:notice_successful_create) flash[:notice] = l(:notice_successful_create)
redirect_to student_work_index_url(:homework => params[:homework]) redirect_to student_work_index_url(:homework => params[:homework])
else else
@ -1168,6 +1174,10 @@ class UsersController < ApplicationController
end end
def show def show
# 统计访问量
unless User.current == @user
@user.update_attribute(:visits, @user.visits.to_i + 1)
end
#更新用户申请成为课程老师或教辅消息的状态 #更新用户申请成为课程老师或教辅消息的状态
if params[:course_id] != nil 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 =?", join_course_messages = CourseMessage.where("course_id =? and course_message_type =? and user_id =? and course_message_id =? and viewed =?",

View File

@ -276,7 +276,7 @@ class WordsController < ApplicationController
ids = params[:asset_id].split(',') ids = params[:asset_id].split(',')
update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE update_kindeditor_assets_owner ids,feedback[:id],OwnerTypeHelper::JOURNALSFORMESSAGE
end end
@homework_common.update_attributes(:updated_at => Time.now)
update_course_activity(@homework_common.class,@homework_common.id) update_course_activity(@homework_common.class,@homework_common.id)
update_user_activity(@homework_common.class,@homework_common.id) update_user_activity(@homework_common.class,@homework_common.id)
update_org_activity(@homework_common.class,@homework_common.id) update_org_activity(@homework_common.class,@homework_common.id)

View File

@ -117,56 +117,102 @@ module ApplicationHelper
when "HomeworkCommon" when "HomeworkCommon"
if course_contributor_score.nil? if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :homework_journal_num => 1 , :total_score => 1) :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :homework_journal_num => 1)
else else
score = course_contributor_score.homework_journal_num + 1 score = course_contributor_score.homework_journal_num + 1
total_score = course_contributor_score.total_score + 1 course_contributor_score.update_attributes(:homework_journal_num => score)
course_contributor_score.update_attributes(:homework_journal_num => score, :total_score => total_score)
end end
when "JournalForMessage" # 课程留言
when "Course"
if course_contributor_score.nil? if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0, :total_score => 1) :news_reply_num => 0, :resource_num => 0, :journal_num => 1, :journal_reply_num => 0)
else else
score = course_contributor_score.journal_num + 1 score = course_contributor_score.journal_num + 1
total_score = course_contributor_score.total_score + 1 course_contributor_score.update_attributes(:journal_num => score)
course_contributor_score.update_attributes(:journal_num => score, :total_score => total_score)
end end
when "Message" when "Message"
if course_contributor_score.nil? if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 2, :message_reply_num => 0, CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 1, :message_reply_num => 0,
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 2) :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
else else
score = course_contributor_score.message_num + 2 score = course_contributor_score.message_num + 1
total_score = course_contributor_score.total_score + 2 course_contributor_score.update_attributes(:message_num => score)
course_contributor_score.update_attributes(:message_num => score, :total_score => total_score)
end end
when "MessageReply" when "MessageReply"
if course_contributor_score.nil? if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 1, CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 1,
:news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1) :news_reply_num => 0, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
else else
score = course_contributor_score.message_reply_num + 1 score = course_contributor_score.message_reply_num + 1
total_score = course_contributor_score.total_score + 1 course_contributor_score.update_attributes(:message_reply_num => score)
course_contributor_score.update_attributes(:message_reply_num => score, :total_score => total_score)
end end
when "NewReply" when "NewReply"
if course_contributor_score.nil? if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1) :news_reply_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
else else
score = course_contributor_score.news_reply_num + 1 score = course_contributor_score.news_reply_num + 1
total_score = course_contributor_score.total_score + 1 course_contributor_score.update_attributes(:news_reply_num => score)
course_contributor_score.update_attributes(:news_reply_num => score, :total_score => total_score)
end end
when "News" when "News"
if course_contributor_score.nil? if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0, CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :news_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0, :total_score => 1) :news_reply_num => 0, :news_num => 1, :resource_num => 0, :journal_num => 0, :journal_reply_num => 0)
else else
score = course_contributor_score.news_num + 1 score = course_contributor_score.news_num + 1
total_score = course_contributor_score.total_score + 1 course_contributor_score.update_attributes(:news_num => score)
course_contributor_score.update_attributes(:news_num => score, :total_score => total_score) end
when "Attachment"
if course_contributor_score.nil?
CourseContributorScore.create(:course_id => course_id, :user_id => user_id, :message_num => 0, :message_reply_num => 0,
:news_reply_num => 0, :news_num => 0, :resource_num => 1, :journal_num => 0, :journal_reply_num => 0)
else
score = course_contributor_score.resource_num + 1
course_contributor_score.update_attributes(:resource_num => score)
end
end
end
# 删除某条记录相应减少课程统计数
def down_course_score_num (course_id,user_id,type)
course_contributor_score = CourseContributorScore.where("course_id =? and user_id =?", course_id, user_id).first
case type
when "HomeworkCommon"
unless course_contributor_score.nil?
score = course_contributor_score.homework_journal_num - 1
course_contributor_score.update_attribute(:homework_journal_num, score < 0 ? 0 : score)
end
# 课程留言
when "Course"
unless course_contributor_score.nil?
score = course_contributor_score.journal_num - 1
course_contributor_score.update_attribute(:journal_num, score < 0 ? 0 : score)
end
when "Message"
unless course_contributor_score.nil?
score = course_contributor_score.message_num - 1
course_contributor_score.update_attribute(:message_num, score < 0 ? 0 : score)
end
when "MessageReply"
unless course_contributor_score.nil?
score = course_contributor_score.message_reply_num - 1
course_contributor_score.update_attribute(:message_reply_num, score < 0 ? 0 : score)
end
when "NewReply"
unless course_contributor_score.nil?
score = course_contributor_score.news_reply_num - 1
course_contributor_score.update_attribute(:news_reply_num, score < 0 ? 0 : score)
end
when "News"
unless course_contributor_score.nil?
score = course_contributor_score.news_num - 1
course_contributor_score.update_attribute(:news_num, score < 0 ? 0 : score)
end
when "Attachment"
unless course_contributor_score.nil?
score = course_contributor_score.resource_num - 1
course_contributor_score.update_attribute(:resource_num, score < 0 ? 0 : score)
end end
end end
end end
@ -2895,3 +2941,13 @@ int main(int argc, char** argv){
end end
end end
end end
def user_url_in_org(user_id)
if Rails.env.development?
return "http://localhost:3000/users/" + user_id.to_s
elsif Rails.env.test?
return "https://www.test.forge.trustie.net/users/" + user_id.to_s
else
return "https://www.trustie.net/users/" + user_id.to_s
end
end

View File

@ -606,6 +606,24 @@ module CoursesHelper
Course.tagged_with(tag_name).order('updated_at desc') Course.tagged_with(tag_name).order('updated_at desc')
end end
#分班下拉框
def course_group_option course
type = []
option1 = []
option1 << "暂无"
option1 << 0
type << option1
unless course.course_groups.nil?
course.course_groups.each do |cg|
option = []
option << cg.name
option << cg.id
type << option
end
end
type
end
#课程实践年份下拉框 #课程实践年份下拉框
def course_time_option year def course_time_option year
type = [] type = []

View File

@ -43,6 +43,7 @@ class Attachment < ActiveRecord::Base
#elasticsearch #elasticsearch
include Elasticsearch::Model include Elasticsearch::Model
include ApplicationHelper
#elasticsearch kaminari init #elasticsearch kaminari init
Kaminari::Hooks.init Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
@ -92,7 +93,7 @@ class Attachment < ActiveRecord::Base
after_save :act_as_course_activity after_save :act_as_course_activity
after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index after_create :office_conver, :be_user_score,:act_as_forge_activity,:create_attachment_ealasticsearch_index
after_update :office_conver, :be_user_score,:update_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 after_destroy :delete_from_disk,:down_user_score,:delete_attachment_ealasticsearch_index, :decrease_attchments_count, :down_course_score
# add by nwb # add by nwb
# 获取所有可公开的资源文件列表 # 获取所有可公开的资源文件列表
@ -655,6 +656,12 @@ class Attachment < ActiveRecord::Base
self.container.project_score.update_attribute(:attach_num, attach_count < 0 ? 0 : attach_count) self.container.project_score.update_attribute(:attach_num, attach_count < 0 ? 0 : attach_count)
end end
end end
def down_course_score
if self.container_type == "Course"
down_course_score_num(self.container_id, self.author_id, "Attachment")
end
end
end end
# Delete the previous articles index in Elasticsearch # Delete the previous articles index in Elasticsearch

View File

@ -36,6 +36,7 @@ class Comment < ActiveRecord::Base
validates_presence_of :commented, :author, :comments validates_presence_of :commented, :author, :comments
safe_attributes 'comments' safe_attributes 'comments'
after_create :send_mail, :act_as_system_message, :act_as_student_score after_create :send_mail, :act_as_system_message, :act_as_student_score
after_destroy :down_course_score
def act_as_system_message def act_as_system_message
if self.commented.course if self.commented.course
@ -86,4 +87,11 @@ class Comment < ActiveRecord::Base
end end
end end
# 课程新闻数减少
def down_course_score
if self.commented.course
down_course_score_num(self.commented.course.id, self.author_id, "NewReply")
end
end
end end

View File

@ -73,7 +73,7 @@ class JournalsForMessage < ActiveRecord::Base
#after_update :update_activity #after_update :update_activity
after_destroy :reset_counters! after_destroy :reset_counters!
after_save :be_user_score after_save :be_user_score
after_destroy :down_user_score after_destroy :down_user_score, :down_course_score
# default_scope { where('m_parent_id IS NULL') } # default_scope { where('m_parent_id IS NULL') }
@ -184,6 +184,7 @@ class JournalsForMessage < ActiveRecord::Base
end end
end end
end end
# 更新用户分数 -by zjc # 更新用户分数 -by zjc
def down_user_score def down_user_score
#删除了留言回复 #删除了留言回复
@ -286,10 +287,19 @@ class JournalsForMessage < ActiveRecord::Base
# 课程成员得分(活跃度) # 课程成员得分(活跃度)
def act_as_student_score def act_as_student_score
if self.jour_type == "Course" if self.jour_type == "Course"
course_member_score(self.jour_id, self.user_id, "JournalForMessage") course_member_score(self.jour_id, self.user_id, "Course")
elsif self.jour_type == "HomeworkCommon" elsif self.jour_type == "HomeworkCommon"
course_member_score(self.jour.course_id, self.user_id, "HomeworkCommon") course_member_score(self.jour.course_id, self.user_id, "HomeworkCommon")
end end
end end
# 删除操作的时候相应扣掉回复数
def down_course_score
if self.jour_type == "Course"
down_course_score_num(self.jour_id, self.user_id, "Course")
elsif self.jour_type == "HomeworkCommon"
down_course_score_num(self.jour.course_id, self.user_id, "HomeworkCommon")
end
end
end end

View File

@ -150,7 +150,7 @@ class Member < ActiveRecord::Base
#当前学生在指定作业内的得分 #当前学生在指定作业内的得分
def homework_common_score homework_common def homework_common_score homework_common
StudentWork.select("IF(final_score is null,null,final_score - absence_penalty - late_penalty) as final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id) StudentWork.select("IF(final_score is null,null,IF(final_score = 0, 0, final_score - absence_penalty - late_penalty)) as final_score").where(:homework_common_id => homework_common.id,:user_id => self.user_id)
end end
def student_work_score_avg def student_work_score_avg
@ -158,7 +158,7 @@ class Member < ActiveRecord::Base
end end
def student_work_score_sum def student_work_score_sum
sql_select = "SELECT (SUM(IF(student_works.final_score is null,null,student_works.final_score - student_works.absence_penalty - student_works.late_penalty))) as score sql_select = "SELECT (SUM(IF(student_works.final_score IS NULL,NULL,IF(student_works.final_score =0,0,student_works.final_score - student_works.absence_penalty - student_works.late_penalty)))) as score
FROM student_works,homework_commons FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = #{self.course_id} AND homework_commons.course_id = #{self.course_id}

View File

@ -79,7 +79,7 @@ class Message < ActiveRecord::Base
after_create :add_author_as_watcher, :reset_counters!, :add_boards_count after_create :add_author_as_watcher, :reset_counters!, :add_boards_count
after_update :update_messages_board, :update_activity after_update :update_messages_board, :update_activity
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets, :decrease_boards_count, :down_course_score
after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, :act_as_at_message after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, :act_as_at_message
#before_save :be_user_score #before_save :be_user_score
@ -354,6 +354,18 @@ class Message < ActiveRecord::Base
end end
end end
# 删除帖子的时候更新课程帖子总数, 删除回复的时候减少总数
def down_course_score
if self.course
if self.parent_id.nil? # 发帖
down_course_score_num(self.course.id, self.author_id, "Message")
else
# 回帖
down_course_score_num(self.course.id, self.author_id, "MessageReply")
end
end
end
def delete_org_activities def delete_org_activities
OrgActivity.where("org_act_type='Message' and org_act_id =#{self.id} and container_type='OrgSubfield'").destroy_all OrgActivity.where("org_act_type='Message' and org_act_id =#{self.id} and container_type='OrgSubfield'").destroy_all
end end

View File

@ -61,7 +61,7 @@ class News < ActiveRecord::Base
after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity,:act_as_system_message, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score
after_update :update_activity after_update :update_activity
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
scope :visible, lambda {|*args| scope :visible, lambda {|*args|
includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args)) includes(:project).where(Project.allowed_to_condition(args.shift || User.current, :view_news, *args))
@ -195,10 +195,18 @@ class News < ActiveRecord::Base
OrgActivity.where("container_type='OrgSubfield' and org_act_type='News' and org_act_id=?", self.id).destroy_all OrgActivity.where("container_type='OrgSubfield' and org_act_type='News' and org_act_id=?", self.id).destroy_all
end end
# 新增新闻统计数增加
def act_as_student_score def act_as_student_score
if self.course if self.course
course_member_score(self.course.id, self.author_id, "News") course_member_score(self.course.id, self.author_id, "News")
end end
end end
# 删除新闻统计数减少
def down_course_score
if self.course
down_course_score_num(self.course.id, self.author_id, "News")
end
end
end end

View File

@ -24,7 +24,8 @@
<ul class="st_box_top"> <ul class="st_box_top">
<li class="ml50" style="padding-right: 5px;"><a href="">姓名</a></li> <li class="ml50" style="padding-right: 5px;"><a href="">姓名</a></li>
<li class="ml10" style="padding-right: 15px;"><a href="">学号</a></li> <li class="ml10" style="padding-right: 15px;"><a href="">学号</a></li>
<li class="ml358"> <li style="padding-right: 55px; margin-left: 260px;"><a href="">分班</a></li>
<li style="margin-left: 25px;">
<%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true%> <%= link_to '作业积分', member_score_sort_course_path(:sort_by => (@score_sort_by == "desc" ? "asc" : "desc"), :group_id => (@group ? @group.id : 0),:search_name => (@search_name ? @search_name : nil)) ,:result => members,method: 'get', remote: true%>
<% if @score_sort_by == 'desc' %> <% if @score_sort_by == 'desc' %>
<a id="pic" href="javascript:" class= "st_down"></a> <a id="pic" href="javascript:" class= "st_down"></a>
@ -58,11 +59,38 @@
<li><%= link_to("#{l(:label_bidding_user_studentcode)}<span >#{member.user.user_extensions.student_id}</span>".html_safe,user_path(member.user)) %></li> <li><%= link_to("#{l(:label_bidding_user_studentcode)}<span >#{member.user.user_extensions.student_id}</span>".html_safe,user_path(member.user)) %></li>
<% end%> <% end%>
</ul> </ul>
<% if User.current.allowed_to?(:as_teacher, @course) || User.current.admin? %>
<% if @course.course_groups.nil? || @group %>
<div class="select-class-option fl" style="margin-left: 105px;">
<span style="width: 100px; text-align: center; float: left;" class="hidden"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
</div>
<% else %>
<%= form_tag({:controller => 'courses', :action => 'teacher_assign_group', :id => @course.id,:user_id => member.user_id},:remote=>'true', :method => 'post', :id=>"join_group_form_#{member.id}", :class => 'query_form') do %>
<div class="select-class-option fl" style="margin-left: 105px;"><span style="width: 100px; text-align: center; float: left;" class="hidden"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
<a style="display: inline-block;" href="javascript:void(0)" class="pic_edit2 ml5"></a>
</div>
<%= select( :name,:group_id, course_group_option(@course),
{ :include_blank => false,:selected => member.course_group_id},
{:onchange=>"join_group_function('#join_group_form_#{member.id}');", :id =>"course_group_id", :name => "course_group_id",:class=>"w125 undis class-edit fl", :style => "margin-left: 105px;"}) %>
<!--<select class="w125 undis class-edit fl" style="margin-left: 105px;">
<option value="1" selected="selected">向日葵班</option>
<option value="2">学前班</option>
<option value="3">幼儿园</option>
<option value="4">小学</option>
<option value="5">初中</option>
</select>-->
<% end %>
<% end %>
<% else %>
<div class="select-class-option fl" style="margin-left: 105px;">
<span style="width: 100px; text-align: center; float: left;" class="hidden"><%=member.course_group_id == 0 ? "暂无" : member.course_group.name %></span>
</div>
<% end %>
<%= link_to format("%0.2f",member.score.nil? ? 0 : member.score.to_s), { <%= link_to format("%0.2f",member.score.nil? ? 0 : member.score.to_s), {
:action => 'show_member_score', :action => 'show_member_score',
:member_id => member.id, :member_id => member.id,
:remote => true}, :remote => true},
:class => 'ml258 c_red' %> :class => 'ml25 c_red' %>
<span class="fr mr15 c_grey"><%= format_date(member.created_on)%></span> <span class="fr mr15 c_grey"><%= format_date(member.created_on)%></span>
<%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %> <%= call_hook(:view_projects_settings_members_table_row, { :course => @course, :member => member}) %>
</div> </div>
@ -79,3 +107,40 @@
</p> </p>
<% end%> <% end%>
<script>
$(document).ready(function(){
/*$(".select-class-option").mouseover(function(){
$(this).children(".pic_edit2").css("display","inline-block");
});
$(".select-class-option").mouseout(function(){
$(this).children(".pic_edit2").css("display","none");
});*/
$(".pic_edit2").click(function(){
$(this).parent().hide();
$(this).parent().next().show();
});
$(".class-edit").blur(function(){
$(this).hide();
$(this).prev().show();
var editValue = $(this).children("option:selected").text();
$(this).prev().children(":first").text(editValue);
});
function stopPropagation(e) {
if (e.stopPropagation)
e.stopPropagation();
else
e.cancelBubble = true;
};
$(document).bind('click',function(){
$('.class-edit').css('display','none');
$('.select-class-option').show();
});
$('.class-edit,.pic_edit2').bind('click',function(e){
stopPropagation(e);
});
});
function join_group_function(id){
$(id).submit();
}
</script>

View File

@ -6,7 +6,7 @@
<li class="mt15"> <%= image_tag(url_to_avatar(e_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %> <li class="mt15"> <%= image_tag(url_to_avatar(e_course), :width => "40", :height => "40", :class => "fl mr10 rankPortrait", :alt => "logo") %>
<div class="fl"> <div class="fl">
<p class="f12 mb5"><%=link_to e_course.name, course_path(e_course.id), :class => "hidden fl w170" %></p> <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"> <p class="f12">
<% if e_course.attachments.count > 0 %> <% if e_course.attachments.count > 0 %>
<span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>)</span> <span class="fl mr15 fontGrey4"><%= l(:project_module_attachments) %>(<%= link_to e_course.attachments.count, course_files_path(e_course), :class => "linkBlue2" %>)</span>
@ -14,6 +14,7 @@
<% if e_course.homework_commons.count > 0 %> <% if e_course.homework_commons.count > 0 %>
<span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)</span> <span class="fl fontGrey4"><%= l(:label_homework_commont) %>(<%= link_to e_course.homework_commons.count, homework_common_index_path(:course=>e_course.id), :class => "linkBlue2" %>)</span>
<% end %> <% end %>
<div class="cl"></div>
</p> </p>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -0,0 +1 @@
$("#st_groups").html("<%=escape_javascript(render :partial => 'new_groups_name', :locals => {:course_groups => @course_groups}) %>");

View File

@ -25,7 +25,7 @@
<div class="mb5"> <div class="mb5">
<label class="fl c_dark f14" style="margin-top: 4px;">附件描述:</label> <label class="fl c_dark f14" style="margin-top: 4px;">附件描述:</label>
<div class="fl"> <div class="fl">
<input type="text" name="description" placeholder="文件描述" class="fl W120 "> <input type="text" name="description" placeholder="文件描述" class="InputBox fl W160">
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>

View File

@ -143,18 +143,19 @@
<% unless contributor_course_scor(@course.id).count == 0 %> <% unless contributor_course_scor(@course.id).count == 0 %>
<ul class="rankList"> <ul class="rankList">
<h4>课程活跃度 <h4>课程活跃度
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))">积分规则</a> <a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor: pointer; position:relative;">积分规则</a>
</h4> </h4>
<div style="display: none;padding: 5px;" class="numIntro color_888"> <div class="numIntro undis" style="cursor:pointer;">
<div class="contributor_course_innor">积分规则</div> <div class="active-degree-rule">
资源发布:资源数 x 5 </br> 积分规则<br/>
问答发布:发帖数 x 2 </br> 资源发布:资源数 x 5 <br/>
通知发布:通知数 x 1 </br> 问答发布:发帖数 x 2 <br/>
问答回复:回复数 x 1 </br> 通知发布:通知数 x 1 <br/>
作业留言:留言数 x 1 </br> 问答回复:回复数 x 1 <br/>
通知留言:留言数 x 1 </br> 作业留言:留言数 x 1 <br/>
课程留言:留言数 x 1 </br> 通知留言:留言数 x 1 <br/>
总得分为以上得分之和 课程留言:留言数 x 1 <br/>
总得分为以上得分之和</div>
</div> </div>
<% contributor_course_scor(@course.id).each do |contributor_score| %> <% contributor_course_scor(@course.id).each do |contributor_score| %>
@ -163,13 +164,13 @@
+ contributor_score.homework_journal_num.to_i * 1 + contributor_score.news_reply_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 %> contributor_score.news_num.to_i * 1 %>
<% unless total_score ==0 %> <% unless total_score ==0 %>
<li> <a href="javascript:void:(0);"><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %></a> <li><%=link_to image_tag(url_to_avatar(contributor_score.user), :width => "35", :height => "35", :class=> "rankPortrait"),user_path(contributor_score.user) %>
<p><a href="javascript:void:(0);"><%=link_to contributor_score.user.show_name, user_path(contributor_score.user), :title => contributor_score.user.show_name %></a></p> <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"> <p><span class="c_green" style="cursor:pointer">
<a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="c_green"> <a onmouseover ="message_titile_show($(this),event)" onmouseout ="message_titile_hide($(this))" class="c_green">
<%=total_score %></a></span></p> <%=total_score %></a></span></p>
<div style="display: none" class="numIntro color_888"> <div style="display: none" class="numIntro">
<div class="contributor_course_calculate">积分计算</div> <div class="contributor-course-calculate">积分计算</div>
<%# unless contributor_score.resource_num.to_i == 0 %> <%# unless contributor_score.resource_num.to_i == 0 %>
<div style="padding-left: 2px;padding-bottom: 2px;padding-right: 2px"> <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> 资源发布数 x 5 = <%= contributor_score.resource_num.to_i %> x 5 = <%= contributor_score.resource_num.to_i * 5 %></br>
@ -208,11 +209,12 @@
<% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %> <% unless hero_homework_scores.map(&:score).detect{|s| s.to_i != 0}.nil? %>
<ul class="rankList"> <ul class="rankList">
<h4><span>课程英雄榜</span> <h4><span>课程英雄榜</span>
<a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))">积分规则</a></h4> <a class="contributor_course" onmouseover ="message_titile_show2($(this),event)" onmouseout ="message_titile_hide2($(this))" style="cursor:pointer;">积分规则</a></h4>
<div style="display: none" class="numIntro color_888"> <div style="cursor:pointer;" class="numIntro undis">
<div class="hero_course_innor">积分规则</div> <div class="hero-degree-rule">积分规则<br/>
英雄榜的得分是每个同学作业的得分总和 英雄榜的得分是每个同学作业的得分总和
</div> </div>
</div>
<% hero_homework_scores.each do |student_score| %> <% hero_homework_scores.each do |student_score| %>
<% if student_score.score.to_i != 0 %> <% 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> <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>
@ -248,6 +250,7 @@
</div><!--项目标签 end--> </div><!--项目标签 end-->
<!--课程推荐--> <!--课程推荐-->
<%= render :partial => 'courses/recommendation', :locals => {:course => @course} %> <%= render :partial => 'courses/recommendation', :locals => {:course => @course} %>
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @course.visits.to_i %></div>
</div><!--LSide end--> </div><!--LSide end-->
<div id="RSide" class="fl"> <div id="RSide" class="fl">

View File

@ -132,6 +132,7 @@
<div class="homepageLeftMenuContainer" id="sub_field_left_lists"> <div class="homepageLeftMenuContainer" id="sub_field_left_lists">
<%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %> <%= render :partial => "organizations/org_left_subfield_list", :locals => {:organization => @organization} %>
</div> </div>
<div class="fontGrey5 mt10 ml20">访问计数 <%= @organization.visits.to_i %></div>
</div> </div>
<div class="homepageRight" style="margin-top:<%= (params[:show_homepage].nil? && User.current.logged?) ? '10px':'0px' %>;"> <div class="homepageRight" style="margin-top:<%= (params[:show_homepage].nil? && User.current.logged?) ? '10px':'0px' %>;">
<%= render_flash_messages %> <%= render_flash_messages %>

View File

@ -158,9 +158,12 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div><!--项目标签 end--> </div><!--项目标签 end-->
<div class="fontGrey5 mt10 ml10 mb10">访问计数 <%= @project.visits.to_i %></div>
</div> </div>
</div> </div>
<div id="RSide" class="fl"> <div id="RSide" class="fl">
<%= render_flash_messages %> <%= render_flash_messages %>
<%= yield %> <%= yield %>

View File

@ -226,6 +226,7 @@
<div class="cl"></div> <div class="cl"></div>
</div> </div>
</div> </div>
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %></div>
</div> </div>
<div class="homepageRight"> <div class="homepageRight">
<%= yield %> <%= yield %>

View File

@ -50,7 +50,7 @@
<%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(act.user_id)} %> <%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(act.user_id)} %>
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo"><%= link_to User.find(act.user_id), user_path(act.user_id) %>&nbsp;&nbsp;创建了 <a href="<%= organization_path(@organization)%>" class="newsBlue ml10"><%= Organization.find(act.org_act_id).name %> <div class="homepagePostTo"><%= link_to User.find(act.user_id), user_url_in_org(act.user_id) %>&nbsp;&nbsp;创建了 <a href="<%= organization_path(@organization)%>" class="newsBlue ml10"><%= Organization.find(act.org_act_id).name %>
| 组织</a></div> | 组织</a></div>
<div class="homepagePostDate"> 创建时间:<%= format_activity_day(act.created_at) %> <%= format_time(act.created_at, false) %> </div> <div class="homepagePostDate"> 创建时间:<%= format_activity_day(act.created_at) %> <%= format_time(act.created_at, false) %> </div>
</div> </div>

View File

@ -1,15 +1,15 @@
<div class="resources mt10"> <div class="resources mt10">
<div class="homepagePostBrief"> <div class="homepagePostBrief">
<div class="homepagePostPortrait"> <div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.teacher), :width => "50", :height => "50"), user_path(activity.tea_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(activity.teacher), :width => "50", :height => "50"), user_url_in_org(activity.tea_id), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.teacher} %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.teacher} %>
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4"> <div class="homepagePostTo break_word mt-4">
<% if activity.try(:teacher).try(:realname) == ' ' %> <% if activity.try(:teacher).try(:realname) == ' ' %>
<%= link_to activity.try(:teacher), user_path(activity.tea_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:teacher), user_url_in_org(activity.tea_id), :class => "newsBlue mr15" %>
<% else %> <% else %>
<%= link_to activity.try(:teacher).try(:realname), user_path(activity.tea_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:teacher).try(:realname), user_url_in_org(activity.tea_id), :class => "newsBlue mr15" %>
<% end %> <% end %>
TO TO
<%= link_to activity.name.to_s+" | 课程", course_path(activity.id,:host=>Setting.host_course), :class => "newsBlue ml15" %> <%= link_to activity.name.to_s+" | 课程", course_path(activity.id,:host=>Setting.host_course), :class => "newsBlue ml15" %>

View File

@ -2,15 +2,15 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>"> <div class="resources mt10" id="user_activity_<%= user_activity_id%>">
<div class="homepagePostBrief"> <div class="homepagePostBrief">
<div class="homepagePostPortrait"> <div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_url_in_org(activity.user_id), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4"> <div class="homepagePostTo break_word mt-4">
<% if activity.try(:user).try(:realname) == ' ' %> <% if activity.try(:user).try(:realname) == ' ' %>
<%= link_to activity.try(:user), user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> <%= link_to activity.try(:user), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %>
<% else %> <% else %>
<%= link_to activity.try(:user).try(:realname), user_path(activity.user_id,:host=>Setting.host_user), :class => "newsBlue mr15" %> <%= link_to activity.try(:user).try(:realname), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %>
<% end %> TO <!--+"(课程名称)" --> <% end %> TO <!--+"(课程名称)" -->
<%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%> <%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%>
</div> </div>
@ -154,8 +154,18 @@
<% end %> <% end %>
<% student_works.each_with_index do |sw, i| %> <% student_works.each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;"> <div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %> <a href="javascript:void(0);" class="linkBlue">
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%></p> <% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>
<%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
<p class="w100 hidden">
<%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%>
</p>
<% else %>
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>
<p class="w100 hidden">
<a href="javascript:void(0);" title="该作业的作品暂未公开"><%=sw.user.show_name %></a>
</p>
<% end %>
</a> </a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p> <p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p>
@ -303,14 +313,14 @@
<% replies_all_i = replies_all_i + 1 %> <% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>"> <li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_url_in_org(comment.user_id), :alt => "用户头像" %>
</div> </div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"> <div class="homepagePostReplyPublisher">
<% if comment.try(:user).try(:realname) == ' ' %> <% if comment.try(:user).try(:realname) == ' ' %>
<%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> <%= link_to comment.try(:user), user_url_in_org(comment.user_id), :class => "newsBlue mr10 f14" %>
<% else %> <% else %>
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %> <%= link_to comment.try(:user).try(:realname), user_url_in_org(comment.user_id), :class => "newsBlue mr10 f14" %>
<% end %> <% end %>
<%= format_time(comment.created_on) %> <%= format_time(comment.created_on) %>
<span id="reply_praise_count_<%=comment.id %>"> <span id="reply_praise_count_<%=comment.id %>">

View File

@ -1,15 +1,15 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>"> <div class="resources mt10" id="user_activity_<%= user_activity_id%>">
<div class="homepagePostBrief"> <div class="homepagePostBrief">
<div class="homepagePostPortrait"> <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 => "用户头像" %> <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4"> <div class="homepagePostTo break_word mt-4">
<% if activity.try(:author).try(:realname) == ' ' %> <% 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_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% else %> <% 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_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% end %> <% end %>
TO TO
<%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%> <%= link_to activity.course.name.to_s+" | 课程问答区", course_boards_path(activity.course,:host=> Setting.host_course), :class => "newsBlue ml15 mr5"%>
@ -105,14 +105,14 @@
<% replies_all_i=replies_all_i+1 %> <% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>"> <li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id,:host=>Setting.host_user), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
</div> </div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher mt-4"> <div class="homepagePostReplyPublisher mt-4">
<% if reply.try(:author).try(:realname) == ' ' %> <% if reply.try(:author).try(:realname) == ' ' %>
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> <%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
<% else %> <% else %>
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %> <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
<% end %> <% end %>
<%= format_time(reply.created_on) %> <%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%=reply.id %>"> <span id="reply_praise_count_<%=reply.id %>">
@ -136,7 +136,7 @@
<% if !activity.locked? && authorize_for_course('messages', 'reply') %> <% if !activity.locked? && authorize_for_course('messages', 'reply') %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48"> <div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div> <div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10"> <div class="homepagePostReplyInputContainer mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;"> <div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>

View File

@ -1,15 +1,15 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>"> <div class="resources mt10" id="user_activity_<%= user_activity_id%>">
<div class="homepagePostBrief"> <div class="homepagePostBrief">
<div class="homepagePostPortrait"> <div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4"> <div class="homepagePostTo break_word mt-4">
<% if @ctivity.try(:author).try(:realname) == ' ' %> <% if @ctivity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% else %> <% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% end %> TO <!--+"(课程名称)"--> <% end %> TO <!--+"(课程名称)"-->
<%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_path(activity.course), :class => "newsBlue ml15" %> <%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_path(activity.course), :class => "newsBlue ml15" %>
</div> </div>
@ -74,14 +74,14 @@
<% replies_all_i = replies_all_i + 1 %> <% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>"> <li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_url_in_org(comment.author_id), :alt => "用户头像" %>
</div> </div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher mt-4"> <div class="homepagePostReplyPublisher mt-4">
<% if comment.try(:author).try(:realname) == ' ' %> <% if comment.try(:author).try(:realname) == ' ' %>
<%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> <%= link_to comment.try(:author), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
<% else %> <% else %>
<%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> <%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
<% end %> <% end %>
<%= format_time(comment.created_on) %> <%= format_time(comment.created_on) %>
<span id="reply_praise_count_<%=comment.id %>"> <span id="reply_praise_count_<%=comment.id %>">
@ -103,7 +103,7 @@
<% end %> <% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48"> <div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div> <div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10"> <div class="homepagePostReplyInputContainer mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;"> <div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>

View File

@ -5,15 +5,15 @@
<div class="homepagePostBrief"> <div class="homepagePostBrief">
<div class="homepagePostPortrait"> <div class="homepagePostPortrait">
<!-- <a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="90" height="90" alt="用户头像"/></a>--> <!-- <a href="javascript:void(0);"><img src="images/homepageImage.jpg" width="90" height="90" alt="用户头像"/></a>-->
<%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_url_in_org(activity.user_id), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4"> <div class="homepagePostTo break_word mt-4">
<% if activity.try(:user).try(:realname) == ' ' %> <% if activity.try(:user).try(:realname) == ' ' %>
<%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:user), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %>
<% else %> <% else %>
<%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:user).try(:realname), user_url_in_org(activity.user_id), :class => "newsBlue mr15" %>
<% end %> <% end %>
TO TO
<%= link_to Course.find(activity.polls_group_id).name.to_s+" | 问卷", poll_index_path(:polls_type => "Course", :polls_group_id => activity.polls_group_id), :class => "newsBlue ml15" %> <%= link_to Course.find(activity.polls_group_id).name.to_s+" | 问卷", poll_index_path(:polls_type => "Course", :polls_group_id => activity.polls_group_id), :class => "newsBlue ml15" %>

View File

@ -1,15 +1,15 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>"> <div class="resources mt10" id="user_activity_<%= user_activity_id%>">
<div class="homepagePostBrief"> <div class="homepagePostBrief">
<div class="homepagePostPortrait"> <div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4"> <div class="homepagePostTo break_word mt-4">
<% if activity.try(:author).try(:realname) == ' ' %> <% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% else %> <% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% end %> TO <% end %> TO
<%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%> <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%>
</div> </div>
@ -23,9 +23,9 @@
<div class="homepagePostAssignTo">指派给&nbsp;&nbsp; <div class="homepagePostAssignTo">指派给&nbsp;&nbsp;
<% unless activity.assigned_to_id.nil? %> <% unless activity.assigned_to_id.nil? %>
<% if activity.try(:assigned_to).try(:realname) == ' ' %> <% if activity.try(:assigned_to).try(:realname) == ' ' %>
<%= link_to activity.try(:assigned_to), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:assigned_to), user_url_in_org(activity.assigned_to_id), :class => "newsBlue mr15" %>
<% else %> <% else %>
<%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:assigned_to).try(:realname), user_url_in_org(activity.assigned_to_id), :class => "newsBlue mr15" %>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
@ -85,14 +85,14 @@
<% replies_all_i=replies_all_i + 1 %> <% replies_all_i=replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>"> <li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_url_in_org(reply.user_id), :alt => "用户头像" %>
</div> </div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher mt-4"> <div class="homepagePostReplyPublisher mt-4">
<% if reply.try(:user).try(:realname) == ' ' %> <% if reply.try(:user).try(:realname) == ' ' %>
<%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> <%= link_to reply.try(:user), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %>
<% else %> <% else %>
<%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %> <%= link_to reply.try(:user).try(:realname), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %>
<% end %> <% end %>
<%= format_time(reply.created_on) %> <%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%=reply.id %>"> <span id="reply_praise_count_<%=reply.id %>">
@ -120,7 +120,7 @@
<% end %> <% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48"> <div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div> <div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10"> <div class="homepagePostReplyInputContainer mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;"> <div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => add_journal_in_org_issue_path(activity.id),:method => "post", :remote => true) do |f|%> <%= form_for('new_form',:url => add_journal_in_org_issue_path(activity.id),:method => "post", :remote => true) do |f|%>

View File

@ -1,15 +1,15 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>"> <div class="resources mt10" id="user_activity_<%= user_activity_id%>">
<div class="homepagePostBrief"> <div class="homepagePostBrief">
<div class="homepagePostPortrait"> <div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4"> <div class="homepagePostTo break_word mt-4">
<% if activity.try(:author).try(:realname) == ' ' %> <% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% else %> <% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% end %> <% end %>
TO TO
<%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",organization_path(activity.board.org_subfield.organization, :org_subfield_id => activity.board.org_subfield.id), :class => "newsBlue ml15 mr5"%> <%= link_to activity.board.org_subfield.name.to_s+" | 帖子栏目讨论区",organization_path(activity.board.org_subfield.organization, :org_subfield_id => activity.board.org_subfield.id), :class => "newsBlue ml15 mr5"%>
@ -110,14 +110,14 @@
<% replies_all_i=replies_all_i+1 %> <% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>"> <li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
</div> </div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher mt-4"> <div class="homepagePostReplyPublisher mt-4">
<% if reply.try(:author).try(:realname) == ' ' %> <% if reply.try(:author).try(:realname) == ' ' %>
<%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> <%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
<% else %> <% else %>
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
<% end %> <% end %>
<%= format_time(reply.created_on) %> <%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%=reply.id %>"> <span id="reply_praise_count_<%=reply.id %>">
@ -139,7 +139,7 @@
<% end %> <% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48"> <div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div> <div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10"> <div class="homepagePostReplyInputContainer mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;"> <div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>

View File

@ -1,15 +1,15 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id %>"> <div class="resources mt10" id="user_activity_<%= user_activity_id %>">
<div class="homepagePostBrief"> <div class="homepagePostBrief">
<div class="homepagePostPortrait"> <div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4"> <div class="homepagePostTo break_word mt-4">
<% if activity.try(:author).try(:realname) == ' ' %> <% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% else %> <% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% end %> TO <!--+"(课程名称)"--> <% end %> TO <!--+"(课程名称)"-->
<%= link_to activity.org_subfield.name.to_s+" | 帖子栏目通知", organization_path(activity.org_subfield.organization, :org_subfield_id => activity.org_subfield.id), :class => "newsBlue ml15" %> <%= link_to activity.org_subfield.name.to_s+" | 帖子栏目通知", organization_path(activity.org_subfield.organization, :org_subfield_id => activity.org_subfield.id), :class => "newsBlue ml15" %>
</div> </div>
@ -94,14 +94,14 @@
<% replies_all_i = replies_all_i + 1 %> <% replies_all_i = replies_all_i + 1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>"> <li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_url_in_org(comment.author_id), :alt => "用户头像" %>
</div> </div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher mt-4"> <div class="homepagePostReplyPublisher mt-4">
<% if comment.try(:author).try(:realname) == ' ' %> <% if comment.try(:author).try(:realname) == ' ' %>
<%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> <%= link_to comment.try(:author), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
<% else %> <% else %>
<%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %> <%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
<% end %> <% end %>
<%= format_time(comment.created_on) %> <%= format_time(comment.created_on) %>
<span id="reply_praise_count_<%=comment.id %>"> <span id="reply_praise_count_<%=comment.id %>">
@ -123,7 +123,7 @@
<% end %> <% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48"> <div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div> <div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10"> <div class="homepagePostReplyInputContainer mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;"> <div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%> <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>

View File

@ -3,15 +3,15 @@
<div class="resources mt10"> <div class="resources mt10">
<div class="homepagePostBrief"> <div class="homepagePostBrief">
<div class="homepagePostPortrait"> <div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => user} %> <%= render :partial => 'users/show_detail_info', :locals => {:user => user} %>
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4"> <div class="homepagePostTo break_word mt-4">
<% if user.try(:realname) == ' ' %> <% if user.try(:realname) == ' ' %>
<%= link_to user, user_path(user), :class => "newsBlue mr15" %> <%= link_to user, user_url_in_org(user), :class => "newsBlue mr15" %>
<% else %> <% else %>
<%= link_to user.try(:realname), user_path(user), :class => "newsBlue mr15" %> <%= link_to user.try(:realname), user_url_in_org(user), :class => "newsBlue mr15" %>
<% end %> <% end %>
TO TO
<%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %> <%= link_to project.to_s+" | 项目", project_path(project.id,:host=>Setting.host_course), :class => "newsBlue ml15" %>

View File

@ -1,15 +1,15 @@
<div class="resources mt10" id="user_activity_<%= user_activity_id%>"> <div class="resources mt10" id="user_activity_<%= user_activity_id%>">
<div class="homepagePostBrief"> <div class="homepagePostBrief">
<div class="homepagePostPortrait"> <div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %> <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo break_word mt-4"> <div class="homepagePostTo break_word mt-4">
<% if activity.try(:author).try(:realname) == ' ' %> <% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% else %> <% else %>
<%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %> <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
<% end %> <% end %>
TO TO
<%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%> <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%>
@ -85,14 +85,14 @@
<% replies_all_i=replies_all_i+1 %> <% replies_all_i=replies_all_i+1 %>
<li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>"> <li class="homepagePostReplyContainer" nhname="reply_rec" style="display:<%= replies_all_i>3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"> <div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id), :alt => "用户头像" %> <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
</div> </div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher mt-4"> <div class="homepagePostReplyPublisher mt-4">
<% if reply.try(:author).try(:realname) == ' ' %> <% if reply.try(:author).try(:realname) == ' ' %>
<%= link_to reply.try(:author), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> <%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
<% else %> <% else %>
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id), :class => "newsBlue mr10 f14" %> <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
<% end %> <% end %>
<%= format_time(reply.created_on) %> <%= format_time(reply.created_on) %>
<span id="reply_praise_count_<%=reply.id %>"> <span id="reply_praise_count_<%=reply.id %>">
@ -114,7 +114,7 @@
<% end %> <% end %>
<div class="homepagePostReplyContainer borderBottomNone minHeight48"> <div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %></div> <div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= user_activity_id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %></div>
<div class="homepagePostReplyInputContainer mb10"> <div class="homepagePostReplyInputContainer mb10">
<div nhname='new_message_<%= user_activity_id%>' style="display:none;"> <div nhname='new_message_<%= user_activity_id%>' style="display:none;">
<%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%> <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>

View File

@ -1,12 +1,12 @@
<div class="resources mt10" id="organization_document_<%= document.id %>"> <div class="resources mt10" id="organization_document_<%= document.id %>">
<div class="homepagePostBrief"> <div class="homepagePostBrief">
<div class="homepagePostPortrait"> <div class="homepagePostPortrait">
<%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_path(document.creator_id) %> <%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(document.creator_id) %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(document.creator_id)} %> <%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(document.creator_id)} %>
</div> </div>
<div class="homepagePostDes"> <div class="homepagePostDes">
<div class="homepagePostTo"> <div class="homepagePostTo">
<%= link_to User.find(document.creator_id), user_path(document.creator.id), :class => "newsBlue mr15" %> <%= link_to User.find(document.creator_id), user_url_in_org(document.creator.id), :class => "newsBlue mr15" %>
TO&nbsp;&nbsp;<%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %> TO&nbsp;&nbsp;<%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %>
| |
<span style="color:#269ac9;"><%= document.org_subfield_id.nil? ? "组织文章" :"#{OrgSubfield.find(document.org_subfield_id).name}" %></span> <span style="color:#269ac9;"><%= document.org_subfield_id.nil? ? "组织文章" :"#{OrgSubfield.find(document.org_subfield_id).name}" %></span>
@ -87,10 +87,10 @@
<% comments_for_doc.each do |comment| %> <% comments_for_doc.each do |comment| %>
<% reply_id += 1 %> <% reply_id += 1 %>
<li style="display:<%= reply_id > 3 ? 'none' : '' %>"> <li style="display:<%= reply_id > 3 ? 'none' : '' %>">
<div class="homepagePostReplyPortrait"><%= link_to image_tag(url_to_avatar(User.find(comment.creator_id)), :width => 33, :height => 33, :alt => "用户头像"), user_path(comment.creator_id) %></div> <div class="homepagePostReplyPortrait"><%= link_to image_tag(url_to_avatar(User.find(comment.creator_id)), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_id) %></div>
<div class="homepagePostReplyDes"> <div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"> <div class="homepagePostReplyPublisher">
<%= link_to User.find(comment.creator_id), user_path(comment.creator_id), :class => "newsBlue mr10 f14" %> <%= link_to User.find(comment.creator_id), user_url_in_org(comment.creator_id), :class => "newsBlue mr10 f14" %>
<%= format_activity_day(comment.created_at) %> <%= format_time(comment.created_at, false) %> <%= format_activity_day(comment.created_at) %> <%= format_time(comment.created_at, false) %>
<span id="reply_praise_count_<%=comment.id %>"> <span id="reply_praise_count_<%=comment.id %>">
<% if comment.creator_id.to_i == User.current.id.to_i %> <% if comment.creator_id.to_i == User.current.id.to_i %>
@ -111,7 +111,7 @@
</div> </div>
<div class="homepagePostReplyContainer borderBottomNone minHeight48"> <div class="homepagePostReplyContainer borderBottomNone minHeight48">
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= act.id %>"> <div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= act.id %>">
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_path(User.current) %> <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current) %>
</div> </div>
<div class="homepagePostReplyInputContainer"> <div class="homepagePostReplyInputContainer">
<div nhname='new_message_<%= act.id %>' style="display:none;"> <div nhname='new_message_<%= act.id %>' style="display:none;">

View File

@ -27,7 +27,7 @@
<div class="fl mt5 ml15"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_zip"></span>ZIP</a> </div> <div class="fl mt5 ml15"><a href="javascript:void(0);" class="vl_btn fb" onclick="zip()"><span class="vl_zip"></span>ZIP</a> </div>
<%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %> <%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %>
<% if User.current.id != @project.user_id %> <% if User.current.id != @project.user_id %>
<div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %> <div class="fr mt5"><%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :target => "_blank", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %>
<span href="javascript:void(0);" class="vl_btn_2 fb"><%= @project.forked_count.to_i %></span> <span href="javascript:void(0);" class="vl_btn_2 fb"><%= @project.forked_count.to_i %></span>
</div> </div>
<% end %> <% end %>

View File

@ -15,10 +15,10 @@
<li> <li>
<% if @homework.homework_type != 3 %> <% if @homework.homework_type != 3 %>
<ul class="mt10 fl"> <ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名"> <li class="hworkStName mr10 mt16" title="<%= student_work.user.show_name%>">
<%= student_work.user.show_name%> <%= student_work.user.show_name%>
</li> </li>
<li class="hworkStID mt16" title="学号"> <li class="hworkStID mt16" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</li> </li>
</ul> </ul>

View File

@ -21,10 +21,10 @@
<li onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;" class="student_work_<%= student_work.id%>"> <li onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;" class="student_work_<%= student_work.id%>">
<% if @homework.homework_type != 3 %> <% if @homework.homework_type != 3 %>
<ul class="mt10 fl"> <ul class="mt10 fl">
<li class="hworkStName mr10 mt16" title="姓名"> <li class="hworkStName mr10 mt16" title="<%= student_work.user.show_name%>">
<%= student_work.user.show_name%> <%= student_work.user.show_name%>
</li> </li>
<li class="hworkStID mt16" title="学号"> <li class="hworkStID mt16" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%> <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</li> </li>
</ul> </ul>

View File

@ -25,7 +25,7 @@
<li > <li >
<span class="tit_fb ">编程代码:</span> <span class="tit_fb ">编程代码:</span>
<div class="showHworkP break_word"><pre id="work-src" style="display: none;"><%= work.description if work.description%></pre><div class="fontGrey2 font_cus" id="work-code"> <div class="showHworkP break_word"><pre id="work-src" style="display: none;"><%= work.description if work.description%></pre><div class="fontGrey2 font_cus" id="work-code_<%= work.id%>">
</div> </div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -63,7 +63,7 @@
} else if(language==4){ } else if(language==4){
program_name = 'text/x-java'; program_name = 'text/x-java';
} }
var editor = CodeMirror(document.getElementById("work-code"), { var editor = CodeMirror(document.getElementById("work-code_<%= work.id%>"), {
mode: {name: program_name, mode: {name: program_name,
version: 2, version: 2,
singleLineStringErrors: false}, singleLineStringErrors: false},

View File

@ -17,7 +17,7 @@ else{
program_name = 'text/x-java'; program_name = 'text/x-java';
} }
var editor = CodeMirror(document.getElementById("work-code"), { var editor = CodeMirror(document.getElementById("work-code_<%= @work.id%>"), {
mode: {name: program_name, mode: {name: program_name,
version: 2, version: 2,
singleLineStringErrors: false}, singleLineStringErrors: false},

View File

@ -153,8 +153,18 @@
<% end %> <% end %>
<% student_works.each_with_index do |sw, i| %> <% student_works.each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;"> <div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %> <a href="javascript:void(0);" class="linkBlue">
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%></p> <% if User.current.member_of_course?(activity.course) || User.current.admin? || activity.is_open == 1 %>
<%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => activity.id), :alt => "学生头像" %>
<p class="w100 hidden">
<%= link_to sw.user.show_name, student_work_index_path(:homework => activity.id)%>
</p>
<% else %>
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>
<p class="w100 hidden">
<a href="javascript:void(0);" title="该作业的作品暂未公开"><%=sw.user.show_name %></a>
</p>
<% end %>
</a> </a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p> <p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p>

View File

@ -1,6 +1,6 @@
<div class="userCard boxShadow" style="<%= User.current == user ? 'top:-153px;':'' %>"> <div class="userCard boxShadow" style="<%= User.current == user ? 'top:-153px;':'' %>">
<div class="userAvatarWrap fl"> <div class="userAvatarWrap fl">
<%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_path(user), :alt => "用户头像", :target => '_blank' %> <%= link_to image_tag(url_to_avatar(user), :width => "50", :height => "50"), user_url_in_org(user), :alt => "用户头像", :target => '_blank' %>
<%#= image_tag(url_to_avatar(user), :width => "50", :height => "50") %> <%#= image_tag(url_to_avatar(user), :width => "50", :height => "50") %>
<!--<img src="images/homepageImage.jpg" width="50" height="50" alt="个人头像" />--> <!--<img src="images/homepageImage.jpg" width="50" height="50" alt="个人头像" />-->
</div> </div>

View File

@ -37,8 +37,8 @@
</div> </div>
<div class="uploadResourceIntr"> <div class="uploadResourceIntr">
<div class="uploadResourceName"><span id="upload_file_count">(未选择文件)</span></div> <div class="uploadResourceName fl"><span id="upload_file_count">(未选择文件)</span></div>
<div class="uploadResourceIntr2"><!--您可以上传小于<span class="c_red">50MB</span>的文件--></div> <div class="uploadResourceIntr2 fl">您可以上传小于<span class="c_red">50MB</span>的文件</div>
</div> </div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -5,10 +5,22 @@
<span class="newsBlue homepageNewsPublisher"><%= ma.author.login %></span><span class="homepageNewsType fl">提到了你:</span> <span class="newsBlue homepageNewsPublisher"><%= ma.author.login %></span><span class="homepageNewsType fl">提到了你:</span>
</li> </li>
<li class="homepageNewsContent fl"> <li class="homepageNewsContent fl">
<%= link_to ma.subject.html_safe, ma.url, <% if ma.at_message_type == "Message" && !ma.at_message.course.nil? %>
<%= link_to ma.subject.html_safe, course_boards_path(ma.at_message.course,
:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id),
:class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}", :class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}",
:onmouseover =>"message_titile_show($(this),event)", :onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></li> :onmouseout => "message_titile_hide($(this))" %>
<% elsif ma.at_message_type == "Message" && !ma.at_message.project.nil? %>
<%= link_to ma.subject.html_safe, project_boards_path(ma.at_message.project,
:parent_id => ma.at_message.parent_id ? ma.at_message.parent_id : ma.at_message.id, :topic_id => ma.at_message.id),
:class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %>
<% else %>
<%= 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"> <div style="display: none" class="message_title_red system_message_style">
<p><strong>标题:</strong><%= ma.subject %></p> <p><strong>标题:</strong><%= ma.subject %></p>
<% unless ma.description.nil? %> <% unless ma.description.nil? %>

View File

@ -157,8 +157,18 @@
<% end %> <% end %>
<% student_works.each_with_index do |sw, i| %> <% student_works.each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;"> <div class="fl mr10 w100" style="text-align:center;">
<a href="javascript:void(0);" class="linkBlue"><%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => homework_common.id), :alt => "学生头像" %> <a href="javascript:void(0);" class="linkBlue">
<p class="w100 hidden"><%= link_to sw.user.show_name, student_work_index_path(:homework => homework_common.id)%></p> <% if User.current.member_of_course?(homework_common.course) || User.current.admin? || homework_common.is_open == 1 %>
<%= link_to image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40"), student_work_index_path(:homework => homework_common.id), :alt => "学生头像" %>
<p class="w100 hidden">
<%= link_to sw.user.show_name, student_work_index_path(:homework => homework_common.id)%>
</p>
<% else %>
<%= image_tag(url_to_avatar(User.find sw.user_id), :width => "40", :height => "40", :title => '该作业的作品暂未公开') %>
<p class="w100 hidden">
<a href="javascript:void(0);" title="该作业的作品暂未公开"><%=sw.user.show_name %></a>
</p>
<% end %>
</a> </a>
<% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %> <% score = sw.respond_to?("score") ? sw.score : (sw.final_score || 0) - sw.absence_penalty - sw.late_penalty %>
<p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p> <p class="fontGrey2">分数:<span class="c_red"><%=format("%.1f",score.to_i<0 ? 0 : score.to_i) %>分</span></p>

View File

@ -246,7 +246,9 @@
<% if ma.course_message_type == "Message" %> <% if ma.course_message_type == "Message" %>
<ul class="homepageNewsList fl"> <ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %></a></li> <li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %></a></li>
<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> <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? %> <% if ma.course_message.parent_id.nil? %>
<li class="homepageNewsContent fl"><a href="javascript:void(0);" class="newsGrey"> <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), <%= 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),

View File

@ -3,7 +3,6 @@
<div id="search_div"> <div id="search_div">
<%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type} %> <%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type} %>
</div> </div>
<div style="float: left; margin-top: 7px; font-size: 14px; margin-left: 15px;"><span style="align:center ;font-size: 14px;color: gray;">为您找到<span id="res_all_count"><%= @atta_count %></span>个资源</span></div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<ul class="resource-list-tab mt10"> <ul class="resource-list-tab mt10">

View File

@ -1008,6 +1008,7 @@ RedmineApp::Application.routes.draw do
get 'course_outline' get 'course_outline'
post 'search_course_outline' post 'search_course_outline'
post 'set_course_outline' post 'set_course_outline'
post 'teacher_assign_group'
get 'syllabus' get 'syllabus'
get 'search_public_orgs_not_in_course' get 'search_public_orgs_not_in_course'
get "homework_search" get "homework_search"

View File

@ -0,0 +1,18 @@
class UpdateHomeworkCommonUpdatedAt < ActiveRecord::Migration
def up
count = HomeworkCommon.all.count / 30 + 2
transaction do
for i in 1 ... count do i
HomeworkCommon.page(i).per(30).each do |hw|
ca = CourseActivity.where("course_act_type = 'HomeworkCommon' and course_act_id = #{hw.id}").first
unless ca.nil?
hw.update_attributes(:updated_at => ca.updated_at)
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,50 @@
class UpdateContributorAfterDelete < ActiveRecord::Migration
def up
Course.all.each do |course|
if course.course_activities.count > 1
course.members.each do |s|
puts course.id
puts course.name
puts s.user_id
# board_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?",s.student_id, course.id, "Message").count * 2
# 发帖数
board_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is null;").count
# 回帖数
message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.user_id} and me.parent_id is not null").count * 1
# 新闻回复
common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.user_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
# 通知
common_count = News.find_by_sql("select n.* from news n where n.author_id = #{s.user_id} and n.course_id = #{course.id} ").count * 1
# attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5
# 附件数
attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.user_id} and container_type ='Course'").count
# 课程留言数
journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.user_id, course.id, "Course").count * 1
# 作业留言
journal_homework_count = JournalsForMessage.find_by_sql("SELECT jfm.* FROM `journals_for_messages` jfm, homework_commons hc where hc.id = jfm.jour_id and hc.course_id =#{course.id} and jfm.user_id =#{s.user_id} and jfm.jour_type ='HomeworkCommon';").count * 1
# journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1
# journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1
total = board_count + message_reply_count + common_reply_count + attachment_count + journal_count
course_contributor = CourseContributorScore.where("course_id =? and user_id =?", course.id, s.user_id).first
if course_contributor.nil?
CourseContributorScore.create(:course_id => course.id, :user_id => s.user_id, :message_num => board_count, :message_reply_num => message_reply_count,
:news_reply_num => common_reply_count, :news_num => common_count, :resource_num => attachment_count, :journal_num => journal_count,
:homework_journal_num => journal_homework_count, :journal_reply_num => 0, :total_score => total)
else
course_contributor.message_num = board_count
course_contributor.message_reply_num = message_reply_count
course_contributor.news_reply_num = common_reply_count
course_contributor.news_num = common_count
course_contributor.resource_num = attachment_count
course_contributor.journal_num = journal_count
course_contributor.homework_journal_num = journal_homework_count
course_contributor.save
end
end
end
end
end
def down
end
end

View File

@ -0,0 +1,8 @@
class DeleteStudentWorkData < ActiveRecord::Migration
def up
StudentWork.where("homework_common_id = 2604 AND user_id = 10763 AND final_score = 0").destroy_all
end
def down
end
end

View File

@ -0,0 +1,5 @@
class AddVisitsToUser < ActiveRecord::Migration
def change
add_column :users, :visits, :integer, :default => 0
end
end

View File

@ -0,0 +1,5 @@
class AddVisitsToProject < ActiveRecord::Migration
def change
add_column :projects, :visits, :integer, :default => 0
end
end

View File

@ -0,0 +1,5 @@
class AddVisitsToCourse < ActiveRecord::Migration
def change
add_column :courses, :visits, :integer, :default => 0
end
end

View File

@ -0,0 +1,5 @@
class AddVisitsToOrganization < ActiveRecord::Migration
def change
add_column :organizations, :visits, :integer, :default => 0
end
end

View File

@ -40,6 +40,11 @@ module Trustie
username: user.login, username: user.login,
confirm: "true") confirm: "true")
user.gid = u.id user.gid = u.id
user.save
end
if user.gid.nil?
user.gid = u.id
user.save
end end
change_password(u.id, user.hashed_password, user.salt) change_password(u.id, user.hashed_password, user.salt)
rescue => e rescue => e

View File

@ -1286,7 +1286,9 @@ a.chooseActive {background-color:#269ac9; color:#ffffff;}
.subjectType {width:70px; text-align:center;} .subjectType {width:70px; text-align:center;}
.subjectCount {width:65px; text-align:center;} .subjectCount {width:65px; text-align:center;}
a.contributor_course{float: right; color: #888; font-size: 12px; font-weight: normal;} a.contributor_course{float: right; color: #888; font-size: 12px; font-weight: normal;}
.contributor_course_innor{font-size: 12px;color: #888;padding-left: 36px;} .active-degree-rule{font-size: 12px;color: #888; text-align: center; cursor: pointer;}
.hero_course_innor{font-size: 12px;color: #888;padding-left:77px;} .hero-degree-rule{font-size: 12px;color: #888;text-align: center;}
.contributor_course_calculate{padding-left: 54px; font-size: 12px;color: #888} .contributor-course-calculate{padding-left: 54px; font-size: 12px;color: #888}
.color_888{color: #888}
/*20160310分班样式*/
.select-class-option {width:125px;}

View File

@ -192,6 +192,7 @@ a.c_green{ color:#28be6c;}
.fontGrey {color:#cecece;} .fontGrey {color:#cecece;}
.fontGrey2 {color:#888888;} .fontGrey2 {color:#888888;}
.fontGrey3 {color:#484848;} .fontGrey3 {color:#484848;}
.fontGrey5 {color:#a1a1a1;}
.fontBlue {color:#3498db;} .fontBlue {color:#3498db;}
a.underline {text-decoration:underline;} a.underline {text-decoration:underline;}
a.fontBlue {color:#297fb8;} a.fontBlue {color:#297fb8;}
@ -692,7 +693,7 @@ a.postReplyCancel:hover {color:#ffffff;}
.homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;} .homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;}
.homepagePostSetting ul li:hover ul {display:block;} .homepagePostSetting ul li:hover ul {display:block;}
.homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;} .homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;}
.homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;} .homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;z-index:999;}
.homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} .homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}
.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} .whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;}
.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} .whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}

View File

@ -66,6 +66,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.ml15{ margin-left:15px;} .ml15{ margin-left:15px;}
.ml16{ margin-left: 16px;} .ml16{ margin-left: 16px;}
.ml20{ margin-left:20px;} .ml20{ margin-left:20px;}
.ml25 {margin-left:25px;}
.ml30{margin-left:30px !important;} .ml30{margin-left:30px !important;}
.ml35{margin-left: 35px;} .ml35{margin-left: 35px;}
.ml40{ margin-left:40px;} .ml40{ margin-left:40px;}
@ -144,6 +145,7 @@ h4{ font-size:14px; color:#3b3b3b;}
.w80{ width:80px;} .w80{ width:80px;}
.w90{ width:90px;} .w90{ width:90px;}
.w100{width: 100px;} .w100{width: 100px;}
.w125{width:125px;}
.w210{ width:210px;} .w210{ width:210px;}
.w150{ width:150px;} .w150{ width:150px;}
.w170{width:170px;} .w170{width:170px;}
@ -228,6 +230,7 @@ a.c_green{ color:#28be6c;}
.fontGrey2 {color:#888888;} .fontGrey2 {color:#888888;}
.fontGrey3 {color:#484848;} .fontGrey3 {color:#484848;}
.fontGrey4{color:#999999;} .fontGrey4{color:#999999;}
.fontGrey5 {color:#a1a1a1;}
.fontBlue {color:#3498db;} .fontBlue {color:#3498db;}
.fontBlue2 {color:#269ac9 !important;} .fontBlue2 {color:#269ac9 !important;}
a.underline {text-decoration:underline;} a.underline {text-decoration:underline;}
@ -615,7 +618,7 @@ a.postReplyCancel:hover {color:#ffffff;}
.homepagePostReplyContainer {border-bottom:1px solid #e3e3e3; width:690px; margin:0px auto; margin-top:15px; min-height:60px;} .homepagePostReplyContainer {border-bottom:1px solid #e3e3e3; width:690px; margin:0px auto; margin-top:15px; min-height:60px;}
.homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;} .homepagePostSetting {position:absolute; width:20px; height:20px; right:0px; top:0px;}
.homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;} .homepagePostSettingIcon {background:url(../images/homepage_icon.png) -93px -5px no-repeat; width:20px; height:20px;}
.homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;} .homepagePostSettiongText {width:85px; line-height:2; font-size:12px; color:#616060; background-color:#ffffff; border:1px solid #eaeaea; border-radius:3px; position:absolute; left:-68px; top:20px; padding:5px 0px; display:none;z-index:999;}
.homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} .homepagePostSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}
.whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;} .whiteSettingIcon {background:url(../images/hwork_icon.png) -5px -302px no-repeat; width:20px; height:20px;}
.whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;} .whiteSettingIcon:hover {background:url(../images/homepage_icon.png) -93px -44px no-repeat;}