Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
lizanle 2015-12-18 09:28:41 +08:00
commit 38c3422b83
109 changed files with 1037 additions and 587 deletions

View File

@ -0,0 +1,152 @@
#coding=utf-8
class AtController < ApplicationController
respond_to :json
def show
@logger = Logger.new(Rails.root.join('log', 'at.log').to_s)
users = find_at_users(params[:type], params[:id])
@users = users
@users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id } if users
end
private
def find_at_users(type, id)
@logger.info("#{type}, #{id}")
case type
when "Issue"
find_issue(id)
when 'Project'
find_project(id)
when 'Course'
find_course(id)
when 'Activity', 'CourseActivity', 'ForgeActivity','UserActivity', 'OrgActivity','PrincipalActivity'
find_activity(id, type)
when 'Attachment'
find_attachment(id)
when 'Message'
find_message(id)
when 'HomeworkCommon'
find_homework(id)
when 'Topic'
find_topic(id)
else
nil
end
end
def find_topic(id)
end
def find_issue(id)
#1. issues list persons
#2. project persons
issue = Issue.find(id)
journals = issue.journals
at_persons = journals.map(&:user) + issue.project.users
at_persons.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }
end
def find_project(id)
at_persons = Project.find(id).users
at_persons.delete_if { |u| u.id == User.current.id }
end
def find_course(id)
at_persons = Course.find(id).users
at_persons.delete_if { |u| u.id == User.current.id }
end
def find_activity(id, type)
## 基本上是本类型中的 加上所属类型的用户
case type
when 'Activity'
activity = Activity.find(id)
(find_at_users(activity.act_type, activity.act_id) ||[]) +
(find_at_users(activity.activity_container_type, activity.activity_container_id) || [])
when 'CourseActivity'
activity = CourseActivity.find(id)
(find_at_users(activity.course_act_type, activity.course_act_id) || []) + (find_course(activity.course.id) || [])
when 'ForgeActivity'
activity = ForgeActivity.find(id)
(find_at_users(activity.forge_act_type, activity.forge_act_id) ||[]) +
(find_project(activity.project_id) || [])
when 'UserActivity'
activity = UserActivity.find(id)
(find_at_users(activity.act_type, activity.act_id) || []) +
(find_at_users(activity.container_type, activity.container_id) || [])
when 'OrgActivity'
activity = OrgActivity.find(id)
(find_at_users(activity.org_act_type, activity.org_act_id) || []) +
(find_at_users(activity.container_type, activity.container_id) || [])
when 'PrincipalActivity'
activity = PrincipalActivity.find(id)
find_at_users(activity.principal_act_type, activity.principal_act_id)
else
nil
end
end
#作业应该是关联课程,取课程的用户列表
def find_homework(id)
homework = HomeworkCommon.find(id)
find_course(homework.course_id)
end
def find_attachment(id)
attachment = Attachment.find(id)
find_at_users(attachment.container_type, attachment.container_id)
end
#Message
def find_message(id)
message = Message.find(id)
at_persons = message.board.messages.map(&:author)
(at_persons || []) + (find_project(message.board.project_id)||[])
end
#News
def find_news(id)
find_project(News.find(id).project_id)
end
#JournalsForMessage
def find_journals_for_message(id)
jounrnal = JournalsForMessage.find(id)
find_at_users(jounrnal.jour_type, jounrnal.jour_id)
end
#Poll
def find_poll(id)
end
#Journal
def find_journal(id)
journal = Journal.find(id)
find_at_users(journal.journalized_type, journal.journalized_id)
end
#Document
def find_document(id)
find_project(Document.find(id).project_id)
end
#ProjectCreateInfo
def find_project_create_info(id)
end
#Principal
def find_principal(id)
end
#BlogComment
def find_blog_comment(id)
blog = BlogComment.find(id).blog
blog.users
end
end

View File

@ -79,6 +79,13 @@ class BoardsController < ApplicationController
end
end
end
@project.boards.each do |board|
board.messages.each do |m|
User.current.at_messages.unviewed('Message', m.id).each {|x| x.viewed!}
end
end
elsif @course
query_course_messages = @board.messages
query_course_messages.each do |query_course_message|

View File

@ -1,8 +1,10 @@
class ExerciseController < ApplicationController
layout "base_courses"
before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy, :commit_exercise, :commit_answer,:publish_exercise,:republish_exercise,:show_student_result]
before_filter :find_course, :only => [:index,:new,:create,:student_exercise_list]
before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy,
:commit_exercise, :commit_answer,:publish_exercise,:republish_exercise,
:show_student_result,:student_exercise_list]
before_filter :find_course, :only => [:index,:new,:create]
include ExerciseHelper
def index
@ -354,8 +356,20 @@ class ExerciseController < ApplicationController
end
def student_exercise_list
=begin
if @exercise.end_time <= Time.now
@course.student.each do |student|
if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,@exercise.id).empty?
ExerciseUser.create(:user_id => student.student_id, :exercise_id => @exercise.id, :start_at => @exercise.end_time, :status => true,:score=>0)
end
s_score = calculate_student_score(@exercise, student.student)
exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", student.student_id, @exercise.id).first
exercise_user.update_attributes(:score => s_score)
end
end
=end
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
@exercise = Exercise.find params[:id]
@all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc")
@exercise_count = @exercise.exercise_users.where('score is not NULL').count
if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time <= Time.now)
@ -543,11 +557,11 @@ class ExerciseController < ApplicationController
def show_student_result
@user = User.find params[:user_id]
@can_edit_excercise = false
@exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first
@exercise_questions = @exercise.exercise_questions
score = calculate_student_score(@exercise, @user)
eu = get_exercise_user(@exercise.id, @user.id)
eu.update_attributes(:score => score)
@exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first
respond_to do |format|
format.html {render :layout => 'base_courses'}
end
@ -565,15 +579,15 @@ class ExerciseController < ApplicationController
standard_answer = get_user_standard_answer(question, user)
unless answer.empty?
# 问答题有多个答案
if question.question_type == 3
if question.question_type == 3 && !standard_answer.empty?
if standard_answer.include?(answer.first.answer_text)
score1 = score1+ question.question_score unless question.question_score.nil?
end
elsif question.question_type == 1
elsif question.question_type == 1 && !standard_answer.nil?
if answer.first.exercise_choice.choice_position == standard_answer.exercise_choice_id
score2 = score2 + question.question_score unless question.question_score.nil?
end
else
elsif question.question_type == 2 && !standard_answer.nil?
arr = get_mulscore(question, user)
if arr.to_i == standard_answer.exercise_choice_id
score3 = score3 + question.question_score unless question.question_score.nil?

View File

@ -19,6 +19,14 @@ class HomeworkCommonController < ApplicationController
@is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,@course))
@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
@ -84,9 +92,20 @@ class HomeworkCommonController < ApplicationController
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"

View File

@ -118,6 +118,14 @@ class IssuesController < ApplicationController
# 当前用户查看指派给他的缺陷消息,则设置消息为已读
query = ForgeMessage.where("forge_message_type =? and user_id =? and forge_message_id =?", "Issue", User.current, @issue).first
query.update_attribute(:viewed, true) unless query.nil?
# issue 新建的at消息
User.current.at_messages.unviewed('Issue', @issue.id).each {|x| x.viewed!}
# 回复的at消息
@issue.journals.each do |j|
User.current.at_messages.unviewed('Journal', j.id).each {|x| x.viewed!}
end
# 缺陷状态更新
query_journals = @issue.journals
query_journals.each do |query_journal|
@ -145,24 +153,17 @@ class IssuesController < ApplicationController
@project_base_tag = (params[:project_id] || @issue.project) ? 'base_projects':'base'#by young
@available_watchers = (@issue.project.users.sort + @issue.watcher_users).uniq
#id name email
#1. issues list persons
#2. project persons
@at_persons = @journals.map(&:user) + @issue.project.users
@at_persons = @at_persons.uniq{|u| u.id}.delete_if{|u| u.id == User.current.id}
@at_persons = nil
respond_to do |format|``
format.html {
retrieve_previous_and_next_issue_ids
render :template => 'issues/show', :layout => @project_base_tag#by young
}
format.api
format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
format.pdf {
pdf = issue_to_pdf(@issue, :journals => @journals)
send_data(pdf, :type => 'application/pdf', :filename => filename_for_content_disposition("#{@project.identifier}-#{@issue.id}.pdf") )
}
respond_to do |format|
format.html {
retrieve_previous_and_next_issue_ids
render :template => 'issues/show', :layout => @project_base_tag#by young
}
format.api
format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
format.pdf {
pdf = issue_to_pdf(@issue, :journals => @journals)
send_data(pdf, :type => 'application/pdf', :filename => filename_for_content_disposition("#{@project.identifier}-#{@issue.id}.pdf") )
}
end
end

View File

@ -348,10 +348,6 @@ update
# end
# end
@changesets = g.commits(@project.gpid, :ref_name => @rev)
# @changesets = @repository.latest_changesets(@path, @rev)
# @changesets_count = @repository.latest_changesets(@path, @rev).count
@ -378,19 +374,6 @@ update
alias_method :browse, :show
#add by hx
def count_commits(project_id , left , right)
count = 0
(left..right).each do |page|
if $g.commits(project_id,:page => page).count == 0
break
else
count = count + $g.commits(project_id,:page => page).count
end
end
return count
end
def changes
@entry = @repository.entry(@path, @rev)
(show_error_not_found; return) unless @entry
@ -400,26 +383,10 @@ update
@commits = g.commits(@project.gpid, page:(params[:page].to_i - 1).to_s)
#add by hx
if g.commits(@project.gpid , :page=>200).count > 0
count = 4020
elsif g.commits(@project.gpid , :page=>25).count==0
count = count_commits(@project.gpid , 0 , 25)
elsif g.commits(@project.gpid , :page=>50).count ==0
count = count_commits(@project.gpid , 25 , 50)+ 25 * 20
elsif g.commits(@project.gpid , :page=>75).count ==0
count = count_commits(@project.gpid , 50 , 75)+ 50 * 20
elsif g.commits(@project.gpid , :page=>100).count== 0
count = count_commits(@project.gpid , 75 , 100) + 75 * 20
elsif g.commits(@project.gpid , :page=>125).count==0
count = count_commits(@project.gpid , 100 , 125) + 100 * 20
elsif g.commits(@project.gpid , :page=>150).count==0
count = count_commits(@project.gpid , 125 , 150) + 125 * 20
else
count = count_commits(@project.gpid , 150 ,200) + 150 * 20
end
rep_count = commit_count(@project)
#页面传递必须要str类型,但是Paginator的初始化必须要num类型,需要类型转化
@commits_count = count
@commits_count = rep_count
@commits_pages = Redmine::Pagination::Paginator.new @commits_count,limit,params[:page]
@commit = g.commit(@project.gpid,@rev)

View File

