Merge branch 'szzh' into develop
This commit is contained in:
commit
fc041d5e99
|
@ -0,0 +1,607 @@
|
|||
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]
|
||||
before_filter :find_course, :only => [:index,:new,:create,:student_exercise_list]
|
||||
include ExerciseHelper
|
||||
|
||||
include ExerciseHelper
|
||||
def index
|
||||
remove_invalid_exercise(@course)
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
if @is_teacher
|
||||
exercises = @course.exercises
|
||||
else
|
||||
exercises = @course.exercises.where(:exercise_status => 2)
|
||||
end
|
||||
@exercises = paginateHelper exercises,20 #分页
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
unless User.current.member_of_course?(@course)
|
||||
render_403
|
||||
return
|
||||
end
|
||||
@exercise = Exercise.find params[:id]
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
if @exercise.exercise_status != 2 && (!User.current.allowed_to?(:as_teacher,@course) || User.current.admin?)
|
||||
render_403
|
||||
return
|
||||
end
|
||||
@can_edit_excercise = (!has_commit_exercise?(@exercise.id,User.current.id)) || User.current.admin?
|
||||
@exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
|
||||
# 学生点击的时候即创建关联,自动保存
|
||||
#eu = ExerciseUser.create(:user_id => User.current, :exercise_id => @exercise.id, :start_at => Time.now, :status => false)
|
||||
|
||||
# 已提交问卷的用户不能再访问该界面
|
||||
if has_commit_exercise?(@exercise.id, User.current.id) && (!User.current.admin?)
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_courses'}
|
||||
end
|
||||
else
|
||||
if !@is_teacher && !has_click_exercise?(@exercise.id, User.current.id)
|
||||
eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false)
|
||||
@exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
|
||||
end
|
||||
# @percent = get_percent(@exercise,User.current)
|
||||
exercise_questions = @exercise.exercise_questions
|
||||
@exercise_questions = paginateHelper exercise_questions,5 #分页
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_courses'}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
option = {
|
||||
:exercise_name => "",
|
||||
:course_id => @course.id,
|
||||
:exercise_status => 1,
|
||||
:user_id => User.current.id,
|
||||
:time => "",
|
||||
:end_time => "",
|
||||
:publish_time => "",
|
||||
:exercise_description => "",
|
||||
:show_result => "",
|
||||
:show_result => 1
|
||||
}
|
||||
@exercise = Exercise.create option
|
||||
if @exercise
|
||||
redirect_to edit_exercise_url @exercise.id
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
if params[:exercise]
|
||||
exercise = Exercise.find(params[:exercise_id]) if params[:exercise_id]
|
||||
exercise ||= Exercise.new
|
||||
exercise.exercise_name = params[:exercise][:exercise_name]
|
||||
exercise.exercise_description = params[:exercise][:exercise_description]
|
||||
exercise.end_time = params[:exercise][:end_time]
|
||||
exercise.publish_time = params[:exercise][:publish_time]
|
||||
exercise.user_id = User.current.id
|
||||
exercise.time = params[:exercise][:time]
|
||||
exercise.course_id = params[:course_id]
|
||||
exercise.exercise_status = 1
|
||||
if exercise.save
|
||||
@exercise = exercise
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@exercise.exercise_name = params[:exercise][:exercise_name]
|
||||
@exercise.exercise_description = params[:exercise][:exercise_description]
|
||||
@exercise.time = params[:exercise][:time]
|
||||
@exercise.end_time = params[:exercise][:end_time]
|
||||
@exercise.publish_time = params[:exercise][:publish_time]
|
||||
@exercise.show_result = params[:exercise][:show_result]
|
||||
if @exercise.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
else
|
||||
render_404
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
if @exercise && @exercise.destroy
|
||||
if @is_teacher
|
||||
exercises = Exercise.where("course_id =?", @course.id)
|
||||
else
|
||||
exercises = Exercise.where("course_id =? and exercise_status =?", @course.id, 2)
|
||||
end
|
||||
@exercises = paginateHelper exercises,20 #分页
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 统计结果
|
||||
def statistics_result
|
||||
@exercise = Exercise.find(params[:id])
|
||||
exercise_questions = @exercise.exercise_questions
|
||||
@exercise_questions = paginateHelper exercise_questions, 5
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
end
|
||||
end
|
||||
|
||||
# 添加题目
|
||||
# question_type 1:单选 2:多选 3:填空题
|
||||
def create_exercise_question
|
||||
question_title = params[:question_title].nil? || params[:question_title].empty? ? l(:label_enter_single_title) : params[:question_title]
|
||||
option = {
|
||||
:question_title => question_title,
|
||||
:question_type => params[:question_type] || 1,
|
||||
:question_number => params[:question_type] == "1"? @exercise.exercise_questions.where("question_type = 1").count + 1 :
|
||||
(params[:question_type] == "2" ? (@exercise.exercise_questions.where("question_type = 2").count + 1) :
|
||||
@exercise.exercise_questions.where("question_type = 3").count + 1),
|
||||
:question_score => params[:question_score]
|
||||
}
|
||||
@exercise_questions = @exercise.exercise_questions.new option
|
||||
# params[:question_answer] 题目选项
|
||||
if params[:question_answer]
|
||||
for i in 1..params[:question_answer].count
|
||||
answer = (params[:question_answer].values[i-1].nil? || params[:question_answer].values[i-1].empty?) ? l(:label_new_answer) : params[:question_answer].values[i-1]
|
||||
question_option = {
|
||||
:choice_position => i,
|
||||
:choice_text => answer
|
||||
}
|
||||
@exercise_questions.exercise_choices.new question_option
|
||||
end
|
||||
end
|
||||
# 如果是插入的话,那么从插入的这个id以后的question_num都将要+1
|
||||
if params[:quest_id]
|
||||
@is_insert = true
|
||||
if @exercise_questions.question_type == 1
|
||||
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number + 1")
|
||||
#@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1")
|
||||
elsif @exercise_questions.question_type == 2
|
||||
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number + 1")
|
||||
else
|
||||
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number + 1")
|
||||
end
|
||||
# @exercise_question_num = params[:quest_num].to_i
|
||||
@exercise_questions.question_number = params[:quest_num].to_i + 1
|
||||
end
|
||||
if @exercise_questions.save
|
||||
# params[:exercise_choice] 标准答案参数
|
||||
# 问答题标准答案有三个,单独处理
|
||||
if @exercise_questions.question_type == 3
|
||||
for i in 1..params[:exercise_choice].count
|
||||
standart_answer = ExerciseStandardAnswer.new
|
||||
standart_answer.exercise_question_id = @exercise_questions.id
|
||||
standart_answer.answer_text = params[:exercise_choice].values[i-1]
|
||||
standart_answer.save
|
||||
end
|
||||
else
|
||||
standart_answer = ExerciseStandardAnswer.new
|
||||
standart_answer.exercise_question_id = @exercise_questions.id
|
||||
if @exercise_questions.question_type == 1
|
||||
standart_answer.exercise_choice_id = sigle_selection_standard_answer(params[:exercise_choice])
|
||||
else
|
||||
standart_answer.exercise_choice_id = multiselect_standard_answer(params[:exercise_choice])
|
||||
end
|
||||
standart_answer.save
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# 修改题目
|
||||
# params[:exercise_question] The id of exercise_question
|
||||
# params[:question_answer] eg:A、B、C选项
|
||||
def update_exercise_question
|
||||
@exercise_question = ExerciseQuestion.find params[:exercise_question]
|
||||
@exercise_question.question_title = params[:question_title].nil? || params[:question_title].empty? ? l(:label_enter_single_title) : params[:question_title]
|
||||
@exercise_question.question_score = params[:question_score]
|
||||
# 处理选项:如果选了某个选项,那么则要删除之前的选项
|
||||
if params[:question_answer]
|
||||
@exercise_question.exercise_choices.each do |answer|
|
||||
answer.destroy unless params[:question_answer].keys.include? answer.id.to_s
|
||||
end
|
||||
for i in 1..params[:question_answer].count
|
||||
question = @exercise_question.exercise_choices.find_by_id params[:question_answer].keys[i-1]
|
||||
answer = (params[:question_answer].values[i-1].nil? || params[:question_answer].values[i-1].empty?) ? l(:label_new_answer) : params[:question_answer].values[i-1]
|
||||
if question
|
||||
question.choice_position = i
|
||||
question.choice_text = answer
|
||||
question.save
|
||||
else
|
||||
question_option = {
|
||||
:choice_position => i,
|
||||
:choice_text => answer
|
||||
}
|
||||
@exercise_question.exercise_choices.new question_option
|
||||
end
|
||||
end
|
||||
end
|
||||
# 更新标准答案
|
||||
if params[:exercise_choice]
|
||||
if @exercise_question.question_type == 3
|
||||
# 删除不合理的选项
|
||||
@exercise_question.exercise_standard_answers.each do |answer|
|
||||
answer.destroy unless params[:exercise_choice].keys.include? answer.id.to_s
|
||||
end
|
||||
for i in 1..params[:exercise_choice].count
|
||||
# 找到对应的标准答案
|
||||
question_standart = @exercise_question.exercise_standard_answers.find_by_id params[:exercise_choice].keys[i-1]
|
||||
# 标准答案值
|
||||
answer_standart = (params[:exercise_choice].values[i-1].nil? || params[:exercise_choice].values[i-1].empty?) ? l(:label_new_answer) : params[:exercise_choice].values[i-1]
|
||||
if question_standart
|
||||
question_standart.answer_text = answer_standart
|
||||
question_standart.save
|
||||
else
|
||||
standart_answer_option = {
|
||||
:answer_text => answer_standart
|
||||
}
|
||||
@exercise_question.exercise_standard_answers.new standart_answer_option
|
||||
end
|
||||
end
|
||||
else
|
||||
answer_standart = @exercise_question.exercise_standard_answers.first
|
||||
answer_standart.exercise_choice_id = @exercise_question.question_type == 1 ? sigle_selection_standard_answer(params[:exercise_choice]) : multiselect_standard_answer(params[:exercise_choice])
|
||||
answer_standart.save
|
||||
end
|
||||
@exercise_question.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 删除题目
|
||||
def delete_exercise_question
|
||||
@exercise_question = ExerciseQuestion.find params[:exercise_question]
|
||||
@exercise = @exercise_question.exercise
|
||||
|
||||
if @exercise_question.question_type == 1
|
||||
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 1).update_all(" question_number = question_number - 1")
|
||||
#@exercise.exercise_questions.where("question_number > #{params[:quest_num].to_i} and question_type == 1").update_all(" question_number = question_number + 1")
|
||||
elsif @exercise_question.question_type == 2
|
||||
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 2).update_all(" question_number = question_number - 1")
|
||||
else
|
||||
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number - 1")
|
||||
end
|
||||
# @exercise_question_num = params[:quest_num].to_i
|
||||
# @exercise_questions.question_number = params[:quest_num].to_i - 1
|
||||
#
|
||||
# exercise_questions = @exercise.exercise_questions.where("question_number > #{@exercise_question.question_number}")
|
||||
# exercise_questions.each do |question|
|
||||
# question.question_number -= 1
|
||||
# question.save
|
||||
# end
|
||||
if @exercise_question && @exercise_question.destroy
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 发布试卷
|
||||
def publish_exercise
|
||||
@exercise.exercise_status = 2
|
||||
@exercise.publish_time = Time.now
|
||||
if @exercise.save
|
||||
redirect_to exercise_index_url(:course_id=> @course.id)
|
||||
end
|
||||
end
|
||||
|
||||
# 重新发布试卷
|
||||
# 重新发布的时候会删除所有的答题
|
||||
def republish_exercise
|
||||
@exercise.exercise_questions.each do |exercise_question|
|
||||
exercise_question.exercise_answers.destroy_all
|
||||
end
|
||||
@exercise.exercise_users.destroy_all
|
||||
@exercise.exercise_status = 1
|
||||
@exercise.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def student_exercise_list
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
@exercise = Exercise.find params[:id]
|
||||
@all_exercises = @course.exercises.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? && Time.parse(@exercise.end_time.to_s).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S"))
|
||||
@exercise_users_list = @exercise.exercise_users.where('score is not NULL')
|
||||
@show_all = true;
|
||||
elsif !@exercise.exercise_users.where(:user_id => User.current.id).empty? && Time.parse(@exercise.end_time.to_s).strftime("%Y-%m-%d-%H-%M-%S") > Time.now.strftime("%Y-%m-%d-%H-%M-%S")
|
||||
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL",User.current.id)
|
||||
else
|
||||
@exercise_users_list = []
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
# 学生提交答卷,选中答案的过程中提交
|
||||
def commit_answer
|
||||
eq = ExerciseQuestion.find(params[:exercise_question_id])
|
||||
# 已提交过的则不允许答题
|
||||
if has_commit_exercise?(@exercise.id,User.current.id) && (!User.current.admin?)
|
||||
render :json => {:text => "failure"}
|
||||
return
|
||||
end
|
||||
if eq.question_type == 1
|
||||
# 单选题
|
||||
ea = ExerciseAnswer.find_by_exercise_question_id_and_user_id(params[:exercise_question_id],User.current.id)
|
||||
if ea.nil?
|
||||
# 尚未答该题,添加答案
|
||||
ea = ExerciseAnswer.new
|
||||
ea.user_id = User.current.id
|
||||
ea.exercise_question_id = params[:exercise_question_id]
|
||||
end
|
||||
#修改该题对应答案
|
||||
ea.exercise_choice_id = params[:exercise_choice_id]
|
||||
if ea.save
|
||||
# 保存成功返回成功信息及当前以答题百分比
|
||||
@percent = get_percent(@exercise,User.current)
|
||||
render :json => {:text => "ok" ,:percent => format("%.2f" ,@percent)}
|
||||
else
|
||||
#返回失败信息
|
||||
render :json => {:text => "failure"}
|
||||
end
|
||||
elsif eq.question_type == 2
|
||||
#多选题
|
||||
ea = ExerciseAnswer.find_by_exercise_choice_id_and_user_id(params[:exercise_choice_id],User.current.id)
|
||||
if ea.nil?
|
||||
#尚未答该题,添加答案
|
||||
ea = ExerciseAnswer.new
|
||||
ea.user_id = User.current.id
|
||||
ea.exercise_question_id = params[:exercise_question_id]
|
||||
ea.exercise_choice_id = params[:exercise_choice_id]
|
||||
if ea.save
|
||||
@percent = get_percent(@exercise,User.current)
|
||||
render :json => {:text => "ok",:percent => format("%.2f" ,@percent)}
|
||||
else
|
||||
render :json => {:text => "failure"}
|
||||
end
|
||||
else
|
||||
#pv不为空,则当前选项之前已被选择,再次点击则是不再选择该项,故删除该答案
|
||||
if ea.delete
|
||||
@percent = get_percent(@exercise, User.current)
|
||||
render :json => {:text => "false" ,:percent => format("%.2f" , @percent)}
|
||||
else
|
||||
render :json => {:text => "failure"}
|
||||
end
|
||||
end
|
||||
elsif eq.question_type == 3
|
||||
#单行文本,多行文本题
|
||||
ea = ExerciseAnswer.find_by_exercise_question_id_and_user_id(params[:exercise_question_id], User.current.id)
|
||||
if ea.nil?
|
||||
# ea为空之前尚未答题,添加答案
|
||||
if params[:answer_text].nil? || params[:answer_text].blank?
|
||||
#用户提交空答案,视作不作答
|
||||
@percent = get_percent(@exercise,User.current)
|
||||
render :json => {:text => ea.answer_text,:percent => format("%.2f", @percent)}
|
||||
else
|
||||
#添加答案
|
||||
ea = ExerciseAnswer.new
|
||||
ea.user_id = User.current.id
|
||||
ea.exercise_question_id = params[:exercise_question_id]
|
||||
ea.answer_text = params[:answer_text]
|
||||
if ea.save
|
||||
@percent = get_percent(@exercise,User.current)
|
||||
render :json => {:text => ea.answer_text,:percent => format("%.2f",@percent)}
|
||||
else
|
||||
render :json => {:text => "failure"}
|
||||
end
|
||||
end
|
||||
else
|
||||
# ea不为空说明用户之前已作答
|
||||
if params[:answer_text].nil? || params[:answer_text].blank?
|
||||
# 用户提交空答案,视为删除答案
|
||||
if ea.delete
|
||||
@percent = get_percent(@exercise,User.current)
|
||||
render :json => {:text => ea.answer_text,:percent => format("%.2f", @percent)}
|
||||
else
|
||||
render :json => {:text => "failure"}
|
||||
end
|
||||
else
|
||||
#用户修改答案
|
||||
ea.answer_text = params[:answer_text]
|
||||
if ea.save
|
||||
@percent = get_percent(@exercise,User.current)
|
||||
render :json => {:text => pv.vote_text,:percent => format("%.2f", @percent)}
|
||||
else
|
||||
render :json => {:text => "failure"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
render :json => {:text => "failure"}
|
||||
end
|
||||
end
|
||||
|
||||
# 提交问卷
|
||||
def commit_exercise
|
||||
# 老师不需要提交
|
||||
if User.current.allowed_to?(:as_teacher,@course)
|
||||
@exercise.update_attributes(:show_result => params[:show_result])
|
||||
redirect_to exercise_url(@exercise)
|
||||
# REDO: 提示提交成功
|
||||
else
|
||||
# 更新提交状态
|
||||
cur_exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", User.current, @exercise.id).first
|
||||
cur_exercise_user.update_attributes(:status => 1)
|
||||
# 答题过程中需要统计完成量
|
||||
@uncomplete_question = get_uncomplete_question(@exercise, User.current)
|
||||
# 获取改学生的考试得分
|
||||
@score = calculate_student_score(@exercise, User.current)
|
||||
# @score = 100
|
||||
if @uncomplete_question.count < 1
|
||||
# 查看是否有已提交记录
|
||||
eu = get_exercise_user(@exercise.id, User.current.id)
|
||||
eu.user_id = User.current.id
|
||||
eu.exercise_id = @exercise.id
|
||||
eu.score = @score
|
||||
if eu.save
|
||||
#redirect_to poll_index_path(:polls_group_id => @course.id,:polls_type => 'Course')
|
||||
@status = 0 #提交成功
|
||||
else
|
||||
@status = 2 #未知错误
|
||||
end
|
||||
else
|
||||
@status = 1 #有未做得必答题
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 计算学生得分
|
||||
def calculate_student_score(exercise, user)
|
||||
score = 0
|
||||
score1 = 0
|
||||
score2 = 0
|
||||
score3 = 0
|
||||
exercise_qustions = exercise.exercise_questions
|
||||
exercise_qustions.each do |question|
|
||||
answer = get_user_answer(question, user)
|
||||
standard_answer = get_user_standard_answer(question, user)
|
||||
unless answer.nil?
|
||||
# 问答题有多个答案
|
||||
if question.question_type == 3
|
||||
if standard_answer.include?(answer.first.answer_text)
|
||||
score1 = score1+ question.question_score unless question.question_score.nil?
|
||||
end
|
||||
elsif question.question_type == 1
|
||||
if answer.first.exercise_choice.choice_position == standard_answer.exercise_choice_id
|
||||
score2 = score2 + question.question_score unless question.question_score.nil?
|
||||
end
|
||||
else
|
||||
arr = get_mulscore(question, user)
|
||||
if arr.to_i == standard_answer.exercise_choice_id
|
||||
score3 = score3 + question.question_score unless question.question_score.nil?
|
||||
end
|
||||
# ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id)
|
||||
# arr = []
|
||||
# ecs.each do |ec|
|
||||
# arr << ec.exercise_choice.choice_position
|
||||
# end
|
||||
# arr.sort
|
||||
# arr = arr.join("")
|
||||
# if arr.to_i == standard_answer.exercise_choice_id
|
||||
# score3 = score + question.question_score unless question.question_score.nil?
|
||||
# end
|
||||
end
|
||||
end
|
||||
end
|
||||
score = score1 + score2 + score3
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# ExerciseUser记录用户是否已提交问卷有对应的记录则已提交,没有则新建一个
|
||||
def get_exercise_user exercise_id,user_id
|
||||
eu = ExerciseUser.find_by_exercise_id_and_user_id(exercise_id,user_id)
|
||||
if eu.nil?
|
||||
eu = ExerciseUser.new
|
||||
end
|
||||
eu
|
||||
end
|
||||
|
||||
#获取未完成的题目
|
||||
def get_uncomplete_question exercise,user
|
||||
all_questions = exercise.exercise_questions
|
||||
uncomplete_question = []
|
||||
all_questions.each do |question|
|
||||
answers = get_user_answer(question, user)
|
||||
if answers.nil?
|
||||
uncomplete_question << question
|
||||
end
|
||||
end
|
||||
uncomplete_question
|
||||
end
|
||||
|
||||
# 获取当前学生回答问题的答案
|
||||
def get_user_answer(question,user)
|
||||
# user_answer = ExerciseAnswer.where("user_id=? and exercise_question_id=?", user.id, question.id).first
|
||||
user_answer = question.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id}")
|
||||
user_answer
|
||||
end
|
||||
|
||||
# 获取问题的标准答案
|
||||
def get_user_standard_answer(question,user)
|
||||
if question.question_type == 3
|
||||
standard_answer =[]
|
||||
question.exercise_standard_answers.each do |answer|
|
||||
standard_answer << answer.answer_text
|
||||
end
|
||||
else
|
||||
standard_answer = question.exercise_standard_answers.first
|
||||
end
|
||||
standard_answer
|
||||
end # 是否完成了答题
|
||||
def get_complete_question(exercise,user)
|
||||
questions = exercise.exercise_questions
|
||||
complete_question = []
|
||||
questions.each do |question|
|
||||
answers = get_user_answer(question,user)
|
||||
if !(answers.nil? || answers.count < 1)
|
||||
complete_question << question
|
||||
end
|
||||
end
|
||||
complete_question
|
||||
end
|
||||
|
||||
# 获取答题百分比
|
||||
def get_percent exercise,user
|
||||
complete_count = get_complete_question(exercise,user).count
|
||||
if exercise.exercise_questions.count == 0
|
||||
return 0
|
||||
else
|
||||
return (complete_count.to_f / exercise.exercise_questions.count.to_f)*100
|
||||
end
|
||||
end
|
||||
|
||||
def remove_invalid_exercise(course)
|
||||
exercises = course.exercises.where("exercise_name=?","")
|
||||
unless exercises.empty?
|
||||
exercises.each do |exercise|
|
||||
if exercise.exercise_questions.empty?
|
||||
exercise.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def find_exercise_and_course
|
||||
@exercise = Exercise.find params[:id]
|
||||
@course = Course.find @exercise.course_id
|
||||
rescue Exception => e
|
||||
render_404
|
||||
end
|
||||
|
||||
def find_course
|
||||
@course = Course.find params[:course_id]
|
||||
rescue Exception => e
|
||||
render_404
|
||||
end
|
||||
end
|
|
@ -20,15 +20,23 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
end
|
||||
end
|
||||
def show
|
||||
|
||||
@document = OrgDocumentComment.find(params[:id])
|
||||
end
|
||||
|
||||
def index
|
||||
@documents = @organization.org_document_comments.where("parent_id is null").order("created_at desc")
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@documents = @organization.org_document_comments.where("parent_id is null").order("created_at desc")
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
def update
|
||||
@org_document = OrgDocumentComment.find(params[:id])
|
||||
@org_document.update_attributes(:title => params[:org_document_comment][:title], :content => params[:org_document_comment][:content])
|
||||
if @org_document.parent.nil?
|
||||
act = OrgActivity.where("org_act_type='OrgDocumentComment' and org_act_id =?", @org_document.id).first
|
||||
act.update_attributes(:updated_at => @org_document.updated_at)
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html {redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id)}
|
||||
end
|
||||
|
@ -48,6 +56,17 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
@document.save
|
||||
end
|
||||
|
||||
def add_reply_in_doc
|
||||
@document = OrgDocumentComment.find(params[:id]).root
|
||||
@comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id])
|
||||
@comment.content = params[:org_comment][:org_content]
|
||||
@document.children << @comment
|
||||
@document.save
|
||||
respond_to do |format|
|
||||
format.html {redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id)}
|
||||
end
|
||||
end
|
||||
|
||||
def find_organization
|
||||
@organization = Organization.find(params[:organization_id])
|
||||
end
|
||||
|
@ -60,5 +79,66 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
org.home_id == nil
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def delete_reply
|
||||
@org_document_comment = OrgDocumentComment.find(params[:id])
|
||||
@document = @org_document_comment.root
|
||||
org = @org_document_comment.organization
|
||||
@org_document_comment.destroy
|
||||
respond_to do |format|
|
||||
format.html {redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id)}
|
||||
end
|
||||
end
|
||||
def quote
|
||||
@org_comment = OrgDocumentComment.find(params[:id])
|
||||
@subject = @org_comment.content
|
||||
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
|
||||
|
||||
@content = "> #{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)}\n> "
|
||||
@temp = OrgDocumentComment.new
|
||||
#@course_id = params[:course_id]
|
||||
@temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, User.find(@org_comment.creator_id).realname)} <br/>#{@org_comment.content.html_safe}</blockquote>".html_safe
|
||||
respond_to do | format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
def reply
|
||||
@document = OrgDocumentComment.find(params[:id]).root
|
||||
@quote = params[:quote][:quote]
|
||||
@org_document = OrgDocumentComment.new(:creator_id => User.current.id, :reply_id => params[:id])
|
||||
|
||||
# params[:blog_comment][:sticky] = params[:blog_comment][:sticky] || 0
|
||||
# params[:blog_comment][:locked] = params[:blog_comment][:locked] || 0
|
||||
@org_document.title = params[:org_document_comment][:title]
|
||||
@org_document.content = params[:org_document_comment][:content]
|
||||
@org_document.content = @quote + @org_document.content
|
||||
#@org_document.title = "RE: #{@article.title}" unless params[:blog_comment][:title]
|
||||
@document.children << @org_document
|
||||
# @user_activity_id = params[:user_activity_id]
|
||||
# user_activity = UserActivity.where("act_type='BlogComment' and act_id =#{@article.id}").first
|
||||
# if user_activity
|
||||
# user_activity.updated_at = Time.now
|
||||
# user_activity.save
|
||||
# end
|
||||
# attachments = Attachment.attach_files(@org_document, params[:attachments])
|
||||
# render_attachment_warning_if_needed(@org_document)
|
||||
#@article.save
|
||||
# redirect_to user_blogs_path(:user_id=>params[:user_id])
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
# if params[:course_id] #如果呆了course_id过来了,那么这是要跳到课程大纲去的
|
||||
# redirect_to syllabus_course_path(:id=>params[:course_id])
|
||||
# else
|
||||
redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id)
|
||||
# end
|
||||
|
||||
}
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -151,7 +151,11 @@ class OrganizationsController < ApplicationController
|
|||
end
|
||||
|
||||
def members
|
||||
@members = OrgMember.where("organization_id =?", @organization.id)
|
||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||
@members = OrgMember.where("organization_id =?", @organization.id)
|
||||
else
|
||||
render_403
|
||||
end
|
||||
end
|
||||
|
||||
def more_org_projects
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
# encoding: utf-8
|
||||
module ExerciseHelper
|
||||
|
||||
# 单选
|
||||
def sigle_selection_standard_answer(params)
|
||||
size = params.ord - 96
|
||||
if size > 0 # 小写字母答案
|
||||
answer = params.ord - 96
|
||||
else
|
||||
answer = params.ord - 64
|
||||
end
|
||||
end
|
||||
|
||||
# 多选
|
||||
def multiselect_standard_answer(params)
|
||||
size = params.ord - 96
|
||||
answer = []
|
||||
if size > 0 # 小写字母答案
|
||||
for i in 0..(params.length-1)
|
||||
answer << (params[i].ord - 96).to_s
|
||||
end
|
||||
else
|
||||
for i in 0..(params.length-1)
|
||||
answer << (params[i].ord - 64)
|
||||
end
|
||||
end
|
||||
answer = answer.sort
|
||||
answer.join("")
|
||||
end
|
||||
|
||||
#
|
||||
def fill_standart_answer(params, standart_answer)
|
||||
params.each do |param|
|
||||
standart_answer.answer_text = param.value
|
||||
standart_answer.save
|
||||
end
|
||||
end
|
||||
|
||||
# 获取多选的得分
|
||||
def get_mulscore(question, user)
|
||||
ecs = ExerciseAnswer.where("user_id =? and exercise_question_id =?", user.id, question.id)
|
||||
arr = []
|
||||
ecs.each do |ec|
|
||||
arr << ec.exercise_choice.choice_position
|
||||
end
|
||||
arr.sort
|
||||
arr = arr.join("")
|
||||
end
|
||||
|
||||
# 判断用户是否已经提交了问卷
|
||||
# status 为0的时候是用户点击试卷。为1表示用户已经提交
|
||||
def has_commit_exercise?(exercise_id, user_id)
|
||||
pu = ExerciseUser.where("exercise_id=? and user_id=? and status=?",exercise_id, user_id, true)
|
||||
if pu.empty?
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
# 判断学生是否点击过问卷,点击则为他保存一个记录,记录start_at
|
||||
def has_click_exercise?(exercise_id, user_id)
|
||||
pu = ExerciseUser.where("exercise_id=? and user_id=? and status=?",exercise_id, user_id, false)
|
||||
if pu.empty?
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
def convert_to_char(str)
|
||||
result = ""
|
||||
length = str.length
|
||||
unless str.nil?
|
||||
if length === 1
|
||||
result += (str.to_i + 64).chr
|
||||
return result
|
||||
elsif length > 1
|
||||
for i in 0...length
|
||||
result += (str[i].to_i + 64).chr
|
||||
end
|
||||
return result
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
def get_current_score exercise
|
||||
score = 0
|
||||
unless exercise.nil?
|
||||
exercise.exercise_questions.each do |exercise_question|
|
||||
unless exercise_question.question_score.nil?
|
||||
score += exercise_question.question_score
|
||||
end
|
||||
end
|
||||
return score
|
||||
end
|
||||
return score
|
||||
end
|
||||
|
||||
def answer_be_selected?(answer,user)
|
||||
pv = answer.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id} ")
|
||||
if !pv.nil? && pv.count > 0
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
#获取文本题答案
|
||||
def get_anwser_vote_text(question_id,user_id)
|
||||
pv = ExerciseAnswer.find_by_exercise_question_id_and_user_id(question_id,user_id)
|
||||
if pv.nil?
|
||||
''
|
||||
else
|
||||
pv.answer_text
|
||||
end
|
||||
end
|
||||
|
||||
# 获取当前学生回答问题的答案
|
||||
def get_user_answer(question,user)
|
||||
user_answer = question.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id}")
|
||||
user_answer
|
||||
end
|
||||
|
||||
# 获取问题的标准答案
|
||||
def get_user_standard_answer(question,user)
|
||||
if question.question_type == 3
|
||||
standard_answer =[]
|
||||
question.exercise_standard_answers.each do |answer|
|
||||
standard_answer << answer.answer_text
|
||||
end
|
||||
else
|
||||
standard_answer = question.exercise_standard_answers
|
||||
end
|
||||
standard_answer
|
||||
end
|
||||
|
||||
end
|
|
@ -41,6 +41,7 @@ class Course < ActiveRecord::Base
|
|||
has_many :course_activities
|
||||
# 课程消息
|
||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||
has_many :exercises, :dependent => :destroy
|
||||
|
||||
acts_as_taggable
|
||||
acts_as_nested_set :order => 'name', :dependent => :destroy
|
||||
|
|
|
@ -6,7 +6,7 @@ class CourseActivity < ActiveRecord::Base
|
|||
belongs_to :user
|
||||
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
|
||||
after_save :add_user_activity, :add_course_activity
|
||||
before_destroy :destroy_user_activity
|
||||
before_destroy :destroy_user_activity, :destroy_org_activity
|
||||
|
||||
#在个人动态里面增加当前动态
|
||||
def add_user_activity
|
||||
|
@ -55,4 +55,9 @@ class CourseActivity < ActiveRecord::Base
|
|||
user_activity = UserActivity.where("act_type = '#{self.course_act_type.to_s}' and act_id = '#{self.course_act_id}'")
|
||||
user_activity.destroy_all
|
||||
end
|
||||
|
||||
def destroy_org_activity
|
||||
org_activity = OrgActivity.where("org_act_type = '#{self.course_act_type.to_s}' and org_act_id = '#{self.course_act_id}'")
|
||||
org_activity.destroy_all
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
class Exercise < ActiveRecord::Base
|
||||
#exercise_status: 1,新建;2,发布;3,关闭
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :user
|
||||
has_many :exercise_questions, :dependent => :destroy,:order => "#{ExerciseQuestion.table_name}.question_number"
|
||||
has_many :exercise_users, :dependent => :destroy
|
||||
has_many :users, :through => :exercise_users #该测试被哪些用户提交答案过
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
class ExerciseAnswer < ActiveRecord::Base
|
||||
#学生答题
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :exercise_question
|
||||
belongs_to :exercise_choice
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class ExerciseChoice < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
belongs_to :exercise_question
|
||||
has_many :exercise_answers, :dependent => :destroy
|
||||
has_many :exercise_standard_answers, :dependent => :destroy
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
class ExerciseQuestion < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
belongs_to :exercise
|
||||
has_many :exercise_choices, :order => "#{ExerciseChoice.table_name}.choice_position",:dependent => :destroy
|
||||
has_many :exercise_answers, :dependent => :destroy
|
||||
has_many :exercise_standard_answers, :dependent => :destroy
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class ExerciseStandardAnswer < ActiveRecord::Base
|
||||
#标准答案
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
belongs_to :exercise_question
|
||||
belongs_to :exercise_choice
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class ExerciseUser < ActiveRecord::Base
|
||||
include Redmine::SafeAttributes
|
||||
|
||||
belongs_to :user
|
||||
belongs_to :exercise
|
||||
end
|
|
@ -21,7 +21,7 @@ class ForgeActivity < ActiveRecord::Base
|
|||
validates :forge_act_type, presence: true
|
||||
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
|
||||
after_save :add_user_activity, :add_org_activity
|
||||
before_destroy :destroy_user_activity
|
||||
before_destroy :destroy_user_activity, :destroy_org_activity
|
||||
|
||||
#在个人动态里面增加当前动态
|
||||
def add_user_activity
|
||||
|
@ -46,17 +46,28 @@ class ForgeActivity < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def add_org_activity
|
||||
OrgActivity.create(:user_id => self.user_id,
|
||||
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?
|
||||
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first
|
||||
org_activity.created_at = self.created_at
|
||||
org_activity.save
|
||||
else
|
||||
OrgActivity.create(:user_id => self.user_id,
|
||||
:org_act_id => self.forge_act_id,
|
||||
:org_act_type => self.forge_act_type,
|
||||
:container_id => self.project_id,
|
||||
:container_type => 'Project',
|
||||
:created_at => self.created_at,
|
||||
:updated_at => self.updated_at)
|
||||
end
|
||||
end
|
||||
|
||||
def destroy_user_activity
|
||||
user_activity = UserActivity.where("act_type = '#{self.forge_act_type.to_s}' and act_id = '#{self.forge_act_id}'")
|
||||
user_activity.destroy_all
|
||||
end
|
||||
|
||||
def destroy_org_activity
|
||||
org_acts = OrgActivity.where("org_act_type='#{self.forge_act_type.to_s}' and org_act_id = '#{self.forge_act_id}'")
|
||||
org_acts.destroy_all
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,6 +11,10 @@ class OrgDocumentComment < ActiveRecord::Base
|
|||
def document_save_as_org_activity
|
||||
if(self.parent().nil?)
|
||||
self.org_acts << OrgActivity.new(:user_id => User.current.id, :container_id => self.organization.id, :container_type => 'Organization')
|
||||
else
|
||||
act = OrgActivity.where("org_act_type='OrgDocumentComment' and org_act_id =?", self.root.id).first
|
||||
act.update_attributes(:updated_at => self.updated_at)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -81,6 +81,12 @@ class User < Principal
|
|||
has_many :poll, :dependent => :destroy #用户创建的问卷
|
||||
has_many :answers, :source => :poll, :through => :poll_users, :dependent => :destroy #用户已经完成问答的问卷
|
||||
# end
|
||||
#在线测验相关关系
|
||||
has_many :exercise_user, :dependent => :destroy #答卷中间表
|
||||
has_many :exercise_answer, :dependent => :destroy #针对每个题目学生的答案
|
||||
has_many :exercises, :dependent => :destroy #创建的试卷
|
||||
has_many :exercises_answers, :source => :exercise, :through => :exercise_user, :dependent => :destroy #用户已经完成问答的试卷
|
||||
#end
|
||||
#作业相关关系
|
||||
has_many :homework_commons, :dependent => :destroy
|
||||
has_many :student_works, :dependent => :destroy
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript">
|
||||
function close_alert_form(){hideModal("#alert_form");}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="alert_form">
|
||||
<div class="upload_con">
|
||||
<div class="polls_alert_upload_box">
|
||||
<p class="polls_alert_box_p">
|
||||
<%= message%>
|
||||
</p>
|
||||
<div class="polls_alert_btn_box">
|
||||
<a class="upload_btn" onclick="close_alert_form();">
|
||||
确 定
|
||||
</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<div id="popbox" style="text-align: center;margin-top: 25px">
|
||||
<% if status == 0 %>
|
||||
<h3 style="font-weight: normal;color: green">提交成功!您的分数是:<%=@score %>分。</h3>
|
||||
<%= link_to "确定", exercise_path(),:class => 'commit'%>
|
||||
<% elsif status == 1 %>
|
||||
<h3 style="font-weight: normal;color: red">您还有尚未作答的题目请完成后再提交!</h3>
|
||||
<%= link_to "确定", "javascript:void(0)",:onclick => 'hidden_atert_form();',:class => 'commit'%>
|
||||
<% else %>
|
||||
<h3 style="font-weight: normal;color: red">发生未知错误,请检查您的网络。</h3>
|
||||
<%= link_to "确定", "javascript:void(0)",:onclick => 'hidden_atert_form();',:class => 'commit'%>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1,63 @@
|
|||
<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
|
||||
<!--编辑单选start-->
|
||||
<script type="text/javascript">
|
||||
function resetQuestion<%=exercise_question.id%>()
|
||||
{
|
||||
$("#poll_questions_title_<%=exercise_question.id%>").val("<%= exercise_question.question_title%>")
|
||||
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>")
|
||||
$("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>")
|
||||
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<label>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>: </label>" +
|
||||
"<input maxlength='200' type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
"</li>" +
|
||||
"<div class='cl'></div>" +
|
||||
"<% end%>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="questionContainer" style="width: 680px;">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入单选题题目" type="text" value="<%=exercise_question.question_title %>">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input type="text" id="poll_question_score_<%=exercise_question.id %>" name="question_score" style="width:40px; text-align:center; padding-left:0px;" value="<%= exercise_question.question_score %>">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<div id="poll_answers_<%=exercise_question.id%>">
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input id="poll_question_standard_answer_<%=exercise_question.id %>" name="exercise_choice" placeholder="若标准答案为A,在此输入A即可" type="text" value="<%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>);">
|
||||
保存
|
||||
</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<!--编辑单选 end-->
|
||||
<% end%>
|
|
@ -0,0 +1,63 @@
|
|||
<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
|
||||
<!--编辑单选start-->
|
||||
<script type="text/javascript">
|
||||
function resetQuestion<%=exercise_question.id%>()
|
||||
{
|
||||
$("#poll_questions_title_<%=exercise_question.id%>").val("<%= exercise_question.question_title%>")
|
||||
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>")
|
||||
$("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>")
|
||||
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<label>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>: </label>" +
|
||||
"<input maxlength='200' type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
"</li>" +
|
||||
"<div class='cl'></div>" +
|
||||
"<% end%>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="questionContainer" style="width: 680px;">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入多选题题目" type="text" value="<%=exercise_question.question_title %>">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input type="text" id="poll_question_score_<%=exercise_question.id %>" name="question_score" style="width:40px; text-align:center; padding-left:0px;" value="<%= exercise_question.question_score %>">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<div id="poll_answers_<%=exercise_question.id%>">
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input id="poll_question_standard_answer_<%=exercise_question.id %>" name="exercise_choice" placeholder="若标准答案为A,B,C,在答案输入框填入ABC即可" type="text" value="<%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>);">
|
||||
保存
|
||||
</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<!--编辑单选 end-->
|
||||
<% end%>
|
|
@ -0,0 +1,33 @@
|
|||
<%= form_for @exercise, :remote=>true do |f| %>
|
||||
<div class="testContainer">
|
||||
<div>
|
||||
<input name="exercise[exercise_name]" maxlength="100" id="exercise_name" class="testTitle mb10" type="text" placeholder="测验标题" value="<%=@exercise.exercise_name%>" />
|
||||
</div>
|
||||
<%# if edit_mode %>
|
||||
<!--<label class="fl c_grey f14" style="margin-top: 4px;">发布日期(可选):</label>-->
|
||||
<%# end %>
|
||||
<div class="calendar_div fl mr10">
|
||||
<input type="text" name="exercise[publish_time]" id="exercise_publish_time" placeholder="发布时间" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if exercise.publish_time %>" >
|
||||
<%= calendar_for('exercise_publish_time')%>
|
||||
</div>
|
||||
<%# if edit_mode %>
|
||||
<!--<label class="fl c_grey f14" style="margin-top: 4px;">截止日期:</label>-->
|
||||
<%# end %>
|
||||
<div class="calendar_div fl">
|
||||
<input type="text" name="exercise[end_time]" id="exercise_end_time" placeholder="截止时间" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d") if exercise.end_time %>" >
|
||||
<%= calendar_for('exercise_end_time')%>
|
||||
</div>
|
||||
<div class="fl ml10 f14 fontGrey2"><span class="mr5">测验时长:</span><input name="exercise[time]" id="exercise_time" type="text" class="examTime mr5" value="<%=exercise.time %>" />分钟</div>
|
||||
<div class="cl"></div>
|
||||
<textarea class="testDes mt10" name="exercise[exercise_description]" id="exercise_description" placeholder="发布须知:试题类型有选择和填空两种,其中选择题包括单选题和多选题。您可以在此处填写测验相关说明。" ><%=exercise.exercise_description %></textarea>
|
||||
<div class="ur_editor_footer" style="padding-top: 10px;">
|
||||
<a class="btn_submit c_white" data-button="ok" onclick="pollsSubmit($(this));">
|
||||
保存
|
||||
</a>
|
||||
<a class="btn_cancel" data-button="cancel" onclick="pollsCancel();">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,59 @@
|
|||
<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
|
||||
<!--编辑单选start-->
|
||||
<script type="text/javascript">
|
||||
function resetQuestion<%=exercise_question.id%>()
|
||||
{
|
||||
$("#poll_questions_title_<%=exercise_question.id%>").val("<%= exercise_question.question_title%>")
|
||||
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>")
|
||||
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<label>候选答案<span class='ur_index'></span>: </label>" +
|
||||
"<input name='exercise_choice[<%=exercise_choice.id %>]' placeholder='请输入候选答案' type='text' value='<%=exercise_choice.answer_text %>'/>" +
|
||||
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_candidate_answer($(this));'></a>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
"</li>" +
|
||||
"<div class='cl'></div>" +
|
||||
"<% end%>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="questionContainer" style="width: 680px;">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text" value="<%=exercise_question.question_title %>">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input type="text" id="poll_question_score_<%=exercise_question.id %>" name="question_score" style="width:40px; text-align:center; padding-left:0px;" value="<%= exercise_question.question_score %>">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<div id="poll_answers_<%=exercise_question.id%>">
|
||||
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label>候选答案<span class="ur_index"></span>: </label>
|
||||
<input name="exercise_choice[<%=exercise_choice.id %>]" placeholder="请输入候选答案" type="text" value="<%=exercise_choice.answer_text %>"/>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this));"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>);">
|
||||
保存
|
||||
</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<!--编辑单选 end-->
|
||||
<% end%>
|
|
@ -0,0 +1,61 @@
|
|||
<%# has_commit = has_commit_poll?(poll.id ,User.current)%>
|
||||
<% exercise_name = exercise.exercise_name.empty? ? l(:label_poll_new) : exercise.exercise_name%>
|
||||
<% if @is_teacher%>
|
||||
<li title="<%= exercise.exercise_name %>">
|
||||
<div style="width: 310px;float: left;">
|
||||
<%# if has_commit %>
|
||||
<%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
|
||||
<%# else %>
|
||||
<%#= link_to poll_name, exercise_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
|
||||
<%# end %>
|
||||
<%= link_to exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<% if exercise.exercise_status == 1%>
|
||||
<li class="pollsbtn fl ml10 pollsbtn_grey">统计结果</li>
|
||||
<% else %>
|
||||
<li><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fl ml10"%></li>
|
||||
<% end%>
|
||||
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<li><a href="javascript:" class="pollsbtn btn_pu fl ml5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>);">发布试卷</a></li>
|
||||
<% elsif exercise.exercise_status == 2%>
|
||||
<li><a href="javascript:" class="pollsbtn btn_de fl ml5" onclick="republish_exercise(<%= exercise.id%>);">取消发布</a></li>
|
||||
<% else%>
|
||||
<li class="pollsbtn fl ml10 pollsbtn_grey" style="margin-left: 5px;" >发布试卷</li>
|
||||
<% end%>
|
||||
|
||||
<%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %>
|
||||
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<li><%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml5"%></li>
|
||||
<% else%>
|
||||
<li class="polls_de_grey fr ml5" title="未发布的试卷才能进行编辑">编辑</li>
|
||||
<% end%>
|
||||
|
||||
<%# if exercise.exercise_status == 2 %>
|
||||
<!--<li><a class="polls_de fr ml5" onclick="" href="javascript:">关闭</a></li>-->
|
||||
<%# else %>
|
||||
<!--<li class="polls_de_grey fr ml5" title="发布的问卷才能进行关闭">关闭</li>-->
|
||||
<%# end%>
|
||||
|
||||
<%# if exercise.exercise_status == 1%>
|
||||
<!--<li class="polls_de_grey fr ml5">导出</li>-->
|
||||
<%# elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %>
|
||||
<!--<li><%#= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%></li>-->
|
||||
<%# end%>
|
||||
|
||||
|
||||
<li class="polls_date fr"><%= format_date exercise.created_at.to_date%></li>
|
||||
<% else%>
|
||||
<% if exercise.exercise_status == 2%>
|
||||
<%# if has_commit%>
|
||||
<!--li><%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue" %></li>
|
||||
<li class="pollsbtn_tip fl ml5">已答</li-->
|
||||
<%#else%>
|
||||
<%= link_to exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%>
|
||||
<%#end%>
|
||||
<% end%>
|
||||
<li class="polls_date fr mr10"><%= format_date exercise.created_at.to_date%></li>
|
||||
<% end%>
|
|
@ -0,0 +1,42 @@
|
|||
<% mc_question_list = exercise.exercise_questions.where("question_type=1") %>
|
||||
<% mcq_question_list = exercise.exercise_questions.where("question_type=2") %>
|
||||
<% single_question_list = exercise.exercise_questions.where("question_type=3") %>
|
||||
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">单选题</h3>
|
||||
<% mc_question_list.each do |exercise_question| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<%= render :partial => 'show_MC', :locals => {:exercise_question => exercise_question} %>
|
||||
</div>
|
||||
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
|
||||
<%= render :partial => 'edit_MC', :locals => {:exercise_question => exercise_question} %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">多选题</h3>
|
||||
<% mcq_question_list.each do |exercise_question| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<%= render :partial => 'show_MCQ', :locals => {:exercise_question => exercise_question} %>
|
||||
</div>
|
||||
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
|
||||
<%= render :partial => 'edit_MCQ', :locals => {:exercise_question => exercise_question} %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">填空题</h3>
|
||||
<% single_question_list.each do |exercise_question| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<%= render :partial => 'show_single', :locals => {:exercise_question => exercise_question} %>
|
||||
</div>
|
||||
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
|
||||
<%= render :partial => 'edit_single', :locals => {:exercise_question => exercise_question} %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1,194 @@
|
|||
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
//编辑问卷描述之后
|
||||
var popWindow ; //弹出框的引用
|
||||
var importPollPopWindow; //选择导入的弹出框引用
|
||||
function edit_head(){
|
||||
$("#polls_description").val($("#polls_description_div").html());
|
||||
}
|
||||
$(function(){
|
||||
//点击空白处
|
||||
$(document).bind('click',function(e){
|
||||
//弹出框非空 不是a标签 点击的不是弹出框 ,那么弹出框就会隐藏
|
||||
if(popWindow && e.target.nodeName != 'A' && !popWindow.is(e.target) && popWindow.has(e.target).length === 0){ // Mark 1
|
||||
popWindow.css('display', 'none');
|
||||
}
|
||||
if(importPollPopWindow && e.target.nodeName != 'A' && !importPollPopWindow.is(e.target) && importPollPopWindow.has(e.target).length === 0){
|
||||
importPollPopWindow.css('display', 'none');
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
function dismiss(quest_type,quest_id){
|
||||
popWindow = $("#div_"+quest_type+"_"+quest_id);
|
||||
if(popWindow){
|
||||
popWindow.css('display', 'none');
|
||||
}
|
||||
}
|
||||
|
||||
function chooseQuestionType(quest_type,quest_id){
|
||||
//quest_type 分为 mc mcq single multi
|
||||
//quest_id 是quetion的id 下同
|
||||
if(popWindow){
|
||||
popWindow.css('display', 'none');
|
||||
}
|
||||
popWindow = $("#div_"+quest_type+"_"+quest_id);
|
||||
$("#div_"+quest_type+"_"+quest_id).click(function(e){
|
||||
e.stopPropagation(); //组织冒泡到document.body中去
|
||||
});
|
||||
$("#div_"+quest_type+"_"+quest_id).css("position", "absolute");
|
||||
|
||||
$("#div_"+quest_type+"_"+quest_id).css("top", $("#add_"+quest_type+"_"+quest_id).offset().top+30);
|
||||
|
||||
$("#div_"+quest_type+"_"+quest_id).css("left", $("#add_"+quest_type+"_"+quest_id).offset().left-10);
|
||||
if( $("#div_"+quest_type+"_"+quest_id).css('display') == 'block') {
|
||||
$("#div_"+quest_type+"_"+quest_id).css('display', 'none');
|
||||
}
|
||||
else{
|
||||
$("#div_"+quest_type+"_"+quest_id).css('display', 'block');
|
||||
}
|
||||
}
|
||||
|
||||
//选择导入调查问卷
|
||||
function importPoll(){
|
||||
importPollPopWindow = $("#import_poll");
|
||||
$("#import_poll").css("position", "absolute");
|
||||
|
||||
$("#import_poll").css("top", $("#import_btn").offset().top+30);
|
||||
|
||||
$("#import_poll").css("left", $("#import_btn").offset().left-65);
|
||||
$("#import_poll").css("display","block")
|
||||
}
|
||||
|
||||
function remote_import(){
|
||||
importPollPopWindow.css('display', 'none');
|
||||
if($("#import_poll").val() === 0){
|
||||
return;
|
||||
}else{
|
||||
if(confirm("确认导入问卷"+$("#import_poll").find("option:selected").text()+"?")){
|
||||
$("#import_form").submit();
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//添加标题时确定按钮
|
||||
function add_poll_question(doc,quest_type,quest_id)
|
||||
{
|
||||
var title = $.trim($("#poll_questions_title").val());
|
||||
var score = $.trim($("#question_score").val());
|
||||
var standard_ans = $.trim($("#question_standard_ans").val());
|
||||
if(title.length == 0 || score.length == 0){
|
||||
alert("题目标题/分数不能为空");
|
||||
}/*else if(standard_ans.length == 0) {
|
||||
alert("标准答案不能为空");
|
||||
}*/else{
|
||||
doc.parent().parent().parent().submit();}
|
||||
}
|
||||
//修改标题时确定按钮
|
||||
function edit_poll_question(doc,id)
|
||||
{
|
||||
var title = $.trim($("#poll_questions_title_" + id).val());
|
||||
var score = $.trim($("#poll_question_score_"+ id).val());
|
||||
var standard_ans = $.trim($("#poll_question_standard_answer_" + id).val());
|
||||
if(title.length == 0 || score.length == 0){
|
||||
alert("题目标题/分数不能为空");
|
||||
}/*else if(standard_ans.length == 0) {
|
||||
alert("标准答案不能为空");
|
||||
}*/else{
|
||||
doc.parent().parent().parent().submit();}
|
||||
}
|
||||
|
||||
//问卷头
|
||||
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
|
||||
function pollsSubmit(doc){
|
||||
var title = $.trim($("#exercise_name").val());
|
||||
if(title.length == 0){
|
||||
alert("测验标题不能为空");
|
||||
} else if($.trim($("#exercise_publish_time").val()) =="") {
|
||||
alert("发布时间不能为空");
|
||||
} else if($.trim($("#exercise_end_time").val()) =="") {
|
||||
alert("截止时间不能为空");
|
||||
} else if($.trim($("#exercise_time").val()) =="") {
|
||||
alert("考试时长不能为空");
|
||||
} else if(Date.parse($("#exercise_end_time").val()) <= Date.parse($("#exercise_publish_time").val())) {
|
||||
alert("截止时间必须大于发布时间");
|
||||
}
|
||||
else {
|
||||
doc.parent().parent().parent().submit();
|
||||
}
|
||||
}
|
||||
function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();}
|
||||
//
|
||||
function pollQuestionCancel(question_id){
|
||||
$("#show_poll_questions_"+question_id).show();
|
||||
$("#edit_poll_questions_"+question_id).hide();
|
||||
}
|
||||
function pollQuestionEdit(question_id){
|
||||
$("#show_poll_questions_"+question_id).hide();
|
||||
$("#edit_poll_questions_"+question_id).show();
|
||||
$("#poll_questions_title_"+question_id).focus();
|
||||
}
|
||||
//单选题
|
||||
function add_single_answer(doc)
|
||||
{
|
||||
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span>: </label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
|
||||
"</li><div class='cl'></div>");
|
||||
}
|
||||
function add_candidate_answer(doc)
|
||||
{
|
||||
doc.parent().after("<li class='ur_item'><label>候选答案<span class='ur_index'></span>: </label><input maxlength='200' type='text' name='exercise_choice["+new Date().getTime()+"]' placeholder='请输入候选答案(选填)'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_candidate_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
|
||||
"</li><div class='cl'></div>");
|
||||
}
|
||||
function remove_single_answer(doc)
|
||||
{
|
||||
if(doc.parent().siblings("li").length == 0)
|
||||
{
|
||||
alert("选择题至少有一个选项");
|
||||
}
|
||||
else
|
||||
{
|
||||
doc.parent().remove();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="resources">
|
||||
<!-- 头部 -->
|
||||
<div id="polls_head_show" style="display: none;">
|
||||
<%= render :partial => 'show_head', :locals => {:exercise => @exercise}%>
|
||||
</div>
|
||||
<div id="polls_head_edit">
|
||||
<%= render :partial => 'edit_head', :locals => {:exercise => @exercise}%>
|
||||
</div>
|
||||
<% current_score = get_current_score @exercise %>
|
||||
<div class="mb5" style="display: <%= current_score == 0 ? "none" : "" %>" id="current_score_div">目前试卷总分:<span class="c_red" id="current_score"><%=current_score %>分</span></div>
|
||||
<!-- 问题 -->
|
||||
<div id="poll_content">
|
||||
<%= render :partial => 'exercise_content', :locals => {:exercise => @exercise}%>
|
||||
</div>
|
||||
|
||||
<div class="testQuestion" id="new_exercise_question">
|
||||
<%= render :partial => 'new_question', :locals => {:exercise => @exercise} %>
|
||||
</div><!--选项 end-->
|
||||
|
||||
<!-- 新增问题 -->
|
||||
<div id="new_poll_question">
|
||||
</div>
|
||||
|
||||
<div id="exercise_submit">
|
||||
<%= render :partial => 'exercise_submit', :locals => {:exercise => @exercise} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<!--contentbox end-->
|
||||
</div>
|
||||
</div><!--编辑end-->
|
|
@ -0,0 +1,208 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#Container").css("width","1000px");
|
||||
/*start_time = new Date();
|
||||
start_time.setFullYear(<%#=exercise_user.start_at.year%>);
|
||||
start_time.setMonth(<%#=exercise_user.start_at.month%>);
|
||||
start_time.setDate(<%#=exercise_user.start_at.day%>);
|
||||
start_time.setHours(<%#=exercise_user.start_at.hour%>);
|
||||
start_time.setMinutes(<%#=exercise_user.start_at.min%>);
|
||||
start_time.setSeconds(<%#=exercise_user.start_at.sec%>);
|
||||
//alert(start_time);
|
||||
end_time = start_time.getTime() + 1000*60*<%#=exercise.time %>;
|
||||
getTime(end_time);*/
|
||||
});
|
||||
function getTime(end_time) {
|
||||
//alert(end_time);
|
||||
now = new Date();
|
||||
var total_seconds = (now.getTime() - end_time)/1000;
|
||||
//start = new Date(start_time);
|
||||
//end_time = start_time;
|
||||
//var total_seconds = total_seconds - 1;
|
||||
var hours = total_seconds / 60 / 60;
|
||||
var hoursRound = Math.floor(hours);
|
||||
var minutes = total_seconds /60 - (60 * hoursRound);
|
||||
var minutesRound = Math.floor(minutes);
|
||||
var seconds = total_seconds - (60 * 60 * hoursRound) - (60 * minutesRound);
|
||||
var secondsRound = Math.round(seconds);
|
||||
$("#rest_hours").html(hoursRound);
|
||||
$("#rest_minutes").html(minutesRound);
|
||||
$("#rest_seconds").html(secondsRound);
|
||||
//if(total_seconds >0) {
|
||||
setTimeout("getTime("+end_time+");", 1000);
|
||||
//}
|
||||
}
|
||||
</script>
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="resources">
|
||||
<div class="testStatus"><!--头部显示 start-->
|
||||
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||
<div id="start_time" style="display: none"><%=exercise_user.start_at %></div>
|
||||
<div class="fontGrey2">
|
||||
<span class="mr130">开始时间:<%=format_time(exercise_user.start_at.to_s)%></span>
|
||||
<span class="mr130">测验时长:<%=exercise.time %>分钟</span>
|
||||
<!--
|
||||
<span class="fr">剩余时长:<span class="c_red" id="rest_hours"></span> 小时 <span class="c_red" id="rest_minutes"></span> 分钟 <span class="c_red" id="rest_seconds"></span> 秒</span>
|
||||
-->
|
||||
</div>
|
||||
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||
<div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% mc_question_list = exercise.exercise_questions.where("question_type=1").shuffle %>
|
||||
<% mcq_question_list = exercise.exercise_questions.where("question_type=2").shuffle %>
|
||||
<% single_question_list = exercise.exercise_questions.where("question_type=3").shuffle %>
|
||||
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">单选题</h3>
|
||||
<% mc_question_list.each_with_index do |exercise_question, list_index| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<script>
|
||||
function click_<%= exercise_choice.id %>(obj)
|
||||
{
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<%= commit_answer_exercise_path(exercise) %>",
|
||||
data: {
|
||||
exercise_choice_id: <%= exercise_choice.id %>,
|
||||
exercise_question_id: <%= exercise_question.id %>
|
||||
},
|
||||
success: function (data) {
|
||||
var dataObj = eval(data);
|
||||
if(dataObj.text == "ok")
|
||||
{
|
||||
obj.checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.checked = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<%= radio_button "exercise",exercise_question.id.to_s+"exercise_choice_id",exercise_choice.id,:class=>"ur_radio",:onclick =>"click_#{exercise_choice.id}(this);return false;",:checked => answer_be_selected?(exercise_choice,User.current),:disabled => !@can_edit_excercise %>
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">多选题</h3>
|
||||
<% mcq_question_list.each_with_index do |exercise_question,list_index| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<script>
|
||||
function click_<%= exercise_choice.id %>(obj)
|
||||
{
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<%= commit_answer_exercise_path(exercise) %>",
|
||||
data: {
|
||||
exercise_choice_id: <%= exercise_choice.id %>,
|
||||
exercise_question_id: <%= exercise_question.id %>
|
||||
},
|
||||
success: function (data) {
|
||||
var dataObj = eval(data);
|
||||
if(dataObj.text == "ok")
|
||||
{
|
||||
obj.checked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.checked = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<input class="ur_radio" type="checkbox" onclick="click_<%= exercise_choice.id %>(this);return false;" <%= answer_be_selected?(exercise_choice,User.current) ? "checked":"" %> <%= @can_edit_excercise?"":"disabled=disabled" %> >
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!--多选题显示 end-->
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">填空题</h3>
|
||||
<% single_question_list.each_with_index do |exercise_question, list_index| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<script>
|
||||
function onblur_<%= exercise_question.id %>(obj)
|
||||
{
|
||||
$(window).unbind('beforeunload');
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<%= commit_answer_exercise_path(exercise) %>",
|
||||
data: {
|
||||
exercise_question_id: <%= exercise_question.id %> ,
|
||||
answer_text: obj.value
|
||||
},
|
||||
success: function (data) {
|
||||
var dataObj = eval(data);
|
||||
obj.value = dataObj.text;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(exercise_question.id,User.current.id).html_safe %>" onblur="onblur_<%= exercise_question.id %>(this);" <%= @can_edit_excercise?"":"disabled=disabled" %>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="ur_buttons">
|
||||
<%= link_to l(:button_submit),commit_exercise_exercise_path(exercise), :method => :post,:class => "ur_button_submit",:style => "margin-left:80px;",:format => 'js',:remote=>true %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<!--contentbox end-->
|
||||
</div>
|
||||
<!--RSide end-->
|
||||
</div>
|
|
@ -0,0 +1,137 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
</script>
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="resources">
|
||||
<div class="testStatus"><!--头部显示 start-->
|
||||
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||
<div class="fontGrey2">
|
||||
<span class="mr130">开始时间:<%=format_time(exercise_user.start_at.to_s) %></span>
|
||||
<span class="mr130">测验时长:<%=exercise.time %>分钟</span>
|
||||
<%# time = exercise_user.end_at - exercise_user.start_at %>
|
||||
</div>
|
||||
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="mb5">得分:<span class="c_red"><%=exercise_user.score %>分</span></div>
|
||||
<% mc_question_list = exercise.exercise_questions.where("question_type=1") %>
|
||||
<% mcq_question_list = exercise.exercise_questions.where("question_type=2") %>
|
||||
<% single_question_list = exercise.exercise_questions.where("question_type=3") %>
|
||||
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">单选题</h3>
|
||||
<% mc_question_list.each_with_index do |exercise_question, list_index| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
<span class="ml15 c_red">
|
||||
<% answer = get_user_answer(exercise_question, User.current)%>
|
||||
<% standard_answer = get_user_standard_answer(exercise_question, User.current)%>
|
||||
<% if answer.first.exercise_choice.choice_position == standard_answer.first.exercise_choice_id %>
|
||||
√
|
||||
<% else %>
|
||||
×
|
||||
<% end %></span><br />
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<%= radio_button "poll_vote","poll_answer_id",exercise_choice.id,:class=>"ur_radio",:checked => answer_be_selected?(exercise_choice,User.current),:disabled => !@can_edit_excercise %>
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">多选题</h3>
|
||||
<% mcq_question_list.each_with_index do |exercise_question, list_index| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
<span class="ml15 c_red">
|
||||
<% answer = get_user_answer(exercise_question, User.current)%>
|
||||
<% standard_answer = get_user_standard_answer(exercise_question, User.current)%>
|
||||
<% if get_mulscore(exercise_question, User.current).to_i == standard_answer.first.exercise_choice_id %>
|
||||
√
|
||||
<% else %>
|
||||
×
|
||||
<% end %></span><br />
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<input class="ur_radio" type="checkbox" <%= answer_be_selected?(exercise_choice,User.current) ? "checked":"" %> <%= @can_edit_poll?"":"disabled=disabled" %> >
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!--多选题显示 end-->
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">填空题</h3>
|
||||
<% single_question_list.each_with_index do |exercise_question,list_index| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
<span class="ml15 c_red">
|
||||
<% answer = get_user_answer(exercise_question, User.current)%>
|
||||
<% standard_answer = get_user_standard_answer(exercise_question, User.current)%>
|
||||
<% if standard_answer.include?(answer.first.answer_text) %>
|
||||
√
|
||||
<% else %>
|
||||
×
|
||||
<% end %></span><br />
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
|
||||
候选答案:<%= exercise_choice.answer_text%><br />
|
||||
<% end %>
|
||||
</div>
|
||||
<div>
|
||||
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(exercise_question.id,User.current.id).html_safe %>" <%= @can_edit_poll?"":"disabled=disabled" %>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<!--contentbox end-->
|
||||
</div>
|
||||
<!--RSide end-->
|
||||
</div>
|
|
@ -0,0 +1,37 @@
|
|||
<%= form_for('',
|
||||
:html => { :multipart => true },
|
||||
:url => {:controller => 'exercise',
|
||||
:action => 'commit_exercise',
|
||||
:id => exercise.id
|
||||
},:remote=>true ) do |f| %>
|
||||
<div class="ur_buttons">
|
||||
<a class="ur_button_submit" onclick="poll_submit();"> 提交 </a>
|
||||
<div class="polls_cha">
|
||||
<%= f.check_box 'show_result', :value => exercise.show_result%>
|
||||
<%= label_tag '_show_result', '允许学生查看测验结果' %>
|
||||
<!--<input name="exercise[show_result]" value="<%#exercise.show_result %>" type="checkbox" checked="true">
|
||||
<label for="">允许学生查看测验结果</label>-->
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
function poll_submit() {
|
||||
var question_form = $("form.new_exercise_question");
|
||||
if($("#polls_head_edit").is(":visible")){
|
||||
alert("请先保存测验标题及测验基本信息。");
|
||||
} else if(question_form.length > 0) {
|
||||
alert("请先保存正在编辑的题目。");
|
||||
} else{
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'exercise_submit_info', locals: { :exercise => exercise}) %>');
|
||||
showModal('ajax-modal', '400px');
|
||||
//$('#ajax-modal').css('height','120px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,45 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<script type="text/javascript">
|
||||
function clickCanel(){hideModal("#popbox02");}
|
||||
function exercise_submit(){
|
||||
$("#exercise_submit>form")[0].submit();
|
||||
hideModal("#popbox02");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="popbox02">
|
||||
<div class="upload_con">
|
||||
<div class="upload_box">
|
||||
<% current_score = get_current_score exercise %>
|
||||
<% question_count = exercise.exercise_questions.count %>
|
||||
<% mc_count = exercise.exercise_questions.where("question_type=1").count %>
|
||||
<% mcq_count = exercise.exercise_questions.where("question_type=2").count %>
|
||||
<% single_count = exercise.exercise_questions.where("question_type=3").count %>
|
||||
<p class="f14">当前测验
|
||||
<% if question_count > 0 %>共有<%= question_count %>道题,其中<% end %>
|
||||
<% if mc_count > 0 %><%= mc_count %>道单选、<% end %>
|
||||
<% if mcq_count > 0 %><%= mcq_count %>道多选、<% end %>
|
||||
<% if single_count > 0%><%= single_count %>道填空,<% end %>
|
||||
总分为<span class="c_red"><%=current_score %></span>分。
|
||||
<br /><br />
|
||||
是否确定提交该测验?
|
||||
</p>
|
||||
<div class="polls_btn_box">
|
||||
<a class="upload_btn" onclick="exercise_submit();">
|
||||
确 定
|
||||
</a>
|
||||
<a class="upload_btn upload_btn_grey" onclick="clickCanel();">
|
||||
取 消
|
||||
</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
</script>
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="resources">
|
||||
<div class="testStatus"><!--头部显示 start-->
|
||||
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||
<div class="fontGrey2">
|
||||
<span class="mr130">发布时间:<%=format_time(exercise.publish_time.to_s) %></span>
|
||||
<span class="mr130">截止时间:<%=format_time(exercise.end_time.to_s) %></span>
|
||||
<span class="fr">测验时长:<%=exercise.time %>分钟</span>
|
||||
</div>
|
||||
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% mc_question_list = exercise.exercise_questions.where("question_type=1") %>
|
||||
<% mcq_question_list = exercise.exercise_questions.where("question_type=2") %>
|
||||
<% single_question_list = exercise.exercise_questions.where("question_type=3") %>
|
||||
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">单选题</h3>
|
||||
<% mc_question_list.each_with_index do |exercise_question, list_index| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
<br />
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<input class="ur_radio" type="radio" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">多选题</h3>
|
||||
<% mcq_question_list.each_with_index do |exercise_question, list_index| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
<br />
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<input class="ur_radio" type="checkbox" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!--多选题显示 end-->
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">填空题</h3>
|
||||
<% single_question_list.each_with_index do |exercise_question, list_index| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
<br />
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
|
||||
候选答案:<%= exercise_choice.answer_text%><br />
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="ur_buttons">
|
||||
<%= link_to "确定",exercise_index_path(:course_id => @course.id),:class => "ur_button_submit" %>
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "ur_button_submit", :style => "float:right"%>
|
||||
<% else %>
|
||||
<span class="ur_button_submit" style="float:right; background:#a3a3a3" title="测验已发布,不可再编辑">编辑</span>
|
||||
<%#= link_to l(:button_edit), '', :class => "ur_button_submit", :style => "float:right; background:#a3a3a3"%>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<!--contentbox end-->
|
||||
</div>
|
||||
<!--RSide end-->
|
||||
</div>
|
|
@ -0,0 +1,25 @@
|
|||
<div class="polls_head">
|
||||
<h2>所有试卷
|
||||
<span>(<%= @obj_count%>)</span>
|
||||
</h2>
|
||||
<% if @is_teacher%>
|
||||
<%#= link_to "导入", other_poll_poll_index_path(:polls_group_id => @course.id), :remote=>true,:class => "newbtn"%>
|
||||
<%= link_to "新建试卷 ", new_exercise_path(:course_id => @course.id), :class => "newbtn" %>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div id="polls_list" class="polls_list">
|
||||
|
||||
<% @exercises.each do |exercise|%>
|
||||
<ul id="polls_<%= exercise.id %>" class="polls_list_ul">
|
||||
<%= render :partial => 'exercise', :locals => {:exercise => exercise} %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
||||
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
|
||||
<div class="cl"></div>
|
||||
</div><!--列表end-->
|
|
@ -0,0 +1,60 @@
|
|||
<%= form_for(ExerciseQuestion.new,
|
||||
:html => { :multipart => true },
|
||||
:url=>create_exercise_question_exercise_path(exercise.id),
|
||||
:remote=>true ) do |f| %>
|
||||
<div class="questionContainer">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="1" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题题目" type="text">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<% score = exercise.exercise_questions.where("question_type=1").last.nil? ? "": exercise.exercise_questions.where("question_type=1").last.question_score %>
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项A<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项B<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项C<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'/>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项D<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'/>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input id="question_standard_ans" name="exercise_choice" placeholder="若标准答案为A,在此输入A即可" type="text">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));"> 保存 </a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,60 @@
|
|||
<%= form_for(ExerciseQuestion.new,
|
||||
:html => { :multipart => true },
|
||||
:url=>create_exercise_question_exercise_path(exercise.id),
|
||||
:remote=>true ) do |f| %>
|
||||
<div class="questionContainer">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="2" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题题目" type="text">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<% score = exercise.exercise_questions.where("question_type=2").last.nil? ? "": exercise.exercise_questions.where("question_type=2").last.question_score %>
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项A<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项B<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项C<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项D<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input id="question_standard_ans" name="exercise_choice" placeholder="若标准答案为A,B,C,在答案输入框填入ABC即可" type="text">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));"> 保存 </a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,39 @@
|
|||
<ul class="tabs_list">
|
||||
<li class="tab_item02 mr118"> <a title="单选题" class="tab_icon icon_radio" onclick="add_MC();"> 新建单选题 </a> </li>
|
||||
<li class="tab_item02 mr118"> <a title="多选题" class=" tab_icon icon_checkbox" onclick="add_MCQ();"> 新建多选题 </a> </li>
|
||||
<li class="tab_item02 "> <a title="单行主观" class="tab_icon icon_text" onclick="add_single();"> 新建填空题 </a> </li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function add_MC(){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
} else{
|
||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>exercise}) %>");
|
||||
$("#poll_questions_title").focus();
|
||||
}
|
||||
}
|
||||
|
||||
function add_MCQ(){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
} else{
|
||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>exercise}) %>");
|
||||
$("#poll_questions_title").focus();
|
||||
}
|
||||
}
|
||||
|
||||
function add_single(){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
} else{
|
||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>exercise}) %>");
|
||||
$("#poll_questions_title").focus();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
|
@ -0,0 +1,48 @@
|
|||
<%= form_for(ExerciseQuestion.new,
|
||||
:html => { :multipart => true },
|
||||
:url=>create_exercise_question_exercise_path(exercise.id),
|
||||
:remote=>true ) do |f| %>
|
||||
<div class="questionContainer">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="3" type="hidden">
|
||||
<input maxlength="250" class="questionTitle" name="question_title" id="poll_questions_title" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<% score = exercise.exercise_questions.where("question_type=3").last.nil? ? "": exercise.exercise_questions.where("question_type=3").last.question_score %>
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input id="question_score" value="<%= score%>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>候选答案一<span class="ur_index"></span>: </label>
|
||||
<input name="exercise_choice[0]" placeholder="请输入候选答案一" type="text">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>候选答案二<span class="ur_index"></span>: </label>
|
||||
<input name="exercise_choice[1]" placeholder="请输入候选答案二(选填)" type="text">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>候选答案三<span class="ur_index"></span>: </label>
|
||||
<input name="exercise_choice[2]" placeholder="请输入候选答案三(选填)" type="text">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));"> 保存 </a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -0,0 +1,111 @@
|
|||
<div>
|
||||
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||
<%= exercise_question.question_title %>
|
||||
<span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span>
|
||||
</div>
|
||||
|
||||
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
|
||||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= exercise_question.id%>);"></a>
|
||||
<a class='ur_icon_add' title='向下插入' id="add_mc_<%=exercise_question.id%>" onclick="dismiss('mc',<%=exercise_question.id%>);insert_MC('mc',<%=exercise_question.question_number%>,<%=exercise_question.id%>);"></a>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<input class="ur_radio" type="radio" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!--单选题显示 end-->
|
||||
<!-- 新增问题 -->
|
||||
<div id="insert_new_poll_question_mc_<%=exercise_question.id%>">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function insert_MC(quest_type,quest_num,quest_id){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
} else{
|
||||
<% score =exercise_question.question_score %>
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
||||
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.exercise.id),:remote=>true) do |f|%>'+
|
||||
' <div class="questionContainer" style="width: 680px;"> '+
|
||||
'<div class="ur_editor_title"> '+
|
||||
'<label>问题: </label>'+
|
||||
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
|
||||
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
|
||||
'<input type="hidden" name="question_type" value="1"/>'+
|
||||
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题题目" type="text"/>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_content">'+
|
||||
'<ul>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>分数<span class="ur_index"></span>: </label>'+
|
||||
'<input value="<%=score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
|
||||
'</li>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项A<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项B<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项C<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项D<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>标准答案<span class="ur_index"></span>: </label>'+
|
||||
'<input name="exercise_choice" id="question_standard_ans" placeholder="若标准答案为A,在此输入A即可" type="text">'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</ul>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_footer">'+
|
||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
|
||||
'保存'+
|
||||
'</a>'+
|
||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<%= l(:button_cancel)%>'+
|
||||
'</a>'+
|
||||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<% end%>'
|
||||
);
|
||||
$("#poll_questions_title").focus();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,109 @@
|
|||
<div>
|
||||
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||
<%= exercise_question.question_title %>
|
||||
<span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span>
|
||||
</div>
|
||||
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
|
||||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= exercise_question.id%>);"></a>
|
||||
<a class='ur_icon_add' title='向下插入' id="add_mcq_<%=exercise_question.id%>" onclick="dismiss('mcq',<%=exercise_question.id%>);insert_MCQ('mcq',<%=exercise_question.question_number%>,<%=exercise_question.id%>);"></a>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<input class="ur_radio" type="checkbox" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!--多选题显示 end-->
|
||||
<!-- 新增问题 -->
|
||||
<div id="insert_new_poll_question_mcq_<%=exercise_question.id%>">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function insert_MCQ(quest_type,quest_num,quest_id){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == ""){
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
} else {
|
||||
<% score =exercise_question.question_score %>
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
||||
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.exercise.id),:remote=>true) do |f|%>'+
|
||||
' <div class="questionContainer" style="width: 680px;"> '+
|
||||
'<div class="ur_editor_title"> '+
|
||||
'<label>问题: </label>'+
|
||||
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
|
||||
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
|
||||
'<input type="hidden" name="question_type" value="2"/>'+
|
||||
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题题目" type="text"/>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_content">'+
|
||||
'<ul>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>分数<span class="ur_index"></span>: </label>'+
|
||||
'<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
|
||||
'</li>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项A<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项B<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项C<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项D<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>标准答案<span class="ur_index"></span>: </label>'+
|
||||
'<input name="exercise_choice" id="question_standard_ans" placeholder="若标准答案为A,B,C,在答案输入框填入ABC即可" type="text">'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</ul>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_footer">'+
|
||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
|
||||
'保存'+
|
||||
'</a>'+
|
||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<%= l(:button_cancel)%>'+
|
||||
'</a>'+
|
||||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<% end%>'
|
||||
);
|
||||
$("#poll_questions_title").focus();
|
||||
}
|
||||
}else {
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,12 @@
|
|||
<div class="testStatus"><!--头部显示 start-->
|
||||
<a href="javascript:" class="testEdit" title="编辑" onclick="pollsEdit();"></a>
|
||||
<!-- <a class='ur_icon_add' title='导入' id="import_btn" onclick="importPoll();"></a> -->
|
||||
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||
<div class="fontGrey2">
|
||||
<span class="mr100">发布时间:<%=Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.publish_time%></span>
|
||||
<span class="mr100">截止时间:<%=Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.end_time %></span>
|
||||
<span>测验时长:<%= exercise.time %>分钟</span></div>
|
||||
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||
<div class="cl"></div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
|
@ -0,0 +1,85 @@
|
|||
<div>
|
||||
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||
<%= exercise_question.question_title %>
|
||||
</div>
|
||||
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
|
||||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= exercise_question.id%>);"></a>
|
||||
<a class='ur_icon_add' title='向下插入' id="add_single_<%=exercise_question.id%>" onclick="dismiss('single',<%=exercise_question.id%>);insert_SINGLE('single',<%=exercise_question.question_number%>,<%=exercise_question.id%>);"></a>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
|
||||
候选答案:<%= exercise_choice.answer_text%><br />
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 新增问题 -->
|
||||
<div id="insert_new_poll_question_single_<%=exercise_question.id%>">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function insert_SINGLE(quest_type,quest_num,quest_id){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
} else {
|
||||
<% score =exercise_question.question_score %>
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
||||
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.exercise.id),:remote=>true) do |f|%>'+
|
||||
' <div class="questionContainer" style="width: 680px;"> '+
|
||||
'<div class="ur_editor_title"> '+
|
||||
'<label>问题: </label>'+
|
||||
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
|
||||
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
|
||||
'<input type="hidden" name="question_type" value="3"/>'+
|
||||
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text"/>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_content">'+
|
||||
'<ul>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>分数<span class="ur_index"></span>: </label>'+
|
||||
'<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
|
||||
'</li>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>候选答案一<span class="ur_index"></span>: </label>'+
|
||||
'<input type="text" name="exercise_choice[0]" placeholder="请输入候选答案一"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>候选答案二<span class="ur_index"></span>: </label>'+
|
||||
'<input type="text" name="exercise_choice[1]" placeholder="请输入候选答案二(选填)"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>候选答案三<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="exercise_choice[2]" placeholder="请输入候选答案三(选填)"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</ul>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_footer">'+
|
||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
|
||||
'保存'+
|
||||
'</a>'+
|
||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<%= l(:button_cancel)%>'+
|
||||
'</a>'+
|
||||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<% end%>'
|
||||
);
|
||||
$("#poll_questions_title").focus();
|
||||
}
|
||||
} else {
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,73 @@
|
|||
<div class="fl" style="padding-bottom:10px; width:720px;">
|
||||
<span class="c_dark f14 fb fl mr30">
|
||||
测验
|
||||
<font class="f12 c_red">
|
||||
(<%= @exercise_count%>人已交)
|
||||
</font>
|
||||
<% if !@is_teacher && @exercise_users_list.empty?%>
|
||||
<span class="f12 c_red">您尚未提交</span>
|
||||
<% elsif !@is_teacher && !@exercise_users_list.empty?%>
|
||||
<span class="f12 c_red">您已提交</span>
|
||||
<% end %>
|
||||
</span>
|
||||
<%#if @is_teacher || @exercise.exercise_status == 3%>
|
||||
<!--<div class="hworkSearchBox">
|
||||
<input type="text" id="course_student_name" value="<%#= @name%>" placeholder="姓名、学号、邮箱" class="hworkSearchInput" onkeypress="SearchByName('<%#= student_work_index_path(:homework => @homework.id)%>',event);"/>
|
||||
<a class="hworkSearchIcon" id="search_in_student_work" onclick="SearchByName_1('<%#= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)"></a>
|
||||
</div>-->
|
||||
<%#= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %>
|
||||
<%# end%>
|
||||
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" style="display: none">[ 显示测验信息 ]</a> </span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="fl">
|
||||
<%= render :partial => "student_table"%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% @exercise_users_list.each do |exercise|%>
|
||||
<script type="text/javascript">
|
||||
$(".student_work_<%= exercise.id%>").mouseenter(function(){
|
||||
$("#work_click_<%= exercise.id%>").show();
|
||||
}).mouseleave(function(){
|
||||
$("#work_click_<%= exercise.id%>").hide();
|
||||
});
|
||||
</script>
|
||||
<ul class="hworkListRow" id="student_work_<%= exercise.id%>">
|
||||
<li class="hworkList340 width530">
|
||||
<ul>
|
||||
<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 onclick="" style="cursor: pointer;" class="student_work_<%= exercise.id%>">
|
||||
<li>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkStName mr15 mt16" title="姓名">
|
||||
<%= exercise.user.show_name%>
|
||||
</li>
|
||||
<li class="hworkStID mr10 mt16" title="学号">
|
||||
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>
|
||||
</li>
|
||||
<li class="hworkStID mt16" title="班级">
|
||||
--
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</div>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="hworkList130 c_grey student_work_<%= exercise.id%>" onclick="" style="cursor: pointer;">
|
||||
<% if exercise.created_at%>
|
||||
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
<li class="hworkList50 <%= score_color exercise.score%> student_final_scor_info">
|
||||
<%= exercise.score.nil? ? "--" : format("%.1f",exercise.score)%>
|
||||
</li>
|
||||
<li class="hworkTip" style="display: none" id="work_click_<%= exercise.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></li>
|
||||
</ul>
|
||||
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
|
@ -0,0 +1,22 @@
|
|||
<ul class="hworkUl">
|
||||
<li class="hworkList340 hworkH30 width530">
|
||||
<span class="c_dark f14 fb fl mr55"> </span>
|
||||
<span class="c_dark f14 fb fl mr60">姓名</span>
|
||||
<span class="c_dark f14 fb fl mr60">学号</span>
|
||||
<span class="c_dark f14 fb fl">班级</span>
|
||||
</li>
|
||||
|
||||
<li class="hworkList130 hworkH30">
|
||||
<%= link_to "时间",'',:class => "c_dark f14 fb fl ml50" ,:remote => true%>
|
||||
<%# if @show_all && @order == "created_at"%>
|
||||
<%#= link_to "", student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%>
|
||||
<%# end%>
|
||||
</li>
|
||||
|
||||
<li class="hworkList50 hworkH30">
|
||||
<%= link_to "成绩",'',:class => "c_dark f14 fb fl ml10",:remote => true%>
|
||||
<%# if @show_all && @order == "score"%>
|
||||
<%#= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%>
|
||||
<%# end%>
|
||||
</li>
|
||||
</ul>
|
|
@ -0,0 +1,9 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status}) %>');
|
||||
showModal('ajax-modal', '270px');
|
||||
$('#ajax-modal').css('height','110px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='hidden_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("alert_box");
|
|
@ -0,0 +1,4 @@
|
|||
$("#polls_head_show").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:exercise => @exercise}) %>");
|
||||
$("#polls_head_edit").html("<%= escape_javascript(render :partial => 'edit_head', :locals => {:exercise => @exercise}) %>");
|
||||
$("#polls_head_edit").hide();
|
||||
$("#polls_head_show").show();
|
|
@ -0,0 +1,42 @@
|
|||
<% if @is_insert %>
|
||||
$("#poll_content").html('<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise})%>');
|
||||
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
|
||||
$("#current_score_div").show();
|
||||
$("#current_score").html("<%=get_current_score @exercise %>分");
|
||||
<% else %>
|
||||
$("#new_exercise_question").html('<%= escape_javascript(render :partial => 'new_question', :locals => {:exercise => @exercise}) %>');
|
||||
$("#new_poll_question").html("");
|
||||
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
|
||||
<%if @exercise_questions.question_type == 1%>
|
||||
$("#mc_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @exercise_questions.id %>'>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @exercise_questions.id %>' style='display: none;'>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
<% end %>
|
||||
<%if @exercise_questions.question_type == 2%>
|
||||
$("#mcq_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @exercise_questions.id %>'>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @exercise_questions.id %>' style='display: none;'>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
<% end %>
|
||||
<%if @exercise_questions.question_type == 3%>
|
||||
$("#single_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @exercise_questions.id %>'>" +
|
||||
"<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @exercise_questions.id %>' style='display: none;'>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
<% end %>
|
||||
$("#current_score_div").show();
|
||||
$("#current_score").html("<%=get_current_score @exercise %>分");
|
||||
<% end %>
|
|
@ -0,0 +1,3 @@
|
|||
$("#poll_content").html("<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise}) %>");
|
||||
$("#current_score").html("<%=get_current_score @exercise %>分");
|
||||
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
|
|
@ -0,0 +1 @@
|
|||
$("#exercise").html("<%= escape_javascript(render :partial => 'exercises_list') %>");
|
|
@ -0,0 +1 @@
|
|||
<%= render :partial => 'exercise_form'%>
|
|
@ -0,0 +1,63 @@
|
|||
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||
<script type="text/javascript">
|
||||
function republish_exercise(exercise_id)
|
||||
{
|
||||
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||
"<div class='upload_con'>" +
|
||||
"<div class='upload_box'>" +
|
||||
"<p class='polls_box_p'>取消发布后问卷统计结果将会被清空<br />是否确定取消发布该问卷?</p>" +
|
||||
"<div class='polls_btn_box'>" +
|
||||
"<a href='/exercise/"+ exercise_id +"/republish_exercise' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||
"</div>" +
|
||||
"<div class='cl'></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
showModal('ajax-modal', '310px');
|
||||
$('#ajax-modal').css('height','120px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
||||
function clickCanel(){hideModal("#popbox02");}
|
||||
|
||||
function exercise_submit(exercise_id,exercise_name)
|
||||
{
|
||||
if(exercise_name == 0)
|
||||
{
|
||||
alert("试卷标题不能为空");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||
"<div class='upload_con'>" +
|
||||
"<div class='upload_box'>" +
|
||||
"<p class='polls_box_p'>测验发布后将不能对测验进行修改,<br />是否确定发布该测验?</p>" +
|
||||
"<div class='polls_btn_box'>" +
|
||||
"<a href='/exercise/"+ exercise_id +"/publish_exercise' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||
"</div>" +
|
||||
"<div class='cl'></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
showModal('ajax-modal', '310px');
|
||||
$('#ajax-modal').css('height','120px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<div class="polls_content02" id="exercise">
|
||||
<%= render :partial => 'exercises_list'%>
|
||||
</div><!--问卷内容end-->
|
|
@ -0,0 +1 @@
|
|||
<%= render :partial => 'exercise_form'%>
|
|
@ -0,0 +1,10 @@
|
|||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise}) %>");
|
||||
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
|
||||
showModal('ajax-modal', '250px');
|
||||
//$('#ajax-modal').css('height','111px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("poll_alert_form");
|
|
@ -0,0 +1,10 @@
|
|||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise_content',:locals => {:exercise => @exercise}) %>");
|
||||
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
|
||||
showModal('ajax-modal', '250px');
|
||||
//$('#ajax-modal').css('height','80px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("poll_alert_form");
|
|
@ -0,0 +1,10 @@
|
|||
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||
<% if @is_teacher %>
|
||||
<%= render :partial => 'exercise_teacher', :locals =>{:exercise =>@exercise, :exercise_questions => @exercise_questions} %>
|
||||
<% else %>
|
||||
<% if @can_edit_excercise %>
|
||||
<%=render :partial => 'exercise_student', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user} %>
|
||||
<% else %>
|
||||
<%=render :partial => 'exercise_student_result', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user} %>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -0,0 +1,138 @@
|
|||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
|
||||
// 匿评弹框提示
|
||||
<%# if @is_evaluation && !@stundet_works.empty?%>
|
||||
// $(function(){
|
||||
// $('#ajax-modal').html('<%#= escape_javascript(render :partial => 'student_work/praise_alert') %>');
|
||||
// showModal('ajax-modal', '500px');
|
||||
// $('#ajax-modal').siblings().remove();
|
||||
// $('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
// "<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
// $('#ajax-modal').parent().css("top","").css("left","");
|
||||
// $('#ajax-modal').parent().addClass("anonymos");
|
||||
// });
|
||||
<%# end%>
|
||||
|
||||
//设置评分规则
|
||||
function set_score_rule(){
|
||||
$('#ajax-modal').html('<%#= escape_javascript(render :partial => 'student_work/set_score_rule',:locals => {:homework => @homework,:student_path => true}) %>');
|
||||
showModal('ajax-modal', '350px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","25%").css("left","35%").css("position","fixed");
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$("#homework_info_hidden").click(function(){
|
||||
$("#homeworkInformation").hide();
|
||||
$("#homework_info_hidden").hide();
|
||||
$("#homework_info_show").show();
|
||||
});
|
||||
$("#homework_info_show").click(function(){
|
||||
$("#homework_info_show").hide();
|
||||
$("#homeworkInformation").show();
|
||||
$("#homework_info_hidden").show();
|
||||
});
|
||||
|
||||
if($("#homework_description").height() > 54) {
|
||||
$("#homeworkDetailShow").show();
|
||||
}
|
||||
$("#homeworkDetailShow").click(function(){
|
||||
$("#homeworkDetail").toggleClass("max_h54");
|
||||
$("#homeworkDetailShow").hide();
|
||||
$("#homeworkDetailHide").show();
|
||||
});
|
||||
$("#homeworkDetailHide").click(function(){
|
||||
$("#homeworkDetail").toggleClass("max_h54");
|
||||
$("#homeworkDetailHide").hide();
|
||||
$("#homeworkDetailShow").show();
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="resources" id="homework_page_right">
|
||||
<div class="hworkListBanner">
|
||||
<div id="menu_r" class="fl">
|
||||
<ul class="menu_r">
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="parent">
|
||||
<% @all_exercises.each_with_index do |exercise,index |%>
|
||||
<% if exercise.id == @exercise.id %>
|
||||
<%="测验 #{@all_exercises.count - index}" %>
|
||||
<% end %>
|
||||
<% end%>
|
||||
</a>
|
||||
<ul>
|
||||
<% @all_exercises.each_with_index do |exercise,index |%>
|
||||
<li class="pr10">
|
||||
<%= link_to "作业#{@all_exercises.count - index}:#{exercise.exercise_name}",''%>
|
||||
<%#= link_to "第#{@homework_commons.count - index}次作业",student_work_index_path(:homework => homework_common.id)%>
|
||||
</li>
|
||||
<% end%>
|
||||
</ul>
|
||||
</li>
|
||||
<!---level1 end--->
|
||||
</ul>
|
||||
<!---menu_r end--->
|
||||
</div>
|
||||
<!--div class="hworkInfor"><a href="javascript:void(0);" class="linkBlue">作业信息</a></div-->
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="homeworkInfo" id="homeworkInformation">
|
||||
<div class="">
|
||||
<div class="homepagePostTitle fl hidden m_w460" title="<%= @exercise.exercise_name %>"><%= @exercise.exercise_name %></div>
|
||||
<% if @exercise.exercise_status == 1 %>
|
||||
<span class="grey_homework_btn_cir ml5">未发布</span>
|
||||
<% elsif @exercise.exercise_status == 2 %>
|
||||
<span class="green_homework_btn_cir ml5">已发布</span>
|
||||
<% elsif @exercise.exercise_status == 3 %>
|
||||
<span class="grey_homework_btn_cir ml5">已截止</span>
|
||||
<% end%>
|
||||
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_hidden">[ 隐藏测验信息 ]</a> </span>
|
||||
<div class="cl"></div>
|
||||
<div class="fontGrey2 db mb5">发布者:<%= @exercise.user.show_name %></div>
|
||||
<div class="homeworkDetail upload_img break_word list_style max_h54" id="homeworkDetail">
|
||||
<div id="homework_description"><%= @exercise.exercise_description.html_safe %></div>
|
||||
</div>
|
||||
<div id="homeworkDetailShow" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
|
||||
<div id="homeworkDetailHide" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt5">
|
||||
<div class="fontGrey2 db fl">截止时间:<%= format_time @exercise.end_time %></div>
|
||||
<% if @exercise.exercise_status == 1 %>
|
||||
<div class="fontGrey2 db fl ml10">发布时间:<%= format_time @exercise.publish_time %></div>
|
||||
<% end %>
|
||||
<% end_time = @exercise.end_time.to_time.to_i %>
|
||||
<% if end_time > Time.now.to_i %>
|
||||
<div class="fontGrey2 db fr">提交剩余时间: <span class="c_red"><%= (end_time - Time.now.to_i) / (24*60*60) %></span> 天
|
||||
<span class="c_red"><%= ((end_time - Time.now.to_i) % (24*60*60)) / (60*60)%></span> 小时
|
||||
<span class="c_red"><%= (((end_time - Time.now.to_i) % (24*60*60)) % (60*60)) / 60%></span> 分</div>
|
||||
<% else %>
|
||||
<div class="fontGrey2 db fr c_red">提交已截止</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="hworkListContainer">
|
||||
<div class="ctt2">
|
||||
<div class="dis" id="homework_student_work_list">
|
||||
<%= render :partial => "exercise/student_exercise"%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
|
@ -0,0 +1,5 @@
|
|||
$("#polls_head_show").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:exercise => @exercise}) %>");
|
||||
$("#polls_head_edit").html("<%= escape_javascript(render :partial => 'edit_head', :locals => {:exercise => @exercise}) %>");
|
||||
$("#polls_head_edit").hide();
|
||||
$("#polls_head_show").show();
|
||||
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
|
|
@ -0,0 +1,20 @@
|
|||
$("#poll_questions_<%= @exercise_question.id%>").html("<div id='show_poll_questions_<%= @exercise_question.id %>'>" +
|
||||
"<% if @exercise_question.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% elsif @exercise_question.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% elsif @exercise_question.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @exercise_question.id %>' style='display: none;'>" +
|
||||
"<% if @exercise_question.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% elsif @exercise_question.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% elsif @exercise_question.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>");
|
||||
$("#current_score").html("<%=get_current_score @exercise_question.exercise %>分");
|
||||
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise_question.exercise}) %>");
|
|
@ -13,10 +13,10 @@
|
|||
</div>
|
||||
<% author = topic.last_reply.try(:author)%>
|
||||
<% if author%>
|
||||
<div class="postDetailCreater">最后回复:<a href="<%= user_path(author) %>" class="linkBlue2" target="_blank"><%= author.name%></a></div>
|
||||
<div class="postDetailCreater">最后回复:<a href="<%= user_path(author) %>" class="linkBlue2" target="_blank"><%= author.name%></a></div>
|
||||
<div class="postDetailDate"><%= format_date(topic.last_reply.created_at)%></div>
|
||||
<% end%>
|
||||
<div class=" fr" style="color: #888888;font-size: 12px">最后更新:<%= format_date(topic.updated_at)%></div>
|
||||
|
||||
</div>
|
||||
<div class="postDetailReply">
|
||||
<a href="<%= forum_memo_path(topic.forum, topic)%>" class="postReplyIcon mr5" target="_blank"></a>
|
||||
|
|
|
@ -173,6 +173,11 @@
|
|||
<%= link_to "(#{course_poll_count})", poll_index_path(:polls_type => "Course", :polls_group_id => @course.id), :class => "subnav_num c_orange" %>
|
||||
<%= link_to( "+#{l(:label_new_poll)}", new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => 'subnav_green c_white') if is_teacher %>
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<%= link_to "在线测验", exercise_index_path(:course_id => @course.id), :class => " f14 c_blue02"%>
|
||||
<%= link_to "(#{User.current.allowed_to?(:as_teacher,@course)? @course.exercises.count : @course.exercises.where("exercise_status=2").count})", exercise_index_path(:course_id => @course.id), :class => "subnav_num c_orange" %>
|
||||
<%= link_to( "+新建试卷", new_exercise_path(:course_id => @course.id), :class => 'subnav_green c_white') if is_teacher %>
|
||||
</div>
|
||||
</div><!--项目侧导航 end-->
|
||||
<div class="cl"></div>
|
||||
<div class="project_intro">
|
||||
|
|
|
@ -79,7 +79,6 @@
|
|||
<%= render :partial => 'attachments_links', :locals => {:attachments => @memo.attachments, :options => options, :is_float => true} %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class=" fr" style="color: #888888;font-size: 12px">最后更新:<%= format_date(@memo.updated_at)%></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +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%");
|
|
@ -0,0 +1,31 @@
|
|||
<style type="text/css">
|
||||
/*回复框*/
|
||||
.ReplyToMessageInputContainer .ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
|
||||
.ReplyToMessageInputContainer .ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
|
||||
.ReplyToMessageInputContainer .ke-toolbar-icon-url{background-image:url( /images/public_icon.png )}
|
||||
.ReplyToMessageInputContainer .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
|
||||
.ReplyToMessageInputContainer .ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
|
||||
.ReplyToMessageInputContainer .ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
||||
.ReplyToMessageInputContainer .ke-outline{border:none;}
|
||||
.ReplyToMessageInputContainer .ke-inline-block{display: none;}
|
||||
.ReplyToMessageInputContainer .ke-container{float:left;}
|
||||
</style>
|
||||
|
||||
<div class="ReplyToMessageContainer borderBottomNone"id="reply_to_message_<%= reply.id%>">
|
||||
<div class="homepagePostReplyPortrait mr15 imageFuzzy" id="reply_image_<%= reply.id%>"><%= link_to image_tag(url_to_avatar(User.current), :width => "33", :height => "33"), user_path(User.current), :alt => "用户头像" %></div>
|
||||
<div class="ReplyToMessageInputContainer mb10">
|
||||
<div nhname='new_message_<%= reply.id%>'>
|
||||
<%= form_for @org_comment, :as => :reply, :url => {:controller => 'org_document_comments',:action => 'reply', :id => @org_comment.id}, :method => 'post', :html => {:multipart => true, :id => 'new_form'} do |f| %>
|
||||
<input type="hidden" name="quote[quote]" id="quote_quote">
|
||||
<input type="hidden" name="org_document_comment[title]" id="reply_subject">
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="org_document_comment[content]"></textarea>
|
||||
<div nhname='toolbar_container_<%= reply.id%>' style="float:left; margin-left: 5px; padding-top:3px;"></div>
|
||||
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:2px;">发送</a>
|
||||
<div class="cl"></div>
|
||||
<p nhname='contentmsg_<%= reply.id%>'></p>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
|
@ -0,0 +1 @@
|
|||
location.reload();
|
|
@ -1 +1,2 @@
|
|||
location.reload();
|
||||
//location.reload();
|
||||
window.location.href = '<%= organization_org_document_comments_path(:organization_id => @org_document_comment.root.organization_id)%>'
|
|
@ -26,7 +26,7 @@
|
|||
<div class="cl"></div>
|
||||
<div id="org_document_editor" >
|
||||
<div class="mt10">
|
||||
<%= kindeditor_tag 'org_document_comment[content]',@org_document.content, :editor_id => 'org1_document_description_editor', :height => "150px" %>
|
||||
<%= kindeditor_tag 'org_document_comment[content]',@org_document.content, :editor_id => 'org_document_description_editor', :height => "150px" %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
|||
<div class="mt5">
|
||||
<a href="javascript:void(0);" class="BlueCirBtnMini fr" onclick="org_document_description_editor.sync();$('#new_org_document_form').submit();">确定</a>
|
||||
<span class="fr mr10 mt3">或</span>
|
||||
<a href="javascript:void(0);" onclick="$('#org_document_editor').hide(); $('#doc_title_hint').hide();" class="fr mr10 mt3">取消</a>
|
||||
<a href="javascript:void(0);" onclick="location=document.referrer;" class="fr mr10 mt3">取消</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<% @documents.each do |document| %>
|
||||
<script>
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= document.id%>, null, "87%");
|
||||
init_activity_KindEditor_data(<%= OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first.id %>, null, "87%");
|
||||
});
|
||||
</script>
|
||||
<%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first} %>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
if($("#reply_message_<%= @org_comment.id%>").length > 0) {
|
||||
$("#reply_message_<%= @org_comment.id%>").replaceWith("<%= escape_javascript(render :partial => 'org_document_comments/simple_ke_reply_form', :locals => {:reply => @org_comment,:temp =>@temp,:subject =>@subject}) %>");
|
||||
$(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%");
|
||||
});
|
||||
}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>");
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
//location.reload();
|
|
@ -0,0 +1,148 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_activity_KindEditor",'blog' %>
|
||||
<script>
|
||||
$(function() {
|
||||
init_activity_KindEditor_data(<%= @document.id%>,null,"85%");
|
||||
showNormalImage('message_description_<%= @document.id %>');
|
||||
});
|
||||
</script>
|
||||
<div class="resources mt10" id="organization_document_<%= @document.id %>">
|
||||
<div class="homepagePostBrief">
|
||||
<div class="homepagePostPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(User.find(@document.creator_id)), :width => 45, :heigth => 45), user_path(@document.creator_id) %>
|
||||
</div>
|
||||
<div class="homepagePostDes">
|
||||
<div class="homepagePostTo">
|
||||
<%= link_to User.find(@document.creator_id), user_path(@document.creator.id), :class => "newsBlue mr15" %>
|
||||
TO <%= link_to @document.organization.name, organization_path(@document.organization), :class => "newsBlue" %>
|
||||
|
|
||||
<% if @document.organization.home_id == @document.id %>
|
||||
<span style="color:#269ac9;">首页</span>
|
||||
<% else %>
|
||||
<span style="color:#269ac9;">组织文章</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostTitle postGrey"><%= link_to @document.title, org_document_comment_path(:id => @document.id, :organization_id => @document.organization.id) %></div>
|
||||
<div class="homepagePostDate">
|
||||
发布时间:<%= format_activity_day(@document.created_at) %> <%= format_time(@document.created_at, false) %></div>
|
||||
<% unless @document.content.blank? %>
|
||||
<div class="homepagePostIntro">
|
||||
<%= @document.content.html_safe %>
|
||||
</div>
|
||||
<% end %>
|
||||
<!-- <%# if defined?(home_id) %>
|
||||
<div style="float:right;">最后编辑:<%#= User.find() %></div>
|
||||
<%# end %>-->
|
||||
<% if User.current.admin? || User.current.admin_of_org?(Organization.find(@document.organization_id) || User.current.id == @document.creator_id) %>
|
||||
<div class="homepagePostSetting">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<li>
|
||||
<%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => @document.organization_id, :home_id => @document.id}, :method => "put", :remote => true) do |f| %>
|
||||
<a href="javascript:void(0);" class="postOptionLink" onclick="$(this).parent().submit();">设为首页</a>
|
||||
<% end %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id), :class => "postOptionLink" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id), :method => 'delete',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:remote => true, :class => 'postOptionLink' %>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% comments_for_doc = @document.children.reorder("created_at desc") %>
|
||||
<% count = @document.children.count() %>
|
||||
|
||||
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= @document.id %>">
|
||||
<% if count > 0 %>
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复(<%= count %>)</div>
|
||||
</div>
|
||||
<div class="" id="reply_div_<%= @document.id %>">
|
||||
<% comments_for_doc.each_with_index do |reply,i| %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
showNormalImage('reply_message_description_<%= reply.id %>');
|
||||
});
|
||||
</script>
|
||||
<% user = User.find(reply.creator_id) %>
|
||||
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id %>').hide();">
|
||||
<div class="homepagePostReplyPortrait">
|
||||
<%= link_to image_tag(url_to_avatar(user), :width => 33,:height => 33), user_path(user) %>
|
||||
</div>
|
||||
<div class="homepagePostReplyDes">
|
||||
<%= link_to User.find(reply.creator_id).realname, user_path(reply.creator_id), :class => "newsBlue mr10 f14" %>
|
||||
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
|
||||
<%= reply.content.html_safe unless reply.content.nil? %>
|
||||
</div>
|
||||
<div style="margin-top: -7px; margin-bottom: 5px">
|
||||
<%= format_time(reply.created_at) %>
|
||||
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
{:controller => 'org_document_comments',:action => 'quote',:user_id=>reply.creator_id, :id => reply.id},
|
||||
:remote => true,
|
||||
:method => 'get',
|
||||
:class => 'fr newsBlue',
|
||||
:title => l(:button_reply)) if User.current.logged? %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller => 'org_document_comments',:action => 'delete_reply', :id => reply.id},
|
||||
:method => :delete,
|
||||
:class => 'fr newsGrey mr10',
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete)
|
||||
) if reply.creator_id == User.current.id %>
|
||||
</div>
|
||||
</div>
|
||||
<p id="reply_message_<%= reply.id %>"></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<% if User.current.logged?%>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply">
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml5 mb10" id="reply<%= @document.id %>">
|
||||
<%= form_for :org_comment, :url => {:action => 'add_reply_in_doc',:controller => 'org_document_comments', :id => @document.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
|
||||
<%= f.kindeditor :org_content,:width=>'99%',:height => '100px;',:editor_id=>'message_content_editor' %>
|
||||
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'message_content_editor.html("");', :class => " grey_btn fr c_white mt10 mr5" %>
|
||||
<%= link_to l(:button_reply), "javascript:void(0)", :onclick => "message_content_editor.sync();$('#message_form').submit();", :class => "blue_btn fr c_white mt10 mb10", :style => "margin-right: 5px;" %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function expand_reply(container, btnid) {
|
||||
var target = $(container);
|
||||
var btn = $(btnid);
|
||||
if (btn.data('init') == '0') {
|
||||
btn.data('init', 1);
|
||||
btn.html('收起回复');
|
||||
target.show();
|
||||
} else {
|
||||
btn.data('init', 0);
|
||||
btn.html('展开更多');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
target.eq(2).show();
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -14,7 +14,7 @@
|
|||
<span style="color:#269ac9;">组织文章</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="homepagePostTitle postGrey"><%= document.title %></div>
|
||||
<div class="homepagePostTitle postGrey"><%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id) %></div>
|
||||
<div class="homepagePostDate">
|
||||
发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %></div>
|
||||
<% unless document.content.blank? %>
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
<span class="c_grey">(打钩为公开,不打钩则不公开,若不公开,仅组织成员可见该组织。)</span>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class=" ml90" >
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_organization();" >提交</a>
|
||||
<li class=" ml125" >
|
||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_organization();" >创建</a>
|
||||
<%= link_to "取消",user_activities_path(User.current.id),:class => "blue_btn grey_btn fl c_white"%>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="homepageHomeworkContentWarn fl"> 截止时间快到了.</li>
|
||||
<li class="homepageHomeworkContentWarn fl"> 截止时间快到了!</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
|
@ -158,7 +158,7 @@
|
|||
<li>匿评截止:<span style="color:Red;"><%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59</span></li>
|
||||
</ul>
|
||||
<% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
|
||||
<p>请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。</p>
|
||||
<p>请您尽早完成匿评!如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。</p>
|
||||
<p>例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分</p>
|
||||
<% end%>
|
||||
</div>
|
||||
|
@ -209,7 +209,7 @@
|
|||
<div style="display: none" class="message_title_red system_message_style">
|
||||
<p>
|
||||
<%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
|
||||
<%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败.
|
||||
<%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败!
|
||||
|
||||
</p>
|
||||
<ul class="ul_normal_color">
|
||||
|
@ -315,7 +315,7 @@
|
|||
<% end %>
|
||||
</ul>
|
||||
<p>
|
||||
本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %> 23:59结束匿评,到时您将可以看到所有其他同学的作品啦.大家可以进一步互相学习。 期待您取得更大的进步.
|
||||
本次作业将在<%= ma.course_message.student_work.homework_common.homework_detail_manual.evaluation_end %> 23:59结束匿评,到时您将可以看到所有其他同学的作品啦!大家可以进一步互相学习。 期待您取得更大的进步!
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -404,16 +404,14 @@
|
|||
</ul>
|
||||
<p>如需获得最终成绩,请您联系主讲老师对您的作品进行单独评分!</p>
|
||||
</div>
|
||||
<li class="homepageHomeworkContentWarn fl"> 您迟交了作品</li>
|
||||
<li class="homepageHomeworkContentWarn fl"> 您迟交了作品!</li>
|
||||
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<!-- 创建课程消息 -->
|
||||
<% if ma.course_message_type == "Course" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div></a>
|
||||
</li>
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"></a></li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="newsBlue homepageNewsPublisher">系统提示</span>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">您成功创建了课程:</span>
|
||||
|
@ -445,9 +443,7 @@
|
|||
<% end %>
|
||||
<% if ma.course_message_type == "JoinCourseRequest" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div></a>
|
||||
</li>
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"></a></li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="newsBlue homepageNewsPublisher">系统提示</span>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">您有了新的课程成员申请:</span>
|
||||
|
@ -486,9 +482,7 @@
|
|||
<% end %>
|
||||
<% if ma.course_message_type == "CourseRequestDealResult" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div></a>
|
||||
</li>
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"></a></li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="newsBlue homepageNewsPublisher">系统提示</span>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">
|
||||
|
@ -554,7 +548,7 @@
|
|||
<% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div></a>
|
||||
<a href="javascript:void(0);"></a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="newsBlue homepageNewsPublisher">系统提示</span>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<%#= stylesheet_link_tag 'pleft','prettify','jquery/jquery-ui-1.9.2','header','new_user','repository','org' %>
|
||||
<div class="homepageContentContainer">
|
||||
<div class="homepageContent">
|
||||
<div class="postContainer">
|
||||
<div class="postContainer mb10">
|
||||
<div class="postBanner" style="padding-bottom:5px;">
|
||||
<span class="linkGrey2 f16">组织列表</span>
|
||||
|
||||
|
|
|
@ -66,6 +66,10 @@ RedmineApp::Application.routes.draw do
|
|||
resources :org_document_comments do
|
||||
member do
|
||||
post 'add_reply'
|
||||
get 'quote'
|
||||
post 'reply'
|
||||
post 'add_reply_in_doc'
|
||||
delete 'delete_reply'
|
||||
end
|
||||
collection do
|
||||
|
||||
|
@ -156,6 +160,25 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
end
|
||||
|
||||
#show、index、new、create、edit、update、destroy路由自动生成
|
||||
resources :exercise do
|
||||
member do #生成路径为 /exercise/:id/方法名
|
||||
get 'statistics_result'
|
||||
get 'student_exercise_list'
|
||||
get 'export_exercise'
|
||||
get 'publish_exercise'
|
||||
get 'republish_exercise'
|
||||
post 'create_exercise_question'
|
||||
post 'commit_answer'
|
||||
post 'commit_exercise'
|
||||
end
|
||||
|
||||
collection do #生成路径为 /exercise/方法名
|
||||
delete 'delete_exercise_question'
|
||||
post 'update_exercise_question'
|
||||
end
|
||||
end
|
||||
|
||||
resources :homework_common, :except => [:show]do
|
||||
member do
|
||||
get 'start_anonymous_comment'
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
class Exercise < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :exercises do |t|
|
||||
t.string :exercise_name
|
||||
t.text :exercise_description
|
||||
t.integer :course_id
|
||||
t.integer :exercise_status
|
||||
t.integer :user_id
|
||||
t.integer :time
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :exercise
|
||||
end
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
class ExerciseQuestion < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :exercise_questions do |t|
|
||||
t.string :question_title
|
||||
t.integer :question_type
|
||||
t.integer :question_number
|
||||
t.integer :exercise_id
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :exercise_question
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
class ExerciseChoices < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :exercise_choices do |t|
|
||||
t.integer :exercise_question_id
|
||||
t.text :choice_text
|
||||
t.integer :choice_position
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :exercise_choices
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
class ExerciseStandardAnswer < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :exercise_standard_answers do |t|
|
||||
t.integer :exercise_question_id
|
||||
t.integer :exercise_choice_id
|
||||
t.text :answer_text
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :exercise_standard_answer
|
||||
end
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
class ExerciseAnswer < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :exercise_answers do |t|
|
||||
t.integer :user_id
|
||||
t.integer :exercise_question_id
|
||||
t.integer :exercise_choice_id
|
||||
t.text :answer_text
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :exercise_answer
|
||||
end
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
class UserExercise < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :exercise_users do |t|
|
||||
t.integer :user_id
|
||||
t.integer :exercise_id
|
||||
t.integer :score
|
||||
t.datetime :start_at
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :exercise_user
|
||||
end
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class AddPublishTimeEndTimeToExercise < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :exercises, :publish_time, :timestamp
|
||||
add_column :exercises, :end_time, :timestamp
|
||||
end
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
class AddCreatedAtToOrgMembers < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :org_members, :created_at, :timestamp
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddShowResultToExercise < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :exercises, :show_result, :integer
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddQuestionScoreToExerciseQuestion < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :exercise_questions, :question_score, :integer
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddEndAtToExerciseUser < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :exercise_users, :end_at, :datetime
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddStatusToExerciseUser < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :exercise_users, :status, :integer
|
||||
end
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
class ChangecolumnOfOrgDocumentComments < ActiveRecord::Migration
|
||||
def up
|
||||
change_column :org_document_comments, :title, :text
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
185
db/schema.rb
185
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20151118031602) do
|
||||
ActiveRecord::Schema.define(:version => 20151120021958) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -425,8 +425,8 @@ ActiveRecord::Schema.define(:version => 20151118031602) do
|
|||
t.string "code"
|
||||
t.integer "time"
|
||||
t.string "extra"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "location"
|
||||
t.string "term"
|
||||
t.string "string"
|
||||
|
@ -436,14 +436,14 @@ ActiveRecord::Schema.define(:version => 20151118031602) do
|
|||
t.string "class_period"
|
||||
t.integer "school_id"
|
||||
t.text "description"
|
||||
t.integer "status", :default => 1
|
||||
t.integer "attachmenttype", :default => 2
|
||||
t.integer "status", :default => 1
|
||||
t.integer "attachmenttype", :default => 2
|
||||
t.integer "lft"
|
||||
t.integer "rgt"
|
||||
t.integer "is_public", :limit => 1, :default => 1
|
||||
t.integer "inherit_members", :limit => 1, :default => 1
|
||||
t.integer "open_student", :default => 0
|
||||
t.integer "outline", :default => 0
|
||||
t.integer "is_public", :limit => 1, :default => 1
|
||||
t.integer "inherit_members", :limit => 1, :default => 1
|
||||
t.integer "open_student", :default => 0
|
||||
t.integer "outline", :default => 0
|
||||
t.integer "publish_resource", :default => 0
|
||||
end
|
||||
|
||||
|
@ -529,23 +529,26 @@ ActiveRecord::Schema.define(:version => 20151118031602) do
|
|||
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
|
||||
add_index "documents", ["project_id"], :name => "documents_project_id"
|
||||
|
||||
create_table "dts", :force => true do |t|
|
||||
t.string "IPLineCode"
|
||||
t.string "Description"
|
||||
t.string "Num"
|
||||
t.string "Variable"
|
||||
t.string "TraceInfo"
|
||||
t.string "Method"
|
||||
create_table "dts", :primary_key => "Num", :force => true do |t|
|
||||
t.string "Defect", :limit => 50
|
||||
t.string "Category", :limit => 50
|
||||
t.string "File"
|
||||
t.string "IPLine"
|
||||
t.string "Review"
|
||||
t.string "Category"
|
||||
t.string "Defect"
|
||||
t.string "PreConditions"
|
||||
t.string "StartLine"
|
||||
t.string "Method"
|
||||
t.string "Module", :limit => 20
|
||||
t.string "Variable", :limit => 50
|
||||
t.integer "StartLine"
|
||||
t.integer "IPLine"
|
||||
t.string "IPLineCode", :limit => 200
|
||||
t.string "Judge", :limit => 15
|
||||
t.integer "Review", :limit => 1
|
||||
t.string "Description"
|
||||
t.text "PreConditions", :limit => 2147483647
|
||||
t.text "TraceInfo", :limit => 2147483647
|
||||
t.text "Code", :limit => 2147483647
|
||||
t.integer "project_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.integer "id", :null => false
|
||||
end
|
||||
|
||||
create_table "enabled_modules", :force => true do |t|
|
||||
|
@ -570,6 +573,129 @@ ActiveRecord::Schema.define(:version => 20151118031602) do
|
|||
add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
|
||||
add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
|
||||
|
||||
<<<<<<< .mine
|
||||
create_table "exercise_answers", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "exercise_question_id"
|
||||
t.integer "exercise_choice_id"
|
||||
t.text "answer_text"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "exercise_choices", :force => true do |t|
|
||||
t.integer "exercise_question_id"
|
||||
t.text "choice_text"
|
||||
t.integer "choice_position"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "exercise_questions", :force => true do |t|
|
||||
t.string "question_title"
|
||||
t.integer "question_type"
|
||||
t.integer "question_number"
|
||||
t.integer "exercise_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "question_score"
|
||||
end
|
||||
|
||||
create_table "exercise_standard_answers", :force => true do |t|
|
||||
t.integer "exercise_question_id"
|
||||
t.integer "exercise_choice_id"
|
||||
t.text "answer_text"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "exercise_users", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "exercise_id"
|
||||
t.integer "score"
|
||||
t.datetime "start_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "end_at"
|
||||
t.integer "status"
|
||||
end
|
||||
|
||||
create_table "exercises", :force => true do |t|
|
||||
t.string "exercise_name"
|
||||
t.text "exercise_description"
|
||||
t.integer "course_id"
|
||||
t.integer "exercise_status"
|
||||
t.integer "user_id"
|
||||
t.integer "time"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "publish_time"
|
||||
t.datetime "end_time"
|
||||
t.integer "show_result"
|
||||
end
|
||||
|
||||
=======
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
>>>>>>> .theirs
|
||||
create_table "first_pages", :force => true do |t|
|
||||
t.string "web_title"
|
||||
t.string "title"
|
||||
|
@ -815,16 +941,6 @@ ActiveRecord::Schema.define(:version => 20151118031602) do
|
|||
|
||||
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
|
||||
|
||||
create_table "journal_details_copy", :force => true do |t|
|
||||
t.integer "journal_id", :default => 0, :null => false
|
||||
t.string "property", :limit => 30, :default => "", :null => false
|
||||
t.string "prop_key", :limit => 30, :default => "", :null => false
|
||||
t.text "old_value"
|
||||
t.text "value"
|
||||
end
|
||||
|
||||
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
|
||||
|
||||
create_table "journal_replies", :id => false, :force => true do |t|
|
||||
t.integer "journal_id"
|
||||
t.integer "user_id"
|
||||
|
@ -1084,6 +1200,7 @@ ActiveRecord::Schema.define(:version => 20151118031602) do
|
|||
create_table "org_members", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "organization_id"
|
||||
t.string "role"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
|
|
@ -83,6 +83,7 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re
|
|||
.width180{width: 180px;}
|
||||
.width525{width: 525px;}
|
||||
.width285{width: 285px;}
|
||||
.width530{width: 530px;}
|
||||
.mr95{margin-right: 95px;}
|
||||
.mr140 {margin-right: 140px;}
|
||||
.ml100{margin-left: 100px;}
|
||||
|
@ -712,6 +713,7 @@ img.ui-datepicker-trigger {
|
|||
width:16px;
|
||||
height:15px;
|
||||
float:left;
|
||||
margin: 7px;
|
||||
}
|
||||
|
||||
.label{ width:80px; text-align:right; font-size:14px; display:block; float:left;}
|
||||
|
@ -1141,3 +1143,27 @@ input.sendSourceText {
|
|||
width: 50px;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
/*20151117在线测验byTim*/
|
||||
.testContainer {width:698px; border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px;}
|
||||
.testTitle{ width:678px; height:40px; padding:0 10px; text-align:center; font-size:16px; font-weight:bold; background:#fff;border-style:solid; border:1px solid #CBCBCB;}
|
||||
.testDes{ width:678px; height:60px; padding:10px; margin-bottom:10px; background:#fff; border-style:solid; border:1px solid #CBCBCB; resize:none;}
|
||||
.btn_submit{ width:56px; height:24px; padding-top:4px;background:#269ac9; color:#fff; text-align:center; display:block; float:left; margin-right:10px;}
|
||||
a:hover.btn_submit{background:#297fb8;}
|
||||
.btn_cancel{width:54px; height:22px; padding-top:4px;background:#fff; color:#999; border:1px solid #999; text-align:center; display:block; float:left; }
|
||||
a:hover.btn_cancel{ color:#666;}
|
||||
.testQuestion{ width:708px; height: auto; border:1px solid #cbcbcb; padding:10px 0 0 10px; margin-bottom:10px;}
|
||||
.mr118 {margin-right:118px !important;}
|
||||
.questionContainer {width:698px; border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px;}
|
||||
.questionTitle{ width:644px; height:30px; border:1px solid #cbcbcb; padding-left:5px; background:#fff;}
|
||||
.examTime {width:40px; border:1px solid #cbcbcb; outline:none; height:28px; text-align:center; padding-left:0px; }
|
||||
.testStatus{width:698px; border:1px solid #cbcbcb; padding:10px; margin-bottom:10px; background:#ffffff; position:relative; color:#767676;}
|
||||
.testEdit{ background:url(images/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right; bottom:10px; right:10px; position:absolute;}
|
||||
a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;}
|
||||
.mr100 {margin-right:100px;}
|
||||
.testDesEdit {width:670px; overflow:hidden;}
|
||||
.testEditTitle{ padding:10px 0px ; float:left; width:564px; }
|
||||
.questionEditContainer {border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px; margin-top:10px;}
|
||||
.fillInput {border:1px solid #cbcbcb; padding-left:5px; background-color:#ffffff; width:693px; height:30px; color:#888888;}
|
||||
.mr130 {margin-right:130px;}
|
||||
.ur_button_submit{ display:block; width:106px; height:31px; margin:0 auto; background:#15bccf; color:#fff; font-size:16px; text-align:center; padding-top:4px; margin-bottom:10px; }
|
|
@ -84,6 +84,7 @@ a.linkGrey6:hover {color:#ffffff !important;}
|
|||
.ml90{ margin-left:90px;}
|
||||
.ml100{ margin-left:100px;}
|
||||
.ml110{ margin-left:110px;}
|
||||
.ml125 { margin-left:125px;}
|
||||
.ml150 { margin-left:150px;}
|
||||
.mr-5 {margin-right:-5px;}
|
||||
.mr5{ margin-right:5px;}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/* CSS Document */
|
||||
|
||||
.orgName {width:130px; color:#484848;}
|
||||
.organization_r_h02{ width:970px; height:40px; background:#eaeaea; margin-bottom:10px;}
|
||||
.organization_r_h02{ width:980px; height:40px; background:#eaeaea; margin-bottom:10px;}
|
||||
.organization_h2{ background:#64bdd9; color:#fff; height:33px; width:90px; text-align:center; font-weight:normal; padding-top:7px; font-size:16px;}
|
||||
|
||||
.orgSettingOp {width:45px; height:21px; color:#269ac9; text-align:center; border-bottom:3px solid #e4e4e4; float:left; font-weight:bold; cursor:pointer;}
|
||||
|
|
|
@ -77,6 +77,7 @@ h4{ font-size:14px; color:#3b3b3b;}
|
|||
.ml90{ margin-left:90px;}
|
||||
.ml100{ margin-left:100px;}
|
||||
.ml110{ margin-left:110px;}
|
||||
.ml125 { margin-left:125px;}
|
||||
.ml320{ margin-left:320px;}
|
||||
.ml150 { margin-left:150px;}
|
||||
.mr-5 {margin-right:-5px;}
|
||||
|
|
Loading…
Reference in New Issue