diff --git a/app/controllers/homework_common_controller.rb b/app/controllers/homework_common_controller.rb
index ba6c136bb..9f754a0fc 100644
--- a/app/controllers/homework_common_controller.rb
+++ b/app/controllers/homework_common_controller.rb
@@ -1,378 +1,378 @@
-class HomeworkCommonController < ApplicationController
- require 'net/http'
- require 'json'
- require "base64"
- layout "base_courses"
-
- include StudentWorkHelper
- before_filter :find_course, :only => [:index,:new,:create]
- before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
- before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
- before_filter :member_of_course, :only => [:index]
-
- def index
- @new_homework = HomeworkCommon.new
- @new_homework.homework_detail_manual = HomeworkDetailManual.new
- @new_homework.course = @course
- @page = params[:page] ? params[:page].to_i + 1 : 0
- @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
- if @is_teacher
- @homeworks = @course.homework_commons.order("updated_at desc").limit(10).offset(@page * 10)
- else
- @homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("updated_at desc").limit(10).offset(@page * 10)
- end
- @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
- @is_new = params[:is_new]
-
- #设置at已读
- @homeworks.each do |homework|
- homework.journals_for_messages.each do |j|
- User.current.at_messages.unviewed('JournalsForMessage', j.id).each {|x| x.viewed!}
- end
- end
-
- respond_to do |format|
- format.js
- format.html
- end
- end
-
- #新建作业,在个人作业列表创建作业
- def new
- render_404
- end
-
- #新建作业,在个人作业列表创建作业
- def create
- redirect_to user_homeworks_user_path(User.current.id)
- end
-
- def edit
- @user = User.current
- @is_in_course = params[:is_in_course].to_i
- @course_activity = params[:course_activity].to_i
- respond_to do |format|
- format.html{render :layout => 'new_base_user'}
- end
- end
-
- def update
- if params[:homework_common]
- @homework.name = params[:homework_common][:name]
- @homework.description = params[:homework_common][:description]
- if params[:homework_common][:publish_time] == ""
- @homework.publish_time = Date.today
- else
- @homework.publish_time = params[:homework_common][:publish_time]
- end
- @homework.end_time = params[:homework_common][:end_time] || Time.now
- @homework.course_id = params[:course_id]
- @homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
-
- homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
- if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
- homework_detail_manual.comment_status = 1
- end
- homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? @homework.end_time + 7 : params[:evaluation_start]
- homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end]
-
- @homework.save_attachments(params[:attachments])
- render_attachment_warning_if_needed(@homework)
-
- #编程作业相关属性
- if @homework.homework_type == 2
- @homework.homework_detail_programing ||= HomeworkDetailPrograming.new
- @homework_detail_programing = @homework.homework_detail_programing
- @homework_detail_programing.language = params[:language_type].to_i
-
- @homework.homework_tests.delete_all
- inputs = params[:program][:input]
- if Array === inputs
- inputs.each_with_index do |val, i|
- @homework.homework_tests << HomeworkTest.new(
- input: val,
- output: params[:program][:output][i]
- )
- end
- end
- end
-
- #分组作业
- if @homework.homework_type == 3
- @homework.homework_detail_group ||= HomeworkDetailGroup.new
- @homework_detail_group = @homework.homework_detail_group
- @homework_detail_group.min_num = params[:min_num].to_i
- @homework_detail_group.max_num = params[:max_num].to_i
- @homework_detail_group.base_on_project = params[:base_on_project].to_i
- end
-
- if @homework.save
- @homework_detail_manual.save if @homework_detail_manual
- @homework_detail_programing.save if @homework_detail_programing
- @homework_detail_group.save if @homework_detail_group
-
- if params[:is_in_course] == "1"
- redirect_to homework_common_index_path(:course => @course.id)
- elsif params[:is_in_course] == "0"
- redirect_to user_homeworks_user_path(User.current.id)
- elsif params[:is_in_course] == "-1" && params[:course_activity] == "0"
- redirect_to user_path(User.current.id)
- elsif params[:is_in_course] == "-1" && params[:course_activity] == "1"
- redirect_to course_path(@course.id)
- end
- end
- end
- end
-
- def destroy
- if @homework.destroy
- respond_to do |format|
- format.html {
- if params[:is_in_course] == "1"
- redirect_to homework_common_index_path(:course => @course.id)
- elsif params[:is_in_course] == "0"
- redirect_to user_homeworks_user_path(User.current.id)
- elsif params[:is_in_course] == "-1" && params[:course_activity] == "0"
- redirect_to user_path(User.current.id)
- elsif params[:is_in_course] == "-1" && params[:course_activity] == "1"
- redirect_to course_path(@course.id)
- end
- }
- end
- end
- end
-
- #开启匿评
- #statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限
- def start_anonymous_comment
- @statue = 4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
- @statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
- if @homework_detail_manual.comment_status == 1
- student_works = @homework.student_works
- if student_works && student_works.size >= 2
- if @homework.homework_type == 3
- student_work_projects = @homework.student_work_projects.where("student_work_id is not null")
- student_work_projects.each_with_index do |pro_work, pro_index|
- n = @homework_detail_manual.evaluation_num
- n = n < student_works.size ? n : student_works.size - 1
- work_index = -1
- student_works.each_with_index do |stu_work, stu_index|
- if stu_work.id.to_i == pro_work.student_work_id.to_i
- work_index = stu_index
- end
- end
- assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
- assigned_homeworks.each do |h|
- student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
- student_works_evaluation_distributions.save
- end
- end
- else
- student_works.each_with_index do |work, index|
- user = work.user
- n = @homework_detail_manual.evaluation_num
- n = n < student_works.size ? n : student_works.size - 1
- assigned_homeworks = get_assigned_homeworks(student_works, n, index)
- assigned_homeworks.each do |h|
- student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
- student_works_evaluation_distributions.save
- end
- end
- end
- @homework_detail_manual.update_column('comment_status', 2)
- @homework_detail_manual.update_column('evaluation_start', Date.today)
- @statue = 1
- # 匿评开启消息邮件通知
- send_message_anonymous_comment(@homework, m_status = 2)
- Mailer.send_mail_anonymous_comment_open(@homework).deliver
- else
- @statue = 2
-
- end
- else
- @statue = 3
- end
- @user_activity_id = params[:user_activity_id].to_i
- @is_in_course = params[:is_in_course].to_i
- @course_activity = params[:course_activity].to_i
- end
-
- #关闭匿评
- def stop_anonymous_comment
- @homework_detail_manual.update_column('comment_status', 3)
- @homework_detail_manual.update_column('evaluation_end', Date.today)
- #计算缺评扣分
- work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
- @homework.student_works.each do |student_work|
- absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
- student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
- student_work.save
- end
- # 匿评关闭消息邮件通知
- send_message_anonymous_comment(@homework, m_status = 3)
- Mailer.send_mail_anonymous_comment_close(@homework).deliver
- @user_activity_id = params[:user_activity_id].to_i
- @is_in_course = params[:is_in_course].to_i
- @course_activity = params[:course_activity].to_i
- respond_to do |format|
- format.js
- end
- end
-
- # 开启/关闭匿评消息通知
- def send_message_anonymous_comment(homework, m_status )
- # status 标记匿评状态 1为关闭 0为开启
- course = homework.course
- course.members.each do |m|
- @homework.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => m_status)
- end
- end
- #提示
- def alert_anonymous_comment
- @cur_size = 0
- @totle_size = 0
- if @homework_detail_manual.comment_status == 1
- @totle_size = @course.student.count
- @cur_size = @homework.student_works.size
- elsif @homework_detail_manual.comment_status == 2
- @homework.student_works.map { |work| @totle_size += work.student_works_evaluation_distributions.count}
- @cur_size = 0
- @homework.student_works.map { |work| @cur_size += work.student_works_scores.where(:reviewer_role => 3).count}
- end
- @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100)
- @user_activity_id = params[:user_activity_id].to_i
- @is_in_course = params[:is_in_course].to_i
- @course_activity = params[:course_activity].to_i
- respond_to do |format|
- format.js
- end
- end
-
- def alert_forbidden_anonymous_comment
- if params[:user_activity_id]
- @user_activity_id = params[:user_activity_id]
- else
- @user_activity_id = -1
- end
- @is_in_course = params[:is_in_course] if params[:is_in_course]
- @course_activity = params[:course_activity] if params[:course_Activity]
- respond_to do |format|
- format.js
- end
- end
-
- def open_student_works
- if @homework.is_open == 0
- @homework.update_attribute(:is_open, 1)
- else
- @homework.update_attribute(:is_open, 0)
- end
- @user_activity_id = params[:user_activity_id]
- @is_in_course = params[:is_in_course] if params[:is_in_course]
- @course_activity = params[:course_activity] if params[:course_Activity]
- end
-
- def alert_open_student_works
- if params[:user_activity_id]
- @user_activity_id = params[:user_activity_id]
- else
- @user_activity_id = -1
- end
- @is_in_course = params[:is_in_course] if params[:is_in_course]
- @course_activity = params[:course_activity] if params[:course_Activity]
- respond_to do |format|
- format.js
- end
- end
-
- def programing_test
- test = {language:params[:language],src:Base64.encode64(params[:src]),input:[params[:input]],output:[params[:output]]}
- @index = params[:index]
- uri = URI('http://192.168.80.21:8080/api/realtime.json')
- body = test.to_json
- res = Net::HTTP.new(uri.host, uri.port).start do |client|
- request = Net::HTTP::Post.new(uri.path)
- request.body = body
- request["Content-Type"] = "application/json"
- client.request(request)
- end
- result = JSON.parse(res.body)
- @err_msg = result["compile_error_msg"]
- result["results"].each do |re|
- @result = re["status"]
- end
- end
-
- #启动匿评参数设置
- def start_evaluation_set
- if params[:user_activity_id]
- @user_activity_id = params[:user_activity_id]
- else
- @user_activity_id = -1
- end
- @is_in_course = params[:is_in_course]
- @course_activity = params[:course_activity].to_i
- end
-
- #设置匿评参数
- def set_evaluation_attr
- if @homework_detail_manual
- unless params[:evaluation_start].to_s == @homework_detail_manual.evaluation_start.to_s
- @homework_detail_manual.evaluation_start = params[:evaluation_start]
- end
-
- unless @homework_detail_manual.evaluation_end.to_s == params[:evaluation_end].to_s
- @homework_detail_manual.evaluation_end = params[:evaluation_end]
- end
-
- @homework_detail_manual.evaluation_num = params[:evaluation_num]
- @homework_detail_manual.save
- @user_activity_id = params[:user_activity_id].to_i
- @is_in_course = params[:is_in_course].to_i
- @course_activity = params[:course_activity].to_i
- end
- end
-
- #评分设置
- def score_rule_set
- if params[:user_activity_id]
- @user_activity_id = params[:user_activity_id]
- else
- @user_activity_id = -1
- end
- @is_in_course = params[:is_in_course]
- @course_activity = params[:course_activity].to_i
- end
-
- private
- #获取课程
- def find_course
- @course = Course.find params[:course]
- rescue
- render_404
- end
- #获取作业
- def find_homework
- @homework = HomeworkCommon.find params[:id]
- @homework_detail_manual = @homework.homework_detail_manual
- @homework_detail_programing = @homework.homework_detail_programing
- @homework_detail_group = @homework.homework_detail_group
- @course = @homework.course
- rescue
- render_404
- end
- #是不是课程的老师
- def teacher_of_course
- render_403 unless User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
- end
-
- #当前用户是不是课程的成员
- def member_of_course
- render_403 unless @course.is_public==1 || User.current.member_of_course?(@course) || User.current.admin?
- end
-
- def get_assigned_homeworks(student_works, n, index)
- student_works += student_works
- student_works[index + 1 .. index + n]
- end
-end
+class HomeworkCommonController < ApplicationController
+ require 'net/http'
+ require 'json'
+ require "base64"
+ layout "base_courses"
+
+ include StudentWorkHelper
+ before_filter :find_course, :only => [:index,:new,:create]
+ before_filter :find_homework, :only => [:edit,:update,:alert_anonymous_comment,:start_anonymous_comment,:stop_anonymous_comment,:destroy,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
+ before_filter :teacher_of_course, :only => [:new, :create, :edit, :update, :destroy, :start_anonymous_comment, :stop_anonymous_comment, :alert_anonymous_comment,:start_evaluation_set,:set_evaluation_attr,:score_rule_set,:alert_forbidden_anonymous_comment,:alert_open_student_works,:open_student_works]
+ before_filter :member_of_course, :only => [:index]
+
+ def index
+ @new_homework = HomeworkCommon.new
+ @new_homework.homework_detail_manual = HomeworkDetailManual.new
+ @new_homework.course = @course
+ @page = params[:page] ? params[:page].to_i + 1 : 0
+ @is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
+ if @is_teacher
+ @homeworks = @course.homework_commons.order("updated_at desc").limit(10).offset(@page * 10)
+ else
+ @homeworks = @course.homework_commons.where("publish_time <= '#{Date.today}'").order("updated_at desc").limit(10).offset(@page * 10)
+ end
+ @is_student = User.current.logged? && (User.current.admin? || (User.current.member_of_course?(@course) && !@is_teacher))
+ @is_new = params[:is_new]
+
+ #设置at已读
+ @homeworks.each do |homework|
+ homework.journals_for_messages.each do |j|
+ User.current.at_messages.unviewed('JournalsForMessage', j.id).each {|x| x.viewed!}
+ end
+ end
+
+ respond_to do |format|
+ format.js
+ format.html
+ end
+ end
+
+ #新建作业,在个人作业列表创建作业
+ def new
+ render_404
+ end
+
+ #新建作业,在个人作业列表创建作业
+ def create
+ redirect_to user_homeworks_user_path(User.current.id)
+ end
+
+ def edit
+ @user = User.current
+ @is_in_course = params[:is_in_course].to_i
+ @course_activity = params[:course_activity].to_i
+ respond_to do |format|
+ format.html{render :layout => 'new_base_user'}
+ end
+ end
+
+ def update
+ if params[:homework_common]
+ @homework.name = params[:homework_common][:name]
+ @homework.description = params[:homework_common][:description]
+ if params[:homework_common][:publish_time] == ""
+ @homework.publish_time = Date.today
+ else
+ @homework.publish_time = params[:homework_common][:publish_time]
+ end
+ @homework.end_time = params[:homework_common][:end_time] || Time.now
+ @homework.course_id = params[:course_id]
+ @homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
+
+ homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
+ if @homework.publish_time <= Date.today && homework_detail_manual.comment_status == 0
+ homework_detail_manual.comment_status = 1
+ end
+ homework_detail_manual.evaluation_start = params[:evaluation_start].blank? ? @homework.end_time + 7 : params[:evaluation_start]
+ homework_detail_manual.evaluation_end = params[:evaluation_end].blank? ? homework_detail_manual.evaluation_start + 7 : params[:evaluation_end]
+
+ @homework.save_attachments(params[:attachments])
+ render_attachment_warning_if_needed(@homework)
+
+ #编程作业相关属性
+ if @homework.homework_type == 2
+ @homework.homework_detail_programing ||= HomeworkDetailPrograming.new
+ @homework_detail_programing = @homework.homework_detail_programing
+ @homework_detail_programing.language = params[:language_type].to_i
+
+ @homework.homework_tests.delete_all
+ inputs = params[:program][:input]
+ if Array === inputs
+ inputs.each_with_index do |val, i|
+ @homework.homework_tests << HomeworkTest.new(
+ input: val,
+ output: params[:program][:output][i]
+ )
+ end
+ end
+ end
+
+ #分组作业
+ if @homework.homework_type == 3
+ @homework.homework_detail_group ||= HomeworkDetailGroup.new
+ @homework_detail_group = @homework.homework_detail_group
+ @homework_detail_group.min_num = params[:min_num].to_i
+ @homework_detail_group.max_num = params[:max_num].to_i
+ @homework_detail_group.base_on_project = params[:base_on_project].to_i
+ end
+
+ if @homework.save
+ @homework_detail_manual.save if @homework_detail_manual
+ @homework_detail_programing.save if @homework_detail_programing
+ @homework_detail_group.save if @homework_detail_group
+
+ if params[:is_in_course] == "1"
+ redirect_to homework_common_index_path(:course => @course.id)
+ elsif params[:is_in_course] == "0"
+ redirect_to user_homeworks_user_path(User.current.id)
+ elsif params[:is_in_course] == "-1" && params[:course_activity] == "0"
+ redirect_to user_path(User.current.id)
+ elsif params[:is_in_course] == "-1" && params[:course_activity] == "1"
+ redirect_to course_path(@course.id)
+ end
+ end
+ end
+ end
+
+ def destroy
+ if @homework.destroy
+ respond_to do |format|
+ format.html {
+ if params[:is_in_course] == "1"
+ redirect_to homework_common_index_path(:course => @course.id)
+ elsif params[:is_in_course] == "0"
+ redirect_to user_homeworks_user_path(User.current.id)
+ elsif params[:is_in_course] == "-1" && params[:course_activity] == "0"
+ redirect_to user_path(User.current.id)
+ elsif params[:is_in_course] == "-1" && params[:course_activity] == "1"
+ redirect_to course_path(@course.id)
+ end
+ }
+ end
+ end
+ end
+
+ #开启匿评
+ #statue 1:启动成功,2:启动失败,作业总数大于等于2份时才能启动匿评,3:已开启匿评,请务重复开启,4:没有开启匿评的权限
+ def start_anonymous_comment
+ @statue = 4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
+ @statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
+ if @homework_detail_manual.comment_status == 1
+ student_works = @homework.student_works
+ if student_works && student_works.size >= 2
+ if @homework.homework_type == 3
+ student_work_projects = @homework.student_work_projects.where("student_work_id is not null")
+ student_work_projects.each_with_index do |pro_work, pro_index|
+ n = @homework_detail_manual.evaluation_num
+ n = n < student_works.size ? n : student_works.size - 1
+ work_index = -1
+ student_works.each_with_index do |stu_work, stu_index|
+ if stu_work.id.to_i == pro_work.student_work_id.to_i
+ work_index = stu_index
+ end
+ end
+ assigned_homeworks = get_assigned_homeworks(student_works, n, work_index)
+ assigned_homeworks.each do |h|
+ student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: pro_work.user_id, student_work_id: h.id)
+ student_works_evaluation_distributions.save
+ end
+ end
+ else
+ student_works.each_with_index do |work, index|
+ user = work.user
+ n = @homework_detail_manual.evaluation_num
+ n = n < student_works.size ? n : student_works.size - 1
+ assigned_homeworks = get_assigned_homeworks(student_works, n, index)
+ assigned_homeworks.each do |h|
+ student_works_evaluation_distributions = StudentWorksEvaluationDistribution.new(user_id: user.id, student_work_id: h.id)
+ student_works_evaluation_distributions.save
+ end
+ end
+ end
+ @homework_detail_manual.update_column('comment_status', 2)
+ @homework_detail_manual.update_column('evaluation_start', Date.today)
+ @statue = 1
+ # 匿评开启消息邮件通知
+ send_message_anonymous_comment(@homework, m_status = 2)
+ Mailer.send_mail_anonymous_comment_open(@homework).deliver
+ else
+ @statue = 2
+
+ end
+ else
+ @statue = 3
+ end
+ @user_activity_id = params[:user_activity_id].to_i
+ @is_in_course = params[:is_in_course].to_i
+ @course_activity = params[:course_activity].to_i
+ end
+
+ #关闭匿评
+ def stop_anonymous_comment
+ @homework_detail_manual.update_column('comment_status', 3)
+ @homework_detail_manual.update_column('evaluation_end', Date.today)
+ #计算缺评扣分
+ work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
+ @homework.student_works.each do |student_work|
+ absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
+ student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
+ student_work.save
+ end
+ # 匿评关闭消息邮件通知
+ send_message_anonymous_comment(@homework, m_status = 3)
+ Mailer.send_mail_anonymous_comment_close(@homework).deliver
+ @user_activity_id = params[:user_activity_id].to_i
+ @is_in_course = params[:is_in_course].to_i
+ @course_activity = params[:course_activity].to_i
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ # 开启/关闭匿评消息通知
+ def send_message_anonymous_comment(homework, m_status )
+ # status 标记匿评状态 1为关闭 0为开启
+ course = homework.course
+ course.members.each do |m|
+ @homework.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => m_status)
+ end
+ end
+ #提示
+ def alert_anonymous_comment
+ @cur_size = 0
+ @totle_size = 0
+ if @homework_detail_manual.comment_status == 1
+ @totle_size = @course.student.count
+ @cur_size = @homework.student_works.size
+ elsif @homework_detail_manual.comment_status == 2
+ @homework.student_works.map { |work| @totle_size += work.student_works_evaluation_distributions.count}
+ @cur_size = 0
+ @homework.student_works.map { |work| @cur_size += work.student_works_scores.where(:reviewer_role => 3).count}
+ end
+ @percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100)
+ @user_activity_id = params[:user_activity_id].to_i
+ @is_in_course = params[:is_in_course].to_i
+ @course_activity = params[:course_activity].to_i
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ def alert_forbidden_anonymous_comment
+ if params[:user_activity_id]
+ @user_activity_id = params[:user_activity_id]
+ else
+ @user_activity_id = -1
+ end
+ @is_in_course = params[:is_in_course] if params[:is_in_course]
+ @course_activity = params[:course_activity] if params[:course_Activity]
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ def open_student_works
+ if @homework.is_open == 0
+ @homework.update_attribute(:is_open, 1)
+ else
+ @homework.update_attribute(:is_open, 0)
+ end
+ @user_activity_id = params[:user_activity_id]
+ @is_in_course = params[:is_in_course] if params[:is_in_course]
+ @course_activity = params[:course_activity] if params[:course_Activity]
+ end
+
+ def alert_open_student_works
+ if params[:user_activity_id]
+ @user_activity_id = params[:user_activity_id]
+ else
+ @user_activity_id = -1
+ end
+ @is_in_course = params[:is_in_course] if params[:is_in_course]
+ @course_activity = params[:course_activity] if params[:course_Activity]
+ respond_to do |format|
+ format.js
+ end
+ end
+
+ def programing_test
+ test = {language:params[:language],src:Base64.encode64(params[:src]),input:[params[:input]],output:[params[:output]]}
+ @index = params[:index]
+ uri = URI('http://192.168.80.21:8080/api/realtime.json')
+ body = test.to_json
+ res = Net::HTTP.new(uri.host, uri.port).start do |client|
+ request = Net::HTTP::Post.new(uri.path)
+ request.body = body
+ request["Content-Type"] = "application/json"
+ client.request(request)
+ end
+ result = JSON.parse(res.body)
+ @err_msg = result["compile_error_msg"]
+ result["results"].each do |re|
+ @result = re["status"]
+ end
+ end
+
+ #启动匿评参数设置
+ def start_evaluation_set
+ if params[:user_activity_id]
+ @user_activity_id = params[:user_activity_id]
+ else
+ @user_activity_id = -1
+ end
+ @is_in_course = params[:is_in_course]
+ @course_activity = params[:course_activity].to_i
+ end
+
+ #设置匿评参数
+ def set_evaluation_attr
+ if @homework_detail_manual
+ unless params[:evaluation_start].to_s == @homework_detail_manual.evaluation_start.to_s
+ @homework_detail_manual.evaluation_start = params[:evaluation_start]
+ end
+
+ unless @homework_detail_manual.evaluation_end.to_s == params[:evaluation_end].to_s
+ @homework_detail_manual.evaluation_end = params[:evaluation_end]
+ end
+
+ @homework_detail_manual.evaluation_num = params[:evaluation_num]
+ @homework_detail_manual.save
+ @user_activity_id = params[:user_activity_id].to_i
+ @is_in_course = params[:is_in_course].to_i
+ @course_activity = params[:course_activity].to_i
+ end
+ end
+
+ #评分设置
+ def score_rule_set
+ if params[:user_activity_id]
+ @user_activity_id = params[:user_activity_id]
+ else
+ @user_activity_id = -1
+ end
+ @is_in_course = params[:is_in_course]
+ @course_activity = params[:course_activity].to_i
+ end
+
+ private
+ #获取课程
+ def find_course
+ @course = Course.find params[:course]
+ rescue
+ render_404
+ end
+ #获取作业
+ def find_homework
+ @homework = HomeworkCommon.find params[:id]
+ @homework_detail_manual = @homework.homework_detail_manual
+ @homework_detail_programing = @homework.homework_detail_programing
+ @homework_detail_group = @homework.homework_detail_group
+ @course = @homework.course
+ rescue
+ render_404
+ end
+ #是不是课程的老师
+ def teacher_of_course
+ render_403 unless User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
+ end
+
+ #当前用户是不是课程的成员
+ def member_of_course
+ render_403 unless @course.is_public==1 || User.current.member_of_course?(@course) || User.current.admin?
+ end
+
+ def get_assigned_homeworks(student_works, n, index)
+ student_works += student_works
+ student_works[index + 1 .. index + n]
+ end
+end
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index e297bc3cd..aa77e2d51 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -99,16 +99,18 @@ class StudentWorkController < ApplicationController
else
student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')'
end
- #老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
- if @homework.is_open == 1
- @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
- 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 @homework.is_open == 1 || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @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 @order == 'lastname'
+ @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("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
+ elsif @order == 'student_id'
+ @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}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
+ else
@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
- elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
+ end
+ @show_all = true
+ elsif User.current.member_of_course?(@course)
+ if @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
if pro.nil?
@@ -145,7 +147,13 @@ class StudentWorkController < ApplicationController
if my_work.empty?
@stundet_works = []
else
- @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
+ if @order == 'lastname'
+ @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("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
+ elsif @order == 'student_id'
+ @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}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
+ else
+ @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
+ end
@show_all = true
end
else
@@ -158,14 +166,17 @@ class StudentWorkController < ApplicationController
@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
- if @homework.is_open == 1
- @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
- 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 @homework.is_open == 1 || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @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 @order == 'lastname'
+ @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).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
+ elsif @order == 'student_id'
+ @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("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
+ else
@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
- elsif @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
+ end
+ @show_all = true
+ elsif User.current.member_of_course?(@course)
+ if @homework.homework_detail_manual.comment_status == 1 #学生 && 未开启匿评 只看到自己的
if @homework.homework_type == 3
pro = @homework.student_work_projects.where(:user_id => User.current.id).first
if pro.nil?
@@ -202,7 +213,13 @@ class StudentWorkController < ApplicationController
if my_work.empty?
@stundet_works = []
else
- @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
+ if @order == 'lastname'
+ @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).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
+ elsif @order == 'student_id'
+ @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("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
+ else
+ @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
+ end
@show_all = true
end
else
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 7fe146926..1c9a00fa4 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -376,13 +376,15 @@ class UsersController < ApplicationController
#用户作业列表
def user_homeworks
+ @order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
@user = User.current
+ @r_sort = @b_sort == "desc" ? "asc" : "desc"
if(params[:type].blank? || params[:type] == "1") #公共题库
visible_course = Course.where("is_public = 1 && is_delete = 0")
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
- @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc")
+ @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
elsif params[:type] == "2" #我的题库
- @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc")
+ @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
end
@type = params[:type]
@limit = 15
@@ -525,20 +527,22 @@ class UsersController < ApplicationController
end
def user_homework_type
+ @order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
+ @r_sort = @b_sort == "desc" ? "asc" : "desc"
@user = User.current
if(params[:type].blank? || params[:type] == "1") #公共题库
visible_course = Course.where("is_public = 1 && is_delete = 0")
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"
- @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("created_at desc")
+ @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
elsif params[:type] == "2" #我的题库
- @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("created_at desc")
+ @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}'").order("#{@order} #{@b_sort}")
end
if params[:property] && params[:property] == "1"
- @homeworks = @homeworks.where("homework_type = 1").reorder("created_at desc")
+ @homeworks = @homeworks.where("homework_type = 1").reorder("#{@order} #{@b_sort}")
elsif params[:property] && params[:property] == "2"
- @homeworks = @homeworks.where("homework_type = 2").reorder("created_at desc")
+ @homeworks = @homeworks.where("homework_type = 2").reorder("#{@order} #{@b_sort}")
elsif params[:property] && params[:property] == "3"
- @homeworks = @homeworks.where("homework_type = 3").reorder("created_at desc")
+ @homeworks = @homeworks.where("homework_type = 3").reorder("#{@order} #{@b_sort}")
end
@type = params[:type]
@property = params[:property]
@@ -564,6 +568,8 @@ class UsersController < ApplicationController
#用户主页过滤作业
def user_search_homeworks
+ @order,@b_sort = params[:order] || "created_at",params[:sort] || "desc"
+ @r_sort = @b_sort == "desc" ? "asc" : "desc"
@user = User.current
search = params[:name].to_s.strip.downcase
if(params[:type].blank? || params[:type] == "1") #全部
@@ -573,16 +579,16 @@ class UsersController < ApplicationController
all_user_ids = all_homeworks.map{|hw| hw.user_id}
user_str_ids = search_user_by_name all_user_ids, search
user_ids = user_str_ids.empty? ? "(-1)" : "(" + user_str_ids.join(",") + ")"
- @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%' or user_id in #{user_ids})").order("created_at desc")
+ @homeworks = HomeworkCommon.where("course_id in #{visible_course_ids} and publish_time <= '#{Date.today}' and (name like '%#{search}%' or user_id in #{user_ids})").order("#{@order} #{@b_sort}")
elsif params[:type] == "2" #课程资源
- @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and (name like '%#{search}%')").order("created_at desc")
+ @homeworks = HomeworkCommon.where("user_id = #{@user.id} and publish_time <= '#{Date.today}' and (name like '%#{search}%')").order("#{@order} #{@b_sort}")
end
if params[:property] && params[:property] == "1"
- @homeworks = @homeworks.where("homework_type = 1").reorder("created_at desc")
+ @homeworks = @homeworks.where("homework_type = 1").reorder("#{@order} #{@b_sort}")
elsif params[:property] && params[:property] == "2"
- @homeworks = @homeworks.where("homework_type = 2").reorder("created_at desc")
+ @homeworks = @homeworks.where("homework_type = 2").reorder("#{@order} #{@b_sort}")
elsif params[:property] && params[:property] == "3"
- @homeworks = @homeworks.where("homework_type = 3").reorder("created_at desc")
+ @homeworks = @homeworks.where("homework_type = 3").reorder("#{@order} #{@b_sort}")
end
@type = params[:type]
@limit = 15
@@ -592,6 +598,8 @@ class UsersController < ApplicationController
@offset ||= @hw_pages.offset
@homeworks = paginateHelper @homeworks,15
@is_import = params[:is_import]
+ @property = params[:property]
+ @search = search
respond_to do |format|
format.js
end
@@ -1547,7 +1555,7 @@ class UsersController < ApplicationController
@user = User.find(params[:id])
#@user.save_attachments(params[:attachments],User.current)
# Container_type为Principal
- Attachment.attach_filesex(@user, params[:attachments], params[:attachment_type])
+ attach = Attachment.attach_filesex_public(@user, params[:attachments], params[:attachment_type], is_public = true)
if(params[:type].blank? || params[:type] == "1") # 我的资源
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
if params[:status] == 2
@@ -2332,9 +2340,7 @@ class UsersController < ApplicationController
# 获取公共资源
def get_public_resources user_course_ids, user_project_ids
- attachments = Attachment.where("(is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) "+
- "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
- "or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)" ).order("created_on desc")
+ attachments = Attachment.where("(is_publish = 1 and is_public =1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) ").order("created_on desc")
end
# 获取我的资源
@@ -2351,7 +2357,7 @@ class UsersController < ApplicationController
# 获取公共资源课程
def get_course_resources_public user_course_ids
- attchments = Attachment.where("(container_type = 'Course' and is_publish = 1) or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
+ attchments = Attachment.where("(container_type = 'Course'and container_id is not null and is_publish = 1 and is_public =1)").order("created_on desc")
end
# 获取我的项目资源
@@ -2361,7 +2367,7 @@ class UsersController < ApplicationController
# 获取公共资源的项目资源
def get_project_resources_public user_project_ids
- attchments = Attachment.where("(container_type = 'Project') or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1) ").order("created_on desc")
+ attchments = Attachment.where("container_type = 'Project' and container_id is not null and is_public =1").order("created_on desc")
end
# 获取我上传的附件
@@ -2371,7 +2377,7 @@ class UsersController < ApplicationController
# 获取公共资源中我上传的附件
def get_attch_resources_public
- attchments = Attachment.where("container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal')").order("created_on desc")
+ attchments = Attachment.where("container_type in('Issue','Document','Message','News','StudentWorkScore','HomewCommon','OrgSubfield','Principal') and container_id is not null and is_public =1").order("created_on desc")
end
# 获取我的用户类型资源
@@ -2381,7 +2387,7 @@ class UsersController < ApplicationController
# 获取我的用户类型资源
def get_principal_resources_public
- attchments = Attachment.where("container_type = 'Principal'").order("created_on desc")
+ attchments = Attachment.where("container_type = 'Principal'and container_id is not null and is_public =1").order("created_on desc")
end
# 资源库 分为全部 课程资源 项目资源 附件
@@ -2613,9 +2619,7 @@ class UsersController < ApplicationController
end
elsif params[:type] == "6" #全部资源
# 公共资源库:所有公开资源或者我上传的私有资源
- @attachments = Attachment.where("((is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course')) "+
- "or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
- "or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)) and (filename like :p)" ,:p => search).order("created_on desc")
+ @attachments = Attachment.where("is_publish = 1 and is_public = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course') and (filename like :p)" ,:p => search).order("created_on desc")
end
@type = params[:type]
@limit = 25
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 4307d7a45..d98de27f6 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -785,7 +785,7 @@ module CoursesHelper
return[] unless course
result = []
course.attachments.each do |attachment|
- if attachment.is_public? ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id))|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
+ if (attachment.is_public? && attachment.is_publish == 1) ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,course)|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
result << attachment
end
end
diff --git a/app/helpers/files_helper.rb b/app/helpers/files_helper.rb
index 238999a71..913c49310 100644
--- a/app/helpers/files_helper.rb
+++ b/app/helpers/files_helper.rb
@@ -121,7 +121,8 @@ module FilesHelper
def visable_attachemnts attachments
result = []
attachments.each do |attachment|
- if attachment.is_public? ||
+ if (attachment.is_public? && attachment.container_type != "Course") ||
+ (attachment.is_public? && attachment.container_type == "Course" && attachment.is_publish == 1)||
(attachment.container_type == "Project" && User.current.member_of?(attachment.project)) ||
(attachment.container_type == "Course" && User.current.allowed_to?(:as_teacher,Course.find(attachment.container_id)))||
(attachment.container_type == "Course" && User.current.member_of_course?(Course.find(attachment.container_id)) && attachment.is_publish == 1)||
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 9f0c2c559..1cc0d3b7a 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -499,6 +499,12 @@ class Attachment < ActiveRecord::Base
result
end
+ def self.attach_filesex_public(obj, attachments,attachment_type, is_public)
+ result = obj.save_attachmentsex_public(attachments, User.current,attachment_type, is_public)
+ obj.attach_saved_attachments
+ result
+ end
+
def self.latest_attach(attachments, filename)
attachments.sort_by(&:created_on).reverse.detect {
|att| att.filename.downcase == filename.downcase
diff --git a/app/models/member.rb b/app/models/member.rb
index ee329def8..9eac21fa7 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -1,185 +1,185 @@
-# Redmine - project management software
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-class Member < ActiveRecord::Base
- belongs_to :user
- belongs_to :principal, :foreign_key => 'user_id'
- has_many :member_roles, :dependent => :destroy
- has_many :roles, :through => :member_roles
-
- belongs_to :project
- belongs_to :course
-
- belongs_to :course_group
- validates_presence_of :principal
- validates_uniqueness_of :user_id, :scope => [:project_id,:course_id]
- validate :validate_role
-
- before_destroy :set_issue_category_nil
- # 删除项目成员一并删除该成员的邀请记录
- after_destroy :delete_ivite_list
-
-
-
- def role
- end
-
- def role=
- end
-
- def name
- self.user.name
- end
-
- alias :base_role_ids= :role_ids=
- def role_ids=(arg)
- ids = (arg || []).collect(&:to_i) - [0]
- # Keep inherited roles
- ids += member_roles.select {|mr| !mr.inherited_from.nil?}.collect(&:role_id)
-
- new_role_ids = ids - role_ids
- # Add new roles
- new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) }
- # Remove roles (Rails' #role_ids= will not trigger MemberRole#on_destroy)
- member_roles_to_destroy = member_roles.select {|mr| !ids.include?(mr.role_id)}
- if member_roles_to_destroy.any?
- member_roles_to_destroy.each(&:destroy)
- end
- end
-
- def <=>(member)
- a, b = roles.sort.first, member.roles.sort.first
- if a == b
- if principal
- principal <=> member.principal
- else
- 1
- end
- elsif a
- a <=> b
- else
- 1
- end
- end
-
- def deletable?
- member_roles.detect {|mr| mr.inherited_from}.nil?
- end
-
- def include?(user)
- if principal.is_a?(Group)
- !user.nil? && user.groups.include?(principal)
- else
- self.user == user
- end
- end
-
- def set_issue_category_nil
- if user
- # remove category based auto assignments for this member
- #modify by nwb
- if project
- IssueCategory.update_all "assigned_to_id = NULL", ["project_id = ? AND assigned_to_id = ?", project.id, user.id]
- elsif course
- #IssueCategory.update_all "assigned_to_id = NULL", ["course_id = ? AND assigned_to_id = ?", course.id, user.id]
- end
-
- end
- end
-
- # 删除成员一并删除该成员的邀请信息
- def delete_ivite_list
- member_invite_lists = InviteList.where("user_id =? and project_id =?", self.user_id, self.project_id)
- unless member_invite_lists.nil?
- member_invite_lists.each do |member_invite_list|
- member_invite_list.destroy
- end
- end
- end
-
- # Find or initilize a Member with an id, attributes, and for a Principal
- def self.edit_membership(id, new_attributes, principal=nil)
- @membership = id.present? ? Member.find(id) : Member.new(:principal => principal)
- @membership.attributes = new_attributes
- @membership
- end
-
- # Finds or initilizes a Member for the given project and principal
- def self.find_or_new(project, principal)
- project_id = project.is_a?(Project) ? project.id : project
- principal_id = principal.is_a?(Principal) ? principal.id : principal
-
- member = Member.find_by_project_id_and_user_id(project_id, principal_id)
- member ||= Member.new(:project_id => project_id, :user_id => principal_id)
- member
- end
-
- # 查找每个学生每个作业的评分
- def student_homework_score
- homework_score = StudentWork.find_by_sql("SELECT homework_commons.name,student_works.final_score as score
- FROM student_works,homework_commons
- WHERE student_works.homework_common_id = homework_commons.id
- AND homework_commons.course_id = #{self.course_id}
- AND student_works.user_id = #{self.user_id}")
- score_count = StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f
- [homework_score, format("%0.2f", score_count)]
- end
-
- def student_work_score
- StudentWork.select("homework_commons.name, student_works.final_score").joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}")
- end
-
- #当前课程的作业列表
- def homework_common_list
- HomeworkCommon.where(:course_id => self.course_id)
- end
-
- #当前学生在指定作业内的得分
- def homework_common_score homework_common
- 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
-
- def student_work_score_avg
- StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f
- end
-
- def student_work_score_sum
- 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
- WHERE student_works.homework_common_id = homework_commons.id
- AND homework_commons.course_id = #{self.course_id}
- AND student_works.user_id = #{self.user_id}"
- score = StudentWork.find_by_sql(sql_select)
- end
-
- protected
-
- def validate_role
- errors.add_on_empty :role if member_roles.empty? && roles.empty?
- end
-
-
-
- def searchTeacherAndAssistant project
- #searchPeopleByRoles(project, TeacherRoles)
- members = []
- project.members.each do |m|
- members << m if m && m.user && m.user.allowed_to?(:as_teacher,project)
- end
- members
- end
-end
+# Redmine - project management software
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+class Member < ActiveRecord::Base
+ belongs_to :user
+ belongs_to :principal, :foreign_key => 'user_id'
+ has_many :member_roles, :dependent => :destroy
+ has_many :roles, :through => :member_roles
+
+ belongs_to :project
+ belongs_to :course
+
+ belongs_to :course_group
+ validates_presence_of :principal
+ validates_uniqueness_of :user_id, :scope => [:project_id,:course_id]
+ validate :validate_role
+
+ before_destroy :set_issue_category_nil
+ # 删除项目成员一并删除该成员的邀请记录
+ after_destroy :delete_ivite_list
+
+
+
+ def role
+ end
+
+ def role=
+ end
+
+ def name
+ self.user.name
+ end
+
+ alias :base_role_ids= :role_ids=
+ def role_ids=(arg)
+ ids = (arg || []).collect(&:to_i) - [0]
+ # Keep inherited roles
+ ids += member_roles.select {|mr| !mr.inherited_from.nil?}.collect(&:role_id)
+
+ new_role_ids = ids - role_ids
+ # Add new roles
+ new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) }
+ # Remove roles (Rails' #role_ids= will not trigger MemberRole#on_destroy)
+ member_roles_to_destroy = member_roles.select {|mr| !ids.include?(mr.role_id)}
+ if member_roles_to_destroy.any?
+ member_roles_to_destroy.each(&:destroy)
+ end
+ end
+
+ def <=>(member)
+ a, b = roles.sort.first, member.roles.sort.first
+ if a == b
+ if principal
+ principal <=> member.principal
+ else
+ 1
+ end
+ elsif a
+ a <=> b
+ else
+ 1
+ end
+ end
+
+ def deletable?
+ member_roles.detect {|mr| mr.inherited_from}.nil?
+ end
+
+ def include?(user)
+ if principal.is_a?(Group)
+ !user.nil? && user.groups.include?(principal)
+ else
+ self.user == user
+ end
+ end
+
+ def set_issue_category_nil
+ if user
+ # remove category based auto assignments for this member
+ #modify by nwb
+ if project
+ IssueCategory.update_all "assigned_to_id = NULL", ["project_id = ? AND assigned_to_id = ?", project.id, user.id]
+ elsif course
+ #IssueCategory.update_all "assigned_to_id = NULL", ["course_id = ? AND assigned_to_id = ?", course.id, user.id]
+ end
+
+ end
+ end
+
+ # 删除成员一并删除该成员的邀请信息
+ def delete_ivite_list
+ member_invite_lists = InviteList.where("user_id =? and project_id =?", self.user_id, self.project_id)
+ unless member_invite_lists.nil?
+ member_invite_lists.each do |member_invite_list|
+ member_invite_list.destroy
+ end
+ end
+ end
+
+ # Find or initilize a Member with an id, attributes, and for a Principal
+ def self.edit_membership(id, new_attributes, principal=nil)
+ @membership = id.present? ? Member.find(id) : Member.new(:principal => principal)
+ @membership.attributes = new_attributes
+ @membership
+ end
+
+ # Finds or initilizes a Member for the given project and principal
+ def self.find_or_new(project, principal)
+ project_id = project.is_a?(Project) ? project.id : project
+ principal_id = principal.is_a?(Principal) ? principal.id : principal
+
+ member = Member.find_by_project_id_and_user_id(project_id, principal_id)
+ member ||= Member.new(:project_id => project_id, :user_id => principal_id)
+ member
+ end
+
+ # 查找每个学生每个作业的评分
+ def student_homework_score
+ homework_score = StudentWork.find_by_sql("SELECT homework_commons.name,student_works.final_score as score
+ FROM student_works,homework_commons
+ WHERE student_works.homework_common_id = homework_commons.id
+ AND homework_commons.course_id = #{self.course_id}
+ AND student_works.user_id = #{self.user_id}")
+ score_count = StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f
+ [homework_score, format("%0.2f", score_count)]
+ end
+
+ def student_work_score
+ StudentWork.select("homework_commons.name, student_works.final_score").joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}")
+ end
+
+ #当前课程的作业列表
+ def homework_common_list
+ HomeworkCommon.where(:course_id => self.course_id)
+ end
+
+ #当前学生在指定作业内的得分
+ def homework_common_score homework_common
+ 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
+
+ def student_work_score_avg
+ StudentWork.joins(:homework_common).where("student_works.user_id = #{self.user_id} and homework_commons.course_id = #{self.course_id}").average(:final_score).try(:round, 2).to_f
+ end
+
+ def student_work_score_sum
+ 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
+ WHERE student_works.homework_common_id = homework_commons.id
+ AND homework_commons.course_id = #{self.course_id}
+ AND student_works.user_id = #{self.user_id}"
+ score = StudentWork.find_by_sql(sql_select)
+ end
+
+ protected
+
+ def validate_role
+ errors.add_on_empty :role if member_roles.empty? && roles.empty?
+ end
+
+
+
+ def searchTeacherAndAssistant project
+ #searchPeopleByRoles(project, TeacherRoles)
+ members = []
+ project.members.each do |m|
+ members << m if m && m.user && m.user.allowed_to?(:as_teacher,project)
+ end
+ members
+ end
+end
diff --git a/app/models/praise_tread.rb b/app/models/praise_tread.rb
index 3df5c72d9..b1b7e0908 100644
--- a/app/models/praise_tread.rb
+++ b/app/models/praise_tread.rb
@@ -2,8 +2,8 @@ class PraiseTread < ActiveRecord::Base
attr_accessible :user_id,:praise_tread_object_id,:praise_tread_object_type,:praise_or_tread
belongs_to :user
belongs_to :praise_tread_object, polymorphic: true
- after_create :be_user_score
- after_destroy :down_user_score
+ #after_create :be_user_score
+ #after_destroy :down_user_score
include UserScoreHelper
def self.find_object_by_type_and_id(type,id)
@obj = nil
diff --git a/app/views/blog_comments/_simple_ke_reply_form.html.erb b/app/views/blog_comments/_simple_ke_reply_form.html.erb
index e222d8e56..ac953b254 100644
--- a/app/views/blog_comments/_simple_ke_reply_form.html.erb
+++ b/app/views/blog_comments/_simple_ke_reply_form.html.erb
@@ -1,21 +1,21 @@
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
-
-
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
+
+
\ No newline at end of file
diff --git a/app/views/blogs/_article.html.erb b/app/views/blogs/_article.html.erb
index 05f69055f..a5aa8b780 100644
--- a/app/views/blogs/_article.html.erb
+++ b/app/views/blogs/_article.html.erb
@@ -1,226 +1,226 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
-
-
- <% if activity.author.id == User.current.id%>
-
-
-
-
-
- <%= link_to(
- l(:button_edit),
- {:controller => 'blog_comments',:action => 'edit',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id},
- :class => 'postOptionLink'
- ) if User.current && User.current.id == activity.author.id %>
-
-
- <%= link_to(
- l(:button_delete),
- {:controller => 'blog_comments',:action => 'destroy',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id},
- :method => :delete,
- :data => {:confirm => l(:text_are_you_sure)},
- :class => 'postOptionLink'
- ) if User.current && User.current.id == activity.author.id %>
-
-
- <% if activity.id == activity.blog.homepage_id %>
- <%= link_to(
- l(:button_cancel_homepage),
- {:controller => 'blogs',:action => 'cancel_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
- :method => :post,
- :class => 'postOptionLink'
- ) if User.current && User.current.id == activity.blog.author_id %>
- <% else %>
- <%= link_to(
- l(:button_set_homepage),
- {:controller => 'blogs',:action => 'set_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
- :method => :post,
- :class => 'postOptionLink'
- ) if User.current && User.current.id == activity.blog.author_id %>
- <% end %>
-
-
-
-
-
- <%end%>
-
- <% if activity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
- <% end %>
- TO
- <%= link_to activity.blog.name+" | 博客", user_blogs_path(:user_id=>activity.author_id,:host=>Setting.host_user), :class => "newsBlue ml15 mr5"%>
- <% if activity.blog.homepage_id and activity.id == activity.blog.homepage_id %>
- 已设为首页
- <% end %>
-
-
-
- <% if activity.parent_id.nil? %>
- <%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey" %>
- <% else %>
- <%= link_to activity.title.subject.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey"%>
- <% end %>
-
- <% if activity.sticky == 1%>
-
置顶
- <% end%>
- <% if activity.locked%>
-
- <% end%>
-
-
- 发帖时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(activity.updated_on) %>
-
-
- <% if activity.parent_id.nil? %>
- <% content= activity.content%>
- <% else %>
- <% content= activity.parent.content%>
- <% end %>
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
-
-
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
-
- <% count=0 %>
- <% if activity.parent %>
- <% count=activity.parent.children.count%>
- <% else %>
- <% count=activity.children.count%>
- <% end %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#=format_date(activity.updated_on)%>
- <%if count > 3 %>
-
- <% end %>
-
-
- <% activity= activity.parent ? activity.parent : activity%>
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.children.reorder("created_on desc").each do |reply|%>
-
- <% replies_all_i=replies_all_i+1 %>
-
-
- <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
-
-
-
- <% if reply.try(:author).try(:realname) == ' ' %>
- <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(reply.created_on) %>
-
- <% if reply.author == User.current %>
- 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
- <% end %>
-
-
-
- <%= reply.content.html_safe %>
-
-
-
-
- <% end %>
-
-
- <% end %>
-
- <% if !activity.locked? %>
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller=>'blog_comments',:action => 'reply', :id => activity.id, :blog_id => activity.blog.id, :user_id => activity.author_id},:method => "post",:remote=>true) do |f|%>
-
-
-
-
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
- <% end %>
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
+
+
+ <% if activity.author.id == User.current.id%>
+
+
+
+
+
+ <%= link_to(
+ l(:button_edit),
+ {:controller => 'blog_comments',:action => 'edit',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id},
+ :class => 'postOptionLink'
+ ) if User.current && User.current.id == activity.author.id %>
+
+
+ <%= link_to(
+ l(:button_delete),
+ {:controller => 'blog_comments',:action => 'destroy',:user_id=>activity.author_id,:blog_id=>activity.blog_id, :id => activity.id},
+ :method => :delete,
+ :data => {:confirm => l(:text_are_you_sure)},
+ :class => 'postOptionLink'
+ ) if User.current && User.current.id == activity.author.id %>
+
+
+ <% if activity.id == activity.blog.homepage_id %>
+ <%= link_to(
+ l(:button_cancel_homepage),
+ {:controller => 'blogs',:action => 'cancel_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
+ :method => :post,
+ :class => 'postOptionLink'
+ ) if User.current && User.current.id == activity.blog.author_id %>
+ <% else %>
+ <%= link_to(
+ l(:button_set_homepage),
+ {:controller => 'blogs',:action => 'set_homepage',:user_id=>activity.author_id,:id=>activity.blog_id, :article_id => activity.id},
+ :method => :post,
+ :class => 'postOptionLink'
+ ) if User.current && User.current.id == activity.blog.author_id %>
+ <% end %>
+
+
+
+
+
+ <%end%>
+
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id,:host=>Setting.host_user), :class => "newsBlue mr15" %>
+ <% end %>
+ TO
+ <%= link_to activity.blog.name+" | 博客", user_blogs_path(:user_id=>activity.author_id,:host=>Setting.host_user), :class => "newsBlue ml15 mr5"%>
+ <% if activity.blog.homepage_id and activity.id == activity.blog.homepage_id %>
+ 已设为首页
+ <% end %>
+
+
+
+ <% if activity.parent_id.nil? %>
+ <%= link_to activity.title.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey" %>
+ <% else %>
+ <%= link_to activity.title.subject.to_s.html_safe, user_blog_blog_comment_path(:user_id=>activity.author_id, :blog_id=>activity.blog.id,:id=>activity), :class=> "postGrey"%>
+ <% end %>
+
+ <% if activity.sticky == 1%>
+
置顶
+ <% end%>
+ <% if activity.locked%>
+
+ <% end%>
+
+
+ 发帖时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(activity.updated_on) %>
+
+
+ <% if activity.parent_id.nil? %>
+ <% content= activity.content%>
+ <% else %>
+ <% content= activity.parent.content%>
+ <% end %>
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
+
+
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+
+ <% count=0 %>
+ <% if activity.parent %>
+ <% count=activity.parent.children.count%>
+ <% else %>
+ <% count=activity.children.count%>
+ <% end %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#=format_date(activity.updated_on)%>
+ <%if count > 3 %>
+
+ <% end %>
+
+
+ <% activity= activity.parent ? activity.parent : activity%>
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.children.reorder("created_on desc").each do |reply|%>
+
+ <% replies_all_i=replies_all_i+1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_path(reply.author_id,:host=>Setting.host_user), :alt => "用户头像" %>
+
+
+
+ <% if reply.try(:author).try(:realname) == ' ' %>
+ <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(reply.created_on) %>
+
+ <% if reply.author == User.current %>
+ 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
+ <% end %>
+
+
+
+ <%= reply.content.html_safe %>
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+ <% if !activity.locked? %>
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller=>'blog_comments',:action => 'reply', :id => activity.id, :blog_id => activity.blog.id, :user_id => activity.author_id},:method => "post",:remote=>true) do |f|%>
+
+
+
+
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+ <% end %>
+
+
+
diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb
index b399c6035..bf69c3a61 100644
--- a/app/views/courses/_new_member_list.html.erb
+++ b/app/views/courses/_new_member_list.html.erb
@@ -72,13 +72,6 @@
<%= 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;"}) %>
-
<% end %>
<% end %>
<% else %>
diff --git a/app/views/courses/syllabus.html.erb b/app/views/courses/syllabus.html.erb
index e12876ce9..8be245958 100644
--- a/app/views/courses/syllabus.html.erb
+++ b/app/views/courses/syllabus.html.erb
@@ -1,218 +1,218 @@
-
-<%= content_for(:header_tags) do %>
- <%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
- <%= javascript_include_tag 'blog' %>
-<% end %>
-
-
-
-
-
-
- <%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %>
-
-
- <% if User.current && @article.author.id == User.current.id%>
-
-
-
-
-
- 重设大纲
-
-
- <%= link_to(
- '取消大纲',
- {:controller => 'blog_comments',:action => 'destroy',:user_id=>BlogComment.find(@course.outline).author_id,:blog_id=>BlogComment.find(@course.outline).blog_id, :id => @course.outline,:course_id=>@course.id},
- :method => :delete,
- :data => {:confirm => '您确定要取消么?'},
- :class => 'postOptionLink'
- ) if User.current && User.current.id == @article.author.id %>
-
-
-
-
-
-
-
-
-
-
-
-
-
- <%end%>
-
-
-
-
- <% if @article.try(:author).try(:realname) == ' ' %>
- <%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
- <% else %>
- <%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
- <% end %>
-
-
<%= format_time( @article.created_on)%>
-
-
- <%= @article.content.html_safe%>
-
-
-
- <%#= link_to_attachments_course @topic, :author => false %>
- <% if @article.attachments.any?%>
- <% options = {:author => true, :deletable => false} %>
- <%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => @article.attachments, :options => options, :is_float => true} %>
- <% end %>
-
-
-
-
-
- <% count=0 %>
- <% if @article.parent %>
- <% count=@article.parent.children.count%>
- <% else %>
- <% count=@article.children.count%>
- <% end %>
-
- <% unless count == 0 %>
-
-
- <%@article.children.reorder('created_on desc').each_with_index do |reply,i| %>
-
-
-
- <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
-
-
-
- <% if reply.try(:author).try(:realname) == ' ' %>
- <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
- <% end %>
-
-
- <%= reply.content.html_safe%>
-
-
- <%= format_time(reply.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
- <% if !@article.locked? && User.current.logged?%>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@article.author_id), :alt => "用户头像" %>
-
-
- <%= form_for 'blog_comment',:url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id},:method => "post",:html => {:multipart => true, :id => 'message_form'} do |f|%>
-
-
-
-
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
- <% end %>
-
-
-
+
+
+
+
+ <%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %>
+
+
+ <% if User.current && @article.author.id == User.current.id%>
+
+
+
+
+
+ 重设大纲
+
+
+ <%= link_to(
+ '取消大纲',
+ {:controller => 'blog_comments',:action => 'destroy',:user_id=>BlogComment.find(@course.outline).author_id,:blog_id=>BlogComment.find(@course.outline).blog_id, :id => @course.outline,:course_id=>@course.id},
+ :method => :delete,
+ :data => {:confirm => '您确定要取消么?'},
+ :class => 'postOptionLink'
+ ) if User.current && User.current.id == @article.author.id %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <%end%>
+
+
+
+
+ <% if @article.try(:author).try(:realname) == ' ' %>
+ <%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
+ <% else %>
+ <%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
+ <% end %>
+
+
<%= format_time( @article.created_on)%>
+
+
+ <%= @article.content.html_safe%>
+
+
+
+ <%#= link_to_attachments_course @topic, :author => false %>
+ <% if @article.attachments.any?%>
+ <% options = {:author => true, :deletable => false} %>
+ <%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => @article.attachments, :options => options, :is_float => true} %>
+ <% end %>
+
+
+
+
+
+ <% count=0 %>
+ <% if @article.parent %>
+ <% count=@article.parent.children.count%>
+ <% else %>
+ <% count=@article.children.count%>
+ <% end %>
+
+ <% unless count == 0 %>
+
+
+ <%@article.children.reorder('created_on desc').each_with_index do |reply,i| %>
+
+
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
+
+
+
+ <% if reply.try(:author).try(:realname) == ' ' %>
+ <%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
+ <% end %>
+
+
+ <%= reply.content.html_safe%>
+
+
+ <%= format_time(reply.created_on) %>
+
+
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+ <% if !@article.locked? && User.current.logged?%>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@article.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for 'blog_comment',:url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id},:method => "post",:html => {:multipart => true, :id => 'message_form'} do |f|%>
+
+
+
+
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+ <% end %>
+
+
+
\ No newline at end of file
diff --git a/app/views/issues/_issue_replies.html.erb b/app/views/issues/_issue_replies.html.erb
index 4c5c922f0..4c8dfa1d9 100644
--- a/app/views/issues/_issue_replies.html.erb
+++ b/app/views/issues/_issue_replies.html.erb
@@ -1,86 +1,86 @@
-
- <% issue.journals.reorder("created_on desc").each do |reply| %>
-
- <% replies_all_i=replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
-
-
-
- <% if reply.try(:user).try(:realname) == ' ' %>
- <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%#= format_time(reply.created_on) %>
-
-
- <% if reply.details.any? %>
- <% details_to_strings(reply.details).each do |string| %>
-
<%= string %>
- <% end %>
- <% end %>
-
<%= reply.notes.html_safe %>
-
-
- <%= format_time(reply.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
-
-
- <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@issue.author_id), :alt => "用户头像" %>
-
-
-
-
- <%= form_for('new_form',:url => add_journal_issue_path(@issue.id),:method => "post", :remote => true) do |f| %>
- <%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%>
-
-
-
-
-
-
-
- <%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %>
-
-
-
发送
-
- <% end %>
-
-
-
-
-
-
+
+ <% issue.journals.reorder("created_on desc").each do |reply| %>
+
+ <% replies_all_i=replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
+
+
+
+ <% if reply.try(:user).try(:realname) == ' ' %>
+ <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%#= format_time(reply.created_on) %>
+
+
+ <% if reply.details.any? %>
+ <% details_to_strings(reply.details).each do |string| %>
+
<%= string %>
+ <% end %>
+ <% end %>
+
<%= reply.notes.html_safe %>
+
+
+ <%= format_time(reply.created_on) %>
+
+
+
+
+
+
+ <% end %>
+
+
+
+
+ <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@issue.author_id), :alt => "用户头像" %>
+
+
+
+
+ <%= form_for('new_form',:url => add_journal_issue_path(@issue.id),:method => "post", :remote => true) do |f| %>
+ <%#= kindeditor_tag :notes,"",:height=>"33",:minHeight=>"33",:editor_id=>"issues_reply_editor"%>
+
+
+
+
+
+
+
+ <%= render :partial => 'attachments/issue_reply', :locals => {:container => @issue} %>
+
+
+
发送
+
+ <% end %>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/issues/_issue_reply_ke_form.html.erb b/app/views/issues/_issue_reply_ke_form.html.erb
index e84d5905c..a2975237b 100644
--- a/app/views/issues/_issue_reply_ke_form.html.erb
+++ b/app/views/issues/_issue_reply_ke_form.html.erb
@@ -1,27 +1,27 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@issue.author_id), :alt => "用户头像" %>
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(@issue.author_id), :alt => "用户头像" %>
+
+
+
\ No newline at end of file
diff --git a/app/views/layouts/_user_courses.html.erb b/app/views/layouts/_user_courses.html.erb
index 7aa591aae..30a911d09 100644
--- a/app/views/layouts/_user_courses.html.erb
+++ b/app/views/layouts/_user_courses.html.erb
@@ -2,7 +2,7 @@
<%= format_date( @memo.created_at)%>
-
+
<%= @memo.content.html_safe%>
@@ -113,7 +113,7 @@
<%= hidden_field_tag :quote,"",:required => false,:style => 'display:none' %>
-
发送
+
发送
<% end%>
@@ -126,7 +126,7 @@
\ No newline at end of file
diff --git a/app/views/messages/_reply_message.html.erb b/app/views/messages/_reply_message.html.erb
index 2d957dbda..faa0bd0ce 100644
--- a/app/views/messages/_reply_message.html.erb
+++ b/app/views/messages/_reply_message.html.erb
@@ -1,19 +1,19 @@
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
-
-
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
+
+
\ No newline at end of file
diff --git a/app/views/org_document_comments/_simple_ke_reply_form.html.erb b/app/views/org_document_comments/_simple_ke_reply_form.html.erb
index 44eb71500..1813f5b5f 100644
--- a/app/views/org_document_comments/_simple_ke_reply_form.html.erb
+++ b/app/views/org_document_comments/_simple_ke_reply_form.html.erb
@@ -1,18 +1,18 @@
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
-
-
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %>
+
+
\ No newline at end of file
diff --git a/app/views/organizations/_org_course_homework.html.erb b/app/views/organizations/_org_course_homework.html.erb
index 499ea6357..75401e765 100644
--- a/app/views/organizations/_org_course_homework.html.erb
+++ b/app/views/organizations/_org_course_homework.html.erb
@@ -47,7 +47,7 @@
<% end%>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%>
-
系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
+
系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
<% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%>
系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!
<% end %>
@@ -356,7 +356,7 @@
<%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
-
发送
+
发送
<% end%>
diff --git a/app/views/organizations/_org_course_message.html.erb b/app/views/organizations/_org_course_message.html.erb
index 99229634e..4873fbba9 100644
--- a/app/views/organizations/_org_course_message.html.erb
+++ b/app/views/organizations/_org_course_message.html.erb
@@ -144,7 +144,7 @@
-
发送
+
发送
<% end%>
diff --git a/app/views/organizations/_org_course_news.html.erb b/app/views/organizations/_org_course_news.html.erb
index ecdf728f8..3da0887ed 100644
--- a/app/views/organizations/_org_course_news.html.erb
+++ b/app/views/organizations/_org_course_news.html.erb
@@ -1,123 +1,123 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
-
-
-
- <% if @ctivity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% end %> TO
- <%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_path(activity.course), :class => "newsBlue ml15" %>
-
-
- <%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
-
- <% if activity.sticky == 1%>
-
置顶
- <% end%>
-
-
- 发布时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
-
-
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
- <% count=activity.comments.count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#= format_date(activity.updated_on) %>
- <%if count>3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.comments.reorder("created_on desc").each do |comment| %>
-
- <% replies_all_i = replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_url_in_org(comment.author_id), :alt => "用户头像" %>
-
-
-
- <% if comment.try(:author).try(:realname) == ' ' %>
- <%= link_to comment.try(:author), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(comment.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+
+
+
+ <% if @ctivity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %> TO
+ <%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_path(activity.course), :class => "newsBlue ml15" %>
+
+
+ <%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
+
+ <% if activity.sticky == 1%>
+
置顶
+ <% end%>
+
+
+ 发布时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
+
+
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+ <% count=activity.comments.count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#= format_date(activity.updated_on) %>
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.comments.reorder("created_on desc").each do |comment| %>
+
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_url_in_org(comment.author_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:author).try(:realname) == ' ' %>
+ <%= link_to comment.try(:author), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
diff --git a/app/views/organizations/_org_project_issue.html.erb b/app/views/organizations/_org_project_issue.html.erb
index 855a8053c..782412e43 100644
--- a/app/views/organizations/_org_project_issue.html.erb
+++ b/app/views/organizations/_org_project_issue.html.erb
@@ -1,141 +1,141 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
-
-
-
- <% if activity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% end %> TO
- <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%>
-
-
- <%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %>
-
- <%#= get_issue_priority(activity.priority_id)[1] %>
-
-
-
-
指派给
- <% unless activity.assigned_to_id.nil? %>
- <% if activity.try(:assigned_to).try(:realname) == ' ' %>
- <%= link_to activity.try(:assigned_to), user_url_in_org(activity.assigned_to_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:assigned_to).try(:realname), user_url_in_org(activity.assigned_to_id), :class => "newsBlue mr15" %>
- <% end %>
- <% end %>
-
-
- 发布时间:
- <%=format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
-
-
-
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
- <% count = activity.journals.count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#= format_date(activity.updated_on) %>
- <% if count > 3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.journals.reorder("created_on desc").each do |reply| %>
-
- <% replies_all_i=replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_url_in_org(reply.user_id), :alt => "用户头像" %>
-
-
-
- <% if reply.try(:user).try(:realname) == ' ' %>
- <%= link_to reply.try(:user), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:user).try(:realname), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(reply.created_on) %>
-
- <% if reply.user == User.current %>
- 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
- <% end %>
-
-
-
- <% if reply.details.any? %>
- <% details_to_strings(reply.details).each do |string| %>
-
<%= string %>
- <% end %>
- <% end %>
-
<%= reply.notes.nil? ? "" : reply.notes.html_safe %>
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => add_journal_in_org_issue_path(activity.id),:method => "post", :remote => true) do |f|%>
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %> TO
+ <%= link_to activity.project.name.to_s+" | 项目问题", project_issues_path(activity.project), :class => "newsBlue ml15"%>
+
+
+ <%= link_to activity.subject.to_s, issue_path(activity), :class => "postGrey" %>
+
+ <%#= get_issue_priority(activity.priority_id)[1] %>
+
+
+
+
指派给
+ <% unless activity.assigned_to_id.nil? %>
+ <% if activity.try(:assigned_to).try(:realname) == ' ' %>
+ <%= link_to activity.try(:assigned_to), user_url_in_org(activity.assigned_to_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:assigned_to).try(:realname), user_url_in_org(activity.assigned_to_id), :class => "newsBlue mr15" %>
+ <% end %>
+ <% end %>
+
+
+ 发布时间:
+ <%=format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
+
+
+
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+ <% count = activity.journals.count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#= format_date(activity.updated_on) %>
+ <% if count > 3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.journals.reorder("created_on desc").each do |reply| %>
+
+ <% replies_all_i=replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_url_in_org(reply.user_id), :alt => "用户头像" %>
+
+
+
+ <% if reply.try(:user).try(:realname) == ' ' %>
+ <%= link_to reply.try(:user), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:user).try(:realname), user_url_in_org(reply.user_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(reply.created_on) %>
+
+ <% if reply.user == User.current %>
+ 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
+ <% end %>
+
+
+
+ <% if reply.details.any? %>
+ <% details_to_strings(reply.details).each do |string| %>
+
<%= string %>
+ <% end %>
+ <% end %>
+
<%= reply.notes.nil? ? "" : reply.notes.html_safe %>
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => add_journal_in_org_issue_path(activity.id),:method => "post", :remote => true) do |f|%>
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
+
diff --git a/app/views/organizations/_org_subfield_message.html.erb b/app/views/organizations/_org_subfield_message.html.erb
index aa2493c5f..bf0cc8734 100644
--- a/app/views/organizations/_org_subfield_message.html.erb
+++ b/app/views/organizations/_org_subfield_message.html.erb
@@ -1,161 +1,161 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
-
-
-
- <% if activity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% end %>
- TO
- <%= link_to activity.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"%>
-
-
- <% if activity.parent_id.nil? %>
- <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
- %>
- <% else %>
- <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
- %>
- <% end %>
-
-
- 发布时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(OrgActivity.where("org_act_type='#{activity.class}' and org_act_id =#{activity.id}").first.updated_at) %>
-
-
- <% if activity.parent_id.nil? %>
- <% content = activity.content%>
- <% else %>
- <% content = activity.parent.content%>
- <% end %>
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
- <% if User.current.logged? %>
-
- <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'message')") %>
-
- <%= link_to(
- l(:button_edit),
- {:controller => 'messages', :action => 'edit', :id => activity, :board_id => activity.board_id},
- :class => 'postOptionLink'
- ) if activity.org_subfield_editable_by?(User.current) %>
-
-
- <%= link_to(
- l(:button_delete),
- {:controller => 'messages', :action => 'destroy', :id => activity, :board_id => activity.board_id},
- :method => 'post',
- :data => {:confirm => l(:text_are_you_sure)},
- :class => 'postOptionLink'
- ) if activity.org_subfield_editable_by?(User.current) %>
-
-
- <% end %>
-
-
-
-
-
-
- <% count = 0 %>
- <% if activity.parent %>
- <% count=activity.parent.children.count%>
- <% else %>
- <% count=activity.children.count%>
- <% end %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
- <%if count>3 %>
-
- <% end %>
-
-
- <% activity= activity.parent_id.nil? ? activity : activity.parent %>
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.children.reorder("created_on desc").each do |reply| %>
-
- <% replies_all_i=replies_all_i+1 %>
-
-
- <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
-
-
-
- <% if reply.try(:author).try(:realname) == ' ' %>
- <%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(reply.created_on) %>
-
- <% if reply.author == User.current %>
- 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
- <% end %>
-
-
-
- <%= reply.content.html_safe %>
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
-
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %>
+ TO
+ <%= link_to activity.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"%>
+
+
+ <% if activity.parent_id.nil? %>
+ <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
+ %>
+ <% else %>
+ <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
+ %>
+ <% end %>
+
+
+ 发布时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(OrgActivity.where("org_act_type='#{activity.class}' and org_act_id =#{activity.id}").first.updated_at) %>
+
+
+ <% if activity.parent_id.nil? %>
+ <% content = activity.content%>
+ <% else %>
+ <% content = activity.parent.content%>
+ <% end %>
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+ <% if User.current.logged? %>
+
+ <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'message')") %>
+
+ <%= link_to(
+ l(:button_edit),
+ {:controller => 'messages', :action => 'edit', :id => activity, :board_id => activity.board_id},
+ :class => 'postOptionLink'
+ ) if activity.org_subfield_editable_by?(User.current) %>
+
+
+ <%= link_to(
+ l(:button_delete),
+ {:controller => 'messages', :action => 'destroy', :id => activity, :board_id => activity.board_id},
+ :method => 'post',
+ :data => {:confirm => l(:text_are_you_sure)},
+ :class => 'postOptionLink'
+ ) if activity.org_subfield_editable_by?(User.current) %>
+
+
+ <% end %>
+
+
+
+
+
+
+ <% count = 0 %>
+ <% if activity.parent %>
+ <% count=activity.parent.children.count%>
+ <% else %>
+ <% count=activity.children.count%>
+ <% end %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% activity= activity.parent_id.nil? ? activity : activity.parent %>
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.children.reorder("created_on desc").each do |reply| %>
+
+ <% replies_all_i=replies_all_i+1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
+
+
+
+ <% if reply.try(:author).try(:realname) == ' ' %>
+ <%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(reply.created_on) %>
+
+ <% if reply.author == User.current %>
+ 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
+ <% end %>
+
+
+
+ <%= reply.content.html_safe %>
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
+
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
+
diff --git a/app/views/organizations/_org_subfield_news.html.erb b/app/views/organizations/_org_subfield_news.html.erb
index edbdfa16b..3d2a316cf 100644
--- a/app/views/organizations/_org_subfield_news.html.erb
+++ b/app/views/organizations/_org_subfield_news.html.erb
@@ -1,146 +1,146 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
-
-
-
- <% if activity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% end %> TO
- <%= link_to activity.org_subfield.name.to_s+" | 帖子栏目通知", organization_path(activity.org_subfield.organization, :org_subfield_id => activity.org_subfield.id), :class => "newsBlue ml15" %>
-
-
- <%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
-
-
-
-
- 发布时间:<%= format_time(activity.created_on) %>
-
-
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
- <% if User.current.logged? %>
-
- <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
-
- <%= link_to(
- l(:button_edit),
- {:controller => 'news', :action => 'edit', :id => activity},
- :class => 'postOptionLink'
- ) if activity.author == User.current %>
-
-
- <%= delete_link(
- news_path(activity),
- :data => {:confirm => l(:text_are_you_sure)},
- :class => 'postOptionLink'
- ) if activity.author == User.current %>
-
-
- <% end %>
-
-
-
-
-
-
- <% count=activity.comments.count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#= format_date(activity.updated_on) %>
- <%if count>3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.comments.reorder("created_on desc").each do |comment| %>
-
- <% replies_all_i = replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_url_in_org(comment.author_id), :alt => "用户头像" %>
-
-
-
- <% if comment.try(:author).try(:realname) == ' ' %>
- <%= link_to comment.try(:author), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(comment.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %> TO
+ <%= link_to activity.org_subfield.name.to_s+" | 帖子栏目通知", organization_path(activity.org_subfield.organization, :org_subfield_id => activity.org_subfield.id), :class => "newsBlue ml15" %>
+
+
+ <%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
+
+
+
+
+ 发布时间:<%= format_time(activity.created_on) %>
+
+
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+ <% if User.current.logged? %>
+
+ <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
+
+ <%= link_to(
+ l(:button_edit),
+ {:controller => 'news', :action => 'edit', :id => activity},
+ :class => 'postOptionLink'
+ ) if activity.author == User.current %>
+
+
+ <%= delete_link(
+ news_path(activity),
+ :data => {:confirm => l(:text_are_you_sure)},
+ :class => 'postOptionLink'
+ ) if activity.author == User.current %>
+
+
+ <% end %>
+
+
+
+
+
+
+ <% count=activity.comments.count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#= format_date(activity.updated_on) %>
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.comments.reorder("created_on desc").each do |comment| %>
+
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_url_in_org(comment.author_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:author).try(:realname) == ' ' %>
+ <%= link_to comment.try(:author), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:author).try(:realname), user_url_in_org(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
+
diff --git a/app/views/organizations/_project_message.html.erb b/app/views/organizations/_project_message.html.erb
index 3b459f366..99a067dfb 100644
--- a/app/views/organizations/_project_message.html.erb
+++ b/app/views/organizations/_project_message.html.erb
@@ -1,136 +1,136 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
-
-
-
- <% if activity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
- <% end %>
- TO
- <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%>
-
-
-
- <% if activity.parent_id.nil? %>
- <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
- %>
- <% else %>
- <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
- %>
- <% end %>
-
-
- 发帖时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
-
-
- <% if activity.parent_id.nil? %>
- <% content = activity.content%>
- <% else %>
- <% content = activity.parent.content%>
- <% end %>
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
- <% count = 0 %>
- <% if activity.parent %>
- <% count=activity.parent.children.count%>
- <% else %>
- <% count=activity.children.count%>
- <% end %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#=format_date(activity.updated_on)%>
- <%if count>3 %>
-
- <% end %>
-
-
- <% activity= activity.parent_id.nil? ? activity : activity.parent %>
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.children.reorder("created_on desc").each do |reply| %>
-
- <% replies_all_i=replies_all_i+1 %>
-
-
- <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
-
-
-
- <% if reply.try(:author).try(:realname) == ' ' %>
- <%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(reply.created_on) %>
-
- <% if reply.author == User.current %>
- 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
- <% end %>
-
-
-
- <%= reply.content.html_safe %>
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
-
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %>
+ TO
+ <%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%>
+
+
+
+ <% if activity.parent_id.nil? %>
+ <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
+ %>
+ <% else %>
+ <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board,activity), :class=> "postGrey"
+ %>
+ <% end %>
+
+
+ 发帖时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
+
+
+ <% if activity.parent_id.nil? %>
+ <% content = activity.content%>
+ <% else %>
+ <% content = activity.parent.content%>
+ <% end %>
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+ <% count = 0 %>
+ <% if activity.parent %>
+ <% count=activity.parent.children.count%>
+ <% else %>
+ <% count=activity.children.count%>
+ <% end %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#=format_date(activity.updated_on)%>
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% activity= activity.parent_id.nil? ? activity : activity.parent %>
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.children.reorder("created_on desc").each do |reply| %>
+
+ <% replies_all_i=replies_all_i+1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(reply.author), :width => "33", :height => "33"), user_url_in_org(reply.author_id), :alt => "用户头像" %>
+
+
+
+ <% if reply.try(:author).try(:realname) == ' ' %>
+ <%= link_to reply.try(:author), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:author).try(:realname), user_url_in_org(reply.author_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(reply.created_on) %>
+
+ <% if reply.author == User.current %>
+ 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
+ <% end %>
+
+
+
+ <%= reply.content.html_safe %>
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller=>'messages',:action => 'reply', :id => activity.id, :board_id => activity.board_id, :is_board => 'true'},:method => "post", :remote => true) do |f|%>
+
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
+
diff --git a/app/views/organizations/_show_org_document.html.erb b/app/views/organizations/_show_org_document.html.erb
index 2584e4209..ed6e1e092 100644
--- a/app/views/organizations/_show_org_document.html.erb
+++ b/app/views/organizations/_show_org_document.html.erb
@@ -1,152 +1,152 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(User.find(document.creator_id)), :width => 45, :heigth => 45), user_url_in_org(document.creator_id) %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => User.find(document.creator_id)} %>
-
-
-
- <%= link_to User.find(document.creator_id), user_url_in_org(document.creator.id), :class => "newsBlue mr15" %>
- TO <%= link_to document.organization.name, organization_path(document.organization), :class => "newsBlue" %>
- |
- <%= document.org_subfield_id.nil? ? "组织文章" :"#{OrgSubfield.find(document.org_subfield_id).name}" %>
-
-
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %>
-
- 发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>
-
-
- 更新时间:<%= format_time(OrgActivity.where("org_act_type='#{document.class}' and org_act_id =#{document.id}").first.updated_at) %>
-
-
- <% unless document.content.blank? %>
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>document.id, :content=>document.content} %>
- <% end %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => document} %>
-
-
- <% if User.current.admin? || User.current.admin_of_org?(Organization.find(document.organization_id)) || User.current.id == document.creator_id %>
-
-
-
-
-
- <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => document.organization_id, :home_id => document.id, :show_homepage => 1}, :method => "put", :remote => true) do |f| %>
- 设为首页
- <% end %>
-
-
- <%= link_to "编辑文章", edit_org_document_comment_path(:id => document.id, :organization_id => document.organization_id, :flag => flag, :org_subfield_id => params[:org_subfield_id] ), :class => "postOptionLink" %>
-
-
- <%= link_to "删除文章", org_document_comment_path(:id => document.id, :organization_id => document.organization_id), :method => 'delete',
- :data => {:confirm => l(:text_are_you_sure)},
- :remote => true, :class => 'postOptionLink' %>
-
-
-
-
-
-
- <% end %>
-
-
- <% comments_for_doc = document.children.reorder("created_at desc") %>
- <% count = document.children.count() %>
-
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if document.creator_id.to_i == User.current.id.to_i %>
- 赞 <%= get_praise_num(document) > 0 ? "(#{get_praise_num(document)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>document, :user_activity_id=>document.id,:type=>"activity"}%>
- <% end %>
-
-
- <% if count > 3 %>
-
- <% end %>
-
-
-
- <% reply_id = 0 %>
- <% comments_for_doc.each do |comment| %>
- <% reply_id += 1 %>
-
- <%= link_to image_tag(url_to_avatar(User.find(comment.creator_id)), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_id) %>
-
-
- <%= link_to User.find(comment.creator_id), user_url_in_org(comment.creator_id), :class => "newsBlue mr10 f14" %>
- <%= format_activity_day(comment.created_at) %> <%= format_time(comment.created_at, false) %>
-
-
- <% unless comment.content.blank? %>
-
<%= comment.content.html_safe %>
- <% end %>
-
-
-
- <% end %>
-
-
-
-
- <%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33", :alt => "用户头像"), user_url_in_org(User.current) %>
-
-
-
- <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %>
-
-
-
-
发送
-
-
-
- <% end %>
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/views/projects/_project_news.html.erb b/app/views/projects/_project_news.html.erb
index 518ee3a2b..4ea0e9f17 100644
--- a/app/views/projects/_project_news.html.erb
+++ b/app/views/projects/_project_news.html.erb
@@ -1,123 +1,123 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
-
-
-
- <% if activity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
- <% end %> TO
- <%= link_to activity.project.name.to_s+" | 项目新闻", project_news_index_path(activity.project), :class => "newsBlue ml15" %>
-
-
- <%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
-
- <% if activity.sticky == 1%>
-
置顶
- <% end%>
-
-
- 发布时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
-
-
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
- <% count=activity.comments.count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#= format_date(activity.updated_on) %>
- <%if count>3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.comments.reorder("created_on desc").each do |comment| %>
-
- <% replies_all_i = replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
-
-
-
- <% if comment.try(:author).try(:realname) == ' ' %>
- <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(comment.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+
+
+
+ <% if activity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %> TO
+ <%= link_to activity.project.name.to_s+" | 项目新闻", project_news_index_path(activity.project), :class => "newsBlue ml15" %>
+
+
+ <%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
+
+ <% if activity.sticky == 1%>
+
置顶
+ <% end%>
+
+
+ 发布时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
+
+
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+ <% count=activity.comments.count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#= format_date(activity.updated_on) %>
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.comments.reorder("created_on desc").each do |comment| %>
+
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:author).try(:realname) == ' ' %>
+ <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb
index 51918d2d7..750a3c6ec 100644
--- a/app/views/repositories/show.html.erb
+++ b/app/views/repositories/show.html.erb
@@ -1,81 +1,81 @@
-<%= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>
-
-
<%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
-
-
- <% if @entries.nil? %>
- <%# 未提交代码提示 %>
-
- <% if @entries.nil? && authorize_for('repositories', 'browse') %>
-
- 该版本库还没有上传代码!
-
- <% end %>
- <% if @repository.type.to_s=="Repository::Gitlab" %>
- 版本库地址:<%= @repos_url %>
- <% else %>
- 版本库地址:<%= h @repository.url %>
- <% end %>
-
-
-
- <% else %>
- <%= render :partial => 'navigation' %>
-
克隆网址:
-
-
-
- <%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %>
- <% if User.current.id != @project.user_id %>
-
<%= link_to " ".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :target => "_blank", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %>
- <%= @project.forked_count.to_i %>
-
- <% end %>
-
-
- <% if @changesets && !@changesets.empty? %>
- <% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %>
- <%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
-
<%=link_to user_commit_rep(@changesets_latest_coimmit.author_email), user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %>
- 提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:
- <%= @changesets_latest_coimmit.message %>
-
- <% else %>
-
<%=@changesets_latest_coimmit.author_email %>
- 提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:
- <%= @changesets_latest_coimmit.message %>
-
- <%end%>
- <% end %>
-
- <%= @repository.branches.count %> 个分支
-
-
-
- <%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %> 提交
-
-
-
- <% end %>
-
-
-
-<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
- <%# 数据统计 %>
- <%#= render :partial => 'summary' %>
- <%# end %>
- <%= render :partial => 'dir_list' %>
-<% end %>
-<%#= render_properties(@properties) %>
-
-
-<%#= render_properties(@properties) %>
-
-
-
如何提交代码
-
-<% content_for :header_tags do %>
- <%= stylesheet_link_tag "scm" %>
-<% end %>
-
-<% html_title(l(:label_repository)) -%>
+<%= call_hook(:view_repositories_show_contextual, {:repository => @repository, :project => @project}) %>
+
+
<%= render :partial => 'breadcrumbs', :locals => {:path => @path, :kind => 'dir', :revision => @rev} %>
+
+
+ <% if @entries.nil? %>
+ <%# 未提交代码提示 %>
+
+ <% if @entries.nil? && authorize_for('repositories', 'browse') %>
+
+ 该版本库还没有上传代码!
+
+ <% end %>
+ <% if @repository.type.to_s=="Repository::Gitlab" %>
+ 版本库地址:<%= @repos_url %>
+ <% else %>
+ 版本库地址:<%= h @repository.url %>
+ <% end %>
+
+
+
+ <% else %>
+ <%= render :partial => 'navigation' %>
+
克隆网址:
+
+
+
+ <%# 针对公开项目:用户必须创建了项目,否则用户无法同步 %>
+ <% if User.current.id != @project.user_id %>
+
<%= link_to " ".html_safe+"Fork", {:controller => 'repositories', :action => 'forked'}, :class=>"vl_btn", :target => "_blank", :confirm=>"平台将为您创建一个新的同名项目和版本库,请问是否继续?" %>
+ <%= @project.forked_count.to_i %>
+
+ <% end %>
+
+
+ <% if @changesets && !@changesets.empty? %>
+ <% if !user_commit_rep(@changesets_latest_coimmit.author_email).nil? %>
+ <%= image_tag(url_to_avatar(user_commit_rep(@changesets_latest_coimmit.author_email)), :width => "25", :height => "25", :class => "fl portraitRadius mt2 ml4 mr5") %>
+
<%=link_to user_commit_rep(@changesets_latest_coimmit.author_email), user_path(user_commit_rep(@changesets_latest_coimmit.author_email)) %>
+ 提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:
+ <%= @changesets_latest_coimmit.message %>
+
+ <% else %>
+
<%=@changesets_latest_coimmit.author_email %>
+ 提交于<%= time_tag(@changesets_latest_coimmit.created_at) %>:
+ <%= @changesets_latest_coimmit.message %>
+
+ <%end%>
+ <% end %>
+
+ <%= @repository.branches.count %> 个分支
+
+
+
+ <%=link_to @changesets_all_count, {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %> 提交
+
+
+
+ <% end %>
+
+
+
+<% if !@entries.nil? && authorize_for('repositories', 'browse') %>
+ <%# 数据统计 %>
+ <%#= render :partial => 'summary' %>
+ <%# end %>
+ <%= render :partial => 'dir_list' %>
+<% end %>
+<%#= render_properties(@properties) %>
+
+
+<%#= render_properties(@properties) %>
+
+
+
如何提交代码
+
+<% content_for :header_tags do %>
+ <%= stylesheet_link_tag "scm" %>
+<% end %>
+
+<% html_title(l(:label_repository)) -%>
diff --git a/app/views/student_work/_evaluation_un_title.html.erb b/app/views/student_work/_evaluation_un_title.html.erb
index 66b96431e..aee833b70 100644
--- a/app/views/student_work/_evaluation_un_title.html.erb
+++ b/app/views/student_work/_evaluation_un_title.html.erb
@@ -2,8 +2,16 @@
作品名称
<% if @homework.homework_type != 3 %>
- 姓名
- 学号
+
+ <%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl" ,:remote => true%>
+ <% if @show_all && @order == "lastname"%>
+ <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%>
+ <% end%>
+
+ <%= link_to "学号",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml50" ,:remote => true%>
+ <% if @show_all && @order == "student_id"%>
+ <%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%>
+ <% end%>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
关联项目
<% end %>
diff --git a/app/views/student_work/_evaluation_un_work.html.erb b/app/views/student_work/_evaluation_un_work.html.erb
index 8ed5f077b..884bb8eb1 100644
--- a/app/views/student_work/_evaluation_un_work.html.erb
+++ b/app/views/student_work/_evaluation_un_work.html.erb
@@ -1,102 +1,102 @@
-
-
-
-
-
- <%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40"),user_activities_path(student_work.user)) %>
-
-
-
- <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
-
- <%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
-
-
-
- <% if @homework.homework_type != 3 %>
-
-
- <%= student_work.user.show_name%>
-
- ">
- <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
-
-
- <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
-
-
- <%= student_work.project.name %>
-
-
- <% end %>
-
-
-
-
-
- <% if student_work.created_at && @homework.end_time%>
- <%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>
- <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
- [迟交]
- <% end %>
- <% end %>
-
-
- <%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
-
-
- <%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
-
-
- <% if @homework.homework_type == 2%>
-
-
- <%= student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%>
-
- <% end%>
-
- <% if @homework.anonymous_comment == 0%>
-
- <%= student_work.student_score.nil? ? "未参与" : format("%.1f",student_work.student_score)%>
- <% unless student_work.student_score.nil?%>
-
- (<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>)
-
-
- 现共有
- <%= student_work.student_works_scores.where(:reviewer_role => 3).count%>
- 名学生进行了匿评,平均分为
- <%= format("%.1f",student_work.student_score)%> 分。
-
- <% end%>
-
- <% end %>
-
- <% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%>
-
- <%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
- <% unless score.nil?%>
-
- 作品最终评分为
- <%= student_work.final_score%> 分。
- 迟交扣分
- <%= student_work.late_penalty%> 分,
- 缺评扣分
- <%= student_work.absence_penalty%> 分,
- 最终成绩为
- <%= format("%.1f",score<0 ? 0 : score)%> 分。
-
- <% end%>
-
- 点击查看详情
-
-
-
+
+
+
+
+
+ <%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40"),user_activities_path(student_work.user)) %>
+
+
+
+ <% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
+
+ <%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
+
+
+
+ <% if @homework.homework_type != 3 %>
+
+
+ <%= student_work.user.show_name%>
+
+ ">
+ <%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
+
+
+ <% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
+
+
+ <%= student_work.project.name %>
+
+
+ <% end %>
+
+
+
+
+
+ <% if student_work.created_at && @homework.end_time%>
+ <%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>
+ <% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
+ [迟交]
+ <% end %>
+ <% end %>
+
+
+ <%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
+
+
+ <%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
+
+
+ <% if @homework.homework_type == 2%>
+
+
+ <%= student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%>
+
+ <% end%>
+
+ <% if @homework.anonymous_comment == 0%>
+
+ <%= student_work.student_score.nil? ? "未参与" : format("%.1f",student_work.student_score)%>
+ <% unless student_work.student_score.nil?%>
+
+ (<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>)
+
+
+ 现共有
+ <%= student_work.student_works_scores.where(:reviewer_role => 3).count%>
+ 名学生进行了匿评,平均分为
+ <%= format("%.1f",student_work.student_score)%> 分。
+
+ <% end%>
+
+ <% end %>
+
+ <% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%>
+
+ <%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
+ <% unless score.nil?%>
+
+ 作品最终评分为
+ <%= student_work.final_score%> 分。
+ 迟交扣分
+ <%= student_work.late_penalty%> 分,
+ 缺评扣分
+ <%= student_work.absence_penalty%> 分,
+ 最终成绩为
+ <%= format("%.1f",score<0 ? 0 : score)%> 分。
+
+ <% end%>
+
+ 点击查看详情
+
+
+
diff --git a/app/views/student_work/show.js.erb b/app/views/student_work/show.js.erb
index afa03bff8..c89180b16 100644
--- a/app/views/student_work/show.js.erb
+++ b/app/views/student_work/show.js.erb
@@ -1,36 +1,36 @@
-if($("#about_hwork_<%= @work.id%>").children().length > 0){
- $("#about_hwork_<%= @work.id%>").html("");
-}
-else{
- <% if @homework.homework_type == 2%>
- $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
-
- var program_name = "text/x-csrc";
- var language = <%= @homework.language %>;
- if (language == 1) {
- program_name = 'text/x-csrc';
- } else if(language==2){
- program_name = 'text/x-c++src';
- }else if(language==3){
- program_name = 'text/x-cython';
- } else if(language==4){
- program_name = 'text/x-java';
- }
-
- var editor = CodeMirror(document.getElementById("work-code_<%= @work.id%>"), {
- mode: {name: program_name,
- version: 2,
- singleLineStringErrors: false},
- lineNumbers: true,
- indentUnit: 2,
- matchBrackets: true,
- readOnly: true,
- value: $("#work-src").text()
- }
- );
-
- <% else%>
- $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
- <% end%>
- $('#score_<%= @work.id%>').peSlider({range: 'min'});
+if($("#about_hwork_<%= @work.id%>").children().length > 0){
+ $("#about_hwork_<%= @work.id%>").html("");
+}
+else{
+ <% if @homework.homework_type == 2%>
+ $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'programing_work_show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
+
+ var program_name = "text/x-csrc";
+ var language = <%= @homework.language %>;
+ if (language == 1) {
+ program_name = 'text/x-csrc';
+ } else if(language==2){
+ program_name = 'text/x-c++src';
+ }else if(language==3){
+ program_name = 'text/x-cython';
+ } else if(language==4){
+ program_name = 'text/x-java';
+ }
+
+ var editor = CodeMirror(document.getElementById("work-code_<%= @work.id%>"), {
+ mode: {name: program_name,
+ version: 2,
+ singleLineStringErrors: false},
+ lineNumbers: true,
+ indentUnit: 2,
+ matchBrackets: true,
+ readOnly: true,
+ value: $("#work-src").text()
+ }
+ );
+
+ <% else%>
+ $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
+ <% end%>
+ $('#score_<%= @work.id%>').peSlider({range: 'min'});
}
\ No newline at end of file
diff --git a/app/views/users/_course_homework.html.erb b/app/views/users/_course_homework.html.erb
index 9dd5eaa7a..ee49e3cfc 100644
--- a/app/views/users/_course_homework.html.erb
+++ b/app/views/users/_course_homework.html.erb
@@ -47,7 +47,7 @@
<% end%>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1%>
- 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
+ 系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
<% elsif activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 0%>
系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!
<% end %>
@@ -356,7 +356,7 @@
<%= hidden_field_tag 'course_activity',params[:course_activity],:value =>course_activity %>
- 发送
+ 发送
<% end%>
diff --git a/app/views/users/_course_journalsformessage.html.erb b/app/views/users/_course_journalsformessage.html.erb
index 6b28fb568..f9a59f024 100644
--- a/app/views/users/_course_journalsformessage.html.erb
+++ b/app/views/users/_course_journalsformessage.html.erb
@@ -1,110 +1,110 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
-
-
-
- <% if activity.try(:user).try(:realname) == ' ' %>
- <%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %>
- <% end %> TO
- <% course=Course.find(activity.jour_id) %>
- <%= link_to course.name.to_s+" | 课程留言", course_feedback_path(course), :class => "newsBlue ml15" %>
-
-
- <% if activity.parent %>
- <%= link_to activity.parent.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
- <% else %>
- <%= link_to activity.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
- <% end %>
-
-
- 留言时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
-
-
-
-
-
- <% count = fetch_user_leaveWord_reply(activity).count %>
-
-
-
-
- 回复(<%= count %>)
-
-
- <%if count>3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% fetch_user_leaveWord_reply(activity).each do |comment| unless fetch_user_leaveWord_reply(activity).nil? %>
-
- <% replies_all_i = replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
-
-
-
- <% if comment.try(:user).try(:realname) == ' ' %>
- <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(comment.created_on) %>
-
-
-
-
-
- <% end %>
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id}, :method => "post", :remote => true) do |f|%>
- <%= hidden_field_tag 'reference_id', params[:reference_id], :value => activity.id %>
- <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => activity.user.id %>
- <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %>
- <%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
- <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
+
+
+
+ <% if activity.try(:user).try(:realname) == ' ' %>
+ <%= link_to activity.try(:user), user_path(activity.user_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:user).try(:realname), user_path(activity.user_id), :class => "newsBlue mr15" %>
+ <% end %> TO
+ <% course=Course.find(activity.jour_id) %>
+ <%= link_to course.name.to_s+" | 课程留言", course_feedback_path(course), :class => "newsBlue ml15" %>
+
+
+ <% if activity.parent %>
+ <%= link_to activity.parent.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
+ <% else %>
+ <%= link_to activity.notes.html_safe, course_feedback_path(course), :class => "postGrey" %>
+ <% end %>
+
+
+ 留言时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
+
+
+
+
+
+ <% count = fetch_user_leaveWord_reply(activity).count %>
+
+
+
+
+ 回复(<%= count %>)
+
+
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% fetch_user_leaveWord_reply(activity).each do |comment| unless fetch_user_leaveWord_reply(activity).nil? %>
+
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:user).try(:realname) == ' ' %>
+ <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+
+ <% end %>
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id}, :method => "post", :remote => true) do |f|%>
+ <%= hidden_field_tag 'reference_id', params[:reference_id], :value => activity.id %>
+ <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => activity.user.id %>
+ <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %>
+ <%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
+ <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
+
diff --git a/app/views/users/_course_message.html.erb b/app/views/users/_course_message.html.erb
index bb2a31dcc..df084357a 100644
--- a/app/views/users/_course_message.html.erb
+++ b/app/views/users/_course_message.html.erb
@@ -178,7 +178,7 @@
- 发送
+ 发送
<% end%>
diff --git a/app/views/users/_course_news.html.erb b/app/views/users/_course_news.html.erb
index 15dd486ec..efaa72beb 100644
--- a/app/views/users/_course_news.html.erb
+++ b/app/views/users/_course_news.html.erb
@@ -1,148 +1,148 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
-
-
-
- <% if @ctivity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
- <% end %> TO
- <%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_path(activity.course), :class => "newsBlue ml15" %>
-
-
- <%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
-
- <% if activity.sticky == 1%>
-
置顶
- <% end%>
-
-
- 发布时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
-
-
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
- <% if User.current.logged? %>
-
- <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
-
- <%= link_to(
- l(:button_edit),
- {controller:'news', :action => 'edit', :id => activity.id},
- :class => 'postOptionLink'
- ) if User.current.allowed_to?(:manage_news, activity.course) %>
-
-
- <%= delete_link(
- news_path(activity),
- :data => {:confirm => l(:text_are_you_sure)},
- :class => 'postOptionLink'
- ) if User.current.allowed_to?(:manage_news, activity.course) %>
-
-
- <% end %>
-
-
-
-
-
-
- <% count=activity.comments.count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#= format_date(activity.updated_on) %>
- <%if count>3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.comments.reorder("created_on desc").each do |comment| %>
-
- <% replies_all_i = replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
-
-
-
- <% if comment.try(:author).try(:realname) == ' ' %>
- <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(comment.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+
+
+
+ <% if @ctivity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %> TO
+ <%= link_to activity.course.name.to_s+" | 课程通知", course_news_index_path(activity.course), :class => "newsBlue ml15" %>
+
+
+ <%= link_to activity.title.to_s, news_path(activity), :class => "postGrey" %>
+
+ <% if activity.sticky == 1%>
+
置顶
+ <% end%>
+
+
+ 发布时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %>
+
+
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.description} %>
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+ <% if User.current.logged? %>
+
+ <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
+
+ <%= link_to(
+ l(:button_edit),
+ {controller:'news', :action => 'edit', :id => activity.id},
+ :class => 'postOptionLink'
+ ) if User.current.allowed_to?(:manage_news, activity.course) %>
+
+
+ <%= delete_link(
+ news_path(activity),
+ :data => {:confirm => l(:text_are_you_sure)},
+ :class => 'postOptionLink'
+ ) if User.current.allowed_to?(:manage_news, activity.course) %>
+
+
+ <% end %>
+
+
+
+
+
+
+ <% count=activity.comments.count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#= format_date(activity.updated_on) %>
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.comments.reorder("created_on desc").each do |comment| %>
+
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:author).try(:realname) == ' ' %>
+ <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'comments', :action => 'create', :id => activity},:method => "post", :remote => true) do |f|%>
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
+
diff --git a/app/views/users/_homework_repository_list.html.erb b/app/views/users/_homework_repository_list.html.erb
new file mode 100644
index 000000000..67a8f47b4
--- /dev/null
+++ b/app/views/users/_homework_repository_list.html.erb
@@ -0,0 +1,21 @@
+
+ 作业名称
+ 来源
+ 类别
+ 贡献者
+
+ <%= link_to "引用数",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort),:class => "fl",:remote => true%>
+ <% if @order == "quotes"%>
+ <%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "quotes", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12" ,:remote => true%>
+ <% end%>
+
+
+ <%= link_to "发布时间",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "fl",:remote => true%>
+ <% if @order == "created_at"%>
+ <%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12" ,:remote => true%>
+ <% end%>
+
+
+
+ <%=render :partial => 'homework_repository', :locals => {:homeworks => homeworks} %>
+
\ No newline at end of file
diff --git a/app/views/users/_project_issue_reply.html.erb b/app/views/users/_project_issue_reply.html.erb
index adebd74ad..16d681dc9 100644
--- a/app/views/users/_project_issue_reply.html.erb
+++ b/app/views/users/_project_issue_reply.html.erb
@@ -1,89 +1,89 @@
-<% count = activity.journals.count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#= format_date(activity.updated_on) %>
- <% if count > 3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.journals.reorder("created_on desc").each do |reply| %>
-
- <% replies_all_i=replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
-
-
-
- <% if reply.try(:user).try(:realname) == ' ' %>
- <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(reply.created_on) %>
-
- <% if reply.user == User.current %>
- 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
- <% end %>
-
-
-
- <% if reply.details.any? %>
- <% details_to_strings(reply.details).each do |string| %>
-
<%= string %>
- <% end %>
- <% end %>
-
<%= reply.notes.html_safe %>
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => add_journal_issue_path(activity.id, :user_activity_id => user_activity_id),:method => "post", :remote => true) do |f| %>
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
+<% count = activity.journals.count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#= format_date(activity.updated_on) %>
+ <% if count > 3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.journals.reorder("created_on desc").each do |reply| %>
+
+ <% replies_all_i=replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33"), user_path(reply.user_id), :alt => "用户头像" %>
+
+
+
+ <% if reply.try(:user).try(:realname) == ' ' %>
+ <%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(reply.created_on) %>
+
+ <% if reply.user == User.current %>
+ 赞 <%= get_praise_num(reply) > 0 ? "(#{get_praise_num(reply)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
+ <% end %>
+
+
+
+ <% if reply.details.any? %>
+ <% details_to_strings(reply.details).each do |string| %>
+
<%= string %>
+ <% end %>
+ <% end %>
+
<%= reply.notes.html_safe %>
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => add_journal_issue_path(activity.id, :user_activity_id => user_activity_id),:method => "post", :remote => true) do |f| %>
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb
index 30183c4d1..dd2c832cf 100644
--- a/app/views/users/_project_message.html.erb
+++ b/app/views/users/_project_message.html.erb
@@ -154,7 +154,7 @@
-
发送
+
发送
<% end%>
diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb
index 9e02c4cf4..7f5d185e5 100644
--- a/app/views/users/_project_news.html.erb
+++ b/app/views/users/_project_news.html.erb
@@ -132,7 +132,7 @@
-
发送
+
发送
<% end%>
diff --git a/app/views/users/_user_at_message.html.erb b/app/views/users/_user_at_message.html.erb
index 343741cd4..d8649cabe 100644
--- a/app/views/users/_user_at_message.html.erb
+++ b/app/views/users/_user_at_message.html.erb
@@ -1,33 +1,33 @@
-<% if AtMessage === ma && ma.at_valid? %>
-
- <%=link_to image_tag(url_to_avatar(ma.author), :width => "30", :height => "30"),user_path(ma.author) %>
-
- <%= ma.author.login %> 提到了你:
-
-
- <% 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"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :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 %>
-
-
-
标题: <%= ma.subject %>
- <% unless ma.description.nil? %>
-
内容:
-
<%= ma.description.html_safe %>
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
+<% if AtMessage === ma && ma.at_valid? %>
+
+ <%=link_to image_tag(url_to_avatar(ma.author), :width => "30", :height => "30"),user_path(ma.author) %>
+
+ <%= ma.author.login %> 提到了你:
+
+
+ <% 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"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :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 %>
+
+
+
标题: <%= ma.subject %>
+ <% unless ma.description.nil? %>
+
内容:
+
<%= ma.description.html_safe %>
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_blog.html.erb b/app/views/users/_user_blog.html.erb
index 244951dfa..841fd9377 100644
--- a/app/views/users/_user_blog.html.erb
+++ b/app/views/users/_user_blog.html.erb
@@ -1,147 +1,147 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
-
-
-
- <% if @ctivity.try(:author).try(:realname) == ' ' %>
- <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
- <% else %>
- <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
- <% end %> TO
- <%= link_to activity.author.name.to_s+" | 博客", user_blogs_path(:user_id=>activity.author_id), :class => "newsBlue ml15" %>
-
-
-
- <%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id,:in_act => true), :class => "postGrey" %>
-
- <% if activity.sticky == 1%>
-
置顶
- <% end%>
- <% if activity.locked%>
-
- <% end%>
-
-
-
-
- 发布时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %>
-
-
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.content} %>
-
-
-
-
-
- <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
-
-
-
-
- <% count=activity.children.count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.author == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
<%#= format_date(activity.updated_on) %>
- <%if count>3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% activity.children.reorder("created_on desc").each do |comment| %>
-
- <% replies_all_i = replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
-
-
-
- <% if comment.try(:author).try(:realname) == ' ' %>
- <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(comment.created_on) %>
-
-
-
-
-
-
- <% end %>
-
-
- <% end %>
-
- <% if activity.locked == false && User.current.logged?%>
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller => 'blog_comments', :action => 'reply', :user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id},:method => "post", :remote => true) do |f|%>
-
-
-
-
-
-
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
- <% end %>
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_path(activity.author_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
+
+
+
+ <% if @ctivity.try(:author).try(:realname) == ' ' %>
+ <%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
+ <% else %>
+ <%= link_to activity.try(:author).try(:realname), user_path(activity.author_id), :class => "newsBlue mr15" %>
+ <% end %> TO
+ <%= link_to activity.author.name.to_s+" | 博客", user_blogs_path(:user_id=>activity.author_id), :class => "newsBlue ml15" %>
+
+
+
+ <%= link_to activity.title.to_s, user_blog_blog_comment_path(:user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id,:in_act => true), :class => "postGrey" %>
+
+ <% if activity.sticky == 1%>
+
置顶
+ <% end%>
+ <% if activity.locked%>
+
+ <% end%>
+
+
+
+
+ 发布时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(UserActivity.where("act_type='#{activity.class}' and act_id =#{activity.id}").first.updated_at) %>
+
+
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>activity.content} %>
+
+
+
+
+
+ <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => activity} %>
+
+
+
+
+ <% count=activity.children.count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.author == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
<%#= format_date(activity.updated_on) %>
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% activity.children.reorder("created_on desc").each do |comment| %>
+
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.author), :width => "33", :height => "33"), user_path(comment.author_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:author).try(:realname) == ' ' %>
+ <%= link_to comment.try(:author), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:author).try(:realname), user_path(comment.author_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+ <% if activity.locked == false && User.current.logged?%>
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(activity.author_id), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'blog_comments', :action => 'reply', :user_id=>activity.author_id,:blog_id=>activity.blog_id,:id=>activity.id},:method => "post", :remote => true) do |f|%>
+
+
+
+
+
+
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+ <% end %>
+
+
+
diff --git a/app/views/users/_user_homework_detail.html.erb b/app/views/users/_user_homework_detail.html.erb
index 9f3847735..a196ee6c0 100644
--- a/app/views/users/_user_homework_detail.html.erb
+++ b/app/views/users/_user_homework_detail.html.erb
@@ -48,7 +48,7 @@
<% end%>
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1%>
-
系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
+
系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"linkBlue",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!
<% elsif homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 0%>
系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!
<% end %>
@@ -360,7 +360,7 @@
<%= hidden_field_tag 'is_in_course',params[:is_in_course],:value =>is_in_course %>
-
发送
+
发送
<% end%>
diff --git a/app/views/users/_user_journalsformessage.html.erb b/app/views/users/_user_journalsformessage.html.erb
index f49a65262..dde4f34ce 100644
--- a/app/views/users/_user_journalsformessage.html.erb
+++ b/app/views/users/_user_journalsformessage.html.erb
@@ -1,152 +1,152 @@
-
-
-
- <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
- <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
-
-
-
- <%= link_to activity.user.show_name, user_path(activity.user_id), :class => "newsBlue mr15" %>
- TO
- <% if activity.jour %>
- <%= link_to activity.jour.show_name+"("+(activity.jour.login ? activity.jour.login : activity.jour.show_name ).to_s+")的"+ (activity.private == 1? "私信":"留言"),
- feedback_path(activity.jour, :host=> Setting.host_user), :class => "newsBlue ml15" %>
- <% if activity.private == 1 %>
- 私信
- <% end %>
- <% end %>
-
- <% if is_activity.to_i == 1 %>
-
- <% if activity.parent %>
- <%= link_to activity.parent.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
- <% else %>
- <%= link_to activity.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
- <% end %>
-
- <% else %>
- <% if activity.parent %>
- <% content = activity.parent.notes %>
- <% else %>
- <% content = activity.notes %>
- <% end %>
- <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
- <% end %>
-
- 留言时间:<%= format_time(activity.created_on) %>
-
-
- 更新时间:<%= format_time(PrincipalActivity.where("principal_act_type='#{activity.class}' and principal_act_id =#{activity.id}").first.updated_at) %>
-
-
- <% if activity.user == User.current || User.current.admin?%>
-
-
-
-
-
- <%= link_to(l(:label_bid_respond_delete),
- {:controller => 'words', :action => 'destroy', :object_id => activity, :user_id => activity.user,:user_activity_id => user_activity_id,:is_activity=>is_activity},
- :confirm => l(:text_are_you_sure), :method => 'delete',
- :class => "postOptionLink", :title => l(:button_delete)) %>
-
-
-
-
-
- <% end%>
-
-
-
- <% count=fetch_user_leaveWord_reply(activity).count %>
-
-
-
回复
- <%= count>0 ? "(#{count})" : "" %> ▪
-
- <% if activity.user == User.current %>
- 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
- <% else %>
- <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
- <% end %>
-
-
-
- <%if count>3 %>
-
- <% end %>
-
-
- <% replies_all_i = 0 %>
- <% if count > 0 %>
-
-
- <% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %>
- <% replies_all_i = replies_all_i + 1 %>
-
-
- <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
-
-
-
- <% if comment.try(:user).try(:realname) == ' ' %>
- <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% else %>
- <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
- <% end %>
- <%= format_time(comment.created_on) %>
-
-
-
-
- <%= comment.notes.html_safe %>
-
-
-
-
- <% end %>
-
-
- <% end %>
-
-
-
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
-
-
- <%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id},:method => "post", :remote => true) do |f|%>
- <%= hidden_field_tag 'reference_id', params[:reference_id], :value => activity.id %>
- <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => activity.user.id %>
- <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %>
- <%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
- <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
- <%= hidden_field_tag 'is_activity',params[:is_activity],:value =>is_activity %>
-
-
-
发送
-
-
- <% end%>
-
-
-
-
-
-
+
+
+
+ <%= link_to image_tag(url_to_avatar(activity.user), :width => "50", :height => "50"), user_path(activity.user_id), :alt => "用户头像" %>
+ <%= render :partial => 'users/show_detail_info', :locals => {:user => activity.user} %>
+
+
+
+ <%= link_to activity.user.show_name, user_path(activity.user_id), :class => "newsBlue mr15" %>
+ TO
+ <% if activity.jour %>
+ <%= link_to activity.jour.show_name+"("+(activity.jour.login ? activity.jour.login : activity.jour.show_name ).to_s+")的"+ (activity.private == 1? "私信":"留言"),
+ feedback_path(activity.jour, :host=> Setting.host_user), :class => "newsBlue ml15" %>
+ <% if activity.private == 1 %>
+ 私信
+ <% end %>
+ <% end %>
+
+ <% if is_activity.to_i == 1 %>
+
+ <% if activity.parent %>
+ <%= link_to activity.parent.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
+ <% else %>
+ <%= link_to activity.notes.html_safe, feedback_path(activity.jour, :host=> Setting.host_user), :class => "postGrey" %>
+ <% end %>
+
+ <% else %>
+ <% if activity.parent %>
+ <% content = activity.parent.notes %>
+ <% else %>
+ <% content = activity.notes %>
+ <% end %>
+ <%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>user_activity_id, :content=>content} %>
+ <% end %>
+
+ 留言时间:<%= format_time(activity.created_on) %>
+
+
+ 更新时间:<%= format_time(PrincipalActivity.where("principal_act_type='#{activity.class}' and principal_act_id =#{activity.id}").first.updated_at) %>
+
+
+ <% if activity.user == User.current || User.current.admin?%>
+
+
+
+
+
+ <%= link_to(l(:label_bid_respond_delete),
+ {:controller => 'words', :action => 'destroy', :object_id => activity, :user_id => activity.user,:user_activity_id => user_activity_id,:is_activity=>is_activity},
+ :confirm => l(:text_are_you_sure), :method => 'delete',
+ :class => "postOptionLink", :title => l(:button_delete)) %>
+
+
+
+
+
+ <% end%>
+
+
+
+ <% count=fetch_user_leaveWord_reply(activity).count %>
+
+
+
回复
+ <%= count>0 ? "(#{count})" : "" %> ▪
+
+ <% if activity.user == User.current %>
+ 赞 <%= get_praise_num(activity) > 0 ? "(#{get_praise_num(activity)})" : "" %>
+ <% else %>
+ <%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
+ <% end %>
+
+
+
+ <%if count>3 %>
+
+ <% end %>
+
+
+ <% replies_all_i = 0 %>
+ <% if count > 0 %>
+
+
+ <% fetch_user_leaveWord_reply(activity).reorder("created_on desc").each do |comment| %>
+ <% replies_all_i = replies_all_i + 1 %>
+
+
+ <%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33", :class =>"mt8"), user_path(comment.user_id), :alt => "用户头像" %>
+
+
+
+ <% if comment.try(:user).try(:realname) == ' ' %>
+ <%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% else %>
+ <%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14" %>
+ <% end %>
+ <%= format_time(comment.created_on) %>
+
+
+
+
+ <%= comment.notes.html_safe %>
+
+
+
+
+ <% end %>
+
+
+ <% end %>
+
+
+
<%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), :alt => "用户头像" %>
+
+
+ <%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => activity.id},:method => "post", :remote => true) do |f|%>
+ <%= hidden_field_tag 'reference_id', params[:reference_id], :value => activity.id %>
+ <%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => activity.user.id %>
+ <%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => activity.id %>
+ <%= hidden_field_tag 'show_name',params[:show_name],:value =>true %>
+ <%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>user_activity_id %>
+ <%= hidden_field_tag 'is_activity',params[:is_activity],:value =>is_activity %>
+
+
+
发送
+
+
+ <% end%>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb
index bb9fc1174..62568d505 100644
--- a/app/views/users/_user_message_course.html.erb
+++ b/app/views/users/_user_message_course.html.erb
@@ -1,692 +1,692 @@
-<% if ma.class == CourseMessage %>
- <% if ma.course_message_type == "News" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author) %>
- <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">发布了通知:
-
- <%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id },
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
标题: <%= ma.course_message.title %>
- <% unless ma.course_message.description.nil? %>
-
内容:
-
<%= ma.course_message.description.html_safe %>
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "Comment" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
- <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">评论了通知:
-
- <%= link_to ma.course_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
评论对象: <%= ma.course_message.commented.title %>
- <% unless ma.course_message.comments.nil? %>
-
评论内容:
-
<%= ma.course_message.comments.html_safe %>
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil?%>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">发布了课程作业:
-
-
- <% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %>
- <%= link_to "作业标题:" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id),
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
- <% else %>
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
- :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
- <% end %>
-
-
- <% if User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
-
- <%= User.current.lastname + User.current.firstname %>老师您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.show_name + "老师")%>刚刚发布了一个作业:
-
-
- 课程名称:<%= ma.course_message.course.name %>
- (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 发布时间:<%= DateTime.parse(ma.course_message.created_at.to_s).strftime('%Y-%m-%d %H:%M').to_s %>
- 提交截止:<%= ma.course_message.end_time %> 23:59
- 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
- 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
- 迟交扣分:<%= ma.course_message.late_penalty %>分
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
-
-
- 您可以修改作业内容、评分规则、匿评过程等,谢谢!
-
- <% else %>
-
<%= User.current.lastname + User.current.firstname %>同学您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业:
-
- 课程名称:<%= ma.course_message.course.name %>
- (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 提交截止:<%= ma.course_message.end_time %> 23:59
- 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
- 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
- 迟交扣分:<%= ma.course_message.late_penalty %>分
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
-
-
- 请抓紧时间提交您的作品,谢谢!
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + '老师',
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :title => "#{ma.course_message.user.lastname + ma.course_message.user.firstname}老师" %>
- ">发布的作业:
-
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
- :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
-
- <%= User.current.lastname + User.current.firstname %>同学您好!
- <%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 提交截止:<%= ma.course_message.end_time %> 23:59
- 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
- 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
- 迟交扣分:<%= ma.course_message.late_penalty %>分
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
- 请抓紧时间提交您的作品,谢谢!
-
- <% end %>
-
- 截止时间快到啦
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
-
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
-
- <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">启动了作业匿评:
-
-
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师' : '同学' %>您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>开启了匿评,作业详情如下:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
- 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
-
- <% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
-
请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。
-
例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分
- <% end%>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">关闭了作业匿评:
-
- <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))"%>
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
- 该作业已经关闭了匿评。作业信息如下:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
-
-
-
注:缺省情况下,系统将在作业提交截止日期后14天自动关闭匿评。
-
- <% if User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
-
祝您的教学活动高效、顺利、愉快!
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 %>
-
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
-
- <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">启动作业匿评失败
-
-
- <%= link_to truncate(ma.course_message.name,:length=>25)+'(失败原因:提交作品的人数低于2人)', student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "c_red" : "newsGrey "}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
- <%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败啦
-
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年' + ma.course_message.course.term %>)
- 作业标题:<%= ma.course_message.name %>
- 提交截止:<%= ma.course_message.end_time%> 23:59
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "Poll" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
- <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">发布了问卷:
-
- <%= link_to format_activity_title(" #{ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name}"), poll_path(ma.course_message.id),
- :class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
- <%= ma.course_message.polls_name %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "Message" %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
-
- <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">
- <%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %>
- <% if ma.course_message.parent_id.nil? %>
-
- <%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
主题: <%= ma.course_message.subject %>
- <% unless ma.course_message.content.nil? %>
-
内容:
-
<%= ma.course_message.content.html_safe %>
- <% end %>
-
- <% else %>
-
- <%= link_to ma.course_message.content.html_safe, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
主题: <%= ma.course_message.subject %>
- <% unless ma.course_message.content.nil? %>
-
内容:
-
<%= ma.course_message.content.html_safe %>
- <% end %>
-
- <% end %>
- <%= time_tag(ma.created_at).html_safe %>
-
-
- <% end %>
- <% if ma.course_message_type == "StudentWorksScore" %>
-
-
- <% if ma.course_message.reviewer_role == 3 %>
- <%=link_to image_tag(url_to_avatar(""), :width => "30", :height => "30") %>
- <% else %>
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
- <% end %>
-
-
- <% if ma.course_message.reviewer_role == 3 %>
- 匿名用户
- <% else %>
- <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- <% end %>
- ">
- <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %>
-
-
-
- <% unless ma.content.nil? %>
- <%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id),
- :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <%= User.current.show_name %>同学您好!
- <%= ma.course_message.reviewer_role == 3? "匿名用户" : (ma.course_message.user.show_name + "老师")%><%= ma.status == 0? "评阅了您的作品":"重新评阅了您的作品"%>。详情如下:
-
-
- 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
- 作业标题:<%=ma.course_message.student_work.homework_common.name %>
- <% content = ma.content.gsub("作业评分:","").split(" 评语:")%>
- 作品评分:<%= content[0] %>分
- <% if content.size > 1 %>
-
作品评语:
- <%= content[1] %>
- <% end %>
-
-
- 本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %> 23:59结束匿评,到时您将可以看到所有其他同学的作品啦!大家可以进一步互相学习。 期待您取得更大的进步!
-
-
- <% end %>
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "JournalsForMessage" %>
- <% if ma.course_message.jour_type == 'Course' %>
- <% if params[:type] != 'homework' %>
-
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
- <%= link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">在课程中留言了:
-
-
- <%= link_to ma.course_message.notes.html_safe, course_feedback_path(:id => ma.course_id),
- :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <%= ma.course_message.notes.html_safe %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% else %>
-
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
-
- <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname +
- "#{ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"}",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
- ">回复了作品评论:
-
-
- <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.show_name %>老师您好!
- <%= ma.course_message.user.show_name%><%= ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"%>回复了您的作品评论。详情如下:
-
-
- 回复内容:<%= ma.course_message.notes %>
- 您的评论:<%= ma.course_message.jour.comment %>
- 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
- 作业标题:<%=ma.course_message.jour.student_work.homework_common.name %>
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% end %>
-
- <% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? %>
-
- <%= link_to image_tag(url_to_avatar(ma.course_message.homework_common.user), :width => "30", :height => "30"), user_path(ma.course_message.homework_common.user) %>
-
- <%=link_to ma.course_message.homework_common.user.show_name+"老师", user_path(ma.course_message.homework_common.user), :class => "newsBlue homepageNewsPublisher" %>
- ">发布的作业:
-
-
- <%= link_to "作业标题:" + ma.course_message.homework_common.name, student_work_index_path(:homework => ma.course_message.homework_common_id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.lastname + User.current.firstname %>
- <%= User.current.allowed_to?(:as_teacher,ma.course_message.homework_common.course) ? '老师':'同学'%>您好!由于迟交作业,您及您的作品都不能参与以下作业的匿评。作业详情如下:
-
-
- 课程名称:<%= ma.course_message.homework_common.course.name %>(<%= ma.course_message.homework_common.course.time.to_s + '年' + ma.course_message.homework_common.course.term %>)
- 作业标题:<%= ma.course_message.homework_common.name %>
- 提交截止:<%= ma.course_message.homework_common.end_time %> 23:59
- 提交时间:<%= format_time(ma.course_message.created_at) %>
- 迟交扣分:<%= ma.course_message.homework_common.late_penalty %>分
-
-
如需获得最终成绩,请您联系主讲老师对您的作品进行单独评分!
-
- 您成功提交了作品(但被标记为迟交啦)
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
- <% if ma.course_message_type == "Course" %>
-
-
- <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
-
-
- 系统提示
- ">您成功创建了课程:
-
-
- <%= link_to "课程名称:" + ma.course_message.name, course_path(ma.course_message),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <%= User.current.lastname + User.current.firstname %>老师您好!您成功创建了一个课程,详情如下:
-
-
课程名称:<%= ma.course_message.name %>
-
开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %>
-
课程ID:<%= ma.course_message.id %>
-
课程密码:<%= ma.course_message.password %>
-
学时总数:<%= ma.course_message.class_period %>
-
创建时间:<%= format_time(ma.course_message.created_at) %>
-
您可以点击左上角的“配置”按钮,修改课程基本信息,添加及删除课程成员。您也可以把课程ID及密码告诉学生和其他成员,让他们输入ID及密码加入课程。
- <% if ma.course_message.is_public %>
-
您的课程是公开的,所有人都能访问您的课程。若不想设置为公开,您可以在配置中设置。
- <% else %>
-
您的课程是私有的,非课程成员不能访问您的课程。如果想设置为公开,您可以在配置中设置。
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "JoinCourseRequest" %>
-
- <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
-
- 系统提示
- ">您有了新的课程成员申请:
-
-
- <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
- :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
-
- <%= User.current.lastname + User.current.firstname %>老师您好!您有了新的课程成员申请,信息如下:
-
-
真实姓名:<%= User.find(ma.course_message_id).realname %>
-
申请课程:<%= Course.find(ma.course_id).name%>
-
课程描述:
-
<%= Course.find(ma.course_id).description.html_safe %>
-
申请职位:<%= ma.content == '9' ? "教师" : "教辅"%>
-
-
-
- <% if ma.status == 0 || ma.status.nil?%>
- <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%>
- |
- <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%>
- <% elsif ma.status == 1%>
- 您已经同意了该申请
- <% elsif ma.status == 2%>
- 您已经拒绝了该申请
- <%end %>
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
- <% if ma.course_message_type == "CourseRequestDealResult" %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "JoinCourse" and ma.status == 0 %>
-
-
- <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
-
-
- <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
- ">将您加入了课程:
-
-
- <%= link_to ma.course.name, course_member_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
- <% teacher = User.find(ma.course_message_id) %>
-
<%= teacher.show_name %>(<%= teacher %>)老师把您加入了课程,详情如下:
-
课程名称:<%= ma.course.name %>
-
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
-
课程ID:<%= ma.course.id %>
-
课时总数:<%= ma.course.class_period %>
- <% else %>
-
- 您已经被移出该私有课程,非课程成员没有权限访问私有课程
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
-
-
- <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
-
-
- 系统提示
- ">您增加了新的课程成员:
-
-
- <%= link_to User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")", user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
-
您增加了新的课程成员,详情如下:
-
成员:<%= User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")" %>
-
课程名称:<%= ma.course.name %>
-
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
-
课程ID:<%= ma.course.id %>
-
课时总数:<%= ma.course.class_period %>
- <% else %>
-
- 您已经被移出该私有课程,非课程成员没有权限访问私有课程
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "RemoveFromCourse" %>
-
-
- <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
-
-
- <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
- ">将您移出了课程:
-
-
- <%= link_to ma.course.name, member_course_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover => "message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %>
-
您已被<%= User.find(ma.course_message_id).show_name %>老师移出了课程,详情如下:
-
课程名称:<%= ma.course.name %>
-
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
- <% if !ma.content.nil? %>
-
担任角色:<%= ma.content %>
- <% end %>
-
学时总数:<%= ma.course.class_period %>
- <% else %>
-
- 您已经被移出该私有课程,非课程成员没有权限访问私有课程
-
- <% end %>
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "Exercise" && ma.status == 2 %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布了课程测验 :
-
- <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))"%>
-
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布了课程测验 ,测验详情如下:
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 测验标题:<%= ma.course_message.exercise_name %>
-
-
-
-
-
- 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
- 答题时长:<%= ma.course_message.time == -1 ? '不限时' : ma.course_message.time.to_s + '分钟' %>
- <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
- 请记得在截止时间前完成测验噢,辛苦啦!
- <% end %>
-
-
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
-
-
- <% if ma.course_message_type == "Exercise" && ma.status == 3 %>
-
- <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
-
- <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
- user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布的测验:
-
- <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))"%>
-
-
-
-
-
- <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
- <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布的课程测验截止时间快到了,测验详情如下:
-
-
-
- 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
- 测验标题:<%= ma.course_message.exercise_name %>
- 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
- 答题时长:<%= ma.course_message.time == -1 ? '无限制' : ma.course_message.time.to_s + '分钟' %>
- 请及时完成课程测验,辛苦啦!
-
-
- 截止时间快到啦
- <%= time_tag(ma.created_at).html_safe %>
-
- <% end %>
+<% if ma.class == CourseMessage %>
+ <% if ma.course_message_type == "News" %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author) %>
+ <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">发布了通知:
+
+ <%= link_to ma.course_message.title, {:controller => 'news', :action => 'show', :id => ma.course_message.id },
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
标题: <%= ma.course_message.title %>
+ <% unless ma.course_message.description.nil? %>
+
内容:
+
<%= ma.course_message.description.html_safe %>
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "Comment" %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
+ <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">评论了通知:
+
+ <%= link_to ma.course_message.commented.title, {:controller => 'news', :action => 'show', :id => ma.course_message.commented.id },
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
评论对象: <%= ma.course_message.commented.title %>
+ <% unless ma.course_message.comments.nil? %>
+
评论内容:
+
<%= ma.course_message.comments.html_safe %>
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status.nil?%>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">发布了课程作业:
+
+
+ <% if !User.current.allowed_to?(:as_teacher, ma.course_message.course) && cur_user_works_for_homework(ma.course_message).nil? %>
+ <%= link_to "作业标题:" + ma.course_message.name, new_student_work_path(:homework => ma.course_message.id),
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+ <% else %>
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
+ :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+ <% end %>
+
+
+ <% if User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
+
+ <%= User.current.lastname + User.current.firstname %>老师您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.show_name + "老师")%>刚刚发布了一个作业:
+
+
+ 课程名称:<%= ma.course_message.course.name %>
+ (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 发布时间:<%= DateTime.parse(ma.course_message.created_at.to_s).strftime('%Y-%m-%d %H:%M').to_s %>
+ 提交截止:<%= ma.course_message.end_time %> 23:59
+ 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+ 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+ 迟交扣分:<%= ma.course_message.late_penalty %>分
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+
+
+ 您可以修改作业内容、评分规则、匿评过程等,谢谢!
+
+ <% else %>
+
<%= User.current.lastname + User.current.firstname %>同学您好!<%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师刚刚发布了一个作业:
+
+ 课程名称:<%= ma.course_message.course.name %>
+ (<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 提交截止:<%= ma.course_message.end_time %> 23:59
+ 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+ 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+ 迟交扣分:<%= ma.course_message.late_penalty %>分
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+
+
+ 请抓紧时间提交您的作品,谢谢!
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + '老师',
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :title => "#{ma.course_message.user.lastname + ma.course_message.user.firstname}老师" %>
+ ">发布的作业:
+
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id),
+ :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course) %>
+
+ <%= User.current.lastname + User.current.firstname %>同学您好!
+ <%= ma.course_message.user.lastname + ma.course_message.user.firstname %>老师发布的作业截止日期快到了:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 提交截止:<%= ma.course_message.end_time %> 23:59
+ 匿评开始:<%= ma.course_message.homework_detail_manual.evaluation_start %> 23:59
+ 匿评关闭:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+ 迟交扣分:<%= ma.course_message.late_penalty %>分
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+ 请抓紧时间提交您的作品,谢谢!
+
+ <% end %>
+
+ 截止时间快到啦
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
+
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+
+ <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">启动了作业匿评:
+
+
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师' : '同学' %>您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>开启了匿评,作业详情如下:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 缺评扣分:<%= ma.course_message.homework_detail_manual.absence_penalty %>分
+ 匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
+
+ <% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
+
请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。
+
例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分
+ <% end%>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">关闭了作业匿评:
+
+ <%= link_to "作业标题:" + ma.course_message.name, student_work_index_path(:homework => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))"%>
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
+ 该作业已经关闭了匿评。作业信息如下:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+
+
+
注:缺省情况下,系统将在作业提交截止日期后14天自动关闭匿评。
+
+ <% if User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
+
祝您的教学活动高效、顺利、愉快!
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 %>
+
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+
+ <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">启动作业匿评失败
+
+
+ <%= link_to truncate(ma.course_message.name,:length=>25)+'(失败原因:提交作品的人数低于2人)', student_work_index_path(:homework => ma.course_message.id), :class => "#{ma.viewed == 0 ? "c_red" : "newsGrey "}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
+ <%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败啦
+
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年' + ma.course_message.course.term %>)
+ 作业标题:<%= ma.course_message.name %>
+ 提交截止:<%= ma.course_message.end_time%> 23:59
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "Poll" %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+ <%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>">发布了问卷:
+
+ <%= link_to format_activity_title(" #{ma.course_message.polls_name.nil? ? "未命名问卷" : ma.course_message.polls_name}"), poll_path(ma.course_message.id),
+ :class=>"#{ma.viewed==0?"newsBlack":"newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+ <%= ma.course_message.polls_name %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "Message" %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author) %>
+
+ <%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher" %>">
+ <%= ma.course_message.parent_id.nil? ? "发布了课程帖子:" : "评论了课程帖子:" %>
+ <% if ma.course_message.parent_id.nil? %>
+
+ <%= link_to ma.course_message.subject, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
主题: <%= ma.course_message.subject %>
+ <% unless ma.course_message.content.nil? %>
+
内容:
+
<%= ma.course_message.content.html_safe %>
+ <% end %>
+
+ <% else %>
+
+ <%= link_to ma.course_message.content.html_safe, course_boards_path(ma.course_message.course, :parent_id => ma.course_message.parent_id ? ma.course_message.parent_id : ma.course_message.id, :topic_id => ma.course_message.id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
主题: <%= ma.course_message.subject %>
+ <% unless ma.course_message.content.nil? %>
+
内容:
+
<%= ma.course_message.content.html_safe %>
+ <% end %>
+
+ <% end %>
+ <%= time_tag(ma.created_at).html_safe %>
+
+
+ <% end %>
+ <% if ma.course_message_type == "StudentWorksScore" %>
+
+
+ <% if ma.course_message.reviewer_role == 3 %>
+ <%=link_to image_tag(url_to_avatar(""), :width => "30", :height => "30") %>
+ <% else %>
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+ <% end %>
+
+
+ <% if ma.course_message.reviewer_role == 3 %>
+ 匿名用户
+ <% else %>
+ <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ <% end %>
+ ">
+ <%= ma.status == 0 ? "评阅了您的作品:" : "重新评阅了您的作品:" %>
+
+
+
+ <% unless ma.content.nil? %>
+ <%= link_to ma.content.html_safe, student_work_index_path(:homework => ma.course_message.student_work.homework_common_id),
+ :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <%= User.current.show_name %>同学您好!
+ <%= ma.course_message.reviewer_role == 3? "匿名用户" : (ma.course_message.user.show_name + "老师")%><%= ma.status == 0? "评阅了您的作品":"重新评阅了您的作品"%>。详情如下:
+
+
+ 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
+ 作业标题:<%=ma.course_message.student_work.homework_common.name %>
+ <% content = ma.content.gsub("作业评分:","").split(" 评语:")%>
+ 作品评分:<%= content[0] %>分
+ <% if content.size > 1 %>
+
作品评语:
+ <%= content[1] %>
+ <% end %>
+
+
+ 本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %> 23:59结束匿评,到时您将可以看到所有其他同学的作品啦!大家可以进一步互相学习。 期待您取得更大的进步!
+
+
+ <% end %>
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "JournalsForMessage" %>
+ <% if ma.course_message.jour_type == 'Course' %>
+ <% if params[:type] != 'homework' %>
+
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+ <%= link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">在课程中留言了:
+
+
+ <%= link_to ma.course_message.notes.html_safe, course_feedback_path(:id => ma.course_id),
+ :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <%= ma.course_message.notes.html_safe %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% else %>
+
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+
+ <%= link_to ma.course_message.user.lastname + ma.course_message.user.firstname +
+ "#{ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"}",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">回复了作品评论:
+
+
+ <%= link_to ma.course_message.notes, student_work_index_path(:homework => ma.course_message.jour.student_work.homework_common_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+
+ <%= User.current.show_name %>老师您好!
+ <%= ma.course_message.user.show_name%><%= ma.course_message.user.allowed_to?(:as_teacher, ma.course)?"老师":"同学"%>回复了您的作品评论。详情如下:
+
+
+ 回复内容:<%= ma.course_message.notes %>
+ 您的评论:<%= ma.course_message.jour.comment %>
+ 课程名称:<%= ma.course.name %>(<%= ma.course.time.to_s + '年'+ ma.course.term %>)
+ 作业标题:<%=ma.course_message.jour.student_work.homework_common.name %>
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% end %>
+
+ <% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? %>
+
+ <%= link_to image_tag(url_to_avatar(ma.course_message.homework_common.user), :width => "30", :height => "30"), user_path(ma.course_message.homework_common.user) %>
+
+ <%=link_to ma.course_message.homework_common.user.show_name+"老师", user_path(ma.course_message.homework_common.user), :class => "newsBlue homepageNewsPublisher" %>
+ ">发布的作业:
+
+
+ <%= link_to "作业标题:" + ma.course_message.homework_common.name, student_work_index_path(:homework => ma.course_message.homework_common_id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+
+ <%= User.current.lastname + User.current.firstname %>
+ <%= User.current.allowed_to?(:as_teacher,ma.course_message.homework_common.course) ? '老师':'同学'%>您好!由于迟交作业,您及您的作品都不能参与以下作业的匿评。作业详情如下:
+
+
+ 课程名称:<%= ma.course_message.homework_common.course.name %>(<%= ma.course_message.homework_common.course.time.to_s + '年' + ma.course_message.homework_common.course.term %>)
+ 作业标题:<%= ma.course_message.homework_common.name %>
+ 提交截止:<%= ma.course_message.homework_common.end_time %> 23:59
+ 提交时间:<%= format_time(ma.course_message.created_at) %>
+ 迟交扣分:<%= ma.course_message.homework_common.late_penalty %>分
+
+
如需获得最终成绩,请您联系主讲老师对您的作品进行单独评分!
+
+ 您成功提交了作品(但被标记为迟交啦)
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+ <% if ma.course_message_type == "Course" %>
+
+
+ <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
+
+
+ 系统提示
+ ">您成功创建了课程:
+
+
+ <%= link_to "课程名称:" + ma.course_message.name, course_path(ma.course_message),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <%= User.current.lastname + User.current.firstname %>老师您好!您成功创建了一个课程,详情如下:
+
+
课程名称:<%= ma.course_message.name %>
+
开课学期:<%= ma.course_message.time.to_s + '年' + ma.course_message.term %>
+
课程ID:<%= ma.course_message.id %>
+
课程密码:<%= ma.course_message.password %>
+
学时总数:<%= ma.course_message.class_period %>
+
创建时间:<%= format_time(ma.course_message.created_at) %>
+
您可以点击左上角的“配置”按钮,修改课程基本信息,添加及删除课程成员。您也可以把课程ID及密码告诉学生和其他成员,让他们输入ID及密码加入课程。
+ <% if ma.course_message.is_public %>
+
您的课程是公开的,所有人都能访问您的课程。若不想设置为公开,您可以在配置中设置。
+ <% else %>
+
您的课程是私有的,非课程成员不能访问您的课程。如果想设置为公开,您可以在配置中设置。
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "JoinCourseRequest" %>
+
+ <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
+
+ 系统提示
+ ">您有了新的课程成员申请:
+
+
+ <%= link_to User.find(ma.course_message_id).name+"申请成为课程\""+"#{Course.find(ma.course_id).name}"+"\"的"+"#{ma.content == '9' ? "教师" : "教辅"}", user_path(User.find(ma.course_message_id), :course_id => ma.course_id),
+ :class => "#{ma.viewed==0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+
+ <%= User.current.lastname + User.current.firstname %>老师您好!您有了新的课程成员申请,信息如下:
+
+
真实姓名:<%= User.find(ma.course_message_id).realname %>
+
申请课程:<%= Course.find(ma.course_id).name%>
+
课程描述:
+
<%= Course.find(ma.course_id).description.html_safe %>
+
申请职位:<%= ma.content == '9' ? "教师" : "教辅"%>
+
+
+
+ <% if ma.status == 0 || ma.status.nil?%>
+ <%= link_to '同意',dealwith_apply_request_user_path(User.current,:agree=>'Y',:msg_id=>ma.id),:remote=>'true'%>
+ |
+ <%= link_to '拒绝',dealwith_apply_request_user_path(User.current,:agree=>'N',:msg_id=>ma.id),:remote=>'true'%>
+ <% elsif ma.status == 1%>
+ 您已经同意了该申请
+ <% elsif ma.status == 2%>
+ 您已经拒绝了该申请
+ <%end %>
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+ <% if ma.course_message_type == "CourseRequestDealResult" %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "JoinCourse" and ma.status == 0 %>
+
+
+ <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
+
+
+ <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
+ ">将您加入了课程:
+
+
+ <%= link_to ma.course.name, course_member_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
+ <% teacher = User.find(ma.course_message_id) %>
+
<%= teacher.show_name %>(<%= teacher %>)老师把您加入了课程,详情如下:
+
课程名称:<%= ma.course.name %>
+
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
+
课程ID:<%= ma.course.id %>
+
课时总数:<%= ma.course.class_period %>
+ <% else %>
+
+ 您已经被移出该私有课程,非课程成员没有权限访问私有课程
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
+
+
+ <%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
+
+
+ 系统提示
+ ">您增加了新的课程成员:
+
+
+ <%= link_to User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")", user_path(ma.course_message_id), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <% if ma.course.is_public? || User.current.member_of_course?(ma.course) || User.current.admin? %>
+
您增加了新的课程成员,详情如下:
+
成员:<%= User.find(ma.course_message_id).login+"("+(User.find(ma.course_message_id).realname ? User.find(ma.course_message_id).realname : User.find(ma.course_message_id).login) +")" %>
+
课程名称:<%= ma.course.name %>
+
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
+
课程ID:<%= ma.course.id %>
+
课时总数:<%= ma.course.class_period %>
+ <% else %>
+
+ 您已经被移出该私有课程,非课程成员没有权限访问私有课程
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "RemoveFromCourse" %>
+
+
+ <%=link_to image_tag(url_to_avatar(User.find(ma.course_message_id)), :width => "30", :height => "30"), user_path(ma.course_message_id) %>
+
+
+ <%=link_to User.find(ma.course_message_id), user_path(User.find(ma.course_message_id)), :class => "newsBlue homepageNewsPublisher" %>
+ ">将您移出了课程:
+
+
+ <%= link_to ma.course.name, member_course_path(ma.course), :class => "#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover => "message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <% if ma.course.is_public? || User.current.member_of?(ma.course) || User.current.admin? %>
+
您已被<%= User.find(ma.course_message_id).show_name %>老师移出了课程,详情如下:
+
课程名称:<%= ma.course.name %>
+
开课学期:<%= ma.course.time.to_s + '年'+ ma.course.term %>
+ <% if !ma.content.nil? %>
+
担任角色:<%= ma.content %>
+ <% end %>
+
学时总数:<%= ma.course.class_period %>
+ <% else %>
+
+ 您已经被移出该私有课程,非课程成员没有权限访问私有课程
+
+ <% end %>
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "Exercise" && ma.status == 2 %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布了课程测验 :
+
+ <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))"%>
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布了课程测验 ,测验详情如下:
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 测验标题:<%= ma.course_message.exercise_name %>
+
+
+
+
+
+ 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
+ 答题时长:<%= ma.course_message.time == -1 ? '不限时' : ma.course_message.time.to_s + '分钟' %>
+ <% if !User.current.allowed_to?(:as_teacher,ma.course_message.course)%>
+ 请记得在截止时间前完成测验噢,辛苦啦!
+ <% end %>
+
+
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
+
+
+ <% if ma.course_message_type == "Exercise" && ma.status == 3 %>
+
+ <%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user) %>
+
+ <%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师",
+ user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher" %> ">发布的测验:
+
+ <%= link_to "测验题目:" + ma.course_message.exercise_name, exercise_path(:id => ma.course_message.id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))"%>
+
+
+
+
+
+ <%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher,ma.course_message.course) ? '老师':'同学'%>您好!
+ <%= User.current.eql?(ma.course_message.user)?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname+"老师") %>发布的课程测验截止时间快到了,测验详情如下:
+
+
+
+ 课程名称:<%= ma.course_message.course.name %>(<%= ma.course_message.course.time.to_s + '年'+ ma.course_message.course.term %>)
+ 测验标题:<%= ma.course_message.exercise_name %>
+ 截止时间:<%= ma.course_message.end_time.to_s.gsub("+0800","").to_datetime.strftime("%Y-%m-%d %H:%M:%S") %>
+ 答题时长:<%= ma.course_message.time == -1 ? '无限制' : ma.course_message.time.to_s + '分钟' %>
+ 请及时完成课程测验,辛苦啦!
+
+
+ 截止时间快到啦
+ <%= time_tag(ma.created_at).html_safe %>
+
+ <% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/users/_user_message_userfeedaback.html.erb b/app/views/users/_user_message_userfeedaback.html.erb
index 23a0774c3..6bc169f21 100644
--- a/app/views/users/_user_message_userfeedaback.html.erb
+++ b/app/views/users/_user_message_userfeedaback.html.erb
@@ -1,30 +1,30 @@
-<% if ma.class == UserFeedbackMessage %>
- <% if ma.journals_for_message_type == "JournalsForMessage" %>
-
-
- <%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"), user_path(ma.journals_for_message.user) %>
-
-
- <%=link_to ma.journals_for_message.user, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher" %>
- "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>
-
-
- <%= link_to ma.journals_for_message.notes.gsub("","").gsub("
","").gsub(" ","").html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
- :onmouseover =>"message_titile_show($(this),event)",
- :onmouseout => "message_titile_hide($(this))" %>
-
-
- <% if ma.journals_for_message.reply_id == 0 %>
- <%= ma.journals_for_message.notes.html_safe %>
- <% else %>
-
您的留言:
-
<%= JournalsForMessage.find(ma.journals_for_message.m_reply_id).notes.html_safe %>
-
回复内容:
-
<%= ma.journals_for_message.notes.html_safe %>
- <% end %>
-
- <%= time_tag(ma.journals_for_message.created_on).html_safe %>
-
-
- <% end %>
+<% if ma.class == UserFeedbackMessage %>
+ <% if ma.journals_for_message_type == "JournalsForMessage" %>
+
+
+ <%=link_to image_tag(url_to_avatar(ma.journals_for_message.user), :width => "30", :height => "30"), user_path(ma.journals_for_message.user) %>
+
+
+ <%=link_to ma.journals_for_message.user, user_path(ma.journals_for_message.user), :class => "newsBlue homepageNewsPublisher" %>
+ "><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %>
+
+
+ <%= link_to ma.journals_for_message.notes.gsub("","").gsub("
","").gsub(" ","").html_safe, feedback_path(ma.journals_for_message.jour_id), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}",
+ :onmouseover =>"message_titile_show($(this),event)",
+ :onmouseout => "message_titile_hide($(this))" %>
+
+
+ <% if ma.journals_for_message.reply_id == 0 %>
+ <%= ma.journals_for_message.notes.html_safe %>
+ <% else %>
+
您的留言:
+
<%= JournalsForMessage.find(ma.journals_for_message.m_reply_id).notes.html_safe %>
+
回复内容:
+
<%= ma.journals_for_message.notes.html_safe %>
+ <% end %>
+
+ <%= time_tag(ma.journals_for_message.created_on).html_safe %>
+
+
+ <% end %>
<% end %>
\ No newline at end of file
diff --git a/app/views/users/user_homework_type.js.erb b/app/views/users/user_homework_type.js.erb
index 701cf45fa..8cfb4dc04 100644
--- a/app/views/users/user_homework_type.js.erb
+++ b/app/views/users/user_homework_type.js.erb
@@ -4,7 +4,7 @@ $("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :
$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");
$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_search_input', :locals=>{:type=>@type,:is_import=>@is_import}) %>");
<% else %>
-$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
+$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => @is_import,:property => @property,:search=>''})%>');
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
$("#homework_search_input").html("<%=escape_javascript(render :partial=>'homework_repository_search', :locals=>{:type=>@type,:is_import=>@is_import,:property=>@property}) %>");
diff --git a/app/views/users/user_homeworks.html.erb b/app/views/users/user_homeworks.html.erb
index 4e928ca78..279f36b5c 100644
--- a/app/views/users/user_homeworks.html.erb
+++ b/app/views/users/user_homeworks.html.erb
@@ -58,40 +58,26 @@
- <%=render :partial=>'homework_repository_search', :locals=>{:type => @type,:is_import => 0,:property => @property} %>
+ <%=render :partial=>'homework_repository_search', :locals=>{:type => @type,:is_import => 0,:property => @property} %>
-
-
-
- 作业名称
- 来源
- 类别
- 贡献者
- 引用数
- 发布时间
-
-
- <%=render :partial => 'homework_repository', :locals => {:homeworks => @homeworks} %>
+
+ <%=render :partial => 'homework_repository_list', :locals => {:homeworks => @homeworks,:type=>@type,:is_import => 0,:property => @property,:search=>''} %>
+
+
+ <%=render :partial => 'homework_repository_detail', :locals => {:homework => nil} %>
+
+
+
+
+ <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
+
+
+
+
+
-
-
- <%=render :partial => 'homework_repository_detail', :locals => {:homework => nil} %>
-
-
-
-
- <%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/views/users/user_homeworks.js.erb b/app/views/users/user_homeworks.js.erb
index a24b3d018..ce1bb65e2 100644
--- a/app/views/users/user_homeworks.js.erb
+++ b/app/views/users/user_homeworks.js.erb
@@ -1,3 +1,4 @@
-$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
+/*$("#homework_repository").html('<%#= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');*/
+$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => 0,:property => @property,:search=>''})%>');
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
diff --git a/app/views/users/user_search_homeworks.js.erb b/app/views/users/user_search_homeworks.js.erb
index 34d73b823..29d490960 100644
--- a/app/views/users/user_search_homeworks.js.erb
+++ b/app/views/users/user_search_homeworks.js.erb
@@ -3,7 +3,7 @@ $("#homework_list_form_show").html('<%= escape_javascript(render :partial => 'us
$("#homewrok_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#homework_detail_information").html("<%=escape_javascript(render :partial => 'users/homework_detail_information', :locals => {:homework=>nil}) %>");
<% else %>
-$("#homework_repository").html('<%= escape_javascript(render :partial => 'users/homework_repository', :locals => {:homeworks => @homeworks})%>');
+$("#homework_repository_list").html('<%= escape_javascript(render :partial => 'users/homework_repository_list', :locals => {:homeworks => @homeworks,:sort => @order,:b_sort => @b_sort,:type=>@type,:is_import => @is_import,:property => @property,:search=>@search})%>');
$("#homework_pository_ref_pages").html('<%= pagination_links_full @hw_pages, @hw_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#homework_repository_detail").html("<%=escape_javascript(render :partial => 'users/homework_repository_detail', :locals => {:homework=>nil}) %>");
<% end %>
\ No newline at end of file
diff --git a/db/migrate/20160309024051_update_homework_common_updated_at.rb b/db/migrate/20160309024051_update_homework_common_updated_at.rb
index 89a0e992d..37accdc6e 100644
--- a/db/migrate/20160309024051_update_homework_common_updated_at.rb
+++ b/db/migrate/20160309024051_update_homework_common_updated_at.rb
@@ -1,18 +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
+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
diff --git a/db/migrate/20160309072649_update_contributor_after_delete.rb b/db/migrate/20160309072649_update_contributor_after_delete.rb
index 33d89b113..01f91105a 100644
--- a/db/migrate/20160309072649_update_contributor_after_delete.rb
+++ b/db/migrate/20160309072649_update_contributor_after_delete.rb
@@ -1,50 +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
+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
diff --git a/db/migrate/20160310033019_delete_student_work_data.rb b/db/migrate/20160310033019_delete_student_work_data.rb
index a7ce60953..9cb952064 100644
--- a/db/migrate/20160310033019_delete_student_work_data.rb
+++ b/db/migrate/20160310033019_delete_student_work_data.rb
@@ -1,8 +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
+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
diff --git a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb
index 682714b9b..6b22496b6 100644
--- a/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb
+++ b/lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb
@@ -99,6 +99,13 @@ module Redmine
result
end
+ def save_attachmentsex_public(attachments, author=User.current,attachment_type, is_public)
+ @curattachment_type = attachment_type
+ @is_public = true
+ result = save_attachments(attachments,author)
+ result
+ end
+
def save_attachments(attachments, author=User.current)
# 清除临时文件
if attachments
@@ -142,7 +149,11 @@ module Redmine
end
if a && !attachment['is_public_checkbox']
- a.is_public = false
+ if @is_public
+ a.is_public = true
+ else
+ a.is_public = false
+ end
elsif a && attachment['is_public_checkbox']
a.is_public = true
end
diff --git a/lib/trustie/gitlab/helper.rb b/lib/trustie/gitlab/helper.rb
index 54bc4620e..c9cbcee26 100644
--- a/lib/trustie/gitlab/helper.rb
+++ b/lib/trustie/gitlab/helper.rb
@@ -1,78 +1,78 @@
-#coding=utf-8
-
-module Trustie
- module Gitlab
- module Helper
- GUEST = 10
- REPORTER = 20
- DEVELOPER = 30
- MASTER = 40
- OWNER = 50
- # 项目公开和私有
- PUBLIC = 20
- PRIVATE = 0
-
- def change_password(uid, en_pwd, salt)
- return unless uid
- options = {:encrypted_password=>en_pwd, :password_salt=>salt}
- self.g.put("/users/ext/#{uid}", :body => options)
- # g.edit_user(uid, :encrypted_password=>en_pwd, :password_salt=>salt)
- end
-
- def find_user(user)
- us = self.g.get("/users?search=#{user.mail}")
- if Array === us
- us.each do |u|
- return u if u.email == user.mail
- end
- end
- return nil
- end
-
- def add_user(user)
- u = nil
- begin
- u = find_user(user)
- unless u
- u = self.g.create_user(user.mail,
- user.hashed_password,
- name: user.show_name,
- username: user.login,
- confirm: "true")
- user.gid = u.id
- user.save
- end
- if user.gid.nil?
- user.gid = u.id
- user.save
- end
- change_password(u.id, user.hashed_password, user.salt)
- rescue => e
- puts e
- end
- return u
- end
-
- def del_user(user)
- return unless user.gid
- self.g.delete_user(user.gid)
- end
-
- def get_gitlab_role m
- case m.roles.first.position
- when 1,2
- GUEST
- when 5
- REPORTER
- when 4
- DEVELOPER
- when 3
- MASTER
- else
- GUEST
- end
- end
-
- end
- end
+#coding=utf-8
+
+module Trustie
+ module Gitlab
+ module Helper
+ GUEST = 10
+ REPORTER = 20
+ DEVELOPER = 30
+ MASTER = 40
+ OWNER = 50
+ # 项目公开和私有
+ PUBLIC = 20
+ PRIVATE = 0
+
+ def change_password(uid, en_pwd, salt)
+ return unless uid
+ options = {:encrypted_password=>en_pwd, :password_salt=>salt}
+ self.g.put("/users/ext/#{uid}", :body => options)
+ # g.edit_user(uid, :encrypted_password=>en_pwd, :password_salt=>salt)
+ end
+
+ def find_user(user)
+ us = self.g.get("/users?search=#{user.mail}")
+ if Array === us
+ us.each do |u|
+ return u if u.email == user.mail
+ end
+ end
+ return nil
+ end
+
+ def add_user(user)
+ u = nil
+ begin
+ u = find_user(user)
+ unless u
+ u = self.g.create_user(user.mail,
+ user.hashed_password,
+ name: user.show_name,
+ username: user.login,
+ confirm: "true")
+ user.gid = u.id
+ user.save
+ end
+ if user.gid.nil?
+ user.gid = u.id
+ user.save
+ end
+ change_password(u.id, user.hashed_password, user.salt)
+ rescue => e
+ puts e
+ end
+ return u
+ end
+
+ def del_user(user)
+ return unless user.gid
+ self.g.delete_user(user.gid)
+ end
+
+ def get_gitlab_role m
+ case m.roles.first.position
+ when 1,2
+ GUEST
+ when 5
+ REPORTER
+ when 4
+ DEVELOPER
+ when 3
+ MASTER
+ else
+ GUEST
+ end
+ end
+
+ end
+ end
end
\ No newline at end of file
diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js
index 6065a563f..060898b88 100644
--- a/public/assets/kindeditor/kindeditor.js
+++ b/public/assets/kindeditor/kindeditor.js
@@ -1,6094 +1,6136 @@
-//function dump_obj(myObject) {
-// var s = "";
-// for (var property in myObject) {
-// s = s + "\n "+property +": " + myObject[property] ;
-// }
-// alert(s);
-//}
-/*******************************************************************************
-* KindEditor - WYSIWYG HTML Editor for Internet
-* Copyright (C) 2006-2013 kindsoft.net
-*
-* @author Roddy
-* @website http://www.kindsoft.net/
-* @licence http://www.kindsoft.net/license.php
-* @version 4.1.10 (2013-11-23)
-*******************************************************************************/
-(function (window, undefined) {
- if (window.KindEditor) {
- return;
- }
-if (!window.console) {
- window.console = {};
-}
-if (!console.log) {
- console.log = function () {};
-}
-var _VERSION = '4.1.10 (2013-11-23)',
- _ua = navigator.userAgent.toLowerCase(),
- _IE = _ua.indexOf('msie') > -1 && _ua.indexOf('opera') == -1,
- _NEWIE = _ua.indexOf('msie') == -1 && _ua.indexOf('trident') > -1,
- _GECKO = _ua.indexOf('gecko') > -1 && _ua.indexOf('khtml') == -1,
- _WEBKIT = _ua.indexOf('applewebkit') > -1,
- _OPERA = _ua.indexOf('opera') > -1,
- _MOBILE = _ua.indexOf('mobile') > -1,
- _IOS = /ipad|iphone|ipod/.test(_ua),
- _QUIRKS = document.compatMode != 'CSS1Compat',
- _IERANGE = !window.getSelection,
- _matches = /(?:msie|firefox|webkit|opera)[\/:\s](\d+)/.exec(_ua),
- _V = _matches ? _matches[1] : '0',
- _TIME = new Date().getTime();
-function _isArray(val) {
- if (!val) {
- return false;
- }
- return Object.prototype.toString.call(val) === '[object Array]';
-}
-function _isFunction(val) {
- if (!val) {
- return false;
- }
- return Object.prototype.toString.call(val) === '[object Function]';
-}
-function _inArray(val, arr) {
- for (var i = 0, len = arr.length; i < len; i++) {
- if (val === arr[i]) {
- return i;
- }
- }
- return -1;
-}
-function _each(obj, fn) {
- if (_isArray(obj)) {
- for (var i = 0, len = obj.length; i < len; i++) {
- if (fn.call(obj[i], i, obj[i]) === false) {
- break;
- }
- }
- } else {
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- if (fn.call(obj[key], key, obj[key]) === false) {
- break;
- }
- }
- }
- }
-}
-function _trim(str) {
- return str.replace(/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g, '');
-}
-function _inString(val, str, delimiter) {
- delimiter = delimiter === undefined ? ',' : delimiter;
- return (delimiter + str + delimiter).indexOf(delimiter + val + delimiter) >= 0;
-}
-function _addUnit(val, unit) {
- unit = unit || 'px';
- return val && /^\d+$/.test(val) ? val + unit : val;
-}
-function _removeUnit(val) {
- var match;
- return val && (match = /(\d+)/.exec(val)) ? parseInt(match[1], 10) : 0;
-}
-function _escape(val) {
- return val.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"');
-}
-function _unescape(val) {
- return val.replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/&/g, '&');
-}
-function _toCamel(str) {
- var arr = str.split('-');
- str = '';
- _each(arr, function(key, val) {
- str += (key > 0) ? val.charAt(0).toUpperCase() + val.substr(1) : val;
- });
- return str;
-}
-function _toHex(val) {
- function hex(d) {
- var s = parseInt(d, 10).toString(16).toUpperCase();
- return s.length > 1 ? s : '0' + s;
- }
- return val.replace(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/ig,
- function($0, $1, $2, $3) {
- return '#' + hex($1) + hex($2) + hex($3);
- }
- );
-}
-function _toMap(val, delimiter) {
- delimiter = delimiter === undefined ? ',' : delimiter;
- var map = {}, arr = _isArray(val) ? val : val.split(delimiter), match;
- _each(arr, function(key, val) {
- if ((match = /^(\d+)\.\.(\d+)$/.exec(val))) {
- for (var i = parseInt(match[1], 10); i <= parseInt(match[2], 10); i++) {
- map[i.toString()] = true;
- }
- } else {
- map[val] = true;
- }
- });
- return map;
-}
-function _toArray(obj, offset) {
- return Array.prototype.slice.call(obj, offset || 0);
-}
-function _undef(val, defaultVal) {
- return val === undefined ? defaultVal : val;
-}
-function _invalidUrl(url) {
- return !url || /[<>"]/.test(url);
-}
-function _addParam(url, param) {
- return url.indexOf('?') >= 0 ? url + '&' + param : url + '?' + param;
-}
-function _extend(child, parent, proto) {
- if (!proto) {
- proto = parent;
- parent = null;
- }
- var childProto;
- if (parent) {
- var fn = function () {};
- fn.prototype = parent.prototype;
- childProto = new fn();
- _each(proto, function(key, val) {
- childProto[key] = val;
- });
- } else {
- childProto = proto;
- }
- childProto.constructor = child;
- child.prototype = childProto;
- child.parent = parent ? parent.prototype : null;
-}
-function _json(text) {
- var match;
- if ((match = /\{[\s\S]*\}|\[[\s\S]*\]/.exec(text))) {
- text = match[0];
- }
- var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
- cx.lastIndex = 0;
- if (cx.test(text)) {
- text = text.replace(cx, function (a) {
- return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
- });
- }
- if (/^[\],:{}\s]*$/.
- test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').
- replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
- replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
- return eval('(' + text + ')');
- }
- throw 'JSON parse error';
-}
-var _round = Math.round;
-var K = {
- DEBUG : false,
- VERSION : _VERSION,
- IE : _IE,
- GECKO : _GECKO,
- WEBKIT : _WEBKIT,
- OPERA : _OPERA,
- V : _V,
- TIME : _TIME,
- each : _each,
- isArray : _isArray,
- isFunction : _isFunction,
- inArray : _inArray,
- inString : _inString,
- trim : _trim,
- addUnit : _addUnit,
- removeUnit : _removeUnit,
- escape : _escape,
- unescape : _unescape,
- toCamel : _toCamel,
- toHex : _toHex,
- toMap : _toMap,
- toArray : _toArray,
- undef : _undef,
- invalidUrl : _invalidUrl,
- addParam : _addParam,
- extend : _extend,
- json : _json
-};
-var _INLINE_TAG_MAP = _toMap('a,abbr,acronym,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,img,input,ins,kbd,label,map,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var'),
- _BLOCK_TAG_MAP = _toMap('address,applet,blockquote,body,center,dd,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,head,hr,html,iframe,ins,isindex,li,map,menu,meta,noframes,noscript,object,ol,p,pre,script,style,table,tbody,td,tfoot,th,thead,title,tr,ul'),
- _SINGLE_TAG_MAP = _toMap('area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed'),
- _STYLE_TAG_MAP = _toMap('b,basefont,big,del,em,font,i,s,small,span,strike,strong,sub,sup,u'),
- _CONTROL_TAG_MAP = _toMap('img,table,input,textarea,button'),
- _PRE_TAG_MAP = _toMap('pre,style,script'),
- _NOSPLIT_TAG_MAP = _toMap('html,head,body,td,tr,table,ol,ul,li'),
- _AUTOCLOSE_TAG_MAP = _toMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr'),
- _FILL_ATTR_MAP = _toMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'),
- _VALUE_TAG_MAP = _toMap('input,button,textarea,select');
-// Begining of modification by Macrow
-function _getBasePath() {
- var refPath = '/assets/kindeditor/';
- var els = document.getElementsByTagName('script'), src;
- for (var i = 0, len = els.length; i < len; i++) {
- src = els[i].src || '';
- if (/(kindeditor|application)[\w\-\.]*\.js/.test(src)) {
- return src.substring(0, src.indexOf('assets')) + refPath;
- }
- }
- return refPath;
-}
-// End of modification by Macrow
-K.basePath = _getBasePath();
-K.options = {
- designMode : true,
- fullscreenMode : false,
- filterMode : true,
- wellFormatMode : true,
- shadowMode : true,
- loadStyleMode : true,
- basePath : K.basePath,
- emotionsBasePath: 'http://forge.trustie.net', //TODO
- themesPath : K.basePath + 'themes/',
- langPath : K.basePath + 'lang/',
- pluginsPath : K.basePath + 'plugins/',
- themeType : 'default',
- langType : 'zh_CN',
- urlType : '',
- newlineTag : 'p',
- resizeType : 2,
- syncType : 'form',
- pasteType : 2,
- dialogAlignType : 'page',
- useContextmenu : true,
- fullscreenShortcut : false,
- bodyClass : 'ke-content',
- indentChar : '\t',
- cssPath : K.basePath +'plugins/code/previewcode.css',
- cssData : 'font{color:black;}',
- minWidth : 650,
- minHeight : 100,
- minChangeSize : 1,
- zIndex : 811213,
- items : ['code','emoticons','fontname',
- 'forecolor', 'hilitecolor', 'bold', '|', 'justifyleft', 'justifycenter', 'insertorderedlist','insertunorderedlist', '|',
- 'formatblock', 'fontsize', '|','indent', 'outdent',
- '|','imagedirectupload','table', 'media', 'preview',"more"
- ],
- noDisableItems : ['source', 'fullscreen'],
- colorTable : [
- ['#E53333', '#E56600', '#FF9900', '#64451D', '#DFC5A4', '#FFE500'],
- ['#009900', '#006600', '#99BB00', '#B8D100', '#60D978', '#00D5FF'],
- ['#337FE5', '#003399', '#4C33E5', '#9933E5', '#CC33E5', '#EE33EE'],
- ['#FFFFFF', '#CCCCCC', '#999999', '#666666', '#333333', '#000000']
- ],
- fontSizeTable : ['选中的字体大小:','9px', '10px', '12px', '14px', '16px', '18px', '24px', '32px'],
- htmlTags : {
- font : ['id', 'class', 'color', 'size', 'face', '.background-color'],
- span : [
- 'id', 'class', '.color', '.background-color', '.font-size', '.font-family', '.background',
- '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.line-height', 'data-user-id'
- ],
- div : [
- 'id', 'class', 'align', '.border', '.margin', '.padding', '.text-align', '.color',
- '.background-color', '.font-size', '.font-family', '.font-weight', '.background',
- '.font-style', '.text-decoration', '.vertical-align', '.margin-left'
- ],
- table: [
- 'id', 'class', 'border', 'cellspacing', 'cellpadding', 'width', 'height', 'align', 'bordercolor',
- '.padding', '.margin', '.border', 'bgcolor', '.text-align', '.color', '.background-color',
- '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.background',
- '.width', '.height', '.border-collapse'
- ],
- 'td,th': [
- 'id', 'class', 'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor',
- '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight',
- '.font-style', '.text-decoration', '.vertical-align', '.background', '.border'
- ],
- a : ['id', 'class', 'href', 'target', 'name'],
- embed : ['id', 'class', 'src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'],
- img : ['id', 'class', 'src', 'width', 'height', 'border', 'alt', 'title', 'align', '.width', '.height', '.border'],
- 'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [
- 'id', 'class', 'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.background',
- '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.text-indent', '.margin-left'
- ],
- pre : ['id', 'class'],
- hr : ['id', 'class', '.page-break-after'],
- 'br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del' : ['id', 'class'],
- iframe : ['id', 'class', 'src', 'frameborder', 'width', 'height', '.width', '.height']
- },
- layout : ''
-};
-var _useCapture = false;
-var _INPUT_KEY_MAP = _toMap('8,9,13,32,46,48..57,59,61,65..90,106,109..111,188,190..192,219..222');
-var _CURSORMOVE_KEY_MAP = _toMap('33..40');
-var _CHANGE_KEY_MAP = {};
-_each(_INPUT_KEY_MAP, function(key, val) {
- _CHANGE_KEY_MAP[key] = val;
-});
-_each(_CURSORMOVE_KEY_MAP, function(key, val) {
- _CHANGE_KEY_MAP[key] = val;
-});
-function _bindEvent(el, type, fn) {
- if (el.addEventListener){
- el.addEventListener(type, fn, _useCapture);
- } else if (el.attachEvent){
- el.attachEvent('on' + type, fn);
- }
-}
-function _unbindEvent(el, type, fn) {
- if (el.removeEventListener){
- el.removeEventListener(type, fn, _useCapture);
- } else if (el.detachEvent){
- el.detachEvent('on' + type, fn);
- }
-}
-var _EVENT_PROPS = ('altKey,attrChange,attrName,bubbles,button,cancelable,charCode,clientX,clientY,ctrlKey,currentTarget,' +
- 'data,detail,eventPhase,fromElement,handler,keyCode,metaKey,newValue,offsetX,offsetY,originalTarget,pageX,' +
- 'pageY,prevValue,relatedNode,relatedTarget,screenX,screenY,shiftKey,srcElement,target,toElement,view,wheelDelta,which').split(',');
-function KEvent(el, event) {
- this.init(el, event);
-}
-_extend(KEvent, {
- init : function(el, event) {
- var self = this, doc = el.ownerDocument || el.document || el;
- self.event = event;
- _each(_EVENT_PROPS, function(key, val) {
- self[val] = event[val];
- });
- if (!self.target) {
- self.target = self.srcElement || doc;
- }
- if (self.target.nodeType === 3) {
- self.target = self.target.parentNode;
- }
- if (!self.relatedTarget && self.fromElement) {
- self.relatedTarget = self.fromElement === self.target ? self.toElement : self.fromElement;
- }
- if (self.pageX == null && self.clientX != null) {
- var d = doc.documentElement, body = doc.body;
- self.pageX = self.clientX + (d && d.scrollLeft || body && body.scrollLeft || 0) - (d && d.clientLeft || body && body.clientLeft || 0);
- self.pageY = self.clientY + (d && d.scrollTop || body && body.scrollTop || 0) - (d && d.clientTop || body && body.clientTop || 0);
- }
- if (!self.which && ((self.charCode || self.charCode === 0) ? self.charCode : self.keyCode)) {
- self.which = self.charCode || self.keyCode;
- }
- if (!self.metaKey && self.ctrlKey) {
- self.metaKey = self.ctrlKey;
- }
- if (!self.which && self.button !== undefined) {
- self.which = (self.button & 1 ? 1 : (self.button & 2 ? 3 : (self.button & 4 ? 2 : 0)));
- }
- switch (self.which) {
- case 186 :
- self.which = 59;
- break;
- case 187 :
- case 107 :
- case 43 :
- self.which = 61;
- break;
- case 189 :
- case 45 :
- self.which = 109;
- break;
- case 42 :
- self.which = 106;
- break;
- case 47 :
- self.which = 111;
- break;
- case 78 :
- self.which = 110;
- break;
- }
- if (self.which >= 96 && self.which <= 105) {
- self.which -= 48;
- }
- },
- preventDefault : function() {
- var ev = this.event;
- if (ev.preventDefault) {
- ev.preventDefault();
- } else {
- ev.returnValue = false;
- }
- },
- stopPropagation : function() {
- var ev = this.event;
- if (ev.stopPropagation) {
- ev.stopPropagation();
- } else {
- ev.cancelBubble = true;
- }
- },
- stop : function() {
- this.preventDefault();
- this.stopPropagation();
- }
-});
-var _eventExpendo = 'kindeditor_' + _TIME, _eventId = 0, _eventData = {};
-function _getId(el) {
- return el[_eventExpendo] || null;
-}
-function _setId(el) {
- el[_eventExpendo] = ++_eventId;
- return _eventId;
-}
-function _removeId(el) {
- try {
- delete el[_eventExpendo];
- } catch(e) {
- if (el.removeAttribute) {
- el.removeAttribute(_eventExpendo);
- }
- }
-}
-function _bind(el, type, fn) {
- if (type.indexOf(',') >= 0) {
- _each(type.split(','), function() {
- _bind(el, this, fn);
- });
- return;
- }
- var id = _getId(el);
- if (!id) {
- id = _setId(el);
- }
- if (_eventData[id] === undefined) {
- _eventData[id] = {};
- }
- var events = _eventData[id][type];
- if (events && events.length > 0) {
- _unbindEvent(el, type, events[0]);
- } else {
- _eventData[id][type] = [];
- _eventData[id].el = el;
- }
- events = _eventData[id][type];
- if (events.length === 0) {
- events[0] = function(e) {
- var kevent = e ? new KEvent(el, e) : undefined;
- _each(events, function(i, event) {
- if (i > 0 && event) {
- event.call(el, kevent);
- }
- });
- };
- }
- if (_inArray(fn, events) < 0) {
- events.push(fn);
- }
- _bindEvent(el, type, events[0]);
-}
-function _unbind(el, type, fn) {
- if (type && type.indexOf(',') >= 0) {
- _each(type.split(','), function() {
- _unbind(el, this, fn);
- });
- return;
- }
- var id = _getId(el);
- if (!id) {
- return;
- }
- if (type === undefined) {
- if (id in _eventData) {
- _each(_eventData[id], function(key, events) {
- if (key != 'el' && events.length > 0) {
- _unbindEvent(el, key, events[0]);
- }
- });
- delete _eventData[id];
- _removeId(el);
- }
- return;
- }
- if (!_eventData[id]) {
- return;
- }
- var events = _eventData[id][type];
- if (events && events.length > 0) {
- if (fn === undefined) {
- _unbindEvent(el, type, events[0]);
- delete _eventData[id][type];
- } else {
- _each(events, function(i, event) {
- if (i > 0 && event === fn) {
- events.splice(i, 1);
- }
- });
- if (events.length == 1) {
- _unbindEvent(el, type, events[0]);
- delete _eventData[id][type];
- }
- }
- var count = 0;
- _each(_eventData[id], function() {
- count++;
- });
- if (count < 2) {
- delete _eventData[id];
- _removeId(el);
- }
- }
-}
-function _fire(el, type) {
- if (type.indexOf(',') >= 0) {
- _each(type.split(','), function() {
- _fire(el, this);
- });
- return;
- }
- var id = _getId(el);
- if (!id) {
- return;
- }
- var events = _eventData[id][type];
- if (_eventData[id] && events && events.length > 0) {
- events[0]();
- }
-}
-function _ctrl(el, key, fn) {
- var self = this;
- key = /^\d{2,}$/.test(key) ? key : key.toUpperCase().charCodeAt(0);
- _bind(el, 'keydown', function(e) {
- if (e.ctrlKey && e.which == key && !e.shiftKey && !e.altKey) {
- fn.call(el);
- e.stop();
- }
- });
-}
-var _readyFinished = false;
-function _ready(fn) {
- if (_readyFinished) {
- fn(KindEditor);
- return;
- }
- var loaded = false;
- function readyFunc() {
- if (!loaded) {
- loaded = true;
- fn(KindEditor);
- _readyFinished = true;
- }
- }
- function ieReadyFunc() {
- if (!loaded) {
- try {
- document.documentElement.doScroll('left');
- } catch(e) {
- setTimeout(ieReadyFunc, 100);
- return;
- }
- readyFunc();
- }
- }
- function ieReadyStateFunc() {
- if (document.readyState === 'complete') {
- readyFunc();
- }
- }
- if (document.addEventListener) {
- _bind(document, 'DOMContentLoaded', readyFunc);
- } else if (document.attachEvent) {
- _bind(document, 'readystatechange', ieReadyStateFunc);
- var toplevel = false;
- try {
- toplevel = window.frameElement == null;
- } catch(e) {}
- if (document.documentElement.doScroll && toplevel) {
- ieReadyFunc();
- }
- }
- _bind(window, 'load', readyFunc);
-}
-if (_IE) {
- window.attachEvent('onunload', function() {
- _each(_eventData, function(key, events) {
- if (events.el) {
- _unbind(events.el);
- }
- });
- });
-}
-K.ctrl = _ctrl;
-K.ready = _ready;
-function _getCssList(css) {
- var list = {},
- reg = /\s*([\w\-]+)\s*:([^;]*)(;|$)/g,
- match;
- while ((match = reg.exec(css))) {
- var key = _trim(match[1].toLowerCase()),
- val = _trim(_toHex(match[2]));
- list[key] = val;
- }
- return list;
-}
-function _getAttrList(tag) {
- var list = {},
- reg = /\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g,
- match;
- while ((match = reg.exec(tag))) {
- var key = (match[1] || match[2] || match[4] || match[6]).toLowerCase(),
- val = (match[2] ? match[3] : (match[4] ? match[5] : match[7])) || '';
- list[key] = val;
- }
- return list;
-}
-function _addClassToTag(tag, className) {
- if (/\s+class\s*=/.test(tag)) {
- tag = tag.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/, function($0, $1, $2, $3) {
- if ((' ' + $2 + ' ').indexOf(' ' + className + ' ') < 0) {
- return $2 === '' ? $1 + className + $3 : $1 + $2 + ' ' + className + $3;
- } else {
- return $0;
- }
- });
- } else {
- tag = tag.substr(0, tag.length - 1) + ' class="' + className + '">';
- }
- return tag;
-}
-function _formatCss(css) {
- var str = '';
- _each(_getCssList(css), function(key, val) {
- str += key + ':' + val + ';';
- });
- return str;
-}
-function _formatUrl(url, mode, host, pathname) {
- mode = _undef(mode, '').toLowerCase();
- if (url.substr(0, 5) != 'data:') {
- url = url.replace(/([^:])\/\//g, '$1/');
- }
- if (_inArray(mode, ['absolute', 'relative', 'domain']) < 0) {
- return url;
- }
- host = host || location.protocol + '//' + location.host;
- if (pathname === undefined) {
- var m = location.pathname.match(/^(\/.*)\//);
- pathname = m ? m[1] : '';
- }
- var match;
- if ((match = /^(\w+:\/\/[^\/]*)/.exec(url))) {
- if (match[1] !== host) {
- return url;
- }
- } else if (/^\w+:/.test(url)) {
- return url;
- }
- function getRealPath(path) {
- var parts = path.split('/'), paths = [];
- for (var i = 0, len = parts.length; i < len; i++) {
- var part = parts[i];
- if (part == '..') {
- if (paths.length > 0) {
- paths.pop();
- }
- } else if (part !== '' && part != '.') {
- paths.push(part);
- }
- }
- return '/' + paths.join('/');
- }
- if (/^\//.test(url)) {
- url = host + getRealPath(url.substr(1));
- } else if (!/^\w+:\/\//.test(url)) {
- url = host + getRealPath(pathname + '/' + url);
- }
- function getRelativePath(path, depth) {
- if (url.substr(0, path.length) === path) {
- var arr = [];
- for (var i = 0; i < depth; i++) {
- arr.push('..');
- }
- var prefix = '.';
- if (arr.length > 0) {
- prefix += '/' + arr.join('/');
- }
- if (pathname == '/') {
- prefix += '/';
- }
- return prefix + url.substr(path.length);
- } else {
- if ((match = /^(.*)\//.exec(path))) {
- return getRelativePath(match[1], ++depth);
- }
- }
- }
- if (mode === 'relative') {
- url = getRelativePath(host + pathname, 0).substr(2);
- } else if (mode === 'absolute') {
- if (url.substr(0, host.length) === host) {
- url = url.substr(host.length);
- }
- }
- return url;
-}
-function _formatHtml(html, htmlTags, urlType, wellFormatted, indentChar) {
- if (html == null) {
- html = '';
- }
- urlType = urlType || '';
- wellFormatted = _undef(wellFormatted, false);
- indentChar = _undef(indentChar, '\t');
- var fontSizeList = 'xx-small,x-small,small,medium,large,x-large,xx-large'.split(',');
- html = html.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig, function($0, $1, $2, $3) {
- return $1 + $2.replace(/<(?:br|br\s[^>]*)>/ig, '\n') + $3;
- });
- html = html.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/ig, '');
- html = html.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/ig, '$1 $2');
- html = html.replace(/\u200B/g, '');
- html = html.replace(/\u00A9/g, '©');
- html = html.replace(/\u00AE/g, '®');
- html = html.replace(/<[^>]+/g, function($0) {
- return $0.replace(/\s+/g, ' ');
- });
- var htmlTagMap = {};
- if (htmlTags) {
- _each(htmlTags, function(key, val) {
- var arr = key.split(',');
- for (var i = 0, len = arr.length; i < len; i++) {
- htmlTagMap[arr[i]] = _toMap(val);
- }
- });
- if (!htmlTagMap.script) {
- html = html.replace(/(<(?:script|script\s[^>]*)>)([\s\S]*?)(<\/script>)/ig, '');
- }
- if (!htmlTagMap.style) {
- html = html.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/ig, '');
- }
- }
- var re = /(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g;
- var tagStack = [];
- html = html.replace(re, function($0, $1, $2, $3, $4, $5, $6) {
- var full = $0,
- startNewline = $1 || '',
- startSlash = $2 || '',
- tagName = $3.toLowerCase(),
- attr = $4 || '',
- endSlash = $5 ? ' ' + $5 : '',
- endNewline = $6 || '';
- if (htmlTags && !htmlTagMap[tagName]) {
- return '';
- }
- if (endSlash === '' && _SINGLE_TAG_MAP[tagName]) {
- endSlash = ' /';
- }
- if (_INLINE_TAG_MAP[tagName]) {
- if (startNewline) {
- startNewline = ' ';
- }
- if (endNewline) {
- endNewline = ' ';
- }
- }
- if (_PRE_TAG_MAP[tagName]) {
- if (startSlash) {
- endNewline = '\n';
- } else {
- startNewline = '\n';
- }
- }
- if (wellFormatted && tagName == 'br') {
- endNewline = '\n';
- }
- if (_BLOCK_TAG_MAP[tagName] && !_PRE_TAG_MAP[tagName]) {
- if (wellFormatted) {
- if (startSlash && tagStack.length > 0 && tagStack[tagStack.length - 1] === tagName) {
- tagStack.pop();
- } else {
- tagStack.push(tagName);
- }
- startNewline = '\n';
- endNewline = '\n';
- for (var i = 0, len = startSlash ? tagStack.length : tagStack.length - 1; i < len; i++) {
- startNewline += indentChar;
- if (!startSlash) {
- endNewline += indentChar;
- }
- }
- if (endSlash) {
- tagStack.pop();
- } else if (!startSlash) {
- endNewline += indentChar;
- }
- } else {
- startNewline = endNewline = '';
- }
- }
- if (attr !== '') {
- var attrMap = _getAttrList(full);
- if (tagName === 'font') {
- var fontStyleMap = {}, fontStyle = '';
- _each(attrMap, function(key, val) {
- if (key === 'color') {
- fontStyleMap.color = val;
- delete attrMap[key];
- }
- if (key === 'size') {
- fontStyleMap['font-size'] = fontSizeList[parseInt(val, 10) - 1] || '';
- delete attrMap[key];
- }
- if (key === 'face') {
- fontStyleMap['font-family'] = val;
- delete attrMap[key];
- }
- if (key === 'style') {
- fontStyle = val;
- }
- });
- if (fontStyle && !/;$/.test(fontStyle)) {
- fontStyle += ';';
- }
- _each(fontStyleMap, function(key, val) {
- if (val === '') {
- return;
- }
- if (/\s/.test(val)) {
- val = "'" + val + "'";
- }
- fontStyle += key + ':' + val + ';';
- });
- attrMap.style = fontStyle;
- }
- _each(attrMap, function(key, val) {
- if (_FILL_ATTR_MAP[key]) {
- attrMap[key] = key;
- }
- if (_inArray(key, ['src', 'href']) >= 0) {
- attrMap[key] = _formatUrl(val, urlType);
- }
- if (htmlTags && key !== 'style' && !htmlTagMap[tagName]['*'] && !htmlTagMap[tagName][key] ||
- tagName === 'body' && key === 'contenteditable' ||
- /^kindeditor_\d+$/.test(key)) {
- delete attrMap[key];
- }
- if (key === 'style' && val !== '') {
- var styleMap = _getCssList(val);
- _each(styleMap, function(k, v) {
- if (htmlTags && !htmlTagMap[tagName].style && !htmlTagMap[tagName]['.' + k]) {
- delete styleMap[k];
- }
- });
- var style = '';
- _each(styleMap, function(k, v) {
- style += k + ':' + v + ';';
- });
- attrMap.style = style;
- }
- });
- attr = '';
- _each(attrMap, function(key, val) {
- if (key === 'style' && val === '') {
- return;
- }
- val = val.replace(/"/g, '"');
- attr += ' ' + key + '="' + val + '"';
- });
- }
- if (tagName === 'font') {
- tagName = 'span';
- }
- return startNewline + '<' + startSlash + tagName + attr + endSlash + '>' + endNewline;
- });
- html = html.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig, function($0, $1, $2, $3) {
- return $1 + $2.replace(/\n/g, '\n') + $3;
- });
- html = html.replace(/\n\s*\n/g, '\n');
- html = html.replace(/\n/g, '\n');
- return _trim(html);
-}
-function _clearMsWord(html, htmlTags) {
- html = html.replace(/ /ig, '')
- .replace(//ig, '')
- .replace(/'
- ];
- if (!_isArray(cssPath)) {
- cssPath = [cssPath];
- }
- _each(cssPath, function(i, path) {
- if (path) {
- arr.push(' ');
- }
- });
- if (cssData) {
- arr.push('');
- }
- arr.push('