@ -215,7 +215,6 @@ class StudentWorkController < ApplicationController
student_work ||= StudentWork.new
student_work.name = params[:student_work][:name]
student_work.description = params[:student_work][:description]
student_work.project_id = params[:student_work][:project_id]
student_work.homework_common_id = @homework.id
student_work.user_id = User.current.id
student_work.save_attachments(params[:attachments])
@ -305,15 +304,28 @@ class StudentWorkController < ApplicationController
@work.save_attachments(params[:attachments])
render_attachment_warning_if_needed(@work)
if @work.save
if @homework.homework_type == 3
@student_work_project = @homework.student_work_projects.where("user_id=?",User.current.id).first
student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",@work.id,0)
student_work_projects.delete_all
members = params[:group_member_ids].split(',')
for i in 1 .. members.count-1
stu_project = StudentWorkProject.new
stu_project.homework_common_id = @homework.id
stu_project.student_work_id = @work.id
if @homework.homework_detail_group.base_on_project == 1
stu_project.project_id = @student_work_project.project_id
else @homework.homework_detail_group.base_on_project == 0
stu_project.project_id = -1
end
stu_project.user_id = members[i].to_i
stu_project.is_leader = 0
stu_project.save
end
end
course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"edit",:course_message_id=>@work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录
course_message.save
=begin
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_edit)
redirect_to student_work_index_url(:homework => @homework.id)
}
=end
@student_work = @work
respond_to do |format|
format.js
@ -689,7 +701,12 @@ class StudentWorkController < ApplicationController
unless params[:name].nil?
name = params[:name]
end
all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")"
if @homework.homework_detail_group.base_on_project == 0
all_student_ids = "(" + @homework.course.student.map{|student| student.student_id}.join(",") + ")"
else
pro = Project.find @homework.student_work_projects.where("user_id=?",User.current.id).first.project_id
all_student_ids = "(" + pro.members.map{|member| member.user_id}.join(",") + ")"
end
all_students = User.where("id in #{all_student_ids}")
@commit_student_ids = @homework.student_work_projects.map{|student| student.user_id}
@users = searchstudent_by_name all_students,name

View File

@ -415,6 +415,7 @@ class UsersController < ApplicationController
def user_select_homework
homework = HomeworkCommon.find_by_id params[:checkMenu]
homework_detail_programing = homework.homework_detail_programing
homework_detail_group = homework.homework_detail_group
@homework = HomeworkCommon.new
@select_course = params[:select_course] || 0
if homework
@ -444,6 +445,14 @@ class UsersController < ApplicationController
)
end
end
if homework_detail_group
@homework.homework_detail_group = HomeworkDetailGroup.new
@homework_detail_group = @homework.homework_detail_group
@homework_detail_group.min_num = homework_detail_group.min_num
@homework_detail_group.max_num = homework_detail_group.max_num
@homework_detail_group.base_on_project = homework_detail_group.base_on_project
end
end
respond_to do |format|
format.js

View File

@ -668,6 +668,42 @@ module ApplicationHelper
return rep.blank? ? true :false
end
# 获取Gitlab版本库提交总数
def commit_count(project)
g = Gitlab.client
#add by hx
if g.commits(project.gpid , :page=>200).count > 0
count = 4020
elsif g.commits(project.gpid , :page=>25).count==0
count = count_commits(project.gpid , 0 , 25)
elsif g.commits(project.gpid , :page=>50).count ==0
count = count_commits(project.gpid , 25 , 50)+ 25 * 20
elsif g.commits(project.gpid , :page=>75).count ==0
count = count_commits(project.gpid , 50 , 75)+ 50 * 20
elsif g.commits(project.gpid , :page=>100).count== 0
count = count_commits(project.gpid , 75 , 100) + 75 * 20
elsif g.commits(project.gpid , :page=>125).count==0
count = count_commits(project.gpid , 100 , 125) + 100 * 20
elsif g.commits(project.gpid , :page=>150).count==0
count = count_commits(project.gpid , 125 , 150) + 125 * 20
else
count = count_commits(project.gpid , 150 ,200) + 150 * 20
end
end
#add by hx
def count_commits(project_id , left , right)
count = 0
(left..right).each do |page|
if $g.commits(project_id,:page => page).count == 0
break
else
count = count + $g.commits(project_id,:page => page).count
end
end
return count
end
# 获取单一gitlab项目
def gitlab_repository(project)
rep = Repository.where("project_id =? and type =?", project.id,"Repository::Gitlab" ).first
@ -1716,6 +1752,13 @@ module ApplicationHelper
#
def javascript_include_tag(*sources)
options = sources.last.is_a?(Hash) ? sources.pop : {}
@sources ||= []
sources = sources.delete_if do|source|
@sources.include?(source)
end
@sources += sources
if plugin = options.delete(:plugin)
sources = sources.map do |source|
if plugin
@ -1725,7 +1768,12 @@ module ApplicationHelper
end
end
end
super sources, options
if sources && !sources.empty?
super(sources, options)
else
''
end
end
def content_for(name, content = nil, &block)
@ -2676,19 +2724,8 @@ int main(int argc, char** argv){
end
def import_ke(default_opt={})
opt = {enable_at: true, prettify: false, init_activity: false}.merge default_opt
opt = {enable_at: false, prettify: false, init_activity: false}.merge default_opt
ss = ''
if opt[:enable_at]
ss = '<script type="text/javascript">'
ss += 'window.atPersonLists = [];'
@at_persons && @at_persons.each_with_index do |person,index|
ss += "var o = {id: #{index}, name: '#{person.show_name}', login: '#{person.login}', searchKey: '#{person.get_at_show_name}'};"
ss += "atPersonLists.push(o);"
end
ss += "</script>"
end
ss += javascript_include_tag("/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg')
if opt[:enable_at]

View File

@ -43,8 +43,9 @@ module ExerciseHelper
ecs.each do |ec|
arr << ec.exercise_choice.choice_position
end
arr.sort
arr = arr.join("")
#arr = arr.sort
str = arr.sort.join("")
return str
end
# 判断用户是否已经提交了问卷

View File

@ -22,6 +22,7 @@ module ProjectScoreHelper
#代码提交数量
def changesets_num project
# commit_count(project)
project.changesets.count
end

View File

@ -19,6 +19,7 @@
include AvatarHelper
include StudentWorkHelper
include ApiHelper
module ProjectsHelper
def link_to_version(version, options = {})
return '' unless version && version.is_a?(Version)

View File

@ -89,7 +89,8 @@ module UsersHelper
forge_count = ForgeMessage.where("user_id =? and viewed =?", user, 0).count
user_feedback_count = UserFeedbackMessage.where("user_id =? and viewed =?", user, 0).count
user_memo_count = MemoMessage.where("user_id =? and viewed =?", user, 0).count
messages_count = course_count + forge_count + user_feedback_count + user_memo_count
at_count = user.at_messages.where(viewed: false).count
messages_count = course_count + forge_count + user_feedback_count + user_memo_count + at_count
end
def user_mail_notification_options(user)

102
app/models/at_message.rb Normal file
View File

@ -0,0 +1,102 @@
#coding=utf-8
class AtMessage < ActiveRecord::Base
belongs_to :user
belongs_to :sender, class_name: "User", foreign_key: "sender_id"
attr_accessible :at_message, :container, :viewed, :user_id, :sender_id
belongs_to :at_message, polymorphic: true
belongs_to :container, polymorphic: true
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
validates :user_id, :sender_id, :at_message_id, :at_message_type, presence: true
after_create :add_user_message
scope :unviewed, ->(type, id){
where(at_message_type: type, at_message_id:id, viewed: false)
}
def viewed!
update_attribute :viewed, true
end
def at_valid?
return true if at_message_type == 'Issue'
return true if 'Journal' == at_message_type
return true if 'JournalsForMessage' == at_message_type
return true if 'Message' == at_message_type
false
end
def add_user_message
if MessageAll.where(message_type: self.class.name,message_id: self.id).empty?
self.message_alls << MessageAll.new(:user_id => self.user_id)
end
end
def subject
case at_message_type
when "Issue"
"新建问题: " + at_message.subject
when "Journal"
"问题留言: " + at_message.journalized.subject
when 'Message'
if(at_message.topic?)
"发布新帖: "
else
"回复帖子: "
end + at_message.subject
when 'JournalsForMessage'
"作业留言: " + at_message.jour.description
else
logger.error "error type: #{at_message_type}"
end
end
def description
case at_message_type
when "Issue"
at_message.description
when "Journal"
at_message.notes
when 'Message'
at_message.content
when "JournalsForMessage"
at_message.notes
else
logger.error "error type: #{at_message_type}"
end
end
def author
case at_message_type
when "Issue"
at_message.author
when "Journal"
at_message.user
when 'Message'
at_message.author
when 'JournalsForMessage'
at_message.user
else
logger.error "error type: #{at_message_type}"
end
end
def url
case at_message_type
when "Issue"
{controller: :issues, action: :show, id: at_message}
when "Journal"
{controller: :issues, action: :show, id: at_message.journalized}
when 'Message'
{controller: :boards, action: :show, project_id: at_message.board.project, id: at_message.board}
when 'JournalsForMessage'
{controller: :homework_common, action: :index, course: at_message.jour.course_id}
else
logger.error "error type: #{at_message_type}"
end
end
end

View File

@ -52,6 +52,7 @@ class Issue < ActiveRecord::Base
# ForgeMessage虚拟关联(多态)
has_many :forge_messages, :class_name => 'ForgeMessage',:as =>:forge_message ,:dependent => :destroy
has_many :at_messages, class_name: 'AtMessage', as: :at_message ,:dependent => :destroy
acts_as_nested_set :scope => 'root_id', :dependent => :destroy
acts_as_attachable :before_add => :attachment_added, :after_remove => :attachment_removed
@ -82,7 +83,7 @@ class Issue < ActiveRecord::Base
attr_reader :current_journal
# fq
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message
after_create :act_as_activity,:be_user_score_new_issue,:act_as_forge_activity, :act_as_forge_message, :act_as_at_message
after_update :be_user_score
after_destroy :down_user_score
# after_create :be_user_score
@ -156,6 +157,14 @@ class Issue < ActiveRecord::Base
end
end
# at 功能添加消息提醒
def act_as_at_message
users = self.description.scan /<span class="at" data-user-id="(\d+?)">/m
users && users.flatten.uniq.each do |uid|
self.at_messages << AtMessage.new(user_id: uid, sender_id: self.author_id)
end
end
# 更新缺陷
#def act_as_forge_message_update
# unless self.author_id == self.assigned_to_id

View File

@ -31,7 +31,9 @@ class Journal < ActiveRecord::Base
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
# 被ForgeMessage虚拟关联
has_many :forge_messages, :class_name => 'ForgeMessage',:as =>:forge_message ,:dependent => :destroy
# end
has_many :at_messages, as: :at_message, dependent: :destroy
attr_accessor :indice
acts_as_event :title =>Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.project_index}#{status}: #{o.issue.subject}" },
@ -50,7 +52,7 @@ class Journal < ActiveRecord::Base
before_create :split_private_notes
# fq
after_save :act_as_activity,:be_user_score,:act_as_forge_activity, :act_as_forge_message
after_save :act_as_activity,:be_user_score,:act_as_forge_activity, :act_as_forge_message, :act_as_at_message
# end
#after_destroy :down_user_score
#before_save :be_user_score
@ -184,6 +186,13 @@ class Journal < ActiveRecord::Base
end
end
def act_as_at_message
users = self.notes.scan /<span class="at" data-user-id="(\d+?)">/m
users && users.flatten.uniq.each do |uid|
self.at_messages << AtMessage.new(user_id: uid, sender_id: self.user_id)
end
end
# 更新用户分数 -by zjc
def be_user_score
#新建了缺陷留言且留言不为空,不为空白

View File

@ -64,8 +64,10 @@ class JournalsForMessage < ActiveRecord::Base
has_many :course_messages, :class_name => 'CourseMessage',:as =>:course_message ,:dependent => :destroy
has_many :user_feedback_messages, :class_name => 'UserFeedbackMessage', :as =>:journals_for_message, :dependent => :destroy
has_many :at_messages, as: :at_message, dependent: :destroy
validates :notes, presence: true, if: :is_homework_jour?
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score
after_create :act_as_activity, :act_as_course_activity, :act_as_course_message, :act_as_at_message, :act_as_user_feedback_message, :act_as_principal_activity, :act_as_student_score
after_create :reset_counters!
after_destroy :reset_counters!
after_save :be_user_score
@ -240,6 +242,12 @@ class JournalsForMessage < ActiveRecord::Base
end
end
def act_as_at_message
users = self.notes.scan /<span class="at" data-user-id="(\d+?)">/m
users && users.flatten.uniq.each do |uid|
self.at_messages << AtMessage.new(user_id: uid, sender_id: self.user_id)
end
end
# 用户留言消息通知
def act_as_user_feedback_message
# 主留言
@ -267,7 +275,7 @@ class JournalsForMessage < ActiveRecord::Base
# 课程成员得分(英雄榜)
def act_as_student_score
unless self.user.allowed_to?(:as_teacher, self.jour)
if !self.user.allowed_to?(:as_teacher, self.jour) && self.jour_type == "Course"
course_member_score(self.jour_id, self.user_id, "JournalForMessage")
end
end

View File

@ -395,13 +395,13 @@ class Mailer < ActionMailer::Base
user = User.find_by_mail(recipients)
@user = user
@token = Token.get_token_from_user(user, 'autologin')
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :token => @token.value)
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
# edit
@issue_author_url = url_for(user_activities_url(@author,:token => @token.value))
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id, :token => @token.value)
@issue_author_url = url_for(user_activities_url(@author))
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id)
@user_url = url_for(my_account_url(user,:token => @token.value))
@user_url = url_for(my_account_url(user))
subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
@ -471,7 +471,7 @@ class Mailer < ActionMailer::Base
recipients = @project.manager_recipients
s = l(:text_applied_project, :id => "##{@user.show_name}", :project => @project.name)
@token = Token.get_token_from_user(@user, 'autologin')
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members', :token => @token.value)
@applied_url = url_for(:controller => 'projects', :action => 'settings', :id => @project.id,:tab=>'members')
mail :to => recipients,
:subject => s
end

View File

@ -38,7 +38,7 @@ class Message < ActiveRecord::Base
# 课程/项目 消息
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
has_many :forge_messages, :class_name => 'ForgeMessage', :as => :forge_message, :dependent => :destroy
#end
has_many :at_messages, as: :at_message, dependent: :destroy
has_many :ActivityNotifies,:as => :activity, :dependent => :destroy
@ -74,7 +74,7 @@ class Message < ActiveRecord::Base
after_update :update_messages_board
after_destroy :reset_counters!,:down_user_score,:delete_kindeditor_assets
after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score
after_create :act_as_activity,:act_as_course_activity,:be_user_score,:act_as_forge_activity, :act_as_system_message, :send_mail, :act_as_student_score, :act_as_at_message
#before_save :be_user_score
scope :visible, lambda {|*args|
@ -96,6 +96,10 @@ class Message < ActiveRecord::Base
end
}
def topic?
parent_id.nil?
end
def visible?(user=User.current)
if project
!user.nil? && user.allowed_to?(:view_messages, project)
@ -237,6 +241,13 @@ class Message < ActiveRecord::Base
end
end
end
def act_as_at_message
users = self.content.scan /<span class="at" data-user-id="(\d+?)">/m
users && users.flatten.uniq.each do |uid|
self.at_messages << AtMessage.new(user_id: uid, sender_id: self.author_id)
end
end
#更新用户分数 -by zjc
def be_user_score

View File

@ -161,6 +161,7 @@ class User < Principal
has_many :user_feedback_messages
has_one :onclick_time
has_many :system_messages
has_many :at_messages
# 虚拟转换
has_many :new_jours, :as => :jour, :class_name => 'JournalsForMessage', :conditions => "status=1"
@ -400,16 +401,7 @@ class User < Principal
end
def show_name
name = ""
unless self.user_extensions.nil?
if self.user_extensions.identity == 2
name = firstname
else
name = lastname+firstname
end
else
name = lastname+firstname
end
name = lastname + firstname
name.empty? || name.nil? ? login : name
end
## end

View File

@ -0,0 +1,6 @@
[
<% @users && @users.each_with_index do |person,index| %>
{"id":<%=index%>, "userid": <%=person.id%>, "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"}
<%= index != @users.size-1 ? ',' : '' %>
<% end %>
]

View File

@ -15,10 +15,10 @@
<label class="fl" >&nbsp;&nbsp;<%= l(:field_quote)%>&nbsp;&nbsp;</label>
<!--<textarea name="bid[description]" placeholder="最多3000个汉字(或6000个英文字符)" class="hwork_text fl"></textarea>-->
<% if edit_mode %>
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:owner_id => bid.id,:owner_type =>OwnerTypeHelper::BID,:resizeType => 0 %>
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:owner_id => bid.id,:owner_type =>OwnerTypeHelper::BID,:resizeType => 0,act_id: @course.id, act_type: @course.class.to_s %>
<% else %>
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:resizeType => 0 %>
<%= f.kindeditor :description,:width=>'91%',:editor_id => 'bid_description_editor',:resizeType => 0, act_id: @course.id, act_type: @course.class.to_s %>
<% end %>
</li>
<div class="cl"></div>

View File

@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
<%= import_ke(enable_at: true, prettify: false) %>
<%= javascript_include_tag 'blog' %>
<% end %>
@ -34,7 +34,9 @@
:class => 'talk_text fl',
:input_html => { :id => 'message_content',
:class => 'talk_text fl',
:maxlength => 5000 }%>
:maxlength => 5000 },
act_id: article.id, act_type: article.class.to_s
%>
<div class="cl"></div>
<p id="message_content_span"></p>
</div>

View File

@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
<%= import_ke(enable_at: true, prettify: false) %>
<% end %>
<li>
<div style="display: none ;" class="fl"><label><span class="c_red">*</span>&nbsp;<%= l(:field_subject) %>&nbsp;&nbsp;</label></div>
@ -27,7 +27,9 @@
:minHeight=>100,
:input_html => { :id => 'message_content',
:class => 'talk_text fl',
:maxlength => 5000 }%>
:maxlength => 5000 },
at_id: article.id, at_type: article.class.to_s
%>
<div class="cl"></div>
<p id="message_content_span"></p>
</li>

View File

@ -3,7 +3,7 @@ if($("#reply_message_<%= @blogComment.id%>").length > 0) {
$(function(){
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
init_activity_KindEditor_data(<%= @blogComment.id%>,null,"85%");
init_activity_KindEditor_data(<%= @blogComment.id%>,null,"85%", "<%=@blogComment.class.to_s%>");
});
}else if($("#reply_to_message_<%= @blogComment.id%>").length >0) {
$("#reply_to_message_<%= @blogComment.id%>").replaceWith("<p id='reply_message_<%= @blogComment.id%>'></p>");

View File

@ -1,7 +1,7 @@
<% if @in_user_center%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
<% else%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'blogs/article', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
<% end %>

View File

@ -27,7 +27,7 @@
}
}
$(function() {
init_activity_KindEditor_data(<%= @article.id%>,null,"85%");
init_activity_KindEditor_data(<%= @article.id%>,null,"85%", '<%=@article.class.to_s%>');
showNormalImage('message_description_<%= @article.id %>');
});
</script>

View File

@ -74,7 +74,7 @@
}
$(function () {
init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>");
showNormalImage('activity_description_<%= topic.id %>');
/*var description_images=$("div#activity_description_<%#= topic.id %>").find("img");
if (description_images.length>0) {

View File

@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
<%= import_ke(enable_at: true, prettify: false) %>
<% end %>
<%= error_messages_for 'message' %>
@ -34,7 +34,9 @@
:class => 'talk_text fl',
:input_html => { :id => 'message_content',
:class => 'talk_text fl',
:maxlength => 5000 }%>
:maxlength => 5000 },
at_id: topic.id, at_type: topic.class.to_s
%>
<div class="cl"></div>
<p id="message_content_span"></p>
</div>

View File

@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
<%= import_ke(enable_at: true, prettify: false) %>
<%= javascript_include_tag "init_activity_KindEditor" %>
<% end %>
@ -74,7 +74,7 @@
}
$(function () {
init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>");
showNormalImage('activity_description_<%= topic.id %>');
/*var description_images=$("div#activity_description_<%#= topic.id %>").find("img");
if (description_images.length>0) {

View File

@ -20,7 +20,7 @@
<% end %>
<div class="cl"></div>
<div class=" talklist_box" >
<div class="talk_new ml15 mb10" nhname="about_talk" style="display:none;">
<div class="talk_new ml15 mb10" nhname="about_talk" data-at-id="<%= project.id %>" data-at-type="Project" style="display:none;">
<ul>
<%= render :partial => 'project_new_topic' %>
</ul>
@ -111,7 +111,7 @@
<a href="javascript:void(0)" nhname="showbtn_reply" class="c_dblue fr f14" style="margin-right:10px;"><%= l(:button_reply) %></a>
<% end %>
<div class="cl"></div>
<div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" style="display: none;border-top: 1px dashed #d9d9d9;padding-top:5px;margin-left:0px;padding-left:15px;">
<div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" data-at-id="<%= topic.id %>" data-at-type="<%= topic.class.name %>" style="display: none;border-top: 1px dashed #d9d9d9;padding-top:5px;margin-left:0px;padding-left:15px;">
<ul>
<%= render :partial => 'edit',locals: {:topic => topic} %>
</ul>
@ -120,7 +120,7 @@
<div class="talkWrapBox">
<% reply = Message.new(:subject => "RE: #{topic.subject}")%>
<% if !topic.locked? && authorize_for('messages', 'reply') %>
<div class="talkWrapMsg" nhname="about_talk_reply" style="display: none;">
<div class="talkWrapMsg" nhname="about_talk_reply" data-at-id="<%= topic.id %>" data-at-type="<%= topic.class.name %>" style="display: none;">
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml15 mb10" style="margin-left:30px;" id="reply<%= topic.id %>">

View File

@ -28,7 +28,7 @@
window.attachEvent("onload", buildsubmenus)
</script>
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
<%= import_ke(enable_at: true, prettify: false) %>
<% end %>
@ -102,6 +102,10 @@ function nh_init_board(params){
if(/trident/.test(userAgent)){
$("div.talk_new .ke-container").css({'margin-left':'0px'});
}
if(typeof enableAt === 'function'){
enableAt(this,params.about_talk.attr('data-at-id'), params.about_talk.attr('data-at-type'));
}
// var toolbar = $("div[class='ke-toolbar']",params.about_talk);
// $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
// params.toolbar_container.append(toolbar);

View File

@ -3,4 +3,4 @@ $("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(r
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'projects/project_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
<% end %>
init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%");
init_activity_KindEditor_data('<%= @user_activity_id%>',"","87%", "UserActivity");

View File

@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<style type="text/css">
@ -19,7 +19,7 @@
}
span.ke-toolbar-icon-url {
background-image: url(/images/public_icon.png)
background-image: url("/images/public_icon.png")
}
div.ke-toolbar .ke-outline {
@ -72,7 +72,7 @@
}
$(function () {
init_activity_KindEditor_data(<%= activity.id%>, null, "87%");
init_activity_KindEditor_data(<%= activity.id%>, null, "87%", "<%= activity.class.to_s %>");
showNormalImage('activity_description_<%= activity.id %>');
if($("#intro_content_<%= activity.id %>").height() > 360) {
$("#intro_content_show_<%= activity.id %>").show();

View File

@ -1,22 +1,20 @@
<style type="text/css">
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:570px;}
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
/*.ke-container{height: 80px !important;}*/
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:570px;}
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
/*.ke-container{height: 80px !important;}*/
</style>
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<script >
init_KindEditor_data('',80);
</script>
@ -24,11 +22,11 @@
<h4><%= l(:label_leave_message) %></h4>
<% if !User.current.logged?%>
<div style="font-size: 14px;margin:20px;">
<%= l(:label_user_login_tips) %>
<%= link_to l(:label_user_login_new), signin_path %>
<hr/>
</div>
<div style="font-size: 14px;margin:20px;">
<%= l(:label_user_login_tips) %>
<%= link_to l(:label_user_login_new), signin_path %>
<hr/>
</div>
<% else %>
<div nhname='new_message_' style="display:none;">
<%= form_for('new_form',:url => {:controller => 'words', :action => 'leave_course_message'}, :html=>{:id => "course_feedback_new"},:method => "post") do |f|%>
@ -59,37 +57,37 @@
$("#submit_feedback_course").one('click',function() {
$("#course_feedback_new").submit();
});
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent('div').parent('div');
params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
params.height = 55;
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
});
}
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
}
},300);
params.textarea.data('init',1);
});
KindEditor.ready(function(K){
$("a[nhname='reply_btn']").live('click',function(){
var params = {};
params.kindutil = K;
params.container = $(this).parent('div').parent('div');
params.div_form = $(">.respond-form",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
params.height = 55;
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
params.cancel_btn.click(function(){
nh_reset_form(params);
});
}
params.cancel_btn.click();
toggleAndSettingWordsVal(params.div_form, params.textarea);
setTimeout(function(){
if(!params.div_form.is(':hidden')){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
}
},300);
params.textarea.data('init',1);
});
});
});
});
</script>

View File

@ -1,6 +1,6 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<%= javascript_include_tag 'blog' %>
<% end %>
@ -40,7 +40,7 @@
}
}
$(function() {
init_activity_KindEditor_data(<%= @article.id%>,null,"87%");
init_activity_KindEditor_data(<%= @article.id%>,null,"87%", "<%=@article.class.to_s%>");
showNormalImage('message_description_<%= @article.id %>');
});
</script>

View File

@ -32,7 +32,7 @@
<div>
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
<br />
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) if exercise_question.exercise_standard_answers.first %>
</div>
<div class="cl"></div>
<div class="ur_inputs">
@ -64,7 +64,7 @@
<div>
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
<br />
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) if exercise_question.exercise_standard_answers.first%>
</div>
<div class="cl"></div>
<div class="ur_inputs">

View File

@ -35,17 +35,19 @@
});
$(function(){
<% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
$("#show_student_result_div").on('click',show_result);
$("#show_student_result_div_<%= exercise.id%>").on('click',function() {
window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user_id) %>';
});
<% else %>
$("#show_student_result_div").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#show_student_result_div_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_name_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_id_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
$("#student_class_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
<% end %>
});
function show_result() {
window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>';
}
/*function show_result(id) {
window.location.href = '<%#=show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>';
}*/
</script>
<ul class="hworkListRow" id="student_work_<%= exercise.id%>">
<li class="hworkList340 width530">
@ -53,7 +55,7 @@
<li class="hworkPortrait mt15 mr10">
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
</li>
<div id="show_student_result_div" style="cursor: pointer;" class="student_work_<%= exercise.id%>">
<div id="show_student_result_div_<%= exercise.id%>" style="cursor: pointer;" class="student_work_<%= exercise.id%>">
<li>
<ul class="mt10 fl">
<li class="hworkStName mr15 mt16" title="姓名" id="student_name_<%= exercise.id%>">

View File

@ -2,10 +2,10 @@
alert('启动成功');
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
<% end %>
/*$("#<%#= @homework.id %>_start_anonymous_comment").replaceWith('<%#= escape_javascript(link_to "关闭匿评", alert_anonymous_comment_homework_common_path(@homework), remote: true, id:"#{@homework.id}_stop_anonymous_comment",:class => "postOptionLink")%>');*/
<% elsif @statue == 2 %>

View File

@ -1,10 +1,10 @@
alert('关闭成功');
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
<% end %>
/*
$("#<%#= @homework.id %>_stop_anonymous_comment").replaceWith('');*/

View File

@ -1,9 +1,8 @@
<div id="issue_edit" style="display: none">
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
<% end %>
<%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true,:remote=>true} do |f| %>
<%= error_messages_for 'issue', 'time_entry' %>
<%= render :partial => 'conflict' if @conflict %>
@ -21,9 +20,23 @@
</div>
<input name="issue_quote_new" type="hidden" value="<%= %>" />
<fieldset><legend>回复</legend>
<%= f.kindeditor :notes, :style => "width:99%;",:height=>'100px', :cssData =>"blockquote { padding:0px}", :rows => "5", :no_label => true, :editor_id=>'issue_journal_kind_reply', at_id: @issue.id, at_type: @issue.class.to_s %>
</fieldset>
<!--<%# if @issue.safe_attribute? 'private_notes' %>-->
<!--<label for="issue_private_notes"><%#= f.check_box :private_notes, :no_label => true %> <%#= l(:field_private_notes) %></label>-->
<!--<%# end %>-->
<%= call_hook(:view_issues_edit_notes_bottom, {:issue => @issue, :notes => @notes, :form => f}) %>
<!--</fieldset>-->
<!--<fieldset><legend><%#= l(:label_attachment_plural) %></legend>-->
<!--<p style="padding-top: 5px;"><%#= render :partial => 'attachments/new_form', :locals => {:container => @issue} %>
<!--</fieldset>-->
<div class="cl"></div>
<%= f.hidden_field :lock_version %>
<%= hidden_field_tag 'last_journal_id', params[:last_journal_id] || @issue.last_journal_id %>
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id] %>
<% end %>
</div>
</div>

View File

@ -49,7 +49,7 @@
<%= f.label_for_field :description, :required => @issue.required_attribute?('description'), :no_label => true, :class => "label" %>
<%#= link_to_function image_tag('edit.png'), '$(this).hide(); $("#issue_description_and_toolbar").show()' unless @issue.new_record? %>
<%#= content_tag 'span', :id => "issue_description_and_toolbar" do %>
<%= f.kindeditor :description,:editor_id => "issue_desc_editor", :width=>'85%', :resizeType => 0, :no_label => true %>
<%= f.kindeditor :description,:editor_id => "issue_desc_editor", :width=>'87%', :resizeType => 0, :no_label => true,at_id: @project.id, at_type: @project.class.to_s %>
<%# end %>
<%#= wikitoolbar_for 'issue_description' %>
<% end %>
@ -103,4 +103,4 @@
<%= call_hook(:view_issues_form_details_bottom, {:issue => @issue, :form => f}) %>
<% end %>
<a href="javascript:void(0);" onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="blue_btn fl ml80"> 确定</a>
<a href="javascript:void(0);" onclick="issueDetailShow();" class="grey_btn fl mr50" > 取消 </a>
<a href="javascript:void(0);" onclick="issueDetailShow();" class="grey_btn fl mr50" > 取消 </a>

View File

@ -4,6 +4,6 @@
sd_create_editor_from_data(<%= @issue.id%>, null, "100%");
<%else%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", 'UserActivity');
// sd_create_editor_from_data(<%#= @issue.id%>, null, "100%");
<%end %>
<%end %>

View File

@ -1,3 +1,3 @@
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_project_issue', :locals => {:activity => @issue,:user_activity_id =>@user_activity_id}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");

View File

@ -1,5 +1,5 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
<% end %>
<script type="text/javascript">
$(function(){

View File

@ -2,9 +2,9 @@
<div class="footerAboutContainer">
<ul class="footerAbout">
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
<li class="fl"><a href="http://forge.trustie.net/projects/2/feedback" class="f_grey mw20" target="_blank"><%= l(:label_contact_us)%></a>|</li>
<li class="fl"><a href="https://forge.trustie.net/projects/2/feedback" class="f_grey mw20" target="_blank"><%= l(:label_contact_us)%></a>|</li>
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_recruitment_information)%></a>|</li>
<li class="fl"><a href="http://forge.trustie.net/forums/1/memos/1168" class="f_grey mw20" target="_blank"><%= l(:label_surpport_group)%></a>|</li>
<li class="fl"><%= link_to l(:label_surpport_group), "https://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|</li>
<li class="fl"><a href="javascript:void:(0);" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a>|</li>
<li class="fl"><a href="javascript:void:(0);" class="f_grey ml20" target="_blank"><%= l(:label_language)%></a>
<select class="languageBox">

View File

@ -4,7 +4,7 @@
<li class="fl"><a href="<%= about_us_path %>" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
<li class="fl"><a href="<%= agreement_path %>" class="f_grey mw20" target="_blank">服务协议</a>|</li>
<li class="fl" style="display: none"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li>
<li class="fl"><a href="http://forge.trustie.net/forums/1/memos/1168" class="f_grey mw20" target="_blank"><%= l(:label_surpport_group)%></a>|</li>
<li class="fl"><%= link_to l(:label_surpport_group), "https://#{Setting.host_name}/forums/1/memos/1168", :class => "f_grey mw20", :target=>"_blank" %>|</li>
<li class="fl"><a href="<%= forums_path(:reorder_complex=>'desc')%>" class="f_grey mw20" target="_blank" ><%= l(:label_forums)%></a></li>
</ul>

View File

@ -13,7 +13,7 @@
<%= link_to "作业", user_homeworks_user_path(User.current.id), :class => "c_white f16 db p10"%>
</li>
<li class="navHomepageMenu fl mr30">
<a href="http://forge.trustie.net/forums/1/memos/1168" class="c_white f16 db p10">帮助中心</a>
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>
</li>
</ul>
</div>

View File

@ -5,7 +5,7 @@
<div class="fl">
<ul>
<li class="navHomepageMenu fl mr40">
<a href="http://forge.trustie.net/forums/1/memos/1168" class="c_white f16 p10">帮助中心</a>
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>
</li>
</ul>
</div>

View File

@ -34,7 +34,7 @@
}
}
$(function() {
init_activity_KindEditor_data(<%= @memo.id%>,null,"87%");
init_activity_KindEditor_data(<%= @memo.id%>,null,"87%", "<%=@memo.class.to_s%>");
});
function del_confirm(){

View File

@ -27,7 +27,7 @@
}
}
$(function() {
init_activity_KindEditor_data(<%= @topic.id%>,null,"85%");
init_activity_KindEditor_data(<%= @topic.id%>,null,"85%", "<%=@topic.class.to_s%>");
showNormalImage('message_description_<%= @topic.id %>');
});
</script>

View File

@ -11,7 +11,7 @@ if($("#reply_message_<%= @message.id%>").length > 0) {
$(function(){
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
init_activity_KindEditor_data(<%= @message.id%>,null,"85%");
init_activity_KindEditor_data(<%= @message.id%>,null,"85%", "<%=@message.class.to_s%>");
});
}else if($("#reply_to_message_<%= @message.id%>").length >0) {
$("#reply_to_message_<%= @message.id%>").replaceWith("<p id='reply_message_<%= @message.id%>'></p>");

View File

@ -3,4 +3,4 @@
<%elsif @course%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%end%>
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");

View File

@ -1,2 +1,2 @@
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/user_blog', :locals => {:activity => @article,:user_activity_id =>@user_activity_id}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");

View File

@ -1,3 +1,2 @@
$("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'organizations/show_org_document', :locals => {:document => @document,:flag => params[:flag], :act => @act}) %>");
init_activity_KindEditor_data(<%= @act.id %>,"","87%");
init_activity_KindEditor_data(<%= @act.id %>,"","87%", "<%=@act.class.to_s%>");

View File

@ -19,7 +19,7 @@
<% @documents.each do |document| %>
<script>
$(function() {
init_activity_KindEditor_data(<%= OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first.id %>, null, "87%");
init_activity_KindEditor_data(<%= OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first.id %>, null, "87%", "OrgActivity");
});
</script>
<%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %>

View File

@ -3,7 +3,7 @@ if($("#reply_message_<%= @org_comment.id%>").length > 0) {
$(function(){
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
init_activity_KindEditor_data(<%= @org_comment.id%>,null,"85%");
init_activity_KindEditor_data(<%= @org_comment.id%>,null,"85%", "<%=@org_comment.class.to_s%>");
});
}else if($("#reply_to_message_<%= @org_comment.id %>").length >0) {
$("#reply_to_message_<%= @org_comment.id%>").replaceWith("<p id='reply_message_<%= @org_comment.id %>'></p>");

View File

@ -1,11 +1,7 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<%= javascript_include_tag 'blog' %>
<% end %>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor",'blog' %>
<script>
$(function() {
init_activity_KindEditor_data(<%= @document.id%>,null,"85%");
init_activity_KindEditor_data(<%= @document.id%>,null,"85%", "<%=@document.class.to_s%>");
showNormalImage('message_description_<%= @document.id %>');
});
</script>

View File

@ -2,7 +2,7 @@
<% org_activities.each do |act| %>
<script>
$(function() {
init_activity_KindEditor_data(<%= act.id%>, null, "87%");
init_activity_KindEditor_data(<%= act.id%>, null, "87%", "<%=act.class.to_s%>");
});
</script>
<% if act.container_type == 'Organization' %>

View File

@ -61,7 +61,7 @@
<% if !@organization.home_id.nil? and OrgDocumentComment.where("id = ?", @organization.home_id).count > 0 and params[:org_subfield_id].nil? %>
<script>
$(function() {
init_activity_KindEditor_data(<%= OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?",@organization.home_id).first.id %>, null, "87%");
init_activity_KindEditor_data(<%= OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?",@organization.home_id).first.id %>, null, "87%", 'OrgActivity');
});
</script>
<% act = OrgActivity.where("org_act_type = 'OrgDocumentComment' and org_act_id =?", @organization.home_id).first %>

View File

@ -1,4 +1,4 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor", '/assets/kindeditor/pasteimg', "init_activity_KindEditor" %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<style type="text/css">
/*回复框*/
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
@ -32,7 +32,7 @@
}
$(function () {
init_activity_KindEditor_data(<%= activity.id%>, null, "87%");
init_activity_KindEditor_data(<%= activity.id%>, null, "87%", "<%= activity.class.to_s %>");
showNormalImage('activity_description_<%= activity.id %>');
if ($("#intro_content_<%= activity.id %>").height() > 360) {
$("#intro_content_show_<%= activity.id %>").show();

View File

@ -5,9 +5,9 @@
<% if @repository.supports_cat? %>
<%= link_to_if action_name != 'entry', l(:button_view), {:action => 'entry', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), :rev => @rev } %> |
<% end %>
<% if @repository.supports_annotate? %>
<%= link_to_if action_name != 'annotate', l(:button_annotate), {:action => 'annotate', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), :rev => @rev } %> |
<% end %>
<%# if @repository.supports_annotate? %>
<%#= link_to_if action_name != 'annotate', l(:button_annotate), {:action => 'annotate', :id => @project, :repository_id => @repository.identifier_param, :path => to_path_param(@path), :rev => @rev } %>
<%# end %>
<%= link_to(l(:button_download),
{:action => 'raw', :id => @project,
:repository_id => @repository.identifier_param,

View File

@ -20,42 +20,31 @@
<div class="col-md-10 col-sm-12">
<ul class="bordered-list">
<li class="commit js-toggle-container">
<div class="commit-row-title">
<strong class="str-truncated">
<a class="commit-row-message"><%= textilizable(truncate_at_line_break(changeset.message)) %></a>
</strong>
<div class="pull-right" title="修订号">
<%= h truncate(changeset.short_id.to_s, :length => 20) %>
</div>
<div class="notes_count">
</div>
</div>
<div class="commit-row-info">
<% if !user_commit_rep(changeset.author_email).nil? %>
<a class="commit-author-link has_tooltip"> <span class="commit-author-name">
<%= image_tag(url_to_avatar(user_commit_rep(changeset.author_email)), :width => "20", :height => "20", :class => "fl portraitRadius mt2 ml4 mr5") %>
<%= link_to user_commit_rep(changeset.author_email), user_path(user_commit_rep(changeset.author_email)), :length => 30 %></span></a>
提交于
<%= image_tag(url_to_avatar(user_commit_rep(changeset.author_email)), :width => "20", :height => "20", :class => "fl portraitRadius mt2 ml4 mr5") %>
<%= link_to user_commit_rep(changeset.author_email), user_path(user_commit_rep(changeset.author_email)), :length => 30 %></span></a>提交于
<div class="committed_ago">
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %>
</time>
&nbsp;
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %>前 </time>&nbsp;
</div>
<% else %>
<span class="commit-author-name"><%= changeset.author_email %></span>
提交于
<span class="commit-author-name"><%= changeset.author_email %></span>提交于
<div class="committed_ago">
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %>
</time>
&nbsp;
<time class="time_ago js-timeago" title="<%= changeset.created_at %>"><%= time_tag(changeset.created_at) %> 前</time>&nbsp;
</div>
<% end %>
</div>
<div style="padding-left:30px;" class="commit-row-title">
<strong class="str-truncated">
<a class="commit-row-message"><%= textilizable(truncate_at_line_break(changeset.message)) %></a>
</strong>
<div class="pull-right" title="修订号">
<%= h truncate(changeset.short_id.to_s, :length => 20) %>
</div>
<div class="notes_count">
</div>
</div>
</li>
</ul>
</div>
@ -65,7 +54,6 @@
<p style="padding-top: 10px;">
<%#= submit_tag(l(:label_view_diff), :name => nil, :class=>"c_blue") if show_diff %>
</p>
<ul class="wlist">
<%= pagination_links_full commits_pages, commits_count, :per_page_links => false, :remote => false, :flag => true %>
</ul>

View File

@ -53,7 +53,7 @@
<span class="fr mr5"><font class="fb ml2 mr2 vl_commit">
<%=link_to"全部提交次数", {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %></font>
<%=link_to"提交明细", {:action => 'changes', :path => to_path_param(@path), :id => @project, :repository_id => @repository.identifier_param, :rev => @rev,:page=>1 ,:commit_count =>"#{@changesets_all_count}"} %></font>
</span>
</div>

View File

@ -1,6 +1,6 @@
<div id="popbox02">
<div>
<div class="relateText fl">请添加小组成员</div>
<div class="relateText fl">请从<%= @homework.homework_detail_group.base_on_project == 1 ? '项目成员':'课程成员' %>中添加小组成员</div>
</div>
<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="clickCanel();"></a></div>
<div class="cl"></div>
@ -92,5 +92,17 @@
url: '<%= url_for(:controller => 'student_work', :action => 'search_course_students') %>'+'?homework='+<%=@homework.id %>,
type:'get'
});
<% if defined?(edit_mode) && edit_mode %>
<% pro = @homework.student_work_projects.where("user_id = ?",User.current.id).first.project_id.to_i %>
<% members = @homework.student_work_projects.where("project_id = ? and is_leader =?",pro,0) %>
<% members.each do |member| %>
var link = "<li id='choose_student_<%=member.user_id%>' onclick='delete_student(<%=member.user_id %>);'><%=member.user.show_name %>";
<% unless member.user.user_extensions.student_id == "" %>
link += "(<%=member.user.user_extensions.student_id %>)";
<% end %>
link += "</li>";
$("#choose_students_list").append(link);
<% end %>
<% end %>
});
</script>

View File

@ -57,7 +57,7 @@
<% if @homework.anonymous_comment == 0%>
<li class="hworkList50 <%= score_color student_work.student_score%> student_score_info">
<%= student_work.student_score.nil? ? "--" : format("%.1f",student_work.student_score)%>
<%= student_work.student_score.nil? ? "未参与" : format("%.1f",student_work.student_score)%>
<% unless student_work.student_score.nil?%>
<span class="linkBlue">
(<%= student_work.student_works_scores.where(:reviewer_role => 3).count%>)
@ -84,7 +84,7 @@
缺评扣分
<span class="c_red">&nbsp;<%= student_work.absence_penalty%>&nbsp;</span>分,
最终成绩为
<span class="c_red">&nbsp;<%= format("%.1f",score)%>&nbsp;</span>分。
<span class="c_red">&nbsp;<%= format("%.1f",score<0 ? 0 : score)%>&nbsp;</span>分。
</div>
<% end%>
</li>

View File

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

View File

@ -4,7 +4,7 @@
<%=form_tag url_for(:controller=>'student_work',:action=>'student_work_project',:homework=>@homework.id,:user_activity_id=>@user_activity_id,:is_in_course=>@is_in_course,:course_activity =>@course_activity),:id =>'student_work_relate_project',:class=>'resourcesSearchBox',:remote => true do %>
<input type="text" name="project" placeholder="输入项目名称进行搜索" class="searchResourcePopup mb10" />
<div class="cl"></div>
<p id="no_search_result" class="c_red" style="width:220px;display: none">您当前尚未参与任何项目,请先加入项目再关联。</p>
<p id="no_search_result" class="c_red" style="width:220px;display: none">您当前尚未创建任何项目,请先创建项目再关联。</p>
<ul id="search_project_list" class="maxHeight100"></ul>
<p id="notes" class="c_red"></p>
<div class="courseSendSubmit mt10"><a href="javascript:void(0);" class="sendSourceText" onclick="clickOK();">确定</a></div>

View File

@ -7,7 +7,7 @@
<div class="HomeWorkBox">
<div class="">
<div class="homepagePostTitle fl">
<div class="homepagePostTitle fl m_w530 hidden">
<%= @homework.name%>(作业名称)
</div>
<span class="fr c_grey">
@ -31,7 +31,11 @@
提示:作品名称和描述中不要出现真实的姓名信息
</div>
<div class="cl"></div>
<% if @homework.homework_type == 3 %>
<span id="min_num_member" style="display: none"><%=@homework.homework_detail_group.min_num %></span>
<span id="max_num_member" style="display: none"><%=@homework.homework_detail_group.max_num %></span>
<%=hidden_field_tag 'group_member_ids', params[:group_member_ids], :value=>User.current.id %>
<% end %>
<div>
<input type="text" name="student_work[name]" id="student_work_name" placeholder="请简洁的概括作品的功能或特性" class="InputBox W700" maxlength="200" onkeyup="regexStudentWorkName();" value="<%= @work.name%>">
<div class="cl"></div>
@ -51,6 +55,12 @@
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => @work, :has_program=>false,:has_group=>false} %>
</div>
<% if @homework.homework_type == 3 %>
<div class="mt5 fl">
<a href="javascript:void(0);" class="memberBtn fl mt3 mr15" title="请添加小组的其他成员" onclick="show_group_member();">合作成员</a>
</div>
<% end %>
<div class="mt5">
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="popupRegex();edit_student_work(<%= @work.id%>);">确定</a>
<span class="fr mr10 mt3">或</span>
@ -61,14 +71,44 @@
</div><!----HomeWorkCon end-->
</div>
<script type="text/javascript">
<% if @homework.homework_detail_group %>
$(function(){
<%members = @work.student_work_projects.where("is_leader =?",0) %>
var str = $('#group_members_show').html();
<% members.each do |member| %>
str += '、<%= (User.find member.user_id).show_name %>';
<% end %>
$('#group_members_show').html(str);
$('span.group_detail_info').text('分组人数:<%=@homework.homework_detail_group.min_num %>-<%=@homework.homework_detail_group.max_num %> 人');
});
<% end %>
// 添加组成员
function show_group_member() {
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'student_work/choose_group_member',:locals => {:homework=>@homework,:edit_mode => true}) %>');
showModal('ajax-modal', '528px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("addMemberCP");
}
function popupRegex(){
if(regexStudentWorkName()&&regexStudentWorkDescription())
{
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
if($("#group_member_ids").length > 0) {
if(regexStudentWorkMember(parseInt($.trim($("#min_num_member").html())),parseInt($.trim($("#max_num_member").html())))) {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
}
} else {
$('#ajax-modal').html("<div><p align='center' style='margin-top: 35px'>作品信息完整性校验中,请稍等...</p></div>");
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
}
}
}
</script>

View File

@ -1,7 +1,7 @@
<% if @user_activity_id == -1 %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => "users/user_homework_detail",:locals => {:homework_common => @homework, :is_in_course => @is_in_course})%>");
init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>");
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@course_activity}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
<% end %>

View File

@ -1,3 +1,8 @@
<% content_for :header_tags do %>
<%= javascript_include_tag "/assets/codemirror/codemirror_python_ruby_c" %>
<%= stylesheet_link_tag "/assets/codemirror/codemirror" %>
<% end %>
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");

View File

@ -11,6 +11,11 @@
$('#ajax-modal').parent().addClass("anonymos_work");
});
<% end%>
<% if @homework.homework_detail_group %>
$(function(){
$('span.group_detail_info').text('分组人数:<%=@homework.homework_detail_group.min_num %>-<%=@homework.homework_detail_group.max_num %> 人');
});
<% end %>
//快速创建项目的弹框
function new_project(){
@ -83,7 +88,7 @@
<div class="HomeWorkBox">
<div class="">
<div class="homepagePostTitle fl">
<div class="homepagePostTitle fl m_w530 hidden">
<%= @homework.name%>(作业名称)
</div>
<span class="fr c_grey">

View File

@ -18,7 +18,7 @@ $("#all_students_list").empty();
}
}
}
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? %>
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? && user.member_of_course?(@course) %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").one("click",function choose_student() {
var li = "<li id='choose_student_<%=user.id %>'";
@ -29,6 +29,10 @@ $("#all_students_list").empty();
$("#choose_students_list").append(li);
});
}
<% elsif !user.member_of_course?(@course) %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").attr("title","该项目成员不是本课程的学生");
}
<% else %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").attr("title","该学生已加入其它分组");

View File

@ -1,8 +1,8 @@
clickCanel();
<% if @user_activity_id %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework,:user_activity_id =>@user_activity_id,:course_activity=>@courae_activity}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
<% else %>
$("#homework_common_<%= @homework.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework,:is_in_course => @is_in_course}) %>");
init_activity_KindEditor_data(<%= @homework.id%>,"","87%");
<% end %>
init_activity_KindEditor_data(<%= @homework.id%>,"","87%", "<%=@homework.class.to_s%>");
<% end %>

View File

@ -4,6 +4,31 @@ if($("#about_hwork_<%= @work.id%>").children().length > 0){
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"), {
mode: {name: program_name,
version: 2,
singleLineStringErrors: false},
lineNumbers: true,
indentUnit: 2,
matchBrackets: true,
readOnly: true,
value: document.getElementById("work-src").innerText
}
);
<% else%>
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work =>@work,:score =>@score,:student_work_scores => @student_work_scores}) %>");
<% end%>

View File

@ -13,7 +13,7 @@
<% end %> TO <!--+"(课程名称)" -->
<%= link_to activity.course.name.to_s+" | 课程作业", homework_common_index_path(:course => activity.course.id, :host=> Setting.host_course), :class => "newsBlue ml15"%>
</div>
<div class="homepagePostTitle hidden m_w505 fl"> <!--+"(作业名称)"-->
<div class="homepagePostTitle hidden fl m_w505"> <!--+"(作业名称)"-->
<%= link_to activity.name.to_s, student_work_index_path(:homework => activity.id,:host=> Setting.host_course), :class => "postGrey"%>
</div>
<% if activity.homework_detail_manual%>
@ -56,7 +56,7 @@
<% works = cur_user_works_for_homework activity %>
<% if works.nil? && projects.nil? %>
<div class="homepagePostSubmit">
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity),remote: true,:class=> 'c_blue', :title=> '请选择分组作业关联的项目' %>
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => activity.id,:is_in_course=>-1,:user_activity_id=>user_activity_id,:course_activity=>course_activity),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
<%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
</div>
<% elsif works.nil? %>
@ -81,7 +81,11 @@
<%= activity.language_name%>
</div>
<% end %>
<% if activity.homework_type == 3 && activity.homework_detail_group%>
<div class="homepagePostDeadline mr15">
分组人数:<%=activity.homework_detail_group.min_num %>-<%=activity.homework_detail_group.max_num %> 人
</div>
<% end %>
<div class="homepagePostDeadline">截止时间:<%= activity.end_time.to_s %>&nbsp;23:59</div>
</div>
<div class="homepagePostIntro break_word upload_img list_style maxh360 lh18 table_maxWidth" id="activity_description_<%= user_activity_id%>">
@ -93,25 +97,49 @@
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
<div class="mt5">
<div class="homepagePostDeadline">
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%>&nbsp;00:00
</div>
<div class="homepagePostDeadline ml15">
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%>&nbsp;23:59
</div>
</div>
<div class="cl"></div>
<div>
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => activity.attachments} %>
<div class="cl"></div>
</div>
<% if activity.homework_type == 3 && !activity.student_work_projects.empty? && activity.homework_detail_group.base_on_project == 1 %>
<% if activity.homework_type == 3 && activity.homework_detail_group.base_on_project == 1 %>
<div class="mt10">
<% projects = activity.student_work_projects.where("is_leader = 1") %>
<div class="fl mr5 fontGrey3">
<!--<img src="/images/course/proRelated.png" width="25" height="25" class="borderRadius mt7 ml7" title="已关联项目" />-->
已关联项目:
已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
</div>
<% activity.student_work_projects.where("is_leader = 1").each do |pro| %>
<div class="mr10 mb10 fl">
<% project = Project.find pro.project_id %>
<% if project.is_public || User.current.member_of?(project) || User.current.admin?%>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:alt =>"项目头像" %>
<% projects.each do |pro| %>
<% project = Project.find pro.project_id %>
<script type="text/javascript">
$(document).ready(function(){
$("#project_img_<%=project.id %>").mouseover(function(){
$("#relatePInfo_<%=project.id %>").css("display","block");
}).mouseout(function(){
$("#relatePInfo_<%=project.id %>").css("display","none");
})
});
</script>
<div class="mr20 mb10 fl">
<% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s,:alt =>"项目头像" %>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius") %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s,:alt =>"项目头像") %>
<% end %>
<p class="c_red tac" title="综合评分"><%=project.project_score.score.to_i %></p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
<% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
更新时间:<%=time_from_now time %>
</div>
</div>
<% end %>
</div>

View File

@ -1,12 +1,12 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<style type="text/css">
/*回复框*/
div.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
span.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
span.ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
span.ke-toolbar-icon-url{background-image:url( "/images/public_icon.png" )}
div.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
@ -39,7 +39,7 @@
}
$(function() {
init_activity_KindEditor_data(<%= user_activity.id%>, null, "87%");
init_activity_KindEditor_data(<%= user_activity.id%>, null, "87%", "<%=user_activity.class.to_s%>");
showNormalImage('activity_description_<%= user_activity.id %>');
if($("#intro_content_<%= user_activity.id %>").height() > 360) {
$("#intro_content_show_<%= user_activity.id %>").show();

View File

@ -0,0 +1,21 @@
<% if AtMessage === ma && ma.at_valid? %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.author), :width => "30", :height => "30"),user_path(ma.author) %></a></li>
<li class="homepageNewsPubType fl">
<span class="newsBlue homepageNewsPublisher"><%= ma.author.login %></span><span class="homepageNewsType fl">提到了你:</span>
</li>
<li class="homepageNewsContent fl">
<%= link_to ma.subject.html_safe, ma.url,
:class =>"#{ma.viewed? ? "newsGrey" : "newsBlack"}",
:onmouseover =>"message_titile_show($(this),event)",
:onmouseout => "message_titile_hide($(this))" %></li>
<div style="display: none" class="message_title_red system_message_style">
<p><strong>标题:</strong><%= ma.subject %></p>
<% unless ma.description.nil? %>
<div class="fl"><strong>内容:</strong></div>
<div class="ml36"><%= ma.description.html_safe %></div>
<% end %>
</div>
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>

View File

@ -11,7 +11,7 @@
<div class="mb10 mt10">
<label>
<input type="checkbox" class="mr5" name="base_on_project" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.base_on_project : 0 %>" id="base_on_project"/>
<span class="f14 fontGrey3 mr10">是否基于项目实施</span>
<span class="f14 fontGrey3 mr10">基于项目实施</span>
</label>
<p class="c_red">提醒勾选后各小组必须在Trustie平台创建项目教师可随时观察平台对各小组最新进展的实时统计。</p>
</div>

View File

@ -48,10 +48,12 @@
<span class="fl fontGrey2" id="group_members"></span>
<div class="cl"></div>
<% if @homework && @homework.homework_type == 3 %>
<sapn class="fl fontGrey2" id="group_members_show">
合作成员:<%=User.current.show_name %>(组长)
</sapn>
<span id="student_work_group_textarea" class="ml10 c_red fl"></span>
<% unless defined?(show_member) && show_member %>
<sapn class="fl fontGrey2" id="group_members_show">
合作成员:<%=User.current.show_name %>(组长)
</sapn>
<span id="student_work_group_textarea" class="ml10 c_red fl"></span>
<% end %>
<% end %>
<div class="cl"></div>
<span class="fl fontGrey2" id="relate_project_show">

View File

@ -10,7 +10,7 @@
TO
<%= link_to homework_common.course.name, course_path(homework_common.course_id), :class => "newsBlue ml15"%>
</div>
<span class="homepagePostTitle hidden m_w505 fl">
<span class="homepagePostTitle hidden fl m_w505">
<%= link_to homework_common.name,student_work_index_path(:homework => homework_common.id),:class => "postGrey"%>
</span>
@ -45,8 +45,10 @@
<% end%>
<% end%>
<div class="cl"></div>
<% if homework_common.homework_type == 3%>
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1%>
<span class="c_red">系统提示:该作业要求各组长<%=link_to "创建项目", new_project_path(:host=>Setting.host_name),:class=>"c_red",:title=>"新建项目",:style=>"text-decoration:underline;"%>,组成员加入项目,然后由组长关联项目。谢谢配合!</span>
<% elsif homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 0%>
<span class="c_red">系统提示:该作业要求各组长提交作品,提交作品时请添加组成员。谢谢配合!</span>
<% end %>
<div class="homepagePostSubmitContainer">
<% if homework_common.homework_type == 3 && !is_teacher && homework_common.homework_detail_group.base_on_project == 1 && User.current.member_of_course?(homework_common.course) %>
@ -54,7 +56,7 @@
<% works = cur_user_works_for_homework homework_common %>
<% if works.nil? && projects.nil? %>
<div class="homepagePostSubmit">
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1),remote: true,:class=> 'c_blue', :title=> '请选择分组作业关联的项目' %>
<%=link_to "关联项目",new_student_work_project_student_work_index_path(:homework => homework_common.id,:is_in_course=>is_in_course,:user_activity_id=>-1,:course_activity=>-1),remote: true,:class=> 'c_blue', :title=> '请各组长关联作业项目' %>
<%#= relate_project(activity,is_teacher,-1,user_activity_id,course_activity) %>
</div>
<% elsif works.nil? %>
@ -77,6 +79,11 @@
<%= homework_common.language_name%>
</div>
<% end %>
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group%>
<div class="homepagePostDeadline mr15">
分组人数:<%=homework_common.homework_detail_group.min_num %>-<%=homework_common.homework_detail_group.max_num %> 人
</div>
<% end %>
<div class="homepagePostDeadline">
<%= l(:label_end_time)%><%= homework_common.end_time%>&nbsp;23:59
</div>
@ -95,25 +102,49 @@
<div id="intro_content_show_<%= homework_common.id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= homework_common.id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div>
<div class="mt5">
<div class="homepagePostDeadline">
匿评开启时间:<%= homework_common.homework_detail_manual.evaluation_start%>&nbsp;00:00
</div>
<div class="homepagePostDeadline ml15">
匿评关闭时间:<%= homework_common.homework_detail_manual.evaluation_end%>&nbsp;23:59
</div>
</div>
<div class="cl"></div>
<div>
<%= render :partial => 'student_work/work_attachments', :locals => {:attachments => homework_common.attachments} %>
<div class="cl"></div>
</div>
<% if homework_common.homework_type == 3 && !homework_common.student_work_projects.empty? && homework_common.homework_detail_group.base_on_project == 1 %>
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 %>
<div class="mt10">
<% projects = homework_common.student_work_projects.where("is_leader = 1") %>
<div class="fl mr5 fontGrey3">
<!--<img src="/images/course/proRelated.png" width="25" height="25" class="borderRadius mt7 ml7" title="已关联项目" />-->
已关联项目:
已关联项目:<%='各小组尚未将小组项目关联到本次作业。' if projects.empty? %>
</div>
<% homework_common.student_work_projects.where("is_leader = 1").each do |pro| %>
<div class="mr10 mb10 fl">
<% project = Project.find pro.project_id %>
<% projects.each do |pro| %>
<% project = Project.find pro.project_id %>
<script type="text/javascript">
$(document).ready(function(){
$("#project_img_<%=project.id %>").mouseover(function(){
$("#relatePInfo_<%=project.id %>").css("display","block");
}).mouseout(function(){
$("#relatePInfo_<%=project.id %>").css("display","none");
})
});
</script>
<div class="mr20 mb10 fl">
<% if project.is_public || User.current.member_of?(project) || User.current.admin? %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:alt =>"项目头像" %>
<%= link_to image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius"),project_path(project.id,:host=>Setting.host_name),:id=>"project_img_"+project.id.to_s,:alt =>"项目头像" %>
<% else %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius") %>
<%= image_tag(url_to_avatar(project),:width=>"40",:height => "40",:class => "borderRadius",:id=>"project_img_"+project.id.to_s,:alt =>"项目头像") %>
<% end %>
<p class="c_red tac" title="综合评分"><%=project.project_score.score.to_i %></p>
<div class="relatePInfo" id="relatePInfo_<%=project.id %>">
项目名称:<%=project.name %><br />
创建者:<%=(User.find project.user_id).show_name %>(组长)<br />
<% time=project.updated_on %>
<% time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last %>
更新时间:<%=time_from_now time %>
</div>
</div>
<% end %>
</div>

View File

@ -1,5 +1,5 @@
<% content_for :header_tags do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: false) %>
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
<%= javascript_include_tag 'homework','baiduTemplate' %>
<script type="text/javascript">
@ -42,10 +42,10 @@
<div id="homework_editor" style="display: <%= edit_mode ? 'block':'none'%>">
<div class="mt10">
<% if edit_mode %>
<%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON %>
<%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px", :owner_id => homework.id, :owner_type => OwnerTypeHelper::HOMEWORKCOMMON, at_id: homework.id, at_type: homework.class.to_s %>
<% else %>
<%= hidden_field_tag :asset_id, params[:asset_id], :required => false, :style => 'display:none' %>
<%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px" %>
<%= f.kindeditor :description, :editor_id => 'homework_description_editor', :height => "150px",at_id: homework.id, at_type: homework.class.to_s %>
<% end %>
</div>
<div class="cl"></div>
@ -58,7 +58,7 @@
<div id="homework_attachments">
<!-- 编辑作业 && 作业类型为匿评作业 时没有编程选项-->
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type != 2), :has_group=>!(edit_mode && homework.homework_type != 3)} %>
<%= render :partial => 'users/user_homework_attachment', :locals => {:container => homework, :has_program=>!(edit_mode && homework.homework_type != 2), :has_group=>(!(edit_mode && homework.homework_type != 3))&& homework.student_works.empty?,:show_member => true} %>
</div>

View File

@ -1,12 +1,12 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<%= import_ke(enable_at: true, prettify: false, init_activity: true) %>
<% end %>
<style type="text/css">
/*回复框*/
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url("/images/public_icon.png")}
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
@ -17,7 +17,7 @@
<% homework_commons.each do |homework_common|%>
<script type="text/javascript">
$(function() {
init_activity_KindEditor_data(<%= homework_common.id%>, null, "87%");
init_activity_KindEditor_data(<%= homework_common.id%>, null, "87%", "<%=homework_common.class.to_s%>");
showNormalImage('homework_description_<%= homework_common.id%>');
if($("#intro_content_<%= homework_common.id%>").height() > 360) {
$("#intro_content_show_<%= homework_common.id%>").show();

View File

@ -17,6 +17,8 @@
<%# 系统消息 %>
<%= render :partial => 'users/user_message_system', :locals => {:ma => ma} %>
<%= render :partial => 'users/user_at_message', :locals => {:ma => ma} %>
<%# 课程消息 %>
<%= render :partial => 'users/user_message_course', :locals => {:ma => ma} %>

View File

@ -5,9 +5,13 @@ $("#homework_end_time").val("<%= @homework.end_time%>");
<% if @select_course == "0"%>
$("#course_id").val("<%= @homework.course_id%>");
<% end%>
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true,:has_group => true })%>");
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => @homework,:has_program => true,:has_group => true,:show_member=>true})%>");
homework_description_editor.html("<%= escape_javascript(@homework.description.html_safe)%>");
<% if @homework_detail_group %>
$('span.group_detail_info').text('分组人数:<%=@homework_detail_group.min_num %>-<%=@homework_detail_group.max_num %> 人');
<% end %>
$("#BluePopupBox").html("<%=escape_javascript( render :partial => 'users/user_programing_attr', :locals => {:edit_mode => true, :homework => @homework})%>");
$("#GroupPopupBox").html("<%=escape_javascript( render :partial => 'users/user_group_attr', :locals => {:edit_mode => true, :homework => @homework})%>");
//$("input[name='homework_type']").val("<%#= @homework.homework_type%>");
$("#homework_editor").show();
$("#BluePopupBox a.BlueCirBtn").click();

View File

@ -5,7 +5,7 @@
<% else %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_journalsformessage', :locals => {:activity => @activity,:user_activity_id =>@user_activity_id}) %>");
<% end %>
init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%");
init_activity_KindEditor_data('<%= @user_activity_id%>', "", "87%", "UserActivity");
<% else %>
<% if !@jfm.nil? && @jfm.jour_type == 'Principal' %>
$("#<%= @jfm.m_parent_id%>").children("div[nhname='reply_list']").prepend("<%= escape_javascript( render(:partial => 'users/user_jour_reply',:locals => {:reply=>@jfm} )) %>");

View File

@ -1,7 +1,7 @@
<% if @user_activity_id %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_homework', :locals => {:activity => @homework_common,:user_activity_id =>@user_activity_id,:course_activity => @course_activity}) %>");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%");
init_activity_KindEditor_data(<%= @user_activity_id%>,"","87%", "UserActivity");
<% elsif @homework_common_id && @is_in_course %>
$("#homework_common_<%= @homework_common_id %>").replaceWith("<%= escape_javascript(render :partial => 'users/user_homework_detail', :locals => {:homework_common => @homework_common,:is_in_course => @is_in_course}) %>");
init_activity_KindEditor_data(<%= @homework_common_id%>,"","87%");
init_activity_KindEditor_data(<%= @homework_common_id%>,"","87%", "HomeworkCommon");
<% end %>

View File

@ -1,235 +0,0 @@
# = Redmine configuration file
#
# Each environment has it's own configuration options. If you are only
# running in production, only the production block needs to be configured.
# Environment specific configuration options override the default ones.
#
# Note that this file needs to be a valid YAML file.
# DO NOT USE TABS! Use 2 spaces instead of tabs for identation.
#
# == Outgoing email settings (email_delivery setting)
#
# === Common configurations
#
# ==== Sendmail command
#
# production:
# email_delivery:
# delivery_method: :sendmail
#
# ==== Simple SMTP server at localhost
#
# production:
# email_delivery:
# delivery_method: :smtp
# smtp_settings:
# address: smtp.163.com
# port: 25
#
# ==== SMTP server at example.com using LOGIN authentication and checking HELO for foo.com
#
# production:
# email_delivery:
# delivery_method: :smtp
# smtp_settings:
# address: smtp.gmail.com
# port: 587
# authentication: :login
# domain: 'foo.com'
# user_name: senluowanxiangt@gmail.com
# password: 1913TXBja
#
# ==== SMTP server at example.com using PLAIN authentication
#
# production:
# email_delivery:
# delivery_method: :smtp
# smtp_settings:
# address: smtp.gmail.com
# port: 587
# authentication: :plain
# domain: 'example.com'
# user_name: senluowanxiangt@gmail.com
# password: 1913TXBja
#
# ==== SMTP server at using TLS (GMail)
#
# This might require some additional configuration. See the guides at:
# http://www.redmine.org/projects/redmine/wiki/EmailConfiguration
#
# production:
# email_delivery:
# delivery_method: :smtp
# smtp_settings:
# enable_starttls_auto: true
# address: smtp.gmail.com
# port: 587
# domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps
# authentication: :plain
# user_name: senluowanxiangt@gmail.com
# password: 1913TXBja
#
#
# === More configuration options
#
# See the "Configuration options" at the following website for a list of the
# full options allowed:
#
# http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer
default:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: mail.trustie.net
port: 25
domain: mail.trustie.net
authentication: :login
user_name: "mail@trustie.net"
password: "loong2010"
# Absolute path to the directory where attachments are stored.
# The default is the 'files' directory in your Redmine instance.
# Your Redmine instance needs to have write permission on this
# directory.
# Examples:
# attachments_storage_path: /var/redmine/files
# attachments_storage_path: D:/redmine/files
attachments_storage_path:
# Configuration of the autologin cookie.
# autologin_cookie_name: the name of the cookie (default: autologin)
# autologin_cookie_path: the cookie path (default: /)
# autologin_cookie_secure: true sets the cookie secure flag (default: false)
autologin_cookie_name: "autologin_trustie"
autologin_cookie_path:
autologin_cookie_secure:
# Configuration of SCM executable command.
#
# Absolute path (e.g. /usr/local/bin/hg) or command name (e.g. hg.exe, bzr.exe)
# On Windows + CRuby, *.cmd, *.bat (e.g. hg.cmd, bzr.bat) does not work.
#
# On Windows + JRuby 1.6.2, path which contains spaces does not work.
# For example, "C:\Program Files\TortoiseHg\hg.exe".
# If you want to this feature, you need to install to the path which does not contains spaces.
# For example, "C:\TortoiseHg\hg.exe".
#
# Examples:
# scm_subversion_command: svn # (default: svn)
# scm_mercurial_command: C:\Program Files\TortoiseHg\hg.exe # (default: hg)
# scm_git_command: /usr/local/bin/git # (default: git)
# scm_cvs_command: cvs # (default: cvs)
# scm_bazaar_command: bzr.exe # (default: bzr)
# scm_darcs_command: darcs-1.0.9-i386-linux # (default: darcs)
#
scm_subversion_command:
scm_mercurial_command:
scm_git_command:
scm_cvs_command:
scm_bazaar_command:
scm_darcs_command:
# Absolute path to the SCM commands errors (stderr) log file.
# The default is to log in the 'log' directory of your Redmine instance.
# Example:
# scm_stderr_log_file: /var/log/redmine_scm_stderr.log
scm_stderr_log_file:
# Key used to encrypt sensitive data in the database (SCM and LDAP passwords).
# If you don't want to enable data encryption, just leave it blank.
# WARNING: losing/changing this key will make encrypted data unreadable.
#
# If you want to encrypt existing passwords in your database:
# * set the cipher key here in your configuration file
# * encrypt data using 'rake db:encrypt RAILS_ENV=production'
#
# If you have encrypted data and want to change this key, you have to:
# * decrypt data using 'rake db:decrypt RAILS_ENV=production' first
# * change the cipher key here in your configuration file
# * encrypt data using 'rake db:encrypt RAILS_ENV=production'
database_cipher_key:
# Set this to false to disable plugins' assets mirroring on startup.
# You can use `rake redmine:plugins:assets` to manually mirror assets
# to public/plugin_assets when you install/upgrade a Redmine plugin.
#
#mirror_plugins_assets_on_startup: false
# Your secret key for verifying cookie session data integrity. If you
# change this key, all old sessions will become invalid! Make sure the
# secret is at least 30 characters and all random, no regular words or
# you'll be exposed to dictionary attacks.
#
# If you have a load-balancing Redmine cluster, you have to use the
# same secret token on each machine.
#secret_token: 'change it to a long random string'
# Absolute path (e.g. /usr/bin/convert, c:/im/convert.exe) to
# the ImageMagick's `convert` binary. Used to generate attachment thumbnails.
imagemagick_convert_command: '/home/pdl/redmine-2.3.2-0/common/bin/convert'
# Configuration of RMagcik font.
#
# Redmine uses RMagcik in order to export gantt png.
# You don't need this setting if you don't install RMagcik.
#
# In CJK (Chinese, Japanese and Korean),
# in order to show CJK characters correctly,
# you need to set this configuration.
#
# Because there is no standard font across platforms in CJK,
# you need to set a font installed in your server.
#
# This setting is not necessary in non CJK.
#
# Examples for Japanese:
# Windows:
# rmagick_font_path: C:\windows\fonts\msgothic.ttc
# Linux:
# rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf
#
rmagick_font_path:
# Maximum number of simultaneous AJAX uploads
#max_concurrent_ajax_uploads: 2
#pic_types: "bmp,jpeg,jpg,png,gif"
repository_root_path: '/tmp/htdocs'
judge_server: 'http://judge.trustie.net/'
# Git's url
gitlab_address: 'http://gitfast.trustie.net'
# specific configuration options for production environment
# that overrides the default ones
production:
# CJK support
rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf
judge_server: 'http://192.168.80.21:8080/'
repository_root_path: '/home/pdl/redmine-2.3.2-0/apache2/htdocs'
cookie_domain: ".trustie.net"
email_delivery:
delivery_method: :smtp
smtp_settings:
address: mail.trustie.net
port: 25
domain: mail.trustie.net
authentication: :login
user_name: "mail@trustie.net"
password: "loong2010"
# specific configuration options for development environment
# that overrides the default ones
development:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: mail.trustie.net
port: 25
domain: mail.trustie.net
authentication: :login
user_name: "mail@trustie.net"
password: "loong2010"

View File

@ -1,9 +0,0 @@
Gitlab.configure do |config|
# config.endpoint = 'http://192.168.41.130:3000/trustie/api/v3' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT']
# config.private_token = 'cK15gUDwvt8EEkzwQ_63' # user's private token, default: ENV['GITLAB_API_PRIVATE_TOKEN']
config.endpoint = 'http://gitfast.trustie.net/api/v3' # API endpoint URL, default: ENV['GITLAB_API_ENDPOINT']
config.private_token = 'fPc_gBmEiSANve8TCfxW' # user's private token, default: ENV['GITLAB_API_PRIVATE_TOKEN']
# Optional
# config.user_agent = 'Custom User Agent' # user agent, default: 'Gitlab Ruby Gem [version]'
# config.sudo = 'user' # username for sudo mode, default: nil
end

View File

@ -1063,13 +1063,14 @@ RedmineApp::Application.routes.draw do
match 'system_log/clear'
##ended by lizanle
resources :git_callback do
collection do
post 'post_update'
end
end
resources :at
Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir|
file = File.join(plugin_dir, "config/routes.rb")
if File.exists?(file)

View File

@ -0,0 +1,13 @@
class DeleteValidateCourseContributor < ActiveRecord::Migration
def up
course_contributors = CourseContributorScore.where("course_id>? and created_at<? ", 450, "2015-12-15 19:51:48")
course_contributors.delete_all
c170 = CourseContributorScore.where("course_id =?", 170)
c170.delete_all
c436 = CourseContributorScore.where("course_id =?", 436)
c436.delete_all
end
def down
end
end

View File

@ -0,0 +1,9 @@
class DeleteExerciseUser < ActiveRecord::Migration
def up
eus=ExerciseUser.where("score is null and status=?",0)
eus.delete_all
end
def down
end
end

View File

@ -0,0 +1,15 @@
class CreateAtMessages < ActiveRecord::Migration
def change
create_table :at_messages do |t|
t.references :user
t.integer :at_message_id
t.string :at_message_type
t.boolean :viewed, :default => false
t.string :container_type
t.integer :container_id
t.timestamps
end
add_index :at_messages, :user_id
end
end

View File

@ -0,0 +1,5 @@
class AddSenderToAtMessage < ActiveRecord::Migration
def change
add_column :at_messages, :sender_id, :integer
end
end

View File

@ -0,0 +1,15 @@
class DeleteValidProject < ActiveRecord::Migration
def up
projects = Project.where("project_type =?", 1)
begin
projects.each do |p|
p.delete
end
rescue => e
logger.error "Delete project failed ====>#{e}"
end
end
def down
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20151209085942) do
ActiveRecord::Schema.define(:version => 20151217051447) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -66,6 +66,20 @@ ActiveRecord::Schema.define(:version => 20151209085942) do
t.datetime "updated_at", :null => false
end
create_table "at_messages", :force => true do |t|
t.integer "user_id"
t.integer "at_message_id"
t.string "at_message_type"
t.boolean "viewed"
t.string "container_type"
t.integer "container_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "sender_id"
end
add_index "at_messages", ["user_id"], :name => "index_at_messages_on_user_id"
create_table "attachments", :force => true do |t|
t.integer "container_id"
t.string "container_type", :limit => 30

View File

@ -58,6 +58,23 @@ class Gitlab::Client
end
alias_method :repo_commits, :commits
# Gets a list of project commits.
#
# @example
# Gitlab.commits('viking')
# Gitlab.repo_commits('gitlab', :ref_name => 'api')
#
# @param [Integer] project The ID of a project.
# @param [Hash] options A customizable set of options.
# @option options [String] :ref_name The branch or tag name of a project repository.
# @option options [Integer] :page The page number.
# @option options [Integer] :per_page The number of results per page.
# @return [Array<Gitlab::ObjectifiedHash>]
def commits_total_count(project, options={})
get("/projects/#{project}/repository/commits_total_count", :query => options)
end
alias_method :repo_commits, :commits_total_count
# Gets a specific commit identified by the commit hash or name of a branch or tag.
#
# @example

View File

@ -1,29 +1,36 @@
module RailsKindeditor
module Helper
EVAL_STR = %Q|eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);} if(typeof enableAt ==='function'){enableAt(self);} this.loadPlugin("autoheight")})|
def eval_str(at_id, at_type)
%Q|eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);};if(typeof enableAt ==='function'){enableAt(self, #{at_id}, '#{at_type}');}; this.loadPlugin('autoheight')})|
end
def kindeditor_tag(name, content = nil, options = {})
id = sanitize_to_id(name)
at_id = options[:at_id] || 0
at_type = options[:at_type] || ''
input_html = { :id => id }.merge(options.delete(:input_html) || {})
input_html = input_html.merge(style: 'display:none')
output = ActiveSupport::SafeBuffer.new
output << text_area_tag(name, content, input_html)
output << javascript_tag(js_replace(id, options.merge(window_onload: 'true',
:autoHeightMode=>true,
afterCreate: EVAL_STR,
afterCreate: eval_str(at_id, at_type),
emotionsBasePath: 'http://' + Setting.host_name
)))
end
def kindeditor(name, method, options = {})
# TODO: Refactory options: 1. kindeditor_option 2. html_option
at_id = options[:at_id] || 0
at_type = options[:at_type] || ''
input_html = (options.delete(:input_html) || {}).stringify_keys
input_html = input_html.merge(style: 'display:none')
output_buffer = ActiveSupport::SafeBuffer.new
output_buffer << build_text_area_tag(name, method, self, options, input_html)
output_buffer << javascript_tag(js_replace(input_html['id'],options.merge(window_onload: 'true',
:autoHeightMode=>true,
afterCreate: EVAL_STR,
afterCreate: eval_str(at_id, at_type),
emotionsBasePath: 'http://' + Setting.host_name
)))
end

View File

@ -1,9 +1,12 @@
function enableAt(_editor) {
var enableAt = function(_editor) {
var editor = _editor;
if(editor.edit == undefined || editor.edit.iframe == undefined){
return;
}
var id = arguments[1] ? arguments[1] : undefined;
var type = arguments[2] ? arguments[2] : 'Activity';
var ifr = editor.edit.iframe[0];
var doc = ifr.contentDocument || iframe.contentWindow.document;
var ifrBody = doc.body;
@ -11,10 +14,16 @@ function enableAt(_editor) {
console.log("enable at");
$.fn.atwho.debug = true;
if(!atPersonLists){
return;
var names = [];
if("undefined" !== (typeof atPersonLists)){
names = atPersonLists;
}
if('undefined' != (typeof id)){
names = '/at/' + id + '?type='+type;
}
var names = atPersonLists;
//var names = ["Jacob","Isabella","Ethan","Emma","Michael","Olivia","Alexander","Sophia","William","Ava","Joshua","Emily","Daniel","Madison","Jayden","Abigail","Noah","Chloe","你好","你你你", "가"];
//
@ -25,14 +34,13 @@ function enableAt(_editor) {
var at_config = {
at: "@",
data: names,
insertTpl: '<span style="color:#269ac9">@${name}(${login})</span>',
insertTpl: '<span class="at" data-user-id="${userid}">@${name}(${login})</span>',
displayTpl: "<li>${name} <small>${login}</small></li>",
searchKey: 'searchKey',
limit: 200
}
};
$inputor = $(ifrBody).atwho(at_config);
window.aaa= $inputor;
$inputor.caret('pos', 47);
$inputor.focus().atwho('run');
};

View File

@ -16,7 +16,7 @@
}
.atwho-view .cur {
background: #3366FF;
background: #269ac9;
color: white;
}
.atwho-view .cur small {
@ -47,3 +47,6 @@
color: #777;
font-weight: normal;
}
/* @功能 定义 */
span.at {color:#269ac9;}

Some files were not shown because too many files have changed in this diff Show More