commit
70a9800c7e
|
@ -695,7 +695,7 @@ class AttachmentsController < ApplicationController
|
|||
@attachment.container.board.course)
|
||||
@course = @attachment.container.board.course
|
||||
else
|
||||
unless @attachment.container_type == 'Syllabus' || @attachment.container_type == 'Bid' || @attachment.container_type == 'Organization' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork' || @attachment.container_type == 'Work'|| @attachment.container_type == 'ContestantWork'|| @attachment.container_type == 'Contest'
|
||||
unless @attachment.container_type == 'Syllabus' || @attachment.container_type == 'Bid' || @attachment.container_type == 'Organization' || @attachment.container_type == 'HomeworkAttach' || @attachment.container_type == 'Memo' || @attachment.container_type == 'Softapplication' || @attachment.container_type == 'PhoneAppVersion' || @attachment.container_type == 'StudentWorksScore'|| @attachment.container_type == 'StudentWork' || @attachment.container_type == 'Work'|| @attachment.container_type == 'ContestantWork'|| @attachment.container_type == 'Contest' || @attachment.container_type == 'HomeworkBank'
|
||||
@project = @attachment.project
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,8 @@ class ExerciseController < ApplicationController
|
|||
|
||||
before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy,
|
||||
:commit_exercise, :commit_answer,:publish_exercise,:republish_exercise,
|
||||
:show_student_result,:student_exercise_list]
|
||||
:show_student_result,:student_exercise_list, :update_question_num,
|
||||
:send_to_course, :get_student_uncomplete_question, :edit_question_score]
|
||||
before_filter :find_course, :only => [:index,:new,:create]
|
||||
include ExerciseHelper
|
||||
|
||||
|
@ -68,8 +69,8 @@ class ExerciseController < ApplicationController
|
|||
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
|
||||
score = calculate_student_score(@exercise, User.current)
|
||||
@exercise_user.update_attributes(:score => score)
|
||||
#score = calculate_student_score(@exercise, User.current)
|
||||
#@exercise_user.update_attributes(:objective_score => score, :score => (score + (@exercise_user.subjective_score > 0 ? @exercise_user.subjective_score : 0)))
|
||||
end
|
||||
# @percent = get_percent(@exercise,User.current)
|
||||
@exercise_questions = @exercise.exercise_questions
|
||||
|
@ -132,7 +133,9 @@ class ExerciseController < ApplicationController
|
|||
@exercise.time = params[:exercise][:time].blank? ? -1 : params[:exercise][:time]
|
||||
@exercise.end_time = Time.at(params[:exercise][:end_time].to_time.to_i + 16*60*60 -1)
|
||||
@exercise.publish_time = params[:exercise][:publish_time]
|
||||
@exercise.show_result = params[:exercise][:show_result].blank? ? 1 : params[:exercise][:show_result]
|
||||
@exercise.show_result = params[:show_result].blank? ? 1 : params[:show_result]
|
||||
@exercise.question_random = params[:question_random] ? 0 : 1
|
||||
@exercise.choice_random = params[:choice_random] ? 0 : 1
|
||||
if @exercise.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -177,7 +180,8 @@ class ExerciseController < ApplicationController
|
|||
: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),
|
||||
(params[:question_type] == "3" ? (@exercise.exercise_questions.where("question_type = 3").count + 1) :
|
||||
@exercise.exercise_questions.where("question_type = 4").count + 1)),
|
||||
:question_score => params[:question_score]
|
||||
}
|
||||
@exercise_questions = @exercise.exercise_questions.new option
|
||||
|
@ -200,8 +204,10 @@ class ExerciseController < ApplicationController
|
|||
#@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
|
||||
elsif @exercise_questions.question_type == 3
|
||||
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number + 1")
|
||||
else
|
||||
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).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
|
||||
|
@ -216,12 +222,19 @@ class ExerciseController < ApplicationController
|
|||
standart_answer.answer_text = params[:exercise_choice].values[i-1]
|
||||
standart_answer.save
|
||||
end
|
||||
elsif @exercise_questions.question_type == 4
|
||||
unless params[:exercise_choice] == ""
|
||||
standart_answer = ExerciseStandardAnswer.new
|
||||
standart_answer.exercise_question_id = @exercise_questions.id
|
||||
standart_answer.answer_text = params[:exercise_choice]
|
||||
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
|
||||
elsif @exercise_questions.question_type == 2
|
||||
standart_answer.exercise_choice_id = multiselect_standard_answer(params[:exercise_choice])
|
||||
end
|
||||
standart_answer.save
|
||||
|
@ -283,12 +296,26 @@ class ExerciseController < ApplicationController
|
|||
@exercise_question.exercise_standard_answers.new standart_answer_option
|
||||
end
|
||||
end
|
||||
elsif @exercise_question.question_type == 4
|
||||
answer_standart = @exercise_question.exercise_standard_answers.empty? ? nil : @exercise_question.exercise_standard_answers.first
|
||||
if params[:exercise_choice] == "" && !answer_standart.nil?
|
||||
answer_standart.destroy
|
||||
elsif params[:exercise_choice] != "" && !answer_standart.nil?
|
||||
answer_standart.answer_text = params[:exercise_choice]
|
||||
answer_standart.save
|
||||
elsif params[:exercise_choice] != "" && answer_standart.nil?
|
||||
standart_answer_option = {
|
||||
:answer_text => params[:exercise_choice]
|
||||
}
|
||||
@exercise_question.exercise_standard_answers.new standart_answer_option
|
||||
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
|
||||
@exercise = @exercise_question.exercise
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -305,8 +332,10 @@ class ExerciseController < ApplicationController
|
|||
#@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
|
||||
elsif @exercise_question.question_type == 3
|
||||
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 3).update_all(" question_number = question_number - 1")
|
||||
else
|
||||
ExerciseQuestion.where("question_number>? and question_type=?",params[:quest_num].to_i, 4).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
|
||||
|
@ -323,6 +352,88 @@ class ExerciseController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#题目上移/下移
|
||||
def update_question_num
|
||||
@exercise_question = ExerciseQuestion.find params[:ques_id]
|
||||
exercise_questions = @exercise.exercise_questions
|
||||
if @exercise_question
|
||||
if params[:opr] == 'up' && @exercise_question.question_number > 1
|
||||
@before_que = exercise_questions.where("question_type = #{@exercise_question.question_type} and question_number = #{@exercise_question.question_number - 1}").first
|
||||
if @before_que && @exercise_question.update_attribute('question_number', @exercise_question.question_number - 1)
|
||||
@before_que.update_attribute('question_number', @before_que.question_number + 1)
|
||||
end
|
||||
elsif params[:opr] == 'down' && @exercise_question.question_number < exercise_questions.count
|
||||
@after_que = exercise_questions.where("question_type = #{@exercise_question.question_type} and question_number = #{@exercise_question.question_number + 1}").first
|
||||
if @after_que && @exercise_question.update_attribute('question_number', @exercise_question.question_number + 1)
|
||||
@after_que.update_attribute('question_number', @after_que.question_number - 1)
|
||||
end
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 发送试卷
|
||||
def send_to_course
|
||||
params[:course_ids].each do |course|
|
||||
option = {
|
||||
:exercise_name => @exercise.exercise_name,
|
||||
:exercise_status => 1,
|
||||
:user_id => User.current.id,
|
||||
:show_result => 1,
|
||||
:course_id => course.to_i,
|
||||
:time => @exercise.time,
|
||||
:exercise_description => @exercise.exercise_description
|
||||
}
|
||||
exercise = Exercise.create option
|
||||
|
||||
@exercise.exercise_questions.each do |q|
|
||||
option = {
|
||||
:question_title => q[:question_title],
|
||||
:question_type => q[:question_type] || 1,
|
||||
:question_number => q[:question_number],
|
||||
:question_score => q[:question_score]
|
||||
}
|
||||
exercise_question = exercise.exercise_questions.new option
|
||||
|
||||
for i in 1..q.exercise_choices.count
|
||||
choice_option = {
|
||||
:choice_position => i,
|
||||
:choice_text => q.exercise_choices[i-1][:choice_text]
|
||||
}
|
||||
exercise_question.exercise_choices.new choice_option
|
||||
end
|
||||
|
||||
for i in 1..q.exercise_standard_answers.count
|
||||
standard_answer_option = {
|
||||
:exercise_choice_id => q.exercise_standard_answers[i-1][:exercise_choice_id],
|
||||
:answer_text => q.exercise_standard_answers[i-1][:answer_text]
|
||||
}
|
||||
exercise_question.exercise_standard_answers.new standard_answer_option
|
||||
end
|
||||
end
|
||||
exercise.save
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 搜索当前用户任教的班级(不包含该试卷所在的班级)
|
||||
def search_courses
|
||||
@user = User.current
|
||||
if !params[:name].nil?
|
||||
search = "%#{params[:name].to_s.strip.downcase}%"
|
||||
@courses = @user.courses.not_deleted.where("courses.id != #{params[:course].to_i} and (#{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p)",:p=>search).reorder("created_at desc").select {|course| @user.allowed_to?(:as_teacher,course)}
|
||||
else
|
||||
@courses = @user.courses.not_deleted.where("courses.id != #{params[:course].to_i}").reorder("created_at desc").select {|course| @user.allowed_to?(:as_teacher,course)}
|
||||
end
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
# 发布试卷
|
||||
def publish_exercise
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
|
@ -375,12 +486,12 @@ class ExerciseController < ApplicationController
|
|||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
@all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc")
|
||||
student_id = @course.student.blank? ? "(-1)" : "(" + @course.student.map{|student| student.student_id}.join(",") + ")"
|
||||
@exercise_count = @exercise.exercise_users.where("score is not NULL and user_id in #{student_id}").count
|
||||
@exercise_count = @exercise.exercise_users.where("commit_status = 1 and user_id in #{student_id}").count
|
||||
if @is_teacher || (!@exercise.exercise_users.where("user_id = #{User.current.id} and user_id in #{student_id}").empty? && @exercise.end_time <= Time.now)
|
||||
@exercise_users_list = @exercise.exercise_users.where("score is not NULL and user_id in #{student_id}")
|
||||
@exercise_users_list = @exercise.exercise_users.where("user_id in #{student_id}")
|
||||
@show_all = true;
|
||||
elsif !@exercise.exercise_users.where("user_id = #{User.current.id} and user_id in #{student_id}").empty? && @exercise.end_time > Time.now
|
||||
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL and user_id in #{student_id}",User.current.id)
|
||||
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and user_id in #{student_id}",User.current.id)
|
||||
else
|
||||
@exercise_users_list = []
|
||||
end
|
||||
|
@ -444,21 +555,23 @@ class ExerciseController < ApplicationController
|
|||
else
|
||||
complete = 0;
|
||||
end
|
||||
is_answer = User.current.exercise_answer.where(:exercise_question_id => params[:exercise_question_id].to_i).count > 0
|
||||
@percent = get_percent(@exercise,User.current)
|
||||
render :json => {:text => "ok",:complete => complete,:percent => format("%.2f" ,@percent)}
|
||||
render :json => {:text => "ok",:complete => complete,:percent => format("%.2f" ,@percent),:is_answer => is_answer}
|
||||
else
|
||||
render :json => {:text => "failure"}
|
||||
end
|
||||
else
|
||||
#pv不为空,则当前选项之前已被选择,再次点击则是不再选择该项,故删除该答案
|
||||
if ea.delete
|
||||
is_answer = User.current.exercise_answer.where(:exercise_question_id => params[:exercise_question_id].to_i).count > 0
|
||||
@percent = get_percent(@exercise, User.current)
|
||||
render :json => {:text => "false" ,:percent => format("%.2f" , @percent)}
|
||||
render :json => {:text => "false" ,:percent => format("%.2f" , @percent),:is_answer => is_answer}
|
||||
else
|
||||
render :json => {:text => "failure"}
|
||||
end
|
||||
end
|
||||
elsif eq.question_type == 3
|
||||
elsif eq.question_type == 3 || eq.question_type == 4
|
||||
#单行文本,多行文本题
|
||||
ea = ExerciseAnswer.find_by_exercise_question_id_and_user_id(params[:exercise_question_id], User.current.id)
|
||||
if ea.nil?
|
||||
|
@ -486,6 +599,7 @@ class ExerciseController < ApplicationController
|
|||
render :json => {:text => "failure"}
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
# ea不为空说明用户之前已作答
|
||||
if params[:answer_text].nil? || params[:answer_text].blank?
|
||||
|
@ -517,60 +631,84 @@ class ExerciseController < ApplicationController
|
|||
def commit_exercise
|
||||
# 老师不需要提交
|
||||
if User.current.allowed_to?(:as_teacher,@course)
|
||||
if @exercise.publish_time.nil? || @exercise.publish_time <= Time.now
|
||||
@exercise.update_attributes(:show_result => params[:show_result])
|
||||
@exercise.update_attributes(:exercise_status => 2)
|
||||
@exercise.update_attributes(:publish_time => Time.now)
|
||||
course = @exercise.course
|
||||
course.members.each do |m|
|
||||
@exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
||||
end
|
||||
redirect_to exercise_url(@exercise)
|
||||
return
|
||||
elsif @exercise.publish_time > Time.now
|
||||
@exercise.update_attributes(:show_result => params[:show_result])
|
||||
redirect_to exercise_url(@exercise)
|
||||
return
|
||||
end
|
||||
@exercise.update_attributes(:show_result => params[:show_result])
|
||||
redirect_to exercise_url(@exercise)
|
||||
# if @exercise.publish_time.nil? || @exercise.publish_time <= Time.now
|
||||
# @exercise.update_attributes(:exercise_status => 2)
|
||||
# @exercise.update_attributes(:publish_time => Time.now)
|
||||
# course = @exercise.course
|
||||
# course.members.each do |m|
|
||||
# @exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
||||
# end
|
||||
# redirect_to exercise_url(@exercise)
|
||||
# return
|
||||
# elsif @exercise.publish_time > Time.now
|
||||
# redirect_to exercise_url(@exercise)
|
||||
# return
|
||||
# end
|
||||
# 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, :commit_status => 1)
|
||||
# 答题过程中需要统计完成量
|
||||
@uncomplete_question = get_uncomplete_question(@exercise, User.current)
|
||||
#@uncomplete_question = get_uncomplete_question(@exercise, User.current)
|
||||
# 获取改学生的考试得分
|
||||
@score = calculate_student_score(@exercise, User.current)
|
||||
#@score = calculate_student_score(@exercise, User.current)
|
||||
# @score = 100
|
||||
if @uncomplete_question.count < 1
|
||||
# 查看是否有已提交记录
|
||||
cur_exercise_user.score = @score
|
||||
if cur_exercise_user.save
|
||||
#redirect_to poll_index_path(:polls_group_id => @course.id,:polls_type => 'Course')
|
||||
@status = 0 #提交成功
|
||||
else
|
||||
@status = 2 #未知错误
|
||||
end
|
||||
else
|
||||
@status = 1 #有未做得必答题
|
||||
end
|
||||
@save = params[:save].to_i if params[:save]
|
||||
# if @uncomplete_question.count < 1
|
||||
# # 查看是否有已提交记录
|
||||
# cur_exercise_user.score = @score
|
||||
# if cur_exercise_user.save
|
||||
# #redirect_to poll_index_path(:polls_group_id => @course.id,:polls_type => 'Course')
|
||||
# @status = 0 #提交成功
|
||||
# else
|
||||
# @status = 2 #未知错误
|
||||
# end
|
||||
# else
|
||||
# @status = 1 #有未做得必答题
|
||||
# end
|
||||
# @save = params[:save].to_i if params[:save]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# 获取学生未答情况
|
||||
def get_student_uncomplete_question
|
||||
time_limit = @exercise.time == -1 || @exercise.time.nil?
|
||||
uncomplete_count = get_uncomplete_question(@exercise, User.current).count
|
||||
render :json => {:time_limit => time_limit, :uncomplete_count => uncomplete_count}
|
||||
end
|
||||
|
||||
# 主观题打分
|
||||
def edit_question_score
|
||||
exercise_user = @exercise.exercise_users.where(:user_id => params[:user_id].to_i).first
|
||||
exercise_answer = ExerciseAnswer.where(:user_id => params[:user_id].to_i, :exercise_question_id => params[:exercise_question_id].to_i).first
|
||||
exercise_question = ExerciseQuestion.where(:id => params[:exercise_question_id].to_i).first
|
||||
if exercise_user && exercise_answer && exercise_question
|
||||
score = params[:score].to_i
|
||||
unless score > exercise_question.question_score || score < 0
|
||||
exercise_answer.update_attributes(:score => score)
|
||||
exercise_user.update_attributes(:subjective_score => calculate_subjective_score(@exercise, exercise_user.user))
|
||||
exercise_user.update_attributes(:score => ((exercise_user.objective_score > 0 ? exercise_user.objective_score : 0) + (exercise_user.subjective_score > 0 ? exercise_user.subjective_score : 0)))
|
||||
render :json => {:status => 1, :score => score, :total_score => exercise_user.score}
|
||||
else
|
||||
render :json => {:status => 2}
|
||||
end
|
||||
else
|
||||
render :json => {:status => 0}
|
||||
end
|
||||
end
|
||||
|
||||
#查看学生的答卷情况
|
||||
def show_student_result
|
||||
@user = User.find params[:user_id]
|
||||
@can_edit_excercise = false
|
||||
@exercise_questions = @exercise.exercise_questions
|
||||
score = calculate_student_score(@exercise, @user)
|
||||
eu = get_exercise_user(@exercise.id, @user.id)
|
||||
eu.update_attributes(:score => score)
|
||||
#score = calculate_student_score(@exercise, @user)
|
||||
#eu = get_exercise_user(@exercise.id, @user.id)
|
||||
#eu.update_attributes(:score => score)
|
||||
@exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first
|
||||
@left_nav_type = 8
|
||||
respond_to do |format|
|
||||
|
@ -619,6 +757,19 @@ class ExerciseController < ApplicationController
|
|||
score = score1 + score2 + score3
|
||||
end
|
||||
|
||||
# 计算主观题总分
|
||||
def calculate_subjective_score exercise, user
|
||||
score = 0
|
||||
exercise_questions = exercise.exercise_questions.where(:question_type => 4)
|
||||
exercise_answers = user.exercise_answer.where(:exercise_question_id => exercise_questions.map(&:id))
|
||||
exercise_answers.each do |ea|
|
||||
if ea.score != -1
|
||||
score += ea.score
|
||||
end
|
||||
end
|
||||
score
|
||||
end
|
||||
|
||||
#导入试卷的弹框
|
||||
def other_exercise
|
||||
# 查作者是我,或者作者是当前课程的老师,且不在当前课程内的试卷 进行导入
|
||||
|
@ -716,7 +867,7 @@ class ExerciseController < ApplicationController
|
|||
sheet1 = book.create_worksheet :name => "exercise"
|
||||
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
|
||||
sheet1.row(0).default_format = blue
|
||||
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_class),l(:excel_f_score),l(:excel_commit_time)])
|
||||
sheet1.row(0).concat([l(:excel_user_id),l(:excel_user_name),l(:excel_nickname),l(:excel_student_id),l(:excel_mail),l(:excel_objective_score),l(:excel_subjective_score),l(:excel_f_score),l(:excel_answer_time)])
|
||||
count_row = 1
|
||||
items.each do |exercise|
|
||||
sheet1[count_row,0]=exercise.user.id
|
||||
|
@ -724,9 +875,10 @@ class ExerciseController < ApplicationController
|
|||
sheet1[count_row,2] = exercise.user.login
|
||||
sheet1[count_row,3] = exercise.user.user_extensions.student_id
|
||||
sheet1[count_row,4] = exercise.user.mail
|
||||
sheet1[count_row,5] = ""
|
||||
sheet1[count_row,6] = exercise.score
|
||||
sheet1[count_row,7] = format_time(exercise.created_at)
|
||||
sheet1[count_row,5] = exercise.objective_score == -1 ? "0.0" : format("%.1f",exercise.objective_score)
|
||||
sheet1[count_row,6] = exercise.subjective_score == -1 ? "0.0" : format("%.1f",exercise.subjective_score)
|
||||
sheet1[count_row,7] = exercise.score
|
||||
sheet1[count_row,8] = exercise.commit_status == 0 ? l(:excel_no_answer) : format_time(exercise.created_at)
|
||||
count_row += 1
|
||||
end
|
||||
book.write xls_report
|
||||
|
|
|
@ -105,8 +105,8 @@ class HomeworkCommonController < ApplicationController
|
|||
else
|
||||
@homework.publish_time = params[:homework_common][:publish_time]
|
||||
end
|
||||
param_end_time = Time.parse(params[:homework_common][:end_time])
|
||||
homework_end_time = @homework.end_time ? @homework.end_time : ''
|
||||
param_end_time = Time.parse(params[:homework_common][:end_time]).to_s
|
||||
homework_end_time = @homework.end_time ? @homework.end_time.to_s : ''
|
||||
if homework_end_time != param_end_time
|
||||
if homework_end_time > param_end_time
|
||||
@homework.student_works.where("work_status = 1").each do |st|
|
||||
|
|
|
@ -1009,14 +1009,15 @@ class UsersController < ApplicationController
|
|||
new_homework.anonymous_comment = 1
|
||||
new_homework.quotes = 0
|
||||
new_homework.is_open = 0
|
||||
# homework.attachments.each do |attachment|
|
||||
# att = attachment.copy
|
||||
# att.container_id = nil
|
||||
# att.container_type = nil
|
||||
# att.copy_from = attachment.id
|
||||
# att.save
|
||||
# new_homework.attachments << att
|
||||
# end
|
||||
new_homework.homework_bank_id = homework.id
|
||||
homework.attachments.each do |attachment|
|
||||
att = attachment.copy
|
||||
att.container_id = nil
|
||||
att.container_type = nil
|
||||
att.copy_from = attachment.id
|
||||
att.save
|
||||
new_homework.attachments << att
|
||||
end
|
||||
#homework_detail_manual = homework.homework_detail_manual
|
||||
#homework_detail_programing = homework.homework_detail_programing
|
||||
#homework_detail_group = homework.homework_detail_group
|
||||
|
@ -1268,14 +1269,14 @@ class UsersController < ApplicationController
|
|||
#@homework.end_time = homework.end_time
|
||||
@homework.homework_type = homework.homework_type
|
||||
#@homework.course_id = homework.course_id
|
||||
# homework.attachments.each do |attachment|
|
||||
# att = attachment.copy
|
||||
# att.container_id = nil
|
||||
# att.container_type = nil
|
||||
# att.copy_from = attachment.id
|
||||
# att.save
|
||||
# @homework.attachments << att
|
||||
# end
|
||||
homework.attachments.each do |attachment|
|
||||
att = attachment.copy
|
||||
att.container_id = nil
|
||||
att.container_type = nil
|
||||
att.copy_from = attachment.id
|
||||
att.save
|
||||
@homework.attachments << att
|
||||
end
|
||||
|
||||
#if homework_detail_programing
|
||||
if homework.homework_type == 2
|
||||
|
@ -1494,6 +1495,7 @@ class UsersController < ApplicationController
|
|||
if params[:quotes] && !params[:quotes].blank?
|
||||
quotes_homework = HomeworkBank.find params[:quotes].to_i
|
||||
quotes_homework.update_column(:quotes, quotes_homework.quotes+1)
|
||||
homework.update_attributes(:homework_bank_id => quotes_homework.id)
|
||||
end
|
||||
|
||||
if params[:add_to_bank]
|
||||
|
|
|
@ -2532,6 +2532,8 @@ module ApplicationHelper
|
|||
candown = true
|
||||
elsif attachment.container.class.to_s=="ContestantWork"
|
||||
candown = true
|
||||
elsif attachment.container.class.to_s=="HomeworkBank"
|
||||
candown = true
|
||||
elsif attachment.container.class.to_s=="BlogComment" #博客资源允许下载
|
||||
candown = true
|
||||
elsif attachment.container.class.to_s=="Memo" #论坛资源允许下载
|
||||
|
@ -3123,77 +3125,85 @@ module ApplicationHelper
|
|||
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
|
||||
def user_for_homework_common homework,is_teacher,work
|
||||
count = homework.student_works.has_committed.count
|
||||
if User.current.member_of_course?(homework.course)
|
||||
if is_teacher #老师显示作品数量
|
||||
link_to "作品(#{count})", student_work_index_url_in_org(homework.id, 2), :class => "c_blue"
|
||||
else #学生显示提交作品、修改作品等按钮
|
||||
work = cur_user_works_for_homework homework
|
||||
project = cur_user_projects_for_homework homework
|
||||
if work.nil? && homework.end_time >= Time.now
|
||||
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
||||
link_to "提交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
|
||||
else
|
||||
link_to "提交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
|
||||
end
|
||||
elsif work.nil? && homework.end_time < Time.now
|
||||
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
||||
link_to "补交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
|
||||
else
|
||||
link_to "补交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_red'
|
||||
end
|
||||
else
|
||||
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前
|
||||
if homework.homework_type != 3
|
||||
link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "开启匿评后不可修改作品"
|
||||
if User.current.logged?
|
||||
if User.current.member_of_course?(homework.course)
|
||||
if is_teacher #老师显示作品数量
|
||||
link_to "作品(#{count})", student_work_index_url_in_org(homework.id, 2), :class => "c_blue"
|
||||
else #学生显示提交作品、修改作品等按钮
|
||||
work = cur_user_works_for_homework homework
|
||||
project = cur_user_projects_for_homework homework
|
||||
if work.nil? && homework.end_time >= Time.now
|
||||
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
||||
link_to "提交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
|
||||
else
|
||||
work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
if User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0
|
||||
link_to "提交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
|
||||
end
|
||||
elsif work.nil? && homework.end_time < Time.now
|
||||
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
|
||||
link_to "补交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
|
||||
else
|
||||
link_to "补交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_red'
|
||||
end
|
||||
else
|
||||
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 && StudentWorksEvaluationDistribution.where("student_work_id = #{work.id}").count > 0 #匿评作业,且作业状态不是在开启匿评之前
|
||||
if homework.homework_type != 3
|
||||
link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "开启匿评后不可修改作品"
|
||||
else
|
||||
link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "匿评开启后提交的作品不参与匿评"
|
||||
work_ids = "(" + homework.student_works.has_committed.map(&:id).join(",") + ")"
|
||||
if User.current.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count > 0
|
||||
link_to "作品匿评", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "开启匿评后不可修改作品"
|
||||
else
|
||||
link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "匿评开启后提交的作品不参与匿评"
|
||||
end
|
||||
end
|
||||
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
|
||||
link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "匿评已结束"
|
||||
elsif homework.homework_type == 2 && homework.end_time >= Time.now#编程作业不能修改作品
|
||||
link_to "修改作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
|
||||
elsif homework.end_time >= Time.now && work.user_id == User.current.id
|
||||
link_to "修改作品(#{count})", edit_student_work_url_without_domain(work.id),:class => 'c_blue'
|
||||
else
|
||||
link_to "查看作品(#{count})", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "作业截止后不可修改作品"
|
||||
end
|
||||
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
|
||||
link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "匿评已结束"
|
||||
elsif homework.homework_type == 2 && homework.end_time >= Time.now#编程作业不能修改作品
|
||||
link_to "修改作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
|
||||
elsif homework.end_time >= Time.now && work.user_id == User.current.id
|
||||
link_to "修改作品(#{count})", edit_student_work_url_without_domain(work.id),:class => 'c_blue'
|
||||
else
|
||||
link_to "查看作品(#{count})", student_work_index_url_in_org(homework.id, 2), :class => 'c_blue', :title => "作业截止后不可修改作品"
|
||||
end
|
||||
end
|
||||
else
|
||||
link_to "作品(#{count})", "javascript:void(0)", :class => "c_blue", :onclick => "notice_sure_box('您不是班级成员,不能提交作品<br/>请先从老师处获取邀请码后加入班级,再提交作品')"
|
||||
end
|
||||
else
|
||||
link_to "作品(#{count})",student_work_index_url_in_org(homework.id, 2),:class => "c_blue"
|
||||
link_to "作品(#{count})", "javascript:void(0)", :class => "c_blue", :onclick => "login_notice_box('#{signin_url_without_domain}');"
|
||||
end
|
||||
end
|
||||
|
||||
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
|
||||
def user_for_contest_work homework,is_contestant,work
|
||||
count = homework.contestant_works.has_committed.count
|
||||
if User.current.member_of_contest?(homework.contest)
|
||||
if !is_contestant #老师显示作品数量
|
||||
link_to "作品(#{count})", contestant_works_path(:work =>homework.id, :tab => 2), :class => "c_blue"
|
||||
else #学生显示提交作品、修改作品等按钮
|
||||
work = cur_user_works_for_work homework
|
||||
project = cur_user_projects_for_work homework
|
||||
if work.nil? && homework.work_status == 1
|
||||
if homework.work_type ==3 && project.nil? && homework.work_detail_group.base_on_project
|
||||
link_to "提交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
|
||||
if User.current.logged?
|
||||
if User.current.member_of_contest?(homework.contest)
|
||||
if !is_contestant #老师显示作品数量
|
||||
link_to "作品(#{count})", contestant_works_path(:work =>homework.id, :tab => 2), :class => "c_blue"
|
||||
else #学生显示提交作品、修改作品等按钮
|
||||
work = cur_user_works_for_work homework
|
||||
project = cur_user_projects_for_work homework
|
||||
if work.nil? && homework.work_status == 1
|
||||
if homework.work_type ==3 && project.nil? && homework.work_detail_group.base_on_project
|
||||
link_to "提交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
|
||||
else
|
||||
link_to "提交作品(#{count})", new_contestant_work_path(:work => homework.id),:class => 'c_blue'
|
||||
end
|
||||
else
|
||||
link_to "提交作品(#{count})", new_contestant_work_path(:work => homework.id),:class => 'c_blue'
|
||||
end
|
||||
else
|
||||
if homework.work_status == 1 && work.user_id == User.current.id
|
||||
link_to "修改作品(#{count})", edit_contestant_work_path(work.id),:class => 'c_blue'
|
||||
else
|
||||
link_to "查看作品(#{count})", contestant_works_path(:work =>homework.id, :tab => 2), :class => 'c_blue', :title => "不可修改作品"
|
||||
if homework.work_status == 1 && work.user_id == User.current.id
|
||||
link_to "修改作品(#{count})", edit_contestant_work_path(work.id),:class => 'c_blue'
|
||||
else
|
||||
link_to "查看作品(#{count})", contestant_works_path(:work =>homework.id, :tab => 2), :class => 'c_blue', :title => "不可修改作品"
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
link_to "作品(#{count})", "javascript:void(0)", :class => "c_blue", :onclick => "notice_sure_box('您不是参赛者,不能提交作品<br/>请加入竞赛,待审批通过后再提交作品')"
|
||||
end
|
||||
else
|
||||
link_to "作品(#{count})",contestant_works_path(:work =>homework.id, :tab => 2),:class => "c_blue"
|
||||
link_to "作品(#{count})", "javascript:void(0)", :class => "c_blue", :onclick => "login_notice_box('#{signin_url_without_domain}');"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -4141,6 +4151,15 @@ def add_to_homework_bank_f homework
|
|||
homework_bank.max_num = homework.homework_detail_group.max_num
|
||||
homework_bank.base_on_project = homework.homework_detail_group.base_on_project
|
||||
end
|
||||
homework.attachments.each do |attachment|
|
||||
att = attachment.copy
|
||||
att.container_id = nil
|
||||
att.container_type = nil
|
||||
att.author_id = homework_bank.user_id
|
||||
att.copy_from = attachment.id
|
||||
att.save
|
||||
homework_bank.attachments << att
|
||||
end
|
||||
homework_bank
|
||||
end
|
||||
|
||||
|
|
|
@ -112,16 +112,30 @@ module ExerciseHelper
|
|||
end
|
||||
|
||||
def get_current_score exercise
|
||||
score = 0
|
||||
total_score = 0
|
||||
mc_score = 0
|
||||
mcq_score = 0
|
||||
single_score = 0
|
||||
multi_score = 0
|
||||
unless exercise.nil?
|
||||
exercise.exercise_questions.each do |exercise_question|
|
||||
unless exercise_question.question_score.nil?
|
||||
score += exercise_question.question_score
|
||||
total_score += exercise_question.question_score
|
||||
case exercise_question.question_type
|
||||
when 1
|
||||
mc_score += exercise_question.question_score
|
||||
when 2
|
||||
mcq_score += exercise_question.question_score
|
||||
when 3
|
||||
single_score += exercise_question.question_score
|
||||
when 4
|
||||
multi_score += exercise_question.question_score
|
||||
end
|
||||
end
|
||||
end
|
||||
return score
|
||||
return total_score, mc_score, mcq_score, single_score, multi_score
|
||||
end
|
||||
return score
|
||||
return total_score, mc_score, mcq_score, single_score, multi_score
|
||||
end
|
||||
|
||||
def answer_be_selected?(answer,user)
|
||||
|
@ -175,4 +189,43 @@ module ExerciseHelper
|
|||
standard_answer
|
||||
end
|
||||
|
||||
# 问题随机的下拉列表
|
||||
def question_random_select
|
||||
type = []
|
||||
option1 = []
|
||||
option1 << "题目不随机打乱"
|
||||
option1 << 0
|
||||
type << option1
|
||||
option2 = []
|
||||
option2 << "题目随机打乱"
|
||||
option2 << 1
|
||||
type << option2
|
||||
end
|
||||
|
||||
# 选项随机的下拉列表
|
||||
def choice_random_select
|
||||
type = []
|
||||
option1 = []
|
||||
option1 << "选项不随机打乱"
|
||||
option1 << 0
|
||||
type << option1
|
||||
option2 = []
|
||||
option2 << "选项随机打乱"
|
||||
option2 << 1
|
||||
type << option2
|
||||
end
|
||||
|
||||
#允许学生查看结果的下拉列表
|
||||
def show_result_select
|
||||
type = []
|
||||
option1 = []
|
||||
option1 << "允许学生查看测验结果"
|
||||
option1 << 1
|
||||
type << option1
|
||||
option2 = []
|
||||
option2 << "不允许学生查看测验结果"
|
||||
option2 << 0
|
||||
type << option2
|
||||
end
|
||||
|
||||
end
|
|
@ -2,6 +2,7 @@ class HomeworkBank < ActiveRecord::Base
|
|||
# attr_accessible :title, :body
|
||||
belongs_to :user
|
||||
has_many :homework_bank_tests
|
||||
acts_as_attachable
|
||||
|
||||
def language_name
|
||||
%W(C C++ Python Java).at(self.language.to_i - 1)
|
||||
|
|
|
@ -10,6 +10,7 @@ class HomeworkCommon < ActiveRecord::Base
|
|||
|
||||
belongs_to :course
|
||||
belongs_to :user
|
||||
belongs_to :homework_bank
|
||||
has_one :homework_detail_manual, :dependent => :destroy
|
||||
has_one :homework_detail_programing, :dependent => :destroy
|
||||
has_one :homework_detail_group, :dependent => :destroy
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
<style>
|
||||
.tscore_con h2{ display:block; background:#eaeaea; font-size:14px; color:#343333; height:31px; width: auto; text-align: center; padding-top:5px;}
|
||||
.tscore_con h2{ display:block; font-size:14px; color:#343333; height:31px; width: auto; text-align: center; padding-top:5px;}
|
||||
.tscore_box li{ height:25px;}
|
||||
</style>
|
||||
|
||||
|
||||
<div id="muban_popup_box" style="width:280px;">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">作业积分</h3>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="tscore_con" id="user_score">
|
||||
<% act_score = CourseContributorScore.where("user_id = ? and course_id = ?", member.user_id, member.course_id).first %>
|
||||
<h2><%= member.user.show_name %> 活跃度计算</h2>
|
||||
<% if act_score.nil? %>
|
||||
<div style="padding-left: 40px;padding-bottom: 2px;padding-right: 2px;padding-top: 10px;">
|
||||
<div style="padding-left: 62px;padding-bottom: 2px;padding-right: 2px;padding-top: 10px;">
|
||||
资源发布数 x 5 = 0 x 5 = 0</br>
|
||||
问答发布数 x 2 = 0 x 2 = 0</br>
|
||||
通知发布数 x 1 = 0 x 1 = 0</br>
|
||||
|
@ -23,7 +28,7 @@
|
|||
act_score.message_reply_num.to_i * 1 + act_score.journal_num.to_i * 1 +
|
||||
+ act_score.homework_journal_num.to_i * 1 + act_score.news_reply_num.to_i * 1 +
|
||||
act_score.news_num.to_i * 1 %>
|
||||
<div style="padding-left: 40px;padding-bottom: 2px;padding-right: 2px;padding-top: 10px;">
|
||||
<div style="padding-left: 62px;padding-bottom: 2px;padding-right: 2px;padding-top: 10px;">
|
||||
资源发布数 x 5 = <%= act_score.resource_num.to_i %> x 5 = <%= act_score.resource_num.to_i * 5 %></br>
|
||||
问答发布数 x 2 = <%= act_score.message_num.to_i %> x 2 = <%= act_score.message_num.to_i * 2 %></br>
|
||||
通知发布数 x 1 = <%= act_score.news_num.to_i %> x 1 = <%= act_score.news_num.to_i %></br>
|
||||
|
@ -36,3 +41,4 @@
|
|||
<% end %>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -1,22 +1,24 @@
|
|||
<style>
|
||||
.c_grey02{ color:#666666;}
|
||||
.c_blue02{ color:#15bcce; font-weight: bold;}
|
||||
.w280{ display:block; width:280px;float:left;}
|
||||
.w70{ display:block;width:70px; text-align:center; float:left;}
|
||||
.c_red{ color:#e50000;}
|
||||
.c_blue03{ color:#0d90c4;}
|
||||
|
||||
|
||||
.tscore_con h2{ display:block; background:#eaeaea; font-size:14px; color:#343333; height:31px; width: auto; text-align: center; padding-top:5px;}
|
||||
.tscore_con h2{ display:block; margin-bottom: -5px; font-size:14px; color:#343333; height:31px; width: auto; text-align: center; padding-top:5px;}
|
||||
.tscore_box{ width:370px; margin:15px auto;}
|
||||
.tscore_box li{ height:25px;}
|
||||
</style>
|
||||
|
||||
<div id="muban_popup_box" style="width:430px;">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">作业积分</h3>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="tscore_con" id="user_score">
|
||||
<h2><%= @member_score.user.name %> 历次作业积分</h2>
|
||||
<h2><%= @member_score.user.show_name %> 历次作业积分</h2>
|
||||
<ul class="tscore_box" style="max-height: 400px; overflow: auto;">
|
||||
<li ><span class="c_blue02 w280">作业名称</span><span class="c_blue02 w70">得分</span></li>
|
||||
<li ><span class="c_blue w280">作业名称</span><span class="c_blue w70">得分</span></li>
|
||||
<% @member_score.homework_common_list.each_with_index do |homework_common, index| %>
|
||||
<li>
|
||||
<span class="c_grey02 w280 hiddent">
|
||||
|
@ -28,7 +30,8 @@
|
|||
</span>
|
||||
</li>
|
||||
<% end %>
|
||||
<li><span class="c_blue03 w280">作业积分(总分)</span><span class="c_red w70"><%= format("%0.2f",(@member_score.student_work_score_sum).first.score.nil? ? 0 : (@member_score.student_work_score_sum).first.score) %></span></li>
|
||||
<li><span class="c_blue w280">作业积分(总分)</span><span class="c_red w70"><%= format("%0.2f",(@member_score.student_work_score_sum).first.score.nil? ? 0 : (@member_score.student_work_score_sum).first.score) %></span></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -1,7 +1,2 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/show_member_act_score', :locals => {:member => @member}) %>');
|
||||
showModal('ajax-modal', '300px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span>" +
|
||||
"<a href='javascript:void(0)' onclick='hidden_homework_score_form();'><img src='/images/bid/close.png' width='26px' height='26px' style='margin-left: 275px;' /></a></span>");
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","40%").css("position","fixed").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("new-watcher");
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'courses/show_member_act_score', :locals => {:member => @member}) %>";
|
||||
pop_box_new(htmlvalue, 280, 235);
|
|
@ -1,13 +1,2 @@
|
|||
//$('#ajax-modal').html('<%#= escape_javascript(render :partial => 'courses/show_member_score', :locals => {:member => @member_score}) %>');
|
||||
//showModal('ajax-modal', '400px');
|
||||
//$('#ajax-modal').addClass('new-watcher');
|
||||
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'courses/show_member_score', :locals => {:member => @member_score}) %>');
|
||||
showModal('ajax-modal', '400px');
|
||||
//$('#ajax-modal').css('height','569px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span>" +
|
||||
"<a href='javascript:void(0)' onclick='hidden_homework_score_form();'><img src='/images/bid/close.png' width='26px' height='26px' style='margin-left: 375px;' /></a></span>");
|
||||
//$('#ajax-modal').parent().removeClass();
|
||||
$('#ajax-modal').parent().css("top","30%").css("left","40%").css("position","fixed").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("new-watcher");
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'courses/show_member_score', :locals => {:member => @member_score}) %>";
|
||||
pop_box_new(htmlvalue, 430, 520);
|
|
@ -3,58 +3,64 @@
|
|||
<script type="text/javascript">
|
||||
function resetQuestion<%=exercise_question.id%>()
|
||||
{
|
||||
$("#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 name='select_items' class='w60'>选项<%=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>" +
|
||||
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>");
|
||||
$("#question_standard_answer_<%=exercise_question.id %>").html("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>");
|
||||
$("#poll_answers_<%=exercise_question.id%>").html("<input style='display: none;' name='exercise_choice' id='exercise_choice_<%=exercise_question.id%>' value='<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>'/>" +
|
||||
"<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item new_answer'>" +
|
||||
"<a class='<%= (index + 1) == exercise_question.exercise_standard_answers.first.exercise_choice_id ? 'question_choice_blue' : 'question_choice_white' %> fl mr10 choice_btn' title='设为答案' href='javascript:void(0)' onclick='toggle_select($(this), 1, <%= exercise_question.id %>);'><%=convert_to_char (index+1).to_s %></a>" +
|
||||
"<input maxlength='200' class='w600' type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
"</li>" +
|
||||
"<div class='cl'></div>" +
|
||||
"<% end%>");
|
||||
"<% end%>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<a class='question_choice_dash fl mr10 choice_btn'><%=convert_to_char (exercise_question.exercise_choices.count+1).to_s %></a>" +
|
||||
"<div class='dash-block new-question w600' onclick='add_single_answer($(this), 1);'>新建选项</div>" +
|
||||
"</li> <div class='cl'></div>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="questionContainer" style="width: 680px;">
|
||||
<div class="mb10 ur_item">
|
||||
<label>分值<span class="ur_index"></span>: </label>
|
||||
<input id="poll_question_score_<%=exercise_question.id %>" value="<%=exercise_question.question_score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
|
||||
<span class="fr c_red" style="width: 60px;" id="question_standard_answer_<%=exercise_question.id %>"><%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
|
||||
<span class="fr">标准答案:</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="ur_editor_title">
|
||||
<label class="questionLabel mt8">问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<textarea name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入单选题题目" type="text" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
|
||||
<textarea name="question_title" style="width: 625px;" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入单选题的题干" type="text" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
|
||||
</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 name='select_items' class='w60'>选项<%=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 %>
|
||||
<input style="display: none;" name="exercise_choice" id="exercise_choice_<%=exercise_question.id%>" value="<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>"/>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item new_answer">
|
||||
<a class="<%= (index + 1) == exercise_question.exercise_standard_answers.first.exercise_choice_id ? 'question_choice_blue' : 'question_choice_white' %> fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, <%= exercise_question.id %>);"><%=convert_to_char (index+1).to_s %></a>
|
||||
<input maxlength="200" class="w600" type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<li class="ur_item">
|
||||
<a class="question_choice_dash fl mr10 choice_btn"><%=convert_to_char (exercise_question.exercise_choices.count+1).to_s %></a>
|
||||
<div class="dash-block new-question w600" onclick='add_single_answer($(this), 1);'>新建选项</div>
|
||||
</li>
|
||||
<div class='cl'></div>
|
||||
</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 %>,1);">
|
||||
保存
|
||||
</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
<span class="fl c_red mt10">温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案</span>
|
||||
<a class="big_blue_btn borderRadius fr" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,1);">保存</a>
|
||||
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -3,56 +3,64 @@
|
|||
<script type="text/javascript">
|
||||
function resetQuestion<%=exercise_question.id%>()
|
||||
{
|
||||
$("#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 name='select_items' class='w60'>选项<%=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>" +
|
||||
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>");
|
||||
$("#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("<input style='display: none;' name='exercise_choice' id='exercise_choice_<%=exercise_question.id%>' value='<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>'/>" +
|
||||
"<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item new_answer'>" +
|
||||
"<a class='<%= exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s.include?((index+1).to_s) ? 'question_choice_blue' : 'question_choice_white' %> fl mr10 choice_btn' title='设为答案' href='javascript:void(0)' onclick='toggle_select($(this), 2, <%= exercise_question.id %>);'><%=convert_to_char (index+1).to_s %></a>" +
|
||||
"<input maxlength='200' class='w600' type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
"</li>" +
|
||||
"<div class='cl'></div>" +
|
||||
"<% end%>");
|
||||
"<% end%>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<a class='question_choice_dash fl mr10 choice_btn'><%=convert_to_char (exercise_question.exercise_choices.count+1).to_s %></a>" +
|
||||
"<div class='dash-block new-question w600' onclick='add_single_answer($(this), 2);'>新建选项</div>" +
|
||||
"</li> <div class='cl'></div>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="questionContainer" style="width: 680px;">
|
||||
<div class="mb10 ur_item">
|
||||
<label>分值<span class="ur_index"></span>: </label>
|
||||
<input id="poll_question_score_<%=exercise_question.id %>" value="<%=exercise_question.question_score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
|
||||
<span class="fr c_red" style="width: 60px;" id="question_standard_answer_<%=exercise_question.id %>"><%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
|
||||
<span class="fr">标准答案:</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="ur_editor_title">
|
||||
<label class="questionLabel mt8">问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<textarea name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入多选题题目" type="text" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
|
||||
<textarea name="question_title" style="width: 625px;" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入多选题的题干" type="text" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
|
||||
</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%>">
|
||||
<input style="display: none;" name="exercise_choice" id="exercise_choice_<%=exercise_question.id%>" value="<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>"/>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label name='select_items' class='w60'>选项<%=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>
|
||||
<li class="ur_item new_answer">
|
||||
<a class="<%= exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s.include?((index+1).to_s) ? 'question_choice_blue' : 'question_choice_white' %> fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, <%= exercise_question.id %>);"><%=convert_to_char (index+1).to_s %></a>
|
||||
<input maxlength="200" class="w600" type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<li class="ur_item">
|
||||
<a class="question_choice_dash fl mr10 choice_btn"><%=convert_to_char (exercise_question.exercise_choices.count+1).to_s %></a>
|
||||
<div class="dash-block new-question w600" onclick='add_single_answer($(this), 2);'>新建选项</div>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</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 %>,2);">
|
||||
<span class="fl c_red mt10">温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案</span>
|
||||
<a class="big_blue_btn borderRadius fr" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,2);">
|
||||
保存
|
||||
</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -16,13 +16,15 @@
|
|||
</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 class="ur_editor_footer">
|
||||
<input type="checkbox" name="question_random" <%= exercise.question_random == 0 ? 'checked' : '' %> id="edit_question_random">
|
||||
<label for="edit_question_random" class="mt10 mr30">题目不随机打乱</label>
|
||||
<input type="checkbox" name="choice_random" <%= exercise.choice_random == 0 ? 'checked' : '' %> id="edit_choice_random">
|
||||
<label for="edit_choice_random" class="mt10 mr30">选项不随机打乱</label>
|
||||
<input type="checkbox" name="show_result" <%= exercise.show_result == 1 ? 'checked' : '' %> id="edit_show_result">
|
||||
<label for="edit_show_result" class="mt10">允许学生查看测验结果</label>
|
||||
<a data-button="ok" onclick="pollsSubmit($(this));" class="big_blue_btn fr borderRadius">保存</a>
|
||||
<a data-button="cancel" onclick="pollsCancel();" class="big_grey_btn fr borderRadius mr10">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<%= 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_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="questionContainer" style="width: 680px;">
|
||||
<div class="mb10 ur_item">
|
||||
<label class="ml25">分值<span class="ur_index"></span>: </label>
|
||||
<input id="poll_question_score_<%=exercise_question.id %>" value="<%=exercise_question.question_score %>" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="ur_editor_title">
|
||||
<label class="questionLabel mt8 ml25">问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<textarea name="question_title" style="width: 600px;" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入问答题的题干" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
|
||||
</div>
|
||||
|
||||
<div class="ur_editor_content" id="edit_multi">
|
||||
<div id="poll_answers_<%=exercise_question.id%>" class="multi_input">
|
||||
<label name='candiate_items'>参考答案<span class="ur_index"></span>: </label>
|
||||
<textarea class="candiate_answer" style="width: 600px; height: 90px;" name="exercise_choice" id="poll_questions_answer_<%=exercise_question.id %>" placeholder="如有参考答案,请输入参考答案" type="text"><%=exercise_question.exercise_standard_answers.empty? ? '' : exercise_question.exercise_standard_answers.first.answer_text %></textarea>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<p class="fl c_red">温馨提示:[问答题]属于主观题需要人工评分,未作答的情况下系统将自动评零分<br><span class="ml60">参考答案作为人工评分时的参考</span></p>
|
||||
<a class="big_blue_btn borderRadius fr" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,4);">保存</a>
|
||||
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<!--编辑单选 end-->
|
||||
<% end%>
|
|
@ -3,52 +3,57 @@
|
|||
<script type="text/javascript">
|
||||
function resetQuestion<%=exercise_question.id%>()
|
||||
{
|
||||
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>")
|
||||
$("#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 name='candiate_items'>候选答案<%=convert_to_chi_num(index+1) %><span class='ur_index'></span>: </label>" +
|
||||
"<input class='candiate_answer' 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>" +
|
||||
"<li class='ur_item new_answer'>" +
|
||||
"<label name='candiate_items'>参考答案<%=convert_to_chi_num(index+1) %><span class='ur_index'></span>: </label>" +
|
||||
"<input class='candiate_answer w560' name='exercise_choice[<%=exercise_choice.id %>]' placeholder='请输入参考答案' type='text' value='<%=exercise_choice.answer_text %>'/>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
"</li>" +
|
||||
"<div class='cl'></div>" +
|
||||
"<% end%>");
|
||||
"<% end%>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<div class='dash-block new-question w560' style='margin-left: 82px;' onclick='add_candidate_answer($(this));'>新建参考答案</div>" +
|
||||
"</li>" +
|
||||
"<div class='cl'></div>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="questionContainer" style="width: 680px;">
|
||||
<div class="ur_editor_title">
|
||||
<label class="questionLabel mt8">问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<textarea name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
|
||||
<div class="mb10 ur_item">
|
||||
<label class="ml36">分值<span class="ur_index"></span>: </label>
|
||||
<input id="poll_question_score_<%=exercise_question.id %>" value="<%=exercise_question.question_score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="ur_editor_title">
|
||||
<label class="questionLabel mt8 ml36">问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<textarea name="question_title" style="width: 590px;" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入填空题的题干(注意:目前仅支持一个空)" type="text" onfocus="autoHeight('#poll_questions_title_<%=exercise_question.id %>',30)"><%=exercise_question.question_title %></textarea>
|
||||
</div>
|
||||
|
||||
<div class="ur_editor_content" id="edit_single">
|
||||
<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 name='candiate_items'>候选答案<%=convert_to_chi_num(index+1) %><span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer" 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>
|
||||
<li class="ur_item new_answer">
|
||||
<label name='candiate_items'>参考答案<%=convert_to_chi_num(index+1) %><span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer w560" name="exercise_choice[<%=exercise_choice.id %>]" placeholder="请输入参考答案" type="text" value="<%=exercise_choice.answer_text %>"/>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this));"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
<li class="ur_item">
|
||||
<div class="dash-block new-question w560" style="margin-left: 82px;" onclick="add_candidate_answer($(this));">新建参考答案</div>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</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 %>,3);">
|
||||
保存
|
||||
</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||
<span class="fl c_red mt10">温馨提示:[填空题]属于客观题将由系统自动评分,请输入参考答案</span>
|
||||
<a class="big_blue_btn borderRadius fr" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,3);">保存</a>
|
||||
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<%# 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%>
|
||||
<div>
|
||||
<div title="<%= exercise.exercise_name %>">
|
||||
<div style="width: 500px;float: left;">
|
||||
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue mw450", :title => "#{exercise_name}" %>
|
||||
<div class="pr">
|
||||
<div title="<%= exercise.exercise_name %>">
|
||||
<div style="width: 640px;float: left;">
|
||||
<%= link_to (index.to_i+1).to_s+". "+exercise_name, student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "polls_title polls_title_w fl c_dblue mw450", :title => "#{exercise_name}" %>
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<span class="exercise_status_nop fl mt3"></span>
|
||||
<% elsif exercise.exercise_status == 2 %>
|
||||
|
@ -12,23 +12,34 @@
|
|||
<% else %>
|
||||
<span class="exercise_status_end fl mt3"></span>
|
||||
<% end%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<% end_time_status = exercise.end_time.nil? ? 1 : (exercise.end_time <= Time.now ? 2 : 3) %>
|
||||
<div><a href="javascript:" class="pollsbtn btn_pu fr mr10 ml5" onclick="exercise_submit(<%=end_time_status %>,<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></div>
|
||||
<% elsif exercise.exercise_status == 2%>
|
||||
<div><a href="javascript:" class="pollsbtn btn_de fr mr10 ml5" onclick="republish_exercise(<%= exercise.id%>,<%=index.to_i %>);">取消发布</a></div>
|
||||
<% else%>
|
||||
<div class="pollsbtn fr mr10 pollsbtn_grey ml5">发布试卷</div>
|
||||
<% end%>
|
||||
|
||||
<% if exercise.exercise_status == 1%>
|
||||
<div class="pollsbtn fr mr10 pollsbtn_grey">统计结果</div>
|
||||
<% else %>
|
||||
<div><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%></div>
|
||||
<% end%>
|
||||
<div class="homepagePostSetting" id="exercise_opr_<%=exercise.id %>" style="display: none">
|
||||
<ul>
|
||||
<li class="homepagePostSettingIcon">
|
||||
<ul class="homepagePostSettiongText">
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<li><a href="<%= edit_exercise_path(exercise.id) %>" class="postOptionLink" title="编辑试卷">编 辑</a></li>
|
||||
<% end%>
|
||||
<li><a href="<%= exercise_path(exercise.id) %>" class="postOptionLink" title="查看试卷">查 看</a></li>
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<% end_time_status = exercise.end_time.nil? ? 1 : (exercise.end_time <= Time.now ? 2 : 3) %>
|
||||
<li><a href="javascript:" class="postOptionLink" onclick="exercise_submit(<%=end_time_status %>,<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></li>
|
||||
<% elsif exercise.exercise_status == 2%>
|
||||
<li><a href="javascript:" class="postOptionLink" onclick="republish_exercise(<%= exercise.id%>,<%=index.to_i %>);">取消发布</a></li>
|
||||
<% else%>
|
||||
<% end%>
|
||||
<% if exercise.exercise_status == 1%>
|
||||
<% else %>
|
||||
<li><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "postOptionLink"%></li>
|
||||
<% end%>
|
||||
<li><a href="javascript:void(0)" onClick="delete_exercise(<%=exercise.id %>);" title="删除试卷" class="postOptionLink">删 除</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
|
@ -39,15 +50,11 @@
|
|||
<% if exercise.exercise_status > 1 %>
|
||||
<span class="c_grey fl mr15">已提交:<span class="c_blue"><%= exercise.exercise_users.where("commit_status = 1").count %></span></span>
|
||||
<span class="c_grey fl mr15">未提交:<span class="c_blue"><%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %></span></span>
|
||||
<% if exercise.exercise_status == 3 %>
|
||||
<% count = exercise.exercise_users.where("commit_status = 1 and subjective_score = -1").count %>
|
||||
<span class="c_grey fl mr15">未批:<span class="<%= count > 0 ? 'c_red' : '' %>"><%= count %></span></span>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div id="exercise_opr_<%=exercise.id %>" class="none fr">
|
||||
<a href="javascript:void(0)" onClick="delete_exercise(<%=exercise.id %>);" title="删除试卷" class="ex_icon_de mt0"></a>
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<%= link_to '', edit_exercise_path(exercise.id), :title => "编辑试卷", :class => "ex_icon_edit mt0"%>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
|
||||
<% else%>
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
<% 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") %>
|
||||
<% multi_question_list = exercise.exercise_questions.where("question_type=4") %>
|
||||
<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| %>
|
||||
<% mc_question_list.each_with_index do |exercise_question, index| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (index + 1) == mc_question_list.count ? '' : 'border_b' %>">
|
||||
<%= render :partial => 'show_MC', :locals => {:exercise_question => exercise_question} %>
|
||||
</div>
|
||||
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
|
||||
|
@ -16,9 +17,9 @@
|
|||
</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| %>
|
||||
<% mcq_question_list.each_with_index do |exercise_question, index| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (index + 1) == mcq_question_list.count ? '' : 'border_b' %>">
|
||||
<%= render :partial => 'show_MCQ', :locals => {:exercise_question => exercise_question} %>
|
||||
</div>
|
||||
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
|
||||
|
@ -29,9 +30,9 @@
|
|||
</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| %>
|
||||
<% single_question_list.each_with_index do |exercise_question, index| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (index + 1) == single_question_list.count ? '' : 'border_b' %>">
|
||||
<%= render :partial => 'show_single', :locals => {:exercise_question => exercise_question} %>
|
||||
</div>
|
||||
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
|
||||
|
@ -40,3 +41,16 @@
|
|||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="testStatus" id="multi_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">问答题</h3>
|
||||
<% multi_question_list.each_with_index do |exercise_question, index| %>
|
||||
<div id="poll_questions_<%= exercise_question.id%>">
|
||||
<div id="show_poll_questions_<%= exercise_question.id %>" class="<%= (index + 1) == multi_question_list.count ? '' : 'border_b' %>">
|
||||
<%= render :partial => 'show_multi', :locals => {:exercise_question => exercise_question} %>
|
||||
</div>
|
||||
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
|
||||
<%= render :partial => 'edit_multi', :locals => {:exercise_question => exercise_question} %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
|
@ -0,0 +1,10 @@
|
|||
<% if !courses.empty? %>
|
||||
<% courses.each do |course| %>
|
||||
<ul class="courseSend" style="width: 370px;">
|
||||
<li>
|
||||
<input id="course_id_<%= course.id %>" name="course_ids[]" type="checkbox" value="<%= course.id %>" class="courseSendCheckbox"/>
|
||||
<label for="course_id_<%= course.id %>" class="chooseCourseName" title="<%=course.name + '('+ (current_time_and_term_short course) + ')'%>"><%=course.name + '('+ (current_time_and_term_short course) + ')'%></label>
|
||||
</li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -84,19 +84,19 @@
|
|||
{
|
||||
var title = $.trim($("#poll_questions_title").val());
|
||||
var score = $.trim($("#question_score").val());
|
||||
var standard_ans = $.trim($("#question_standard_ans").val());
|
||||
var standard_ans = $.trim($("#exercise_choice_" + quest_type).val());
|
||||
if(title.length == 0 || score.length == 0){
|
||||
alert("题目标题/分数不能为空");
|
||||
notice_box("题目标题/分数不能为空");
|
||||
doc.one('click', function(){
|
||||
add_poll_question($(this),quest_type);
|
||||
});
|
||||
}else if(!/^[1-9][0-9]*$/.test(score)) {
|
||||
alert("分数必须是非零开头的数字");
|
||||
notice_box("分数必须是非零开头的数字");
|
||||
doc.one('click', function(){
|
||||
add_poll_question($(this),quest_type);
|
||||
});
|
||||
}else if(quest_type !=3 && standard_ans.length == 0) {
|
||||
alert("标准答案不能为空");
|
||||
}else if(quest_type !=3 && quest_type !=4 && standard_ans.length == 0) {
|
||||
notice_box("标准答案不能为空");
|
||||
doc.one('click', function(){
|
||||
add_poll_question($(this),quest_type);
|
||||
});
|
||||
|
@ -108,13 +108,13 @@
|
|||
{
|
||||
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());
|
||||
var standard_ans = $.trim($("#exercise_choice_" + id).val());
|
||||
if(title.length == 0 || score.length == 0){
|
||||
alert("题目标题/分数不能为空");
|
||||
notice_box("题目标题/分数不能为空");
|
||||
}else if(!/^[1-9][0-9]*$/.test(score)) {
|
||||
alert("分数必须是非零开头的数字");
|
||||
}else if(quest_type !=3 && standard_ans.length == 0) {
|
||||
alert("标准答案不能为空");
|
||||
notice_box("分数必须是非零开头的数字");
|
||||
}else if(quest_type !=3 && quest_type !=4 && standard_ans.length == 0) {
|
||||
notice_box("标准答案不能为空");
|
||||
}else if(quest_type ==3) {
|
||||
var div = $("#poll_answers_" + id);
|
||||
var candiate_answer = $(".candiate_answer",div);
|
||||
|
@ -123,7 +123,7 @@
|
|||
if(i<candiate_answer.length-1 && $.trim($(candiate_answer[i]).val()) == "") {
|
||||
continue;
|
||||
} else if(i == (candiate_answer.length-1) && $.trim($(candiate_answer[i]).val()) == "") {
|
||||
alert("候选答案不能为空");
|
||||
notice_box("参考答案不能为空");
|
||||
} else if($.trim($(candiate_answer[i]).val()) != ""){
|
||||
doc.parent().parent().parent().submit();
|
||||
break;
|
||||
|
@ -131,7 +131,7 @@
|
|||
|
||||
}
|
||||
} else{
|
||||
alert("候选答案不能为空");
|
||||
notice_box("参考答案不能为空");
|
||||
}
|
||||
}else{
|
||||
doc.parent().parent().parent().submit();}
|
||||
|
@ -142,17 +142,17 @@
|
|||
function pollsSubmit(doc){
|
||||
var title = $.trim($("#exercise_name").val());
|
||||
if(title.length == 0){
|
||||
alert("测验标题不能为空");
|
||||
notice_box("测验标题不能为空");
|
||||
} else if($.trim($("#exercise_end_time").val()) =="") {
|
||||
alert("截止时间不能为空");
|
||||
notice_box("截止时间不能为空");
|
||||
} else if((Date.parse($("#exercise_end_time").val())+(24*60*60-1)*1000) <= Date.now()) {
|
||||
alert("截止时间不能小于当前时间");
|
||||
notice_box("截止时间不能早于当前时间");
|
||||
} else if($.trim($("#exercise_time").val()) !="" && !/^[1-9][0-9]*$/.test($.trim($("#exercise_time").val()))) {
|
||||
alert("测验时长必须为非零开头的数字");
|
||||
notice_box("测验时长必须为非零开头的数字");
|
||||
} else if($.trim($("#exercise_publish_time").val()) !="" && ((Date.parse($("#exercise_publish_time").val())+(24*60*60-1)*1000) < Date.now())) {
|
||||
alert("发布时间不能小于当前时间");
|
||||
notice_box("发布时间不能小于当前时间");
|
||||
} else if($.trim($("#exercise_publish_time").val()) !="" && Date.parse($("#exercise_end_time").val()) < Date.parse($("#exercise_publish_time").val())) {
|
||||
alert("截止时间不能小于发布时间");
|
||||
notice_box("截止时间不能小于发布时间");
|
||||
} else {
|
||||
doc.parent().parent().parent().submit();
|
||||
}
|
||||
|
@ -168,26 +168,61 @@
|
|||
$("#edit_poll_questions_"+question_id).show();
|
||||
$("#poll_questions_title_"+question_id).focus();
|
||||
}
|
||||
//单选题
|
||||
function add_single_answer(doc)
|
||||
{
|
||||
var li = doc.parent().after("<li class='ur_item'><label name='select_items' class='w60'>选项 <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>");
|
||||
var select_items =$("label[name='select_items']",li.parent());
|
||||
for(var i=0; i<select_items.length; i++){
|
||||
$(select_items[i]).html("选项"+String.fromCharCode(64 + parseInt(i+1))+"<span class='ur_index'></span>: ");
|
||||
// 选项的选择
|
||||
function toggle_select(doc, type, id){
|
||||
if(doc.hasClass("question_choice_blue")){
|
||||
doc.removeClass("question_choice_blue").addClass("question_choice_white");
|
||||
if(type == "1"){
|
||||
$("#question_standard_answer_" + id).html("请点击选项");
|
||||
$("#exercise_choice_" + id).val("");
|
||||
}else{
|
||||
var eles = doc.parent().parent().find("a.question_choice_blue");
|
||||
var str = "";
|
||||
if(eles.length > 0){
|
||||
for(var i=0; i<eles.length; i++){
|
||||
str += $(eles[i]).html();
|
||||
}
|
||||
$("#question_standard_answer_" + id).html(str);
|
||||
$("#exercise_choice_" + id).val(str);
|
||||
} else{
|
||||
$("#question_standard_answer_" + id).html("请点击选项");
|
||||
$("#exercise_choice_" + id).val("");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(type == "1"){
|
||||
doc.parent().parent().find("a.question_choice_blue").removeClass("question_choice_blue").addClass("question_choice_white");
|
||||
doc.removeClass("question_choice_white").addClass("question_choice_blue");
|
||||
$("#question_standard_answer_" + id).html(doc.html());
|
||||
$("#exercise_choice_" + id).val(doc.html());
|
||||
} else{
|
||||
doc.removeClass("question_choice_white").addClass("question_choice_blue");
|
||||
var eles = doc.parent().parent().find("a.question_choice_blue");
|
||||
var str = "";
|
||||
for(var i=0; i<eles.length; i++){
|
||||
str += $(eles[i]).html();
|
||||
}
|
||||
$("#question_standard_answer_" + id).html(str);
|
||||
$("#exercise_choice_" + id).val(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
//单选题
|
||||
function add_single_answer(doc, type)
|
||||
{
|
||||
var li = doc.parent().before("<li class='ur_item new_answer'><a class='question_choice_white fl mr10 choice_btn' title='设为答案' href='javascript:void(0)' onclick='toggle_select($(this), "+ type +", "+ type +");'></a><input maxlength='200' class='w600' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
|
||||
"</li><div class='cl'></div>");
|
||||
var select_items =$("li.new_answer",li.parent());
|
||||
li.prev().prev().find("a.question_choice_white").html(String.fromCharCode(64 + select_items.length));
|
||||
doc.prev("a.question_choice_dash").html(String.fromCharCode(64 + select_items.length + 1));
|
||||
}
|
||||
function add_candidate_answer(doc)
|
||||
{
|
||||
doc.parent().after("<li class='ur_item'><label name='candiate_items'>候选答案<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>"+
|
||||
var select_items =$("li.new_answer",doc.parent().parent());
|
||||
var li = doc.parent().before("<li class='ur_item new_answer'><label name='candiate_items'>参考答案"+ revert_to_chinese_num(select_items.length + 1) +"<span class='ur_index'></span>: </label><input maxlength='200' class='candiate_answer w560' type='text' name='exercise_choice["+new Date().getTime()+"]' placeholder='请输入参考答案(选填)'/>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
|
||||
"</li><div class='cl'></div>");
|
||||
var select_items =$("label[name='candiate_items']",doc.parent().parent());
|
||||
for(var i=0; i<select_items.length; i++){
|
||||
$(select_items[i]).html("候选答案"+revert_to_chinese_num(i + 1)+"<span class='ur_index'></span>: ");
|
||||
}
|
||||
}
|
||||
function revert_to_chinese_num(num){
|
||||
var s_num = "";
|
||||
|
@ -208,19 +243,20 @@
|
|||
{
|
||||
if(doc.parent().siblings("li").length == 0)
|
||||
{
|
||||
alert("至少有一个选项或一个候选答案");
|
||||
notice_box("至少有一个选项或一个参考答案");
|
||||
}
|
||||
else
|
||||
{
|
||||
var parent = doc.parent().parent();
|
||||
doc.parent().remove();
|
||||
var select_items =$("label[name='select_items']",parent);
|
||||
|
||||
var select_items =$("li.ur_item",parent);
|
||||
var candiate_items =$("label[name='candiate_items']",parent);
|
||||
for(var i=0; i<select_items.length; i++){
|
||||
$(select_items[i]).html("选项"+String.fromCharCode(64 + parseInt(i+1))+"<span class='ur_index'></span>: ");
|
||||
$(select_items[i]).find("a.choice_btn").html(String.fromCharCode(64 + parseInt(i+1)));
|
||||
}
|
||||
for(var i=0; i<candiate_items.length; i++){
|
||||
$(candiate_items[i]).html("候选答案"+revert_to_chinese_num(i + 1)+"<span class='ur_index'></span>: ");
|
||||
$(candiate_items[i]).html("参考答案"+revert_to_chinese_num(i + 1)+"<span class='ur_index'></span>: ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -234,9 +270,7 @@
|
|||
<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} %>
|
||||
|
@ -251,6 +285,11 @@
|
|||
<div id="new_poll_question">
|
||||
</div>
|
||||
|
||||
<% current_score = get_current_score @exercise %>
|
||||
<div id="total_questions_score" style="display: <%= @exercise.exercise_questions.count != 0 ? '' : 'none' %>">
|
||||
<%= render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score} %>
|
||||
</div>
|
||||
|
||||
<div id="exercise_submit">
|
||||
<%= render :partial => 'exercise_submit', :locals => {:exercise => @exercise} %>
|
||||
</div>
|
||||
|
|
|
@ -57,26 +57,40 @@
|
|||
<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>
|
||||
<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%></pre>
|
||||
<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 %>
|
||||
|
||||
<% current_score = get_current_score exercise %>
|
||||
<div id="total_questions_score" style="display: <%= exercise.exercise_questions.count != 0 ? '' : 'none' %>">
|
||||
<%= render :partial => 'exercise/total_questions_score', :locals => {:exercise => exercise, :current_score => current_score} %>
|
||||
</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") %>
|
||||
<% multi_question_list = exercise.exercise_questions.where("question_type=4") %>
|
||||
<% if exercise.question_random == 1 %>
|
||||
<% mc_question_list = mc_question_list.shuffle %>
|
||||
<% mcq_question_list = mcq_question_list.shuffle %>
|
||||
<% single_question_list = single_question_list.shuffle %>
|
||||
<% multi_question_list =multi_question_list.shuffle %>
|
||||
<% end %>
|
||||
<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 id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == mc_question_list.count ? '' : 'border_b' %>">
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
<div class="exercise_title">
|
||||
第<%= 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;">
|
||||
<div class="exercise_inputs">
|
||||
<table class="" style="width:100%;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<% exercise_choices = exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %>
|
||||
<% exercise_choices.each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
|
@ -95,6 +109,7 @@
|
|||
if(dataObj.text == "ok")
|
||||
{
|
||||
obj.checked = true;
|
||||
$("#question_answer_span_<%= exercise_question.id %>").addClass("bg_blue");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -102,7 +117,7 @@
|
|||
}
|
||||
},
|
||||
error: function () {
|
||||
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
||||
long_notice_box("网络异常,答题失败,请确认网络正常连接后再答题。");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -125,15 +140,17 @@
|
|||
<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 id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == mcq_question_list.count ? '' : 'border_b' %>">
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
<div class="exercise_title">
|
||||
第<%= 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;">
|
||||
<div class="exercise_inputs">
|
||||
<table class="" style="width:100%;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<% exercise_choices = exercise.choice_random == 1 ? exercise_question.exercise_choices.shuffle : exercise_question.exercise_choices.reorder("choice_position") %>
|
||||
<% exercise_choices.each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
|
@ -157,9 +174,17 @@
|
|||
{
|
||||
obj.checked = false;
|
||||
}
|
||||
if(dataObj.is_answer)
|
||||
{
|
||||
$("#question_answer_span_<%= exercise_question.id %>").addClass("bg_blue");
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#question_answer_span_<%= exercise_question.id %>").removeClass("bg_blue");
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
||||
long_notice_box("网络异常,答题失败,请确认网络正常连接后再答题。");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -182,9 +207,10 @@
|
|||
<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 id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == single_question_list.count ? '' : 'border_b' %>">
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
<div class="exercise_title">
|
||||
第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
|
@ -196,18 +222,22 @@
|
|||
type: "post",
|
||||
url: "<%= commit_answer_exercise_path(exercise) %>",
|
||||
data: {
|
||||
exercise_question_id: <%= exercise_question.id %> ,
|
||||
answer_text: obj.value
|
||||
exercise_question_id: <%= exercise_question.id %>,
|
||||
answer_text: $(obj).val().trim()
|
||||
},
|
||||
success: function (data) {
|
||||
var dataObj = eval(data);
|
||||
obj.value = dataObj.text;
|
||||
if(dataObj.text != ""){
|
||||
$("#question_answer_span_<%= exercise_question.id %>").addClass("bg_blue");
|
||||
} else{
|
||||
$("#question_answer_span_<%= exercise_question.id %>").removeClass("bg_blue");
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
alert("网络异常,答题失败,请确认网络正常连接后再答题。");
|
||||
long_notice_box("网络异常,答题失败,请确认网络正常连接后再答题。");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</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" %>>
|
||||
|
@ -217,16 +247,122 @@
|
|||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="ur_buttons">
|
||||
<% if exercise.time == -1 %>
|
||||
<%= link_to "保存",commit_exercise_exercise_path(exercise,:save => 1),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:format => 'js',:remote=>true %>
|
||||
<%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:20px;",:format => 'js',:remote=>true %>
|
||||
<% else %>
|
||||
<%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:84px;",:format => 'js',:remote=>true %>
|
||||
<div class="testStatus" id="multi_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">问答题</h3>
|
||||
<% multi_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 %>" class="<%= (list_index + 1) == multi_question_list.count ? '' : 'border_b' %>">
|
||||
<div>
|
||||
<div class="exercise_title">
|
||||
第<%= 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).val().trim()
|
||||
},
|
||||
success: function (data) {
|
||||
var dataObj = eval(data);
|
||||
obj.text = dataObj.text;
|
||||
if(dataObj.text != ""){
|
||||
$("#question_answer_span_<%= exercise_question.id %>").addClass("bg_blue");
|
||||
} else{
|
||||
$("#question_answer_span_<%= exercise_question.id %>").removeClass("bg_blue");
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
long_notice_box("网络异常,答题失败,请确认网络正常连接后再答题。");
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<textarea style="width: 693px; height: 90px; line-height: 30px; border: 1px solid #CBCBCB;" name="exercise_choice" placeholder="在此填入答案" onblur="onblur_<%= exercise_question.id %>(this);" <%= @can_edit_excercise?"":"disabled=disabled" %>><%= get_anwser_vote_text(exercise_question.id,User.current.id).html_safe %></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="testStatus">
|
||||
<p class="f14 fontGrey3">答题情况</p>
|
||||
<div class="mt5">
|
||||
<span class="f14 mr10 fl">单选题:</span>
|
||||
<% mc_question_list.each_with_index do |exercise_question, list_index| %>
|
||||
<span id="question_answer_span_<%= exercise_question.id %>" class="fl mr10 question_answer_span <%= User.current.exercise_answer.where(:exercise_question_id => exercise_question.id).count > 0 ? 'bg_blue' : '' %>"><%= list_index + 1 %></span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
<span class="f14 mr10 fl">多选题:</span>
|
||||
<% mcq_question_list.each_with_index do |exercise_question, list_index| %>
|
||||
<span id="question_answer_span_<%= exercise_question.id %>" class="fl mr10 question_answer_span <%= User.current.exercise_answer.where(:exercise_question_id => exercise_question.id).count > 0 ? 'bg_blue' : '' %>"><%= list_index + 1 %></span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
<span class="f14 mr10 fl">填空题:</span>
|
||||
<% single_question_list.each_with_index do |exercise_question, list_index| %>
|
||||
<span id="question_answer_span_<%= exercise_question.id %>" class="fl mr10 question_answer_span <%= User.current.exercise_answer.where(:exercise_question_id => exercise_question.id).count > 0 ? 'bg_blue' : '' %>"><%= list_index + 1 %></span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="mt5">
|
||||
<span class="f14 mr10 fl">问答题:</span>
|
||||
<% multi_question_list.each_with_index do |exercise_question, list_index| %>
|
||||
<span id="question_answer_span_<%= exercise_question.id %>" class="fl mr10 question_answer_span <%= User.current.exercise_answer.where(:exercise_question_id => exercise_question.id).count > 0 ? 'bg_blue' : '' %>"><%= list_index + 1 %></span>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ur_buttons">
|
||||
<a href="javascript:void(0)" onclick="commit_exercise_f();" class="btn_blue_64_width" style="margin-left:105px;">马上提交</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<!--contentbox end-->
|
||||
</div>
|
||||
<!--RSide end-->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function commit_exercise_f(){
|
||||
var str = "";
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "<%= get_student_uncomplete_question_exercise_path(exercise) %>",
|
||||
data: {},
|
||||
success: function (data) {
|
||||
var dataObj = eval(data);
|
||||
if(dataObj.time_limit){
|
||||
if(dataObj.uncomplete_count == 0){
|
||||
str = "截止日期前您还可以继续答题<br/>是否确定提交";
|
||||
} else{
|
||||
str = "您还有 " + dataObj.uncomplete_count + " 题没有完成,截止日期前您还可以继续答题<br/>是否确定提交";
|
||||
}
|
||||
} else{
|
||||
if(dataObj.uncomplete_count == 0){
|
||||
str = "提交后将不能继续答题<br/>是否确定提交";
|
||||
} else{
|
||||
str = "您还有 " + dataObj.uncomplete_count + " 题没有完成,提交后将不能继续答题<br/>是否确定提交";
|
||||
}
|
||||
}
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:380px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14 fontGrey7">' + str + '</p><div class="cl"></div><a href="<%= commit_exercise_exercise_path(exercise) %>" class="fr sy_btn_blue mt20" data-remote="true" style="margin-right: 132px;">确定</a>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt20 mr10" onclick="hideModal();">取消</a></div></div>';
|
||||
pop_box_new(htmlvalue, 380, 140);
|
||||
},
|
||||
error: function () {
|
||||
long_notice_box("网络异常,提交失败,请确认网络正常连接后再提交。");
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -8,7 +8,7 @@
|
|||
<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>
|
||||
<h1 class="ur_page_title text_c" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||
<div class="fontGrey2">
|
||||
<span class="mr100">开始时间:<%=Time.parse(h(exercise_user.start_at)).strftime("%Y-%m-%d %H:%M:%S") %></span>
|
||||
<span class="mr100">截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S")%></span>
|
||||
|
@ -17,39 +17,48 @@
|
|||
<% end %>
|
||||
<%# time = exercise_user.end_at - exercise_user.start_at %>
|
||||
</div>
|
||||
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||
<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%></pre>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="fl mb5">得分:<span class="c_red"><%=exercise_user.score %>分</span></div>
|
||||
<div class="fl mb5">得分:<span class="c_red" id="exercise_user_score"><%=exercise_user.score %></span>分</div>
|
||||
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,exercise.course) || (exercise.exercise_status == 3 && exercise.show_result == 1) %>
|
||||
<%= link_to '返回统计列表>>',student_exercise_list_exercise_path(exercise.id,:course_id => exercise.course.id) , :class => "fr linkBlue" %>
|
||||
<%= link_to '返回统计结果>>',student_exercise_list_exercise_path(exercise.id,:course_id => exercise.course.id) , :class => "fr linkBlue" %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></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") %>
|
||||
<% multi_question_list = exercise.exercise_questions.where("question_type=4") %>
|
||||
|
||||
<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 id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == mc_question_list.count ? '' : 'border_b' %>">
|
||||
<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)%>
|
||||
<% standard_answer = get_user_standard_answer(exercise_question, user)%>
|
||||
<% if !answer.empty? && !standard_answer.empty? && 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) if exercise_question.exercise_standard_answers.first %>
|
||||
<div class="exercise_title">
|
||||
<div>
|
||||
<span class="fl lh27">第<%= exercise_question.question_number%>题. <%= exercise_question.question_score %>分
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
|
||||
<div class="fr" id="menu_div_<%= exercise_question.id %>">
|
||||
<% answer = get_user_answer(exercise_question, user)%>
|
||||
<% standard_answer = get_user_standard_answer(exercise_question, user)%>
|
||||
<% is_correct = !answer.empty? && !standard_answer.empty? && answer.first.exercise_choice.choice_position == standard_answer.first.exercise_choice_id %>
|
||||
<div class="fr">
|
||||
得分:<div class="c_red fr mr10 ml10"><%= is_correct ? exercise_question.question_score : 0 %></div>
|
||||
</div>
|
||||
<span class="fr mt-4 f16 mr20"><i class="<%= is_correct ? 'icon-ok c_green' : 'icon-remove c_red' %>"></i></span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<div class="exercise_inputs">
|
||||
<table class="" style="width:100%;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
|
@ -69,26 +78,34 @@
|
|||
</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 id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == mc_question_list.count ? '' : 'border_b' %>">
|
||||
<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)%>
|
||||
<% standard_answer = get_user_standard_answer(exercise_question, user)%>
|
||||
<% if !standard_answer.empty? && get_mulscore(exercise_question, user).to_i == standard_answer.first.exercise_choice_id %>
|
||||
√
|
||||
<% else %>
|
||||
×
|
||||
<% end %></span><br />
|
||||
标准答案:<%= convert_to_char(standard_answer.first.exercise_choice_id.to_s) if !standard_answer.empty? %>
|
||||
<div class="exercise_title">
|
||||
<div>
|
||||
<span class="fl lh27">第<%= exercise_question.question_number%>题. <%= exercise_question.question_score %>分
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
|
||||
<div class="fr" id="menu_div_<%= exercise_question.id %>">
|
||||
<% answer = get_user_answer(exercise_question, user)%>
|
||||
<% standard_answer = get_user_standard_answer(exercise_question, user)%>
|
||||
<% is_correct = !standard_answer.empty? && get_mulscore(exercise_question, user).to_i == standard_answer.first.exercise_choice_id %>
|
||||
<div class="fr">
|
||||
得分:<div class="c_red fr mr10 ml10"><%= is_correct ? exercise_question.question_score : 0 %></div>
|
||||
</div>
|
||||
<span class="fr mt-4 f16 mr20"><i class="<%= is_correct ? 'icon-ok c_green' : 'icon-remove c_red' %>"></i></span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<div class="exercise_inputs">
|
||||
<table class="" style="width:100%;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
|
@ -108,26 +125,34 @@
|
|||
</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 id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == mc_question_list.count ? '' : 'border_b' %>">
|
||||
<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)%>
|
||||
<% standard_answer = get_user_standard_answer(exercise_question, user)%>
|
||||
<% if !answer.empty? && !standard_answer.empty? && standard_answer.include?(answer.first.answer_text) %>
|
||||
√
|
||||
<% else %>
|
||||
×
|
||||
<% end %></span>
|
||||
<div class="exercise_title">
|
||||
<div>
|
||||
<span class="fl lh27">第<%= exercise_question.question_number%>题. <%= exercise_question.question_score %>分</span>
|
||||
<div class="fr" id="menu_div_<%= exercise_question.id %>">
|
||||
<% answer = get_user_answer(exercise_question, user)%>
|
||||
<% standard_answer = get_user_standard_answer(exercise_question, user)%>
|
||||
<% is_correct = !answer.empty? && !standard_answer.empty? && standard_answer.include?(answer.first.answer_text) %>
|
||||
<div class="fr">
|
||||
得分:<div class="c_red fr mr10 ml10"><%= is_correct ? exercise_question.question_score : 0 %></div>
|
||||
</div>
|
||||
<span class="fr mt-4 f16 mr20"><i class="<%= is_correct ? 'icon-ok c_green' : 'icon-remove c_red' %>"></i></span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
|
||||
</div>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<div class="mb10">
|
||||
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
|
||||
候选答案:<%= exercise_choice.answer_text%><br />
|
||||
参考答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%><br />
|
||||
<% end %>
|
||||
</div>
|
||||
<div>
|
||||
|
@ -138,8 +163,94 @@
|
|||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="testStatus" id="multi_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">问答题</h3>
|
||||
<% multi_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 %>" class="<%= (list_index + 1) == multi_question_list.count ? '' : 'border_b' %>">
|
||||
<div>
|
||||
<div class="exercise_title">
|
||||
<div>
|
||||
<span class="fl lh27">第<%= exercise_question.question_number%>题. <%= exercise_question.question_score %>分</span>
|
||||
<div class="fr" id="menu_div_<%= exercise_question.id %>">
|
||||
<% answer = get_user_answer(exercise_question, user)%>
|
||||
<div class="fr">
|
||||
<% if User.current.admin? || User.current.allowed_to?(:as_teacher,exercise.course) %>
|
||||
得分:
|
||||
<% if answer.empty? %>
|
||||
<div id="exercise_question_score_<%= exercise_question.id %>" title="未答题系统自动打0分" class="c_red fr mr10 ml10">
|
||||
0
|
||||
</div>
|
||||
<% else %>
|
||||
<div id="exercise_question_score_<%= exercise_question.id %>" title="双击批阅" ondblclick="edit_question_score('<%= exercise_question.id %>', <%= exercise_question.question_score %>, <%= exercise_user.user_id %>)" class="c_red fr mr10 ml10">
|
||||
<%= answer.first.score == -1 ? "双击批阅" : answer.first.score %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
得分:<div class="c_red fr mr10 ml10"><%= answer.empty? ? 0 : (answer.first.score == -1 ? "未批" : answer.first.score) %></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if exercise_question.exercise_standard_answers.count > 0 %>
|
||||
<div class="mb10">
|
||||
参考答案:<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= exercise_question.exercise_standard_answers.first.answer_text%></pre>
|
||||
</div>
|
||||
<% end %>
|
||||
<div>
|
||||
<textarea style="width: 693px; height: 90px; line-height: 30px; border: 1px solid #CBCBCB; color: #888888;" name="exercise_choice" placeholder="在此填入答案" <%= @can_edit_excercise?"":"disabled=disabled" %>><%= get_anwser_vote_text(exercise_question.id,exercise_user.user_id).html_safe %></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<!--contentbox end-->
|
||||
</div>
|
||||
<!--RSide end-->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// 在线测验的主观题打分
|
||||
function edit_question_score(id, score, user_id){
|
||||
$("#exercise_question_score_"+id).html("<input type='text' id='edit_score_input' onblur='edit_question_score_submit(this, "+ id +", "+ score +", "+ user_id +")' class='score_input' placeholder='0-"+ score +"'></input>");
|
||||
}
|
||||
|
||||
function edit_question_score_submit(obj, id, score, user_id){
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "<%= edit_question_score_exercise_path(exercise) %>",
|
||||
data: {
|
||||
exercise_question_id: id,
|
||||
user_id: user_id,
|
||||
score: $(obj).val().trim()
|
||||
},
|
||||
success: function (data) {
|
||||
var dataObj = eval(data);
|
||||
if(dataObj.status == 2){
|
||||
$("#ajax_notice_p").html("请输入0-"+score);
|
||||
$("#ajax-notice").css('top', $(window).scrollTop()+200);
|
||||
$("#ajax-notice").show();
|
||||
} else if(dataObj.status == 1){
|
||||
$("#exercise_question_score_"+id).html(dataObj.score);
|
||||
$("#exercise_user_score").html(dataObj.total_score);
|
||||
$("#ajax_notice_p").html("分数已保存");
|
||||
$("#ajax-notice").css('top', $(window).scrollTop()+200);
|
||||
$("#ajax-notice").show();
|
||||
}
|
||||
setTimeout(function(){
|
||||
$("#ajax-notice").hide();
|
||||
},2000);
|
||||
},
|
||||
error: function () {
|
||||
long_notice_box("网路异常,请重新批阅。");
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -1,40 +1,33 @@
|
|||
<%= 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 class="ur_buttons" style="width: 143px;">
|
||||
<a class="btn_blue_64_width mr10" onclick="exercise_submit();">保存</a>
|
||||
<a class="btn_blue_64_width" onclick="exercise_save();">立即发布</a>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<script type="text/javascript">
|
||||
function poll_submit() {
|
||||
function exercise_submit() {
|
||||
var question_form = $("form.new_exercise_question");
|
||||
if($("#polls_head_edit").is(":visible")){
|
||||
alert("请先保存测验标题及测验基本信息。");
|
||||
notice_box("请先保存测验标题及测验基本信息。");
|
||||
} else if($("#show_exercise_time").html().trim() == ""){
|
||||
notice_box("请先设置测验的截止时间");
|
||||
}
|
||||
else if(question_form.length > 0) {
|
||||
alert("请先保存正在编辑的题目。");
|
||||
notice_box("请先保存正在编辑的题目。");
|
||||
} 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","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
window.location.href = '<%= exercise_url(@exercise) %>';
|
||||
}
|
||||
}
|
||||
function exercise_save() {
|
||||
var question_form = $("form.new_exercise_question");
|
||||
if($("#polls_head_edit").is(":visible")){
|
||||
notice_box("请先保存测验标题及测验基本信息。");
|
||||
} else if($("#show_exercise_time").html().trim() == ""){
|
||||
notice_box("请先设置测验的截止时间");
|
||||
}
|
||||
else if(question_form.length > 0) {
|
||||
notice_box("请先保存正在编辑的题目。");
|
||||
} else{
|
||||
$.get('<%= publish_exercise_exercise_path(@exercise) %>');
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -20,25 +20,30 @@
|
|||
<span class="fr">测验时长:<%=exercise.time %>分钟</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||
<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%></pre>
|
||||
<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") %>
|
||||
<% multi_question_list = exercise.exercise_questions.where("question_type=4") %>
|
||||
<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 id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == mc_question_list.count ? '' : 'border_b' %>">
|
||||
<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) if exercise_question.exercise_standard_answers.first %>
|
||||
<div class="exercise_title">
|
||||
<div>
|
||||
<span class="fl lh27">第<%= exercise_question.question_number%>题. <%= exercise_question.question_score %>分
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<div class="exercise_inputs">
|
||||
<table class="" style="width:100%;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
|
@ -62,15 +67,19 @@
|
|||
<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 id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == mcq_question_list.count ? '' : 'border_b' %>">
|
||||
<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) if exercise_question.exercise_standard_answers.first%>
|
||||
<div class="exercise_title">
|
||||
<div>
|
||||
<span class="fl lh27">第<%= exercise_question.question_number%>题. <%= exercise_question.question_score %>分
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<div class="exercise_inputs">
|
||||
<table class="" style="width:100%;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
|
@ -94,14 +103,19 @@
|
|||
<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 id="show_poll_questions_<%= exercise_question.id %>" class="<%= (list_index + 1) == single_question_list.count ? '' : 'border_b' %>">
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
<div class="exercise_title">
|
||||
<div>
|
||||
<span class="fl lh27">第<%= exercise_question.question_number%>题. <%= exercise_question.question_score %>分</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
|
||||
</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 />
|
||||
参考答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%><br />
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -109,13 +123,43 @@
|
|||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="ur_buttons">
|
||||
<%= link_to "确定",exercise_index_path(:course_id => @course.id),:class => "ur_button_submit" %>
|
||||
<div class="testStatus" id="multi_question_list" style="display: <%=multi_question_list.count > 0 ? "" : "none" %>">
|
||||
<h3 class="fontGrey3">问答题</h3>
|
||||
<% multi_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 %>" class="<%= (list_index + 1) == multi_question_list.count ? '' : 'border_b' %>">
|
||||
<div>
|
||||
<div class="exercise_title">
|
||||
<div>
|
||||
<span class="fl lh27">第<%= exercise_question.question_number%>题. <%= exercise_question.question_score %>分</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% if exercise_question.exercise_standard_answers.count > 0 %>
|
||||
<div>
|
||||
参考答案:<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= exercise_question.exercise_standard_answers.first.answer_text%></pre>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% current_score = get_current_score exercise %>
|
||||
<div id="total_questions_score" style="display: <%= exercise.exercise_questions.count != 0 ? '' : 'none' %>">
|
||||
<%= render :partial => 'exercise/total_questions_score', :locals => {:exercise => exercise, :current_score => current_score} %>
|
||||
</div>
|
||||
|
||||
<div class="ur_buttons" style="width: 220px;">
|
||||
<%= link_to "返回", exercise_index_path(:course_id => @course.id),:class => "btn_grey_64_width" %>
|
||||
<a href="javascript:void(0)" onclick="send_exercise_to_course();" class="btn_green_64_width ml10 mr10">发送</a>
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "ur_button_submit", :style => "float:right"%>
|
||||
<%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "btn_blue_64_width" %>
|
||||
<% 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"%>
|
||||
<span class="btn_grey_64_width" title="测验已发布,不可再编辑">编辑</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -123,3 +167,10 @@
|
|||
</div>
|
||||
<!--RSide end-->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function send_exercise_to_course(){
|
||||
var htmlvalue = "<%= escape_javascript(render :partial => 'exercise/send_to_course', :locals => {:exercise => exercise}) %>";
|
||||
pop_box_new(htmlvalue, 450, 325);
|
||||
}
|
||||
</script>
|
|
@ -1,4 +1,4 @@
|
|||
<div class="polls_head" style="width:730px;">
|
||||
<div class="polls_head" style="width:730px;">
|
||||
<h2>所有试卷
|
||||
<span>(<%= @obj_count%>)</span>
|
||||
</h2>
|
||||
|
|
|
@ -3,59 +3,60 @@
|
|||
:url=>create_exercise_question_exercise_path(exercise.id),
|
||||
:remote=>true ) do |f| %>
|
||||
<div class="questionContainer">
|
||||
<div class="mb10 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:60px; text-align:center; padding-left:0px;">分
|
||||
<span class="fr c_red" style="width: 60px;" id="question_standard_answer_1">请点击选项</span>
|
||||
<span class="fr">标准答案:</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="ur_editor_title">
|
||||
<label class="questionLabel mt8">问题: </label>
|
||||
<input name="question_type" value="1" type="hidden">
|
||||
<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题题目" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
|
||||
<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
|
||||
</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>
|
||||
<div>
|
||||
<li class="ur_item">
|
||||
<label name='select_items' class='w60'>选项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 name='select_items' class='w60'>选项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 name='select_items' class='w60'>选项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 name='select_items' class='w60'>选项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>
|
||||
<input style="display: none;" name="exercise_choice" id="exercise_choice_1"/>
|
||||
<li class="ur_item new_answer">
|
||||
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">A</a>
|
||||
<input maxlength="200" class="w600" type='text' name='question_answer[0]' placeholder='输入选项内容'>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item new_answer">
|
||||
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">B</a>
|
||||
<input maxlength="200" class="w600" type='text' name='question_answer[1]' placeholder='输入选项内容'>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item new_answer">
|
||||
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">C</a>
|
||||
<input maxlength="200" class="w600" type='text' name='question_answer[2]' placeholder='输入选项内容'/>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item new_answer">
|
||||
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">D</a>
|
||||
<input maxlength="200" class="w600" type='text' name='question_answer[3]' placeholder='输入选项内容'/>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class='cl'></div>
|
||||
<li class="ur_item">
|
||||
<a class="question_choice_dash fl mr10 choice_btn">E</a>
|
||||
<div class="dash-block new-question w600" onclick='add_single_answer($(this), 1);'>新建选项</div>
|
||||
</li>
|
||||
<div class='cl'></div>
|
||||
</div>
|
||||
<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" id="add_new_question"> 保存 </a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||
<span class="fl c_red mt10">温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案</span>
|
||||
<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">保存</a>
|
||||
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -3,59 +3,59 @@
|
|||
:url=>create_exercise_question_exercise_path(exercise.id),
|
||||
:remote=>true ) do |f| %>
|
||||
<div class="questionContainer">
|
||||
<div class="mb10 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:60px; text-align:center; padding-left:0px;">分
|
||||
<span class="fr c_red" style="width: 60px;" id="question_standard_answer_2">请点击选项</span>
|
||||
<span class="fr">标准答案:</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="ur_editor_title">
|
||||
<label class="questionLabel mt8">问题: </label>
|
||||
<input name="question_type" value="2" type="hidden">
|
||||
<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题题目" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
|
||||
<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
|
||||
</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>
|
||||
<div>
|
||||
<li class="ur_item">
|
||||
<label name='select_items' class='w60'>选项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>
|
||||
<input style="display: none;" name="exercise_choice" id="exercise_choice_2"/>
|
||||
<li class="ur_item new_answer">
|
||||
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">A</a>
|
||||
<input maxlength="200" class="w600" type='text' name='question_answer[0]' placeholder='输入选项内容'>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item new_answer">
|
||||
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">B</a>
|
||||
<input maxlength="200" class="w600" type='text' name='question_answer[1]' placeholder='输入选项内容'>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item new_answer">
|
||||
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">C</a>
|
||||
<input maxlength="200" class="w600" type='text' name='question_answer[2]' placeholder='输入选项内容'>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item new_answer">
|
||||
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">D</a>
|
||||
<input maxlength="200" class="w600" type='text' name='question_answer[3]' placeholder='输入选项内容'>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label name='select_items' class='w60'>选项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 name='select_items' class='w60'>选项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 name='select_items' class='w60'>选项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>
|
||||
<a class="question_choice_dash fl mr10 choice_btn">E</a>
|
||||
<div class="dash-block new-question w600" onclick='add_single_answer($(this), 2);'>新建选项</div>
|
||||
</li>
|
||||
<div class='cl'></div>
|
||||
</div>
|
||||
<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" id="add_new_question"> 保存 </a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||
<span class="fl c_red mt10">温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案</span>
|
||||
<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">保存</a>
|
||||
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<%= form_for(ExerciseQuestion.new,
|
||||
:html => { :multipart => true },
|
||||
:url=>create_exercise_question_exercise_path(exercise.id),
|
||||
:remote=>true ) do |f| %>
|
||||
<div class="questionContainer">
|
||||
<div class="mb10 ur_item">
|
||||
<% score = exercise.exercise_questions.where("question_type=4").last.nil? ? "": exercise.exercise_questions.where("question_type=4").last.question_score %>
|
||||
<label class="ml25">分值<span class="ur_index"></span>: </label>
|
||||
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="ur_editor_title">
|
||||
<label class="questionLabel mt8 ml25">问题: </label>
|
||||
<input name="question_type" value="4" type="hidden">
|
||||
<textarea maxlength="250" style="width: 619px;" class="questionTitle" name="question_title" id="poll_questions_title" placeholder="请输入问答题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
|
||||
</div>
|
||||
<div class="ur_editor_content" id="new_multi">
|
||||
<div class="multi_input">
|
||||
<label name='candiate_items'>参考答案<span class="ur_index"></span>: </label>
|
||||
<textarea class="candiate_answer" style="width: 620px; height: 90px;" name="exercise_choice" placeholder="如有参考答案,请输入参考答案" type="text"></textarea>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<p class="fl c_red">温馨提示:[问答题]属于主观题需要人工评分,未作答的情况下系统将自动评零分<br><span class="ml60">参考答案作为人工评分时的参考</span></p>
|
||||
<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">保存</a>
|
||||
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#add_new_question").one('click', function(){
|
||||
add_poll_question($(this),4);
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -1,7 +1,8 @@
|
|||
<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>
|
||||
<li class="tab_item02 mr27"> <a title="单选题" class="tab_icon icon_radio" onclick="add_MC();"> 新建单选题 </a> </li>
|
||||
<li class="tab_item02 mr27"> <a title="多选题" class=" tab_icon icon_checkbox" onclick="add_MCQ();"> 新建多选题 </a> </li>
|
||||
<li class="tab_item02 mr27"> <a title="单行主观" class="tab_icon icon_text" onclick="add_single();"> 新建填空题 </a> </li>
|
||||
<li class="tab_item02 "> <a title="问答题" class="tab_icon icon_text" onclick="add_multi();"> 新建问答题 </a> </li>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
|
||||
|
@ -9,36 +10,48 @@
|
|||
function add_MC(){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if($("#polls_head_edit").is(":visible")){
|
||||
alert("请先保存测验标题及测验基本信息。");
|
||||
notice_box("请先保存测验标题及测验基本信息。");
|
||||
}else if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
notice_box("请先保存正在编辑的题目再新建。");
|
||||
} else{
|
||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>exercise}) %>");
|
||||
$("#poll_questions_title").focus();
|
||||
$("#question_score").focus();
|
||||
}
|
||||
}
|
||||
|
||||
function add_MCQ(){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if($("#polls_head_edit").is(":visible")){
|
||||
alert("请先保存测验标题及测验基本信息。");
|
||||
notice_box("请先保存测验标题及测验基本信息。");
|
||||
}else if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
notice_box("请先保存正在编辑的题目再新建。");
|
||||
} else{
|
||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>exercise}) %>");
|
||||
$("#poll_questions_title").focus();
|
||||
$("#question_score").focus();
|
||||
}
|
||||
}
|
||||
|
||||
function add_single(){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if($("#polls_head_edit").is(":visible")){
|
||||
alert("请先保存测验标题及测验基本信息。");
|
||||
notice_box("请先保存测验标题及测验基本信息。");
|
||||
}else if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
notice_box("请先保存正在编辑的题目再新建。");
|
||||
} else{
|
||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>exercise}) %>");
|
||||
$("#poll_questions_title").focus();
|
||||
$("#question_score").focus();
|
||||
}
|
||||
}
|
||||
|
||||
function add_multi(){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if($("#polls_head_edit").is(":visible")){
|
||||
notice_box("请先保存测验标题及测验基本信息。");
|
||||
}else if(forms.length > 0){
|
||||
notice_box("请先保存正在编辑的题目再新建。");
|
||||
} else{
|
||||
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_multi', :locals => {:exercise=>exercise}) %>");
|
||||
$("#question_score").focus();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,47 +3,50 @@
|
|||
:url=>create_exercise_question_exercise_path(exercise.id),
|
||||
:remote=>true ) do |f| %>
|
||||
<div class="questionContainer">
|
||||
<div class="mb10 ur_item">
|
||||
<% score = exercise.exercise_questions.where("question_type=3").last.nil? ? "": exercise.exercise_questions.where("question_type=3").last.question_score %>
|
||||
<label class="ml36">分值<span class="ur_index"></span>: </label>
|
||||
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="ur_editor_title">
|
||||
<label class="questionLabel mt8">问题: </label>
|
||||
<label class="questionLabel mt8 ml36">问题: </label>
|
||||
<input name="question_type" value="3" type="hidden">
|
||||
<textarea maxlength="250" class="questionTitle" name="question_title" id="poll_questions_title" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
|
||||
<textarea maxlength="250" style="width: 608px;" class="questionTitle" name="question_title" id="poll_questions_title" placeholder="请输入填空题的题干(注意:目前仅支持一个空)" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
|
||||
</div>
|
||||
<div class="ur_editor_content" id="new_single">
|
||||
<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>
|
||||
<div>
|
||||
<li class="ur_item">
|
||||
<label name='candiate_items'>候选答案一<span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer" name="exercise_choice[0]" placeholder="请输入候选答案" type="text">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
|
||||
<li class="ur_item new_answer">
|
||||
<label name='candiate_items'>参考答案一<span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer w560" name="exercise_choice[0]" placeholder="请输入参考答案" type="text">
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item new_answer">
|
||||
<label name='candiate_items'>参考答案二<span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer w560" name="exercise_choice[1]" placeholder="请输入参考答案(选填)" type="text">
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item new_answer">
|
||||
<label name='candiate_items'>参考答案三<span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer w560" name="exercise_choice[2]" placeholder="请输入参考答案(选填)" type="text">
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label name='candiate_items'>候选答案二<span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer" 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 name='candiate_items'>候选答案三<span class="ur_index"></span>: </label>
|
||||
<input class="candiate_answer" 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>
|
||||
<div class="dash-block new-question w560" style="margin-left: 82px;" onclick="add_candidate_answer($(this));">新建参考答案</div>
|
||||
</li>
|
||||
<div class='cl'></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question"> 保存 </a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||
<span class="fl c_red mt10">温馨提示:[填空题]属于客观题将由系统自动评分,请输入参考答案</span>
|
||||
<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">保存</a>
|
||||
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
</div>
|
||||
<div class="clear">
|
||||
<p class="none c_red" id="choose_exercise_notice"></p>
|
||||
<div class="clear fl mt10">
|
||||
<div class="clear mr15 mt10">
|
||||
<a href="javascript:void(0)" class="btn btn-blue fr" onclick="submit_import_form();">确定</a>
|
||||
<a href="javascript:void(0)" class="btn fr mr5" onclick="hideModal();">取消</a>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
<div style="width:450px;">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">发送</h3>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="muban_popup_con clear">
|
||||
<div class="clear mt15 ml30 mb10">
|
||||
<div class="alert alert-orange mb10" style="margin-right: 33px;">
|
||||
试卷将被发送到班级的在线测验
|
||||
</div>
|
||||
<div class="mb10 fl">
|
||||
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入班级ID或者名称搜索" style="height: 28px; border: 1px solid #d8d3d3; width: 380px;" />
|
||||
</div>
|
||||
<div>
|
||||
<%= form_tag send_to_course_exercise_path(exercise),:remote=>true,:id=>'course_list_form' do %>
|
||||
<div>
|
||||
<ul class="courseReferContainer" id="exercise_course_list" style="max-height: 170px;">
|
||||
<%= render :partial => 'exercise/exercise_course_list', :locals => {:courses => []} %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<p class="c_red mb10" id="choose_course_notice"></p>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class="fr sy_btn_blue" style="margin-right: 33px;" onclick="submit_course_form();">发送</a>
|
||||
<a href="javascript:void(0);" class="fr sy_btn_grey mr5" onclick="hideModal();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function submit_course_form(){
|
||||
var checkboxs = $("input[name='course_ids[]']:checked");
|
||||
if(checkboxs.length > 0) {
|
||||
$("#choose_course_notice").html("");
|
||||
$('#course_list_form').submit();
|
||||
hideModal();
|
||||
} else{
|
||||
$("#choose_course_notice").html("请至少选择一个班级");
|
||||
}
|
||||
}
|
||||
|
||||
var lastSearchCondition = '';
|
||||
var count = 0;
|
||||
function search_exs(e){
|
||||
if($(e.target).val().trim() == lastSearchCondition && lastSearchCondition != '')
|
||||
{
|
||||
return;
|
||||
}
|
||||
lastSearchCondition = $(e.target).val().trim();
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'exercise', :action => 'search_courses') %>'+'?name='+ e.target.value+'&course=<%=exercise.course_id %>',
|
||||
type:'get'
|
||||
});
|
||||
}
|
||||
|
||||
function throttle(method,context,e){
|
||||
clearTimeout(method.tId);
|
||||
method.tId=setTimeout(function(){
|
||||
method.call(context,e);
|
||||
},500);
|
||||
}
|
||||
|
||||
//查询项目
|
||||
$("input[name='search']").on('input', function (e) {
|
||||
throttle(search_exs,window,e);
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
$.ajax({
|
||||
url: '<%= url_for(:controller => 'exercise', :action => 'search_courses') %>'+'?course='+<%=exercise.course_id %>,
|
||||
type:'get'
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -1,17 +1,29 @@
|
|||
<div>
|
||||
<div class="testEditTitle">
|
||||
<div>第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)</div>
|
||||
<span class="formatContainer break_word" style="max-width:534px;"><%= exercise_question.question_title %></span>
|
||||
<span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span>
|
||||
<div onmouseover="$('#menu_div_<%= exercise_question.id %>').show();" onmouseout="$('#menu_div_<%= exercise_question.id %>').hide();">
|
||||
<div class="exercise_title">
|
||||
<div>
|
||||
<span class="fl lh27">第<%= exercise_question.question_number%>题. <%= exercise_question.question_score %>分
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
|
||||
<div class="fr none" id="menu_div_<%= exercise_question.id %>">
|
||||
<% type = exercise_question.question_type %>
|
||||
<% exercise = exercise_question.exercise %>
|
||||
<% count = exercise.exercise_questions.where(:question_type => type).count %>
|
||||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= exercise_question.id%>);"></a>
|
||||
<a href="javascript:void(0)" class="ur_icon_de" title="删除" onclick="delete_confirm_box('<%= delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :quest_num => exercise_question.question_number) %>', '确定要删除该题目吗?')"></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>
|
||||
<% if exercise_question.question_number < count %>
|
||||
<%= link_to('', {:controller => 'exercise', :action => 'update_question_num', :id => exercise.id, :ques_id => exercise_question.id, :opr => 'down'},:remote => true, :method => 'post', :class => "poll-down up_and_down", :title => '下移') %>
|
||||
<% end %>
|
||||
<% unless exercise_question.question_number == 1 %>
|
||||
<%= link_to('', {:controller => 'exercise', :action => 'update_question_num', :id => exercise.id, :ques_id => exercise_question.id, :opr => 'up'},:remote => true, :method => 'post', :class => "poll-up up_and_down", :title => '上移') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
|
||||
</div>
|
||||
|
||||
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :quest_num => exercise_question.question_number),
|
||||
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;">
|
||||
<div class="exercise_inputs">
|
||||
<table class="" style="width:100%;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
|
@ -30,71 +42,76 @@
|
|||
<!-- 新增问题 -->
|
||||
<div id="insert_new_poll_question_mc_<%=exercise_question.id%>">
|
||||
</div>
|
||||
<div class="cl"></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("请先保存正在编辑的题目再新建。");
|
||||
notice_box("请先保存正在编辑的题目再新建。");
|
||||
} 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="mb10 ur_item">'+
|
||||
'<label>分值<span class="ur_index"></span>: </label>'+
|
||||
'<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分'+
|
||||
'<span class="fr c_red" style="width: 60px;" id="question_standard_answer_1">请点击选项</span>'+
|
||||
'<span class="fr">标准答案:</span>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_title"> '+
|
||||
'<label>问题: </label>'+
|
||||
'<label class="questionLabel mt8">问题: </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"/>'+
|
||||
'<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题题目" type="text"></textarea>'+
|
||||
'<textarea name="question_title" style="width: 625px;" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题的题干" type="text"></textarea>'+
|
||||
'</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><div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label name="select_items" class="w60">选项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>'+
|
||||
'<div>'+
|
||||
'<input style="display: none;" name="exercise_choice" id="exercise_choice_1"/>'+
|
||||
'<li class="ur_item new_answer">'+
|
||||
'<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">A</a>'+
|
||||
'<input maxlength="200" class="w600" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label name="select_items" class="w60">选项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>'+
|
||||
'<li class="ur_item new_answer">'+
|
||||
'<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">B</a>'+
|
||||
'<input maxlength="200" class="w600" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label name="select_items" class="w60">选项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>'+
|
||||
'<li class="ur_item new_answer">'+
|
||||
'<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">C</a>'+
|
||||
'<input maxlength="200" class="w600" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item new_answer">'+
|
||||
'<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">D</a>'+
|
||||
'<input maxlength="200" class="w600" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label name="select_items" class="w60">选项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>'+
|
||||
'<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">'+
|
||||
'<a class="question_choice_dash fl mr10 choice_btn">E</a>'+
|
||||
'<div class="dash-block new-question w600" onclick="add_single_answer($(this), 1);">新建选项</div>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</ul>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_footer">'+
|
||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
|
||||
'<span class="fl c_red mt10">温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案</span>'+
|
||||
'<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">'+
|
||||
'保存'+
|
||||
'</a>'+
|
||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<%= l(:button_cancel)%>'+
|
||||
'</a>'+
|
||||
'</div>'+
|
||||
|
|
|
@ -1,16 +1,29 @@
|
|||
<div>
|
||||
<div class="testEditTitle">
|
||||
<div>第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)</div>
|
||||
<span class="formatContainer break_word" style="max-width:534px;"><%= exercise_question.question_title %></span>
|
||||
<span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span>
|
||||
<div onmouseover="$('#menu_div_<%= exercise_question.id %>').show();" onmouseout="$('#menu_div_<%= exercise_question.id %>').hide();">
|
||||
<div class="exercise_title">
|
||||
<div>
|
||||
<span class="fl lh27">第<%= exercise_question.question_number%>题. <%= exercise_question.question_score %>分
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %></span>
|
||||
<div class="fr none" id="menu_div_<%= exercise_question.id %>">
|
||||
<% type = exercise_question.question_type %>
|
||||
<% exercise = exercise_question.exercise %>
|
||||
<% count = exercise.exercise_questions.where(:question_type => type).count %>
|
||||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= exercise_question.id%>);"></a>
|
||||
<a href="javascript:void(0)" class="ur_icon_de" title="删除" onclick="delete_confirm_box('<%= delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :quest_num => exercise_question.question_number) %>', '确定要删除该题目吗?')"></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>
|
||||
<% if exercise_question.question_number < count %>
|
||||
<%= link_to('', {:controller => 'exercise', :action => 'update_question_num', :id => exercise.id, :ques_id => exercise_question.id, :opr => 'down'},:remote => true, :method => 'post', :class => "poll-down up_and_down", :title => '下移') %>
|
||||
<% end %>
|
||||
<% unless exercise_question.question_number == 1 %>
|
||||
<%= link_to('', {:controller => 'exercise', :action => 'update_question_num', :id => exercise.id, :ques_id => exercise_question.id, :opr => 'up'},:remote => true, :method => 'post', :class => "poll-up up_and_down", :title => '上移') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
|
||||
</div>
|
||||
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :quest_num => exercise_question.question_number),
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de",:title => "删除") %>
|
||||
<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;">
|
||||
|
||||
<div class="exercise_inputs">
|
||||
<table class="" style="width:100%;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
|
@ -35,65 +48,67 @@
|
|||
var forms = $("form.new_exercise_question");
|
||||
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == ""){
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
notice_box("请先保存正在编辑的题目再新建。");
|
||||
} 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>'+
|
||||
'<div class="questionContainer" style="width: 680px;"> '+
|
||||
'<div class="mb10 ur_item">'+
|
||||
'<label>分值<span class="ur_index"></span>: </label>'+
|
||||
'<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分'+
|
||||
'<span class="fr c_red" style="width: 60px;" id="question_standard_answer_2">请点击选项</span>'+
|
||||
'<span class="fr">标准答案:</span>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_title">'+
|
||||
'<label class="questionLabel mt8">问题: </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"/>'+
|
||||
'<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题题目" type="text"></textarea>'+
|
||||
'<textarea name="question_title" style="width: 625px;" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题的题干" type="text"></textarea>'+
|
||||
'</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><div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label name="select_items" class="w60">选项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>'+
|
||||
'<div>'+
|
||||
'<input style="display: none;" name="exercise_choice" id="exercise_choice_2"/>'+
|
||||
'<li class="ur_item new_answer">'+
|
||||
'<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">A</a>'+
|
||||
'<input maxlength="200" class="w600" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label name="select_items" class="w60">选项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>'+
|
||||
'<li class="ur_item new_answer">'+
|
||||
'<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">B</a>'+
|
||||
'<input maxlength="200" class="w600" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label name="select_items" class="w60">选项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>'+
|
||||
'<li class="ur_item new_answer">'+
|
||||
'<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">C</a>'+
|
||||
'<input maxlength="200" class="w600" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item new_answer">'+
|
||||
'<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">D</a>'+
|
||||
'<input maxlength="200" class="w600" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label name="select_items" class="w60">选项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>'+
|
||||
'<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">'+
|
||||
'<a class="question_choice_dash fl mr10 choice_btn">E</a>'+
|
||||
'<div class="dash-block new-question w600" onclick="add_single_answer($(this), 2);">新建选项</div>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</ul>'+
|
||||
'</div> </ul>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_footer">'+
|
||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
|
||||
'<span class="fl c_red mt10">温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案</span>'+
|
||||
'<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">'+
|
||||
'保存'+
|
||||
'</a>'+
|
||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<%= l(:button_cancel)%>'+
|
||||
'</a>'+
|
||||
'</div>'+
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="testStatus"><!--头部显示 start-->
|
||||
<a href="javascript:" class="testEdit" title="编辑" onclick="pollsEdit();"></a>
|
||||
<div class="testStatus" onmouseover="$('#poll_head_edit_pen').show();" onmouseout="$('#poll_head_edit_pen').hide();"><!--头部显示 start-->
|
||||
<a href="javascript:" class="testEdit" title="编辑" id="poll_head_edit_pen" onclick="pollsEdit();" style="top:0;display:none"></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">
|
||||
|
@ -12,5 +12,13 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%></pre>
|
||||
<div class="ur_editor_footer mt10">
|
||||
<input type="checkbox" name="question_random" disabled <%= exercise.question_random == 0 ? 'checked' : '' %> id="show_question_random">
|
||||
<label for="show_question_random" class="mr30">题目不随机打乱</label>
|
||||
<input type="checkbox" name="choice_random" disabled <%= exercise.choice_random == 0 ? 'checked' : '' %> id="show_question_random">
|
||||
<label for="show_question_random" class="mr30">选项不随机打乱</label>
|
||||
<input type="checkbox" name="show_result" disabled <%= exercise.show_result == 1 ? 'checked' : '' %> id="show_question_random">
|
||||
<label for="show_question_random">允许学生查看测验结果</label>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
|
@ -0,0 +1,91 @@
|
|||
<div onmouseover="$('#menu_div_<%= exercise_question.id %>').show();" onmouseout="$('#menu_div_<%= exercise_question.id %>').hide();">
|
||||
<div class="exercise_title">
|
||||
<div>
|
||||
<span class="fl lh27">第<%= exercise_question.question_number%>题. <%= exercise_question.question_score %>分</span>
|
||||
<div class="fr none" id="menu_div_<%= exercise_question.id %>">
|
||||
<% type = exercise_question.question_type %>
|
||||
<% exercise = exercise_question.exercise %>
|
||||
<% count = exercise.exercise_questions.where(:question_type => type).count %>
|
||||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= exercise_question.id%>);"></a>
|
||||
<a href="javascript:void(0)" class="ur_icon_de" title="删除" onclick="delete_confirm_box('<%= delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :quest_num => exercise_question.question_number) %>', '确定要删除该题目吗?')"></a>
|
||||
<a class='ur_icon_add' title='向下插入' id="add_multi_<%=exercise_question.id%>" onclick="dismiss('multi',<%=exercise_question.id%>);insert_MULTI('multi',<%=exercise_question.question_number%>,<%=exercise_question.id%>);"></a>
|
||||
<% if exercise_question.question_number < count %>
|
||||
<%= link_to('', {:controller => 'exercise', :action => 'update_question_num', :id => exercise.id, :ques_id => exercise_question.id, :opr => 'down'},:remote => true, :method => 'post', :class => "poll-down up_and_down", :title => '下移') %>
|
||||
<% end %>
|
||||
<% unless exercise_question.question_number == 1 %>
|
||||
<%= link_to('', {:controller => 'exercise', :action => 'update_question_num', :id => exercise.id, :ques_id => exercise_question.id, :opr => 'up'},:remote => true, :method => 'post', :class => "poll-up up_and_down", :title => '上移') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
|
||||
</div>
|
||||
|
||||
<% if exercise_question.exercise_standard_answers.count > 0 %>
|
||||
<div>
|
||||
参考答案:<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= exercise_question.exercise_standard_answers.first.answer_text%></pre>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<!-- 新增问题 -->
|
||||
<div id="insert_new_poll_question_multi_<%=exercise_question.id%>">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function insert_MULTI(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){
|
||||
notice_box("请先保存正在编辑的题目再新建。");
|
||||
} 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="mb10 ur_item">'+
|
||||
'<label class="ml25">分值<span class="ur_index"></span>: </label>'+
|
||||
'<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_title"> '+
|
||||
'<label class="questionLabel mt8 ml25">问题: </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="4"/>'+
|
||||
'<textarea maxlength="250" style="width: 600px;" name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入问答题的题干" type="text"></textarea>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_content" id="new_multi">'+
|
||||
'<div class="multi_input">'+
|
||||
'<label name="candiate_items">参考答案<span class="ur_index"></span>: </label>'+
|
||||
'<textarea class="candiate_answer" style="width: 600px; height: 90px;" name="exercise_choice" placeholder="如有参考答案,请输入参考答案" type="text"></textarea>'+
|
||||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_footer">'+
|
||||
'<p class="fl c_red">温馨提示:[问答题]属于主观题需要人工评分,未作答的情况下系统将自动评零分<br><span class="ml60">参考答案作为人工评分时的参考</span></p>'+
|
||||
'<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">'+
|
||||
'保存'+
|
||||
'</a>'+
|
||||
'<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<%= l(:button_cancel)%>'+
|
||||
'</a>'+
|
||||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<% end%>'
|
||||
);
|
||||
$("#poll_questions_title").focus();
|
||||
$("#add_new_question").one('click', function(){
|
||||
add_poll_question($(this),4);
|
||||
});
|
||||
$(".questionTitle").on("input",function(){
|
||||
$(this).height(30);
|
||||
var scrollVal = $(this)[0].scrollHeight;
|
||||
$(this).height(scrollVal);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,16 +1,29 @@
|
|||
<div>
|
||||
<div class="testEditTitle">
|
||||
<div>第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)</div>
|
||||
<span class="formatContainer break_word"><%= exercise_question.question_title %></span>
|
||||
<div onmouseover="$('#menu_div_<%= exercise_question.id %>').show();" onmouseout="$('#menu_div_<%= exercise_question.id %>').hide();">
|
||||
<div class="exercise_title">
|
||||
<div>
|
||||
<span class="fl lh27">第<%= exercise_question.question_number%>题. <%= exercise_question.question_score %>分</span>
|
||||
<div class="fr none" id="menu_div_<%= exercise_question.id %>">
|
||||
<% type = exercise_question.question_type %>
|
||||
<% exercise = exercise_question.exercise %>
|
||||
<% count = exercise.exercise_questions.where(:question_type => type).count %>
|
||||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= exercise_question.id%>);"></a>
|
||||
<a href="javascript:void(0)" class="ur_icon_de" title="删除" onclick="delete_confirm_box('<%= delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :quest_num => exercise_question.question_number) %>', '确定要删除该题目吗?')"></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>
|
||||
<% if exercise_question.question_number < count %>
|
||||
<%= link_to('', {:controller => 'exercise', :action => 'update_question_num', :id => exercise.id, :ques_id => exercise_question.id, :opr => 'down'},:remote => true, :method => 'post', :class => "poll-down up_and_down", :title => '下移') %>
|
||||
<% end %>
|
||||
<% unless exercise_question.question_number == 1 %>
|
||||
<%= link_to('', {:controller => 'exercise', :action => 'update_question_num', :id => exercise.id, :ques_id => exercise_question.id, :opr => 'up'},:remote => true, :method => 'post', :class => "poll-up up_and_down", :title => '上移') %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<p class="formatContainer break_word"><%= exercise_question.question_title %></p>
|
||||
</div>
|
||||
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :quest_num => exercise_question.question_number),
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de",:title => "删除") %>
|
||||
<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| %>
|
||||
候选答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%><br />
|
||||
参考答案<%= convert_to_chi_num(index+1) %>:<%= exercise_choice.answer_text%><br />
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -23,53 +36,59 @@
|
|||
var forms = $("form.new_exercise_question");
|
||||
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
notice_box("请先保存正在编辑的题目再新建。");
|
||||
} 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="questionContainer" style="width: 680px;"> '+
|
||||
'<div class="mb10 ur_item">'+
|
||||
'<label class="ml36">分值<span class="ur_index"></span>: </label>'+
|
||||
'<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_title"> '+
|
||||
'<label>问题: </label>'+
|
||||
'<label class="questionLabel mt8 ml36">问题: </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"/>'+
|
||||
'<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text"></textarea>'+
|
||||
'<textarea maxlength="250" style="width: 590px;" name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入填空题的题干(注意:目前仅支持一个空)" type="text"></textarea>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_content" id="new_single">'+
|
||||
'<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><div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label name="candiate_items">候选答案一<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer" type="text" name="exercise_choice[0]" placeholder="请输入候选答案"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<div>'+
|
||||
'<li class="ur_item new_answer">'+
|
||||
'<label name="candiate_items">参考答案一<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer w560" type="text" name="exercise_choice[0]" placeholder="请输入参考答案"/>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label name="candiate_items">候选答案二<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer" type="text" name="exercise_choice[1]" placeholder="请输入候选答案(选填)"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<li class="ur_item new_answer">'+
|
||||
'<label name="candiate_items">参考答案二<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer w560" type="text" name="exercise_choice[1]" placeholder="请输入参考答案(选填)"/>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label name="candiate_items">候选答案三<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer" type="text" name="exercise_choice[2]" placeholder="请输入候选答案(选填)"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<li class="ur_item new_answer">'+
|
||||
'<label name="candiate_items">参考答案三<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer w560" type="text" name="exercise_choice[2]" placeholder="请输入参考答案(选填)"/>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li></div>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<div class="dash-block new-question w560" style="margin-left: 82px;" onclick="add_candidate_answer($(this));">新建参考答案</div>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</ul>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_footer">'+
|
||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" id="add_new_question">'+
|
||||
'<span class="fl c_red mt10">温馨提示:[填空题]属于客观题将由系统自动评分,请输入参考答案</span>'+
|
||||
'<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">'+
|
||||
'保存'+
|
||||
'</a>'+
|
||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<%= l(:button_cancel)%>'+
|
||||
'</a>'+
|
||||
'</div>'+
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
<div class="fl" style="padding-bottom:10px; width:720px;">
|
||||
<div class="fl pr" style="padding-bottom:10px; width:720px;">
|
||||
<span class="c_dark f14 fb fl mr30">
|
||||
测验
|
||||
<font class="f12 c_red">
|
||||
(<%= @exercise_count%>人已交)
|
||||
(<%= @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">
|
||||
|
@ -18,6 +13,14 @@
|
|||
<%#= 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" onclick="show_or_hide_info();" style="display: none">[ 显示测验信息 ]</a> </span>
|
||||
|
||||
<div class="group_work_tip_box fontGrey2">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p class="mt5 mb5 break_word">客观题由系统自动评分:<br/>
|
||||
单选题、多选题、填空题<br/><br/>主观题需要人工评分,但未作答时系统<br/>自动评零分:<br/>问答题
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
|
|
|
@ -1,44 +1,45 @@
|
|||
<table class="hwork-table-wrap" style="border-bottom:1px solid #eaeaea;">
|
||||
<tr class="b_grey hworkH30">
|
||||
<th class="hworkList30 pl5 pr5"><span class="c_dark f14 fb">序号</span></th>
|
||||
<th class="hworkList40 pl5 pr5"><span class="c_dark f14 fb">序号</span></th>
|
||||
<th class="hworkList50"> </th>
|
||||
<th class="hworkList130"><span class="c_dark f14 fb">姓名</span></th>
|
||||
<th class="hworkList130"><span class="c_dark f14 fb">学号</span></th>
|
||||
<th class="hworkList130"><span class="c_dark f14 fb">班级</span></th>
|
||||
<th width="60"> </th>
|
||||
<th class="hworkList130">
|
||||
<%= link_to "时间",'',:class => "c_dark f14 fb" ,:remote => true%>
|
||||
</th>
|
||||
<th class="hworkList50">
|
||||
<th class="hworkList130"><span class="c_dark f14 fb">答题时间</span></th>
|
||||
<th class="hworkList80">客观题</th>
|
||||
<th class="hworkList80">主观题</th>
|
||||
<th class="hworkList80">
|
||||
<%= link_to "成绩",'',:class => "c_dark f14 fb",:remote => true%>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<% @exercise_users_list.each_with_index do |exercise, index|%>
|
||||
<tr class="hworkListRow" id="student_work_<%= exercise.id%>">
|
||||
<td class="pl5 pr5" style="text-align:center;"><%=index + 1 %></td>
|
||||
<tr class="hworkListRow" id="student_work_<%= exercise.id%>" style="cursor:pointer;">
|
||||
<td class="hworkList40 pl5 pr5" style="text-align:center; cursor: default;"><%=index + 1 %></td>
|
||||
<td class="hworkPortrait float-none">
|
||||
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40",:style => "display:block;", :class => "mt15"),user_activities_path(exercise.user)) %>
|
||||
</td>
|
||||
<td class="hworkStName130 pr10 student_work_<%= exercise.id%>" title="姓名" id="student_name_<%= exercise.id%>" style="cursor:pointer;">
|
||||
<td class="hworkStName130 pr10 student_work_<%= exercise.id%>" title="姓名" id="student_name_<%= exercise.id%>">
|
||||
<%=exercise.user.show_name %>
|
||||
</td>
|
||||
<td class="hworkStID130 pr10 student_work_<%= exercise.id%> float-none" title="学号" id="student_id_<%= exercise.id%>" style="cursor:pointer;">
|
||||
<td class="hworkStID130 pr10 student_work_<%= exercise.id%> float-none" title="学号" id="student_id_<%= exercise.id%>">
|
||||
<span class="hidden fl" style="width:130px;"><%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%></span>
|
||||
</td>
|
||||
<td class="hworkStID130 student_work_<%= exercise.id%> float-none" title="班级" id="student_class_<%= exercise.id%>" style="cursor:pointer;">
|
||||
--
|
||||
</td>
|
||||
<td width="60"> </td>
|
||||
<td class="hworkList130 c_grey">
|
||||
<% if exercise.created_at%>
|
||||
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>
|
||||
<% if exercise.commit_status == 0 %>
|
||||
<span class="c_red">[未答]</span>
|
||||
<td class="hworkList130 c_grey student_work_<%= exercise.id%>">
|
||||
<% if exercise.commit_status == 0 %>
|
||||
<span class="c_red">未答</span>
|
||||
<% else %>
|
||||
<% if exercise.created_at%>
|
||||
<%= format_time(exercise.created_at) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="hworkList50 <%= score_color exercise.score%> student_final_scor_info">
|
||||
<td class="hworkList80 <%= score_color exercise.objective_score %> student_work_<%= exercise.id%>">
|
||||
<%= exercise.objective_score == -1 ? "0.0" : format("%.1f",exercise.objective_score)%>
|
||||
</td>
|
||||
<td class="hworkList80 <%= score_color(exercise.subjective_score == -1 ? nil : exercise.subjective_score) %> student_work_<%= exercise.id%>">
|
||||
<%= exercise.subjective_score == -1 ? "未批" : format("%.1f",exercise.subjective_score)%>
|
||||
</td>
|
||||
<td class="hworkList80 <%= score_color exercise.score%> student_final_scor_info student_work_<%= exercise.id%>">
|
||||
<%= exercise.score.nil? ? "--" : format("%.1f",exercise.score)%>
|
||||
</td>
|
||||
<td><div style="position:relative;"><div class="hworkTip" style="display: none" id="work_click_<%= exercise.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div></div></td>
|
||||
|
@ -52,14 +53,14 @@
|
|||
}).mouseleave(function(){
|
||||
$("#work_click_<%= exercise.id%>").hide();
|
||||
}).mouse;
|
||||
$("#student_name_<%= exercise.id%>,#student_id_<%= exercise.id%>,#student_class_<%= exercise.id%>").on('click',function() {
|
||||
$(".student_work_<%= exercise.id%>").on('click',function() {
|
||||
window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user_id) %>';
|
||||
});
|
||||
<% else %>
|
||||
//$("#show_student_result_div_<%#= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
|
||||
$("#student_name_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
|
||||
$("#student_id_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
|
||||
$("#student_class_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
|
||||
$(".student_work_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
|
||||
//$("#student_id_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
|
||||
//$("#student_class_<%= exercise.id%>").attr("title","截止日期未到,暂不能查看学生答题结果");
|
||||
<% end %>
|
||||
});
|
||||
/*function show_result(id) {
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<div class="" style="display: <%= current_score[0] == 0 ? "none" : "" %>" id="current_score_div">
|
||||
<span class="mr20">单选题 <%= exercise.exercise_questions.where("question_type=1").count %> 题,共<%= current_score[1] %>分</span>
|
||||
<span class="mr20">多选题 <%= exercise.exercise_questions.where("question_type=2").count %> 题,共<%= current_score[2] %>分</span>
|
||||
<span class="mr20">填空题 <%= exercise.exercise_questions.where("question_type=3").count %> 题,共<%= current_score[3] %>分</span>
|
||||
<span class="mr20">问答题 <%= exercise.exercise_questions.where("question_type=4").count %> 题,共<%= current_score[4] %>分</span>
|
||||
<span class="fr">合计 <font class="c_red"><%= exercise.exercise_questions.count %></font> 题,共<font class="c_red"><%= current_score[0] %></font>分</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
|
@ -1,8 +1 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status,:exercise =>@exercise}) %>');
|
||||
showModal('ajax-modal', '270px');
|
||||
$('#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","").css("border","3px solid #269ac9");
|
||||
$('#ajax-modal').parent().addClass("alert_box");
|
||||
notice_box_redirect("<%= exercise_index_path(:course_id => @course.id) %>", "提交成功");
|
|
@ -1,13 +1,14 @@
|
|||
<% 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 %>分");
|
||||
<% current_score = get_current_score @exercise %>
|
||||
$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score}) %>");
|
||||
<% 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>div").last().children().first().addClass("border_b");
|
||||
$("#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}) %>" +
|
||||
|
@ -37,6 +38,17 @@
|
|||
"</div>" +
|
||||
"</div>");
|
||||
<% end %>
|
||||
$("#current_score_div").show();
|
||||
$("#current_score").html("<%=get_current_score @exercise %>分");
|
||||
<%if @exercise_questions.question_type == 4%>
|
||||
$("#multi_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @exercise_questions.id %>'>" +
|
||||
"<%= escape_javascript(render :partial => 'show_multi', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @exercise_questions.id %>' style='display: none;'>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_multi', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
<% end %>
|
||||
$("#total_questions_score").show();
|
||||
<% current_score = get_current_score @exercise %>
|
||||
$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score}) %>");
|
||||
<% end %>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
hideModal();
|
||||
$("#poll_content").html("<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise}) %>");
|
||||
$("#current_score").html("<%=get_current_score @exercise %>分");
|
||||
<% current_score = get_current_score @exercise %>
|
||||
$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score}) %>");
|
||||
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
|
|
@ -1,5 +1,6 @@
|
|||
<% if params[:index] %>
|
||||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>");
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>发布成功</p>' +
|
||||
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 152);
|
||||
notice_box("发布成功");
|
||||
<% else %>
|
||||
notice_box_redirect('<%= exercise_url(@exercise) %>', '发布成功');
|
||||
<% end %>
|
|
@ -0,0 +1 @@
|
|||
$("#exercise_course_list").html("<%= escape_javascript(render :partial => 'exercise/exercise_course_list', :locals => {:courses => @courses}) %>");
|
|
@ -0,0 +1,4 @@
|
|||
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">试卷已发送<br/>但需要您设置发布时间和截止时间,以激活相应的试卷</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt20 mr10" onclick="hideModal();" style="margin-right: 174px;">确定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 162);
|
|
@ -68,17 +68,8 @@
|
|||
</div>
|
||||
<!--div class="hworkInfor"><a href="javascript:void(0);" class="linkBlue">作业信息</a></div-->
|
||||
<% if @is_teacher%>
|
||||
<div class="fr mt5">
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected">
|
||||
<a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="hworkMenu">
|
||||
<li>
|
||||
<%= link_to "导出测验成绩", student_exercise_list_exercise_path(@exercise.id,:course_id => @course.id, :format => 'xls'),:class=>'hworkExport postTypeGrey', :id => "export_student_work"%>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="fr mt10 mr5">
|
||||
<%= link_to "导出成绩", student_exercise_list_exercise_path(@exercise.id,:course_id => @course.id, :format => 'xls'),:class=>'linkBlue', :id => "export_student_work"%>
|
||||
</div>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
|
@ -86,7 +77,7 @@
|
|||
|
||||
<div class="homeworkInfo mb10" id="homeworkInformation">
|
||||
<div class="">
|
||||
<div class="homepagePostTitle fl hidden m_w460" title="<%= @exercise.exercise_name %>"><%= @exercise.exercise_name %></div>
|
||||
<%= link_to @exercise.exercise_name, exercise_path(@exercise), :class => 'homepagePostTitle fl hidden m_w460', :title => "#{@exercise.exercise_name}", :target => '_blank' %>
|
||||
<% if @exercise.exercise_status == 1 %>
|
||||
<span class="grey_homework_btn_cir ml5">未发布</span>
|
||||
<% elsif @exercise.exercise_status == 2 %>
|
||||
|
@ -114,7 +105,7 @@
|
|||
<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>
|
||||
<div class="db fr c_red">提交已截止</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -5,6 +5,8 @@ $("#poll_questions_<%= @exercise_question.id%>").html("<div id='show_poll_questi
|
|||
"<%= 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}) %>" +
|
||||
"<% elsif @exercise_question.question_type == 4%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_multi', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @exercise_question.id %>' style='display: none;'>" +
|
||||
|
@ -14,7 +16,10 @@ $("#poll_questions_<%= @exercise_question.id%>").html("<div id='show_poll_questi
|
|||
"<%= 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}) %>" +
|
||||
"<% elsif @exercise_question.question_type == 4%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_multi', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>");
|
||||
$("#current_score").html("<%=get_current_score @exercise_question.exercise %>分");
|
||||
<% current_score = get_current_score @exercise %>
|
||||
$("#total_questions_score").html("<%= escape_javascript(render :partial => 'exercise/total_questions_score', :locals => {:exercise => @exercise, :current_score => current_score}) %>");
|
||||
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise_question.exercise}) %>");
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<% if @before_que %>
|
||||
$("#poll_questions_<%= @exercise_question.id%>").insertBefore($("#poll_questions_<%= @before_que.id%>"));
|
||||
<% if @before_que.question_type == 1%>
|
||||
$("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @before_que}) %>");
|
||||
<% elsif @before_que.question_type == 2%>
|
||||
$("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @before_que}) %>");
|
||||
<% elsif @before_que.question_type == 3%>
|
||||
$("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @before_que}) %>");
|
||||
<% elsif @before_que.question_type == 4%>
|
||||
$("#show_poll_questions_<%= @before_que.id %>").html("<%= escape_javascript(render :partial => 'show_mulit', :locals => {:exercise_question => @before_que}) %>");
|
||||
<% end%>
|
||||
<% elsif @after_que %>
|
||||
$("#poll_questions_<%= @exercise_question.id%>").insertAfter($("#poll_questions_<%= @after_que.id%>"));
|
||||
<% if @after_que.question_type == 1%>
|
||||
$("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @after_que}) %>");
|
||||
<% elsif @after_que.question_type == 2%>
|
||||
$("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @after_que}) %>");
|
||||
<% elsif @after_que.question_type == 3%>
|
||||
$("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @after_que}) %>");
|
||||
<% elsif @after_que.question_type == 4%>
|
||||
$("#show_poll_questions_<%= @after_que.id %>").html("<%= escape_javascript(render :partial => 'show_mulit', :locals => {:exercise_question => @after_que}) %>");
|
||||
<% end%>
|
||||
<% end %>
|
||||
<% if @exercise_question.question_type == 1%>
|
||||
$("#show_poll_questions_<%= @exercise_question.id %>").html("<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_question}) %>");
|
||||
<% elsif @exercise_question.question_type == 2%>
|
||||
$("#show_poll_questions_<%= @exercise_question.id %>").html("<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_question}) %>");
|
||||
<% elsif @exercise_question.question_type == 3%>
|
||||
$("#show_poll_questions_<%= @exercise_question.id %>").html("<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_question}) %>");
|
||||
<% elsif @exercise_question.question_type == 4%>
|
||||
$("#show_poll_questions_<%= @exercise_question.id %>").html("<%= escape_javascript(render :partial => 'show_mulit', :locals => {:exercise_question => @exercise_question}) %>");
|
||||
<% end%>
|
|
@ -19,7 +19,7 @@
|
|||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','css/syllabus', 'css/moduel','css/contest'%>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','css/syllabus', 'css/moduel','css/contest','css/font-awesome'%>
|
||||
<%= javascript_include_tag "course","avatars","header","attachments",'prettify' %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
|
@ -170,6 +170,9 @@
|
|||
<div id="ajax-indicator" style="display:none;">
|
||||
<span><%= l(:label_loading) %></span>
|
||||
</div>
|
||||
<div id="ajax-notice" style="display: none; text-align: center; bottom: 200px; left: 50%; margin-left: -70px; background: #a1a1a1; width: 140px; height: 80px; position: absolute; z-index: 999999;">
|
||||
<p id="ajax_notice_p" style="text-align: center; color: #fff; font-size: 18px; padding-top: 26px;">分数已保存</p>
|
||||
</div>
|
||||
<div id="ajax-modal" style="display:none;"></div>
|
||||
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
|
||||
<%=render :partial => 'layouts/upload_avatar', :locals => {:source => @course} %>
|
||||
|
|
|
@ -128,9 +128,11 @@
|
|||
<%= link_to("加入题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 1),:class => "wpostOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% elsif activity.is_update %>
|
||||
<li>
|
||||
<%= link_to("同步到题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 2),:class => "wpostOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% if activity.user == activity.homework_bank.user %>
|
||||
<li>
|
||||
<%= link_to("同步到题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 2),:class => "wpostOptionLink", :remote => true)%>
|
||||
</li>
|
||||
<% end %>
|
||||
<li>
|
||||
<%= link_to("另存到题库", add_to_homework_bank_homework_common_path(activity,:user_activity_id => user_activity_id, :hw_status => hw_status, :type => 3),:class => "wpostOptionLink", :remote => true)%>
|
||||
</li>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div id="sy_popup_box" style="width:380px;">
|
||||
<div class="sy_popup_top sy_popup_top_tishi">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">提示</h3>
|
||||
<a href="javascript:void(0);" class="sy_icons_close02 fr" onclick="hideModal()"></a>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr" onclick="hideModal()"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="sy_popup_con02" >
|
||||
|
|
|
@ -65,6 +65,10 @@
|
|||
分组人数:<%=@homework.min_num %> - <%=@homework.max_num %>人
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<div class="mt10" style="font-weight:normal;">
|
||||
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @homework} %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -167,7 +167,7 @@
|
|||
if($.trim($("#homework_end_time").val()) == ""){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14 fontGrey7">您还没有设置作业截止时间,因此学生不可见<br/>您是否确定</p><div class="cl"></div><a href="javascript:void(0)" class="fr sy_btn_blue mt10" style="margin-right: 92px;" onclick="submit_form()">确定</a>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="hideModal();">取消</a></div></div>';
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_grey mt10 mr10" onclick="first_click = true;hideModal();">取消</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
} else{
|
||||
$(this)[0].submit();
|
||||
|
@ -208,6 +208,9 @@
|
|||
edit.iframe.height(150);
|
||||
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) , 150));
|
||||
elocalStorage(homework_description_editor,'homework_<%=User.current.id %>');
|
||||
},
|
||||
afterFocus:function(){
|
||||
$(".xdsoft_datetimepicker").hide();
|
||||
}
|
||||
}).loadPlugin('paste');
|
||||
return editor;
|
||||
|
@ -326,7 +329,7 @@
|
|||
</label>
|
||||
</li>
|
||||
<% if !edit_mode %>
|
||||
<li class="f14 ml10 mb5" style="">
|
||||
<li class="f14 ml10 mb5" style="" id="join_bank_li">
|
||||
<input type="checkbox" value="1" name="add_to_bank" id="join_bank"/>
|
||||
<label for="join_bank" class="f14 c_grey">加入题库(同时将该作业保存到您的题库,可以随时复用)</label>
|
||||
</li>
|
||||
|
|
|
@ -21,3 +21,5 @@ homework_description_editor.html("<%= escape_javascript(@homework.description.ht
|
|||
document.getElementById("homework_type_option").options[<%=@homework.homework_type %>].selected = true;
|
||||
$("#select_type_nitice").hide();
|
||||
$("#homework_editor").show();
|
||||
$("#join_bank").attr("checked",false);
|
||||
$("#join_bank_li").hide();
|
|
@ -10,7 +10,7 @@
|
|||
<ul class="pro_newsetting_con fl">
|
||||
<li class="clear">
|
||||
<input type="checkbox" class="fl ml30" id="online_evaluation" name="online_evaluation" <%=homework.online_evaluation ? 'checked' : '' %> value="1"/>
|
||||
<label class="pop_box_label_l fl text_l ml10">启用在线评审 : </label>
|
||||
<label class="pop_box_label_l fl text_l ml10" for="online_evaluation">启用在线评审 : </label>
|
||||
<div class="cl"></div>
|
||||
<ul class="clear">
|
||||
<li class="clear mt10">
|
||||
|
@ -54,12 +54,12 @@
|
|||
<ul class="fl ml90">
|
||||
<li class="clear mb10">
|
||||
<input type="radio" class="fl" id="all_score_valid" value="1" name="score_valid"/>
|
||||
<label for="score_valid" class="fl ml5">全部评分有效</label>
|
||||
<label for="all_score_valid" class="fl ml5">全部评分有效</label>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<li class="clear">
|
||||
<input type="radio" class="fl" id="score_valid" value="0" name="score_valid"/>
|
||||
<label for="all_score_valid" class="fl ml5">最高分和最低分无效</label>
|
||||
<label for="score_valid" class="fl ml5">最高分和最低分无效</label>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -1908,7 +1908,11 @@ zh:
|
|||
excel_a_penalty: 缺评扣分
|
||||
excel_l_penalty: 迟交扣分
|
||||
excel_f_score: 成绩
|
||||
excel_objective_score: 客观成绩
|
||||
excel_subjective_score: 主观成绩
|
||||
excel_commit_time: 提交时间
|
||||
excel_answer_time: 答题时间
|
||||
excel_no_answer: 未答
|
||||
excel_homework_score: 作业积分
|
||||
excel_class: "班级:"
|
||||
excel_member_with_out_class: "未加入班级的学生"
|
||||
|
|
|
@ -291,15 +291,20 @@ RedmineApp::Application.routes.draw do
|
|||
get 'show_student_result'
|
||||
post 'create_exercise_question'
|
||||
post 'commit_answer'
|
||||
post 'commit_exercise'
|
||||
get 'commit_exercise'
|
||||
post 'update_question_num'
|
||||
post 'send_to_course'
|
||||
get 'get_student_uncomplete_question'
|
||||
post 'edit_question_score'
|
||||
end
|
||||
|
||||
collection do #生成路径为 /exercise/方法名
|
||||
delete 'delete_exercise_question'
|
||||
get 'delete_exercise_question'
|
||||
post 'update_exercise_question'
|
||||
get 'other_exercise'
|
||||
post 'import_other_exercise'
|
||||
get 'search_exercises'
|
||||
get 'search_courses'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
class AddColumnToExercises < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :exercises, :question_random, :integer, :default => 0
|
||||
add_column :exercises, :choice_random, :integer, :default => 0
|
||||
add_column :exercise_answers, :score, :integer, :default => -1
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
class AddAttachToHomeworkBank < ActiveRecord::Migration
|
||||
def change
|
||||
HomeworkBank.all.each do |homework_bank|
|
||||
homework = homework_bank.homework_common_id.nil? ? nil : HomeworkCommon.where(:id =>homework_bank.homework_common_id).first
|
||||
unless homework.nil?
|
||||
homework.attachments.each do |attachment|
|
||||
att = attachment.copy
|
||||
att.container_id = nil
|
||||
att.container_type = nil
|
||||
att.author_id = homework_bank.user_id
|
||||
att.copy_from = attachment.id
|
||||
att.save
|
||||
homework_bank.attachments << att
|
||||
homework_bank.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
class AddColumnToExercise < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :exercise_users, :objective_score, :integer, :default => -1
|
||||
add_column :exercise_users, :subjective_score, :integer, :default => -1
|
||||
|
||||
ExerciseUser.all.each do |eu|
|
||||
eu.update_column('objective_score', eu.score)
|
||||
end
|
||||
end
|
||||
end
|
147
db/schema.rb
147
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20170303030731) do
|
||||
ActiveRecord::Schema.define(:version => 20170210082105) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -350,16 +350,14 @@ ActiveRecord::Schema.define(:version => 20170303030731) do
|
|||
add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
|
||||
|
||||
create_table "changesets", :force => true do |t|
|
||||
t.integer "repository_id", :null => false
|
||||
t.string "revision", :null => false
|
||||
t.integer "repository_id", :null => false
|
||||
t.string "revision", :null => false
|
||||
t.string "committer"
|
||||
t.datetime "committed_on", :null => false
|
||||
t.datetime "committed_on", :null => false
|
||||
t.text "comments"
|
||||
t.date "commit_date"
|
||||
t.string "scmid"
|
||||
t.integer "user_id"
|
||||
t.integer "project_id"
|
||||
t.integer "type", :default => 0
|
||||
end
|
||||
|
||||
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
|
||||
|
@ -630,6 +628,20 @@ ActiveRecord::Schema.define(:version => 20170303030731) do
|
|||
t.integer "container_id", :default => 0
|
||||
end
|
||||
|
||||
create_table "course_class_post", :id => false, :force => true do |t|
|
||||
t.integer "班级id", :default => 0, :null => false
|
||||
t.string "班级名"
|
||||
t.integer "帖子id", :default => 0, :null => false
|
||||
t.integer "主贴id"
|
||||
t.string "帖子标题", :default => "", :null => false
|
||||
t.text "帖子内容"
|
||||
t.integer "帖子用户id"
|
||||
t.integer "帖子回复数", :default => 0, :null => false
|
||||
t.integer "最后回帖id"
|
||||
t.datetime "发帖时间", :null => false
|
||||
t.datetime "帖子更新时间", :null => false
|
||||
end
|
||||
|
||||
create_table "course_contributor_scores", :force => true do |t|
|
||||
t.integer "course_id"
|
||||
t.integer "user_id"
|
||||
|
@ -820,21 +832,6 @@ ActiveRecord::Schema.define(:version => 20170303030731) do
|
|||
|
||||
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
||||
|
||||
create_table "delayed_jobs_20161218", :id => false, :force => true do |t|
|
||||
t.integer "id", :default => 0, :null => false
|
||||
t.integer "priority", :default => 0, :null => false
|
||||
t.integer "attempts", :default => 0, :null => false
|
||||
t.text "handler", :null => false
|
||||
t.text "last_error"
|
||||
t.datetime "run_at"
|
||||
t.datetime "locked_at"
|
||||
t.datetime "failed_at"
|
||||
t.string "locked_by"
|
||||
t.string "queue"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "discuss_demos", :force => true do |t|
|
||||
t.string "title"
|
||||
t.text "body"
|
||||
|
@ -911,8 +908,9 @@ ActiveRecord::Schema.define(:version => 20170303030731) do
|
|||
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
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "score", :default => -1
|
||||
end
|
||||
|
||||
create_table "exercise_choices", :force => true do |t|
|
||||
|
@ -960,11 +958,13 @@ ActiveRecord::Schema.define(:version => 20170303030731) do
|
|||
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 "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "publish_time"
|
||||
t.datetime "end_time"
|
||||
t.integer "show_result"
|
||||
t.integer "question_random", :default => 0
|
||||
t.integer "choice_random", :default => 0
|
||||
end
|
||||
|
||||
create_table "first_pages", :force => true do |t|
|
||||
|
@ -1064,39 +1064,12 @@ ActiveRecord::Schema.define(:version => 20170303030731) do
|
|||
|
||||
add_index "homework_attaches", ["bid_id"], :name => "index_homework_attaches_on_bid_id"
|
||||
|
||||
create_table "homework_bank_tests", :force => true do |t|
|
||||
t.text "input"
|
||||
t.text "output"
|
||||
t.boolean "test_type"
|
||||
t.integer "homework_bank_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "homework_banks", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
t.integer "homework_type"
|
||||
t.integer "quotes", :default => 0
|
||||
t.boolean "is_public"
|
||||
t.string "language"
|
||||
t.text "standard_code", :limit => 2147483647
|
||||
t.integer "min_num"
|
||||
t.integer "max_num"
|
||||
t.boolean "base_on_project"
|
||||
t.string "applicable_syllabus"
|
||||
t.integer "homework_common_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "homework_commons", :force => true do |t|
|
||||
t.string "name"
|
||||
t.integer "user_id"
|
||||
t.text "description"
|
||||
t.datetime "publish_time"
|
||||
t.datetime "end_time"
|
||||
t.date "publish_time"
|
||||
t.date "end_time"
|
||||
t.integer "homework_type", :default => 1
|
||||
t.string "late_penalty"
|
||||
t.integer "course_id"
|
||||
|
@ -1164,16 +1137,6 @@ ActiveRecord::Schema.define(:version => 20170303030731) do
|
|||
add_index "homework_for_courses", ["bid_id"], :name => "index_homework_for_courses_on_bid_id"
|
||||
add_index "homework_for_courses", ["course_id"], :name => "index_homework_for_courses_on_course_id"
|
||||
|
||||
create_table "homework_samples", :force => true do |t|
|
||||
t.text "input"
|
||||
t.text "output"
|
||||
t.integer "homework_common_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "homework_samples", ["homework_common_id"], :name => "index_homework_samples_on_homework_common_id"
|
||||
|
||||
create_table "homework_tests", :force => true do |t|
|
||||
t.text "input"
|
||||
t.text "output"
|
||||
|
@ -1191,23 +1154,6 @@ ActiveRecord::Schema.define(:version => 20170303030731) do
|
|||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "ii", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.string "author_login"
|
||||
t.string "rep_identifier"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "sonar_version", :default => 0
|
||||
t.string "path"
|
||||
t.string "branch"
|
||||
t.string "language"
|
||||
t.string "sonar_name"
|
||||
end
|
||||
|
||||
create_table "innodb_monitor", :id => false, :force => true do |t|
|
||||
t.integer "a"
|
||||
end
|
||||
|
||||
create_table "invite_lists", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "user_id"
|
||||
|
@ -1789,37 +1735,35 @@ ActiveRecord::Schema.define(:version => 20170303030731) do
|
|||
end
|
||||
|
||||
create_table "projects", :force => true do |t|
|
||||
t.string "name", :default => "", :null => false
|
||||
t.string "name", :default => "", :null => false
|
||||
t.text "description"
|
||||
t.string "homepage", :default => ""
|
||||
t.boolean "is_public", :default => true, :null => false
|
||||
t.string "homepage", :default => ""
|
||||
t.boolean "is_public", :default => true, :null => false
|
||||
t.integer "parent_id"
|
||||
t.datetime "created_on"
|
||||
t.datetime "updated_on"
|
||||
t.string "identifier"
|
||||
t.integer "status", :default => 1, :null => false
|
||||
t.integer "status", :default => 1, :null => false
|
||||
t.integer "lft"
|
||||
t.integer "rgt"
|
||||
t.boolean "inherit_members", :default => false, :null => false
|
||||
t.boolean "inherit_members", :default => false, :null => false
|
||||
t.integer "project_type"
|
||||
t.boolean "hidden_repo", :default => false, :null => false
|
||||
t.integer "attachmenttype", :default => 1
|
||||
t.boolean "hidden_repo", :default => false, :null => false
|
||||
t.integer "attachmenttype", :default => 1
|
||||
t.integer "user_id"
|
||||
t.integer "dts_test", :default => 0
|
||||
t.integer "dts_test", :default => 0
|
||||
t.string "enterprise_name"
|
||||
t.integer "organization_id"
|
||||
t.integer "project_new_type"
|
||||
t.integer "gpid"
|
||||
t.integer "forked_from_project_id"
|
||||
t.integer "forked_count"
|
||||
t.integer "publish_resource", :default => 0
|
||||
t.integer "visits", :default => 0
|
||||
t.integer "hot", :default => 0
|
||||
t.integer "publish_resource", :default => 0
|
||||
t.integer "visits", :default => 0
|
||||
t.integer "hot", :default => 0
|
||||
t.string "invite_code"
|
||||
t.string "qrcode"
|
||||
t.integer "qrcode_expiretime", :default => 0
|
||||
t.text "script"
|
||||
t.integer "training_status", :limit => 1, :default => 0
|
||||
t.integer "qrcode_expiretime", :default => 0
|
||||
end
|
||||
|
||||
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
||||
|
@ -2305,19 +2249,6 @@ ActiveRecord::Schema.define(:version => 20170303030731) do
|
|||
t.integer "fields_bits", :default => 0
|
||||
end
|
||||
|
||||
create_table "training_tasks", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "tracker_id"
|
||||
t.string "subject"
|
||||
t.text "description"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "author_id"
|
||||
t.integer "status", :limit => 1, :default => 0
|
||||
t.integer "position", :limit => 1
|
||||
t.integer "result", :default => 0
|
||||
end
|
||||
|
||||
create_table "user_actions", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.string "action_type"
|
||||
|
|
|
@ -2,6 +2,36 @@
|
|||
|
||||
namespace :exercise_publish do
|
||||
desc "publish exercise and end exercise"
|
||||
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.empty?
|
||||
# 问答题有多个答案
|
||||
if question.question_type == 3 && !standard_answer.empty?
|
||||
if standard_answer.include?(answer.first.answer_text)
|
||||
score1 = score1+ question.question_score unless question.question_score.nil?
|
||||
end
|
||||
elsif question.question_type == 1 && !standard_answer.nil?
|
||||
if answer.first.exercise_choice.choice_position == standard_answer.exercise_choice_id
|
||||
score2 = score2 + question.question_score unless question.question_score.nil?
|
||||
end
|
||||
elsif question.question_type == 2 && !standard_answer.nil?
|
||||
arr = get_mulscore(question, user)
|
||||
if arr.to_i == standard_answer.exercise_choice_id
|
||||
score3 = score3 + question.question_score unless question.question_score.nil?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
score = score1 + score2 + score3
|
||||
end
|
||||
|
||||
task :publish => :environment do
|
||||
Rails.logger.info("log--------------------------------exercise_publish start")
|
||||
puts "--------------------------------exercise_publish start"
|
||||
|
@ -24,16 +54,14 @@ namespace :exercise_publish do
|
|||
course = exercise.course
|
||||
exercise.update_column('exercise_status', 3)
|
||||
course.student.each do |student|
|
||||
if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,exercise.id).blank?
|
||||
ExerciseUser.create(:user_id => student.student_id, :exercise_id => exercise.id, :start_at => exercise.end_time, :status => true,:score=>0)
|
||||
else
|
||||
ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,exercise.id).first.update_column('commit_status', 1)
|
||||
end
|
||||
=begin
|
||||
s_score = calculate_student_score(exercise, student.student)
|
||||
exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", student.student_id, exercise.id).first
|
||||
exercise_user.update_attributes(:score => s_score)
|
||||
=end
|
||||
if exercise_user
|
||||
exercise_user = ExerciseUser.create(:user_id => student.student_id, :exercise_id => exercise.id, :start_at => exercise.end_time, :status => true,:score=>0)
|
||||
else
|
||||
exercise_user.update_column('commit_status', 1)
|
||||
end
|
||||
s_score = calculate_student_score(exercise, student.student)
|
||||
exercise_user.update_attributes(:objective_score => s_score, :score => (s_score + (exercise_user.subjective_score > 0 ? exercise_user.subjective_score : 0)))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,6 +6,14 @@
|
|||
/* Redmine - project management software
|
||||
Copyright (C) 2006-2013 Jean-Philippe Lang */
|
||||
|
||||
//未登录弹框提示
|
||||
function login_notice_box(url){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="'+ url +'" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">您还没有登录,不能提交作品<br/>请登录</p><div class="cl"></div>'+
|
||||
'<a href="'+ url +'" class="fr sy_btn_blue mt10 mr10" style="margin-right: 124px;">知道了</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 170);
|
||||
}
|
||||
|
||||
//动态高度控制
|
||||
function description_show_hide(id){
|
||||
showNormalImage('activity_description_'+id);
|
||||
|
@ -1765,6 +1773,14 @@ function delete_confirm_box_3(url, str){
|
|||
pop_box_new(htmlvalue, 300, 140);
|
||||
}
|
||||
|
||||
//提示框:只有一个按钮,点击关闭弹框
|
||||
function notice_sure_box(str){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:350px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">' + str + '</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10 mr10" onclick="hideModal();" style="margin-right: 124px;">知道了</a></div></div>';
|
||||
pop_box_new(htmlvalue, 350, 140);
|
||||
}
|
||||
|
||||
//提示框:只有一个确定按钮,点击关闭弹框
|
||||
function notice_box(str){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
|
@ -1773,6 +1789,15 @@ function notice_box(str){
|
|||
pop_box_new(htmlvalue, 300, 140);
|
||||
}
|
||||
|
||||
|
||||
// 长提示框:只有一个确定按钮,点击关闭弹框
|
||||
function long_notice_box(str){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:380px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
|
||||
'<div class="clear mt15"><p class="text_c f14">' + str + '</p><div class="cl"></div>'+
|
||||
'<a href="javascript:void(0);" class="fr sy_btn_blue mt10 mr10" onclick="hideModal();" style="margin-right: 164px;">确定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 380, 140);
|
||||
}
|
||||
|
||||
//提示框:只有一个确定按钮,点击跳转
|
||||
function notice_box_redirect(url, str){
|
||||
var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="'+ url +'" class="muban_icons_close fr"></a></div>'+
|
||||
|
|
|
@ -58,6 +58,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
|
|||
.lh22{line-height:22px;}
|
||||
.lh24{line-height:24px;}
|
||||
.lh26{line-height:26px;}
|
||||
.lh27{line-height:27px;}
|
||||
.fmYh{font-family:"微软雅黑";}
|
||||
.font999{ color:#999;}
|
||||
.fontRed{color:#770000;}
|
||||
|
@ -93,7 +94,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
|
|||
.ml110{ margin-left:110px;}.ml125 { margin-left:125px;}.ml130 { margin-left:130px;}.ml140 { margin-left:140px;}.ml150 { margin-left:150px;}
|
||||
.ml160 {margin-left:160px;}.ml250 {margin-left:250px;}.ml258{ margin-left:258px;}.ml320{ margin-left:320px;}.ml358{ margin-left:358px;}.mr-5 {margin-right:-5px;}
|
||||
.mr2{ margin-right:2px;}.mr3{ margin-right:3px;}.mr5{ margin-right:5px;}.mr8{ margin-right:8px;}.mr10{ margin-right:10px;}.mr12{ margin-right:12px;}.mr15 {margin-right:15px;}
|
||||
.mr16 {margin-right:16px;}.mr18 {margin-right:18px;}.mr20{ margin-right:20px;}.mr25 {margin-right:25px;}.mr27 {margin-right:27px;}.mr30{ margin-right:30px !important;}
|
||||
.mr16 {margin-right:16px;}.mr18 {margin-right:18px;}.mr20{ margin-right:20px;}.mr25 {margin-right:25px;}.mr27 {margin-right:27px !important;}.mr30{ margin-right:30px !important;}
|
||||
.mr35{ margin-right:35px;}.mr40{ margin-right:40px !important;}.mr45{margin-right: 45px;}.mr50{margin-right: 50px;}.mr55{margin-right: 55px;}.mr60 {margin-right:60px;}
|
||||
.mr65 {margin-right:65px;}.mr70{margin-right: 70px;}.mr75{margin-right: 75px;}.mr80{margin-right: 80px;}.mr85{margin-right: 85px;}.mr95 {margin-right:95px !important;}
|
||||
.mr100 {margin-right:100px !important;}.mr118 {margin-right:118px !important;}.mr130 {margin-right:130px;}.mr135 {margin-right:135px;}.mr150 {margin-right:150px;}
|
||||
|
@ -124,7 +125,7 @@ h4{ font-size:14px;}/*color:#3b3b3b;*/
|
|||
.mw380 {max-width: 380px !important;}.mw400 {max-width: 400px !important;}.mh18 {max-height: 18px;}.max_h54 {max-height:54px; }.maxHeight100 {max-height:100px; overflow-x:hidden; overflow-y:auto;}
|
||||
.maxHeight200 {max-height:200px; overflow-x:hidden; overflow-y:auto;}
|
||||
.W50{ width:50px;}.W120{ width:110px;}.W130{ width:130px;}.W200{ width:200px;}.W300 {width:300px !important;}.W320{ width:320px;}.W420 {width:420px;}.W440{ width:440px;}
|
||||
.W600{ width:600px !important;}.W700{ width:700px; max-width:700px; min-width:700px;}.W710{ width:708px;}.W800{ width:800px !important;}
|
||||
.W700{ width:700px; max-width:700px; min-width:700px;}.W710{ width:708px;}.W800{ width:800px !important;}
|
||||
.maxwidth150{max-width: 150px;}.m_w460{max-width: 460px;}.m_w500{max-width: 500px;}.m_w505{max-width: 505px;}.m_w530{max-width: 530px;}
|
||||
.m_w600{max-width: 600px;}.td_w70{ width:70px;}.td_w60{ width:60px;}.td_w110{ width:110px;}.width165{width: 165px;}.width180{width: 180px !important;}
|
||||
.width285{width: 285px;}.width255{width: 255px;}.width385{width: 385px;}.width505{width: 505px;}.width525{width: 525px;}.width530{width: 530px;}
|
||||
|
@ -453,3 +454,10 @@ a:hover.btn-blue{background: #2788d0; color: #fff;}
|
|||
.sy_popup_con02 ul li p{ margin-bottom:15px; text-align:center; font-size:14px; color:#616161;}
|
||||
.sy_popup_con02 a{ margin:0 auto;}
|
||||
#sy_popup_box{ width:460px; background:#fff; padding-bottom:30px; border-radius:5px; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5);}
|
||||
|
||||
a.btn_blue_64_width{ width: 64px; display:inline-block; color: #fff; background: #3b94d6; text-align: center; font-size: 12px; height: 30px; line-height: 30px;border-radius:3px; }
|
||||
a:hover.btn_blue_64_width{ background: #2788d0; color: #fff;}
|
||||
.btn_grey_64_width{ width: 64px; display:inline-block; color: #656565; background: #d9d9d9; text-align: center; font-size: 12px; height: 30px; line-height: 30px;border-radius:3px; }
|
||||
a:hover.btn_grey_64_width{ background: #717171; color: #fff;}
|
||||
a.btn_green_64_width{ width: 64px; display:inline-block; color: #fff; background: #28be6c; text-align: center; font-size: 12px; height: 30px; line-height: 30px;border-radius:3px; }
|
||||
a:hover.btn_green_64_width{ background: #14ad5a; color: #fff;}
|
||||
|
|
|
@ -396,6 +396,7 @@ a:hover.btn_cancel{ color:#666;}
|
|||
a:hover.testEdit{ background:url(../images/icons.png) -21px -272px no-repeat;}
|
||||
.testDesEdit {width:670px; overflow:hidden; white-space:pre-wrap;}
|
||||
.testEditTitle{ padding:10px 0px ; float:left; width:564px; }
|
||||
.exercise_title{padding: 10px 0px;}
|
||||
.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;}
|
||||
.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; }
|
||||
|
@ -540,3 +541,11 @@ a.banner-course-notice {position: absolute; font-size: 12px; line-height: 20px;
|
|||
.program_input_pre{font-family: '微软雅黑','宋体'; max-width:450px; word-wrap:break-word; white-space:pre-wrap;}
|
||||
.homeworkInfo .program_input_ul li{list-style-type: none; margin-left: 0;}
|
||||
.homework_base_setting{border: 1px solid #d9d9d9; background: #F5F5F5; color: #d9d9d9;}
|
||||
|
||||
/* 新版测验 */
|
||||
a.question_choice_white{ background: #fff; color: #000000; width: 34px; height: 30px; border: 1px solid #ddd; text-align: center; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
|
||||
a.question_choice_blue{ background: #3b94d6; color: #fff; width: 34px; height: 30px; border: 1px solid #ddd; text-align: center; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
|
||||
.question_choice_dash{ background: #fff; color: #000000; width: 34px; height: 30px; border: 1px dashed #ddd; text-align: center; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
|
||||
.question_answer_span{ background: #fff; color: #000000; padding: 6px 10px; border: 1px solid #c8cbce; text-align: center; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
|
||||
.bg_blue{ background: #3b94d6;}
|
||||
.score_input{ width: 40px; border: 1px solid #d8d3d3;}
|
|
@ -23,6 +23,7 @@
|
|||
.courseSend {width:390px; height:15px; line-height:15px; margin-bottom:10px;display:block;white-space:nowrap;}
|
||||
.courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;}
|
||||
.sendCourseName {font-size:12px; color:#5f6060;display:inline-block}
|
||||
.chooseCourseName {font-size: 12px; color: #5f6060; max-width: 320px; display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
|
||||
.courseSendSubmit {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#3b94d6; margin-right:25px; float:left;cursor: pointer;}
|
||||
.courseSendSubmit:hover {background-color:#297fb8;}
|
||||
.courseSendCancel {width:50px; height:25px; line-height:25px; text-align:center; vertical-align:middle; background-color:#c1c1c1; float:left}
|
||||
|
@ -33,7 +34,7 @@ input.sendSourceText:hover {background-color:#297fb8;}
|
|||
/*input.sendSourceText:hover {font-size:14px; color:#ffffff;}*/
|
||||
.resourcesSendTo {float:left; height:20px; margin-top:15px;}
|
||||
.resourcesSendType {border:1px solid #e6e6e6; width:60px; height:24px; outline:none; font-size:14px; color:#888888;}
|
||||
.courseReferContainer {float:left; max-height:120px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden;}
|
||||
.courseReferContainer {float:left; max-height:120px;margin-right:16px;margin-bottom:10px; overflow:auto; overflow-x:hidden;}
|
||||
/*上传资源弹窗*/
|
||||
.resourceUploadPopup {width:400px; height:auto; border:3px solid #3b94d6; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:fixed; top:50%; left:50%; margin-left:-200px; z-index:1000;}
|
||||
.uploadText {font-size:16px; color:#3b94d6; line-height:16px; padding-top:15px; width:140px; display:inline-block;}
|
||||
|
|
|
@ -102,12 +102,13 @@ a:hover.icon_remove{background:url(images/icons.png) -20px -338px no-repeat;}
|
|||
a.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; }
|
||||
a:hover.ur_button_submit{ background:#0fa9bb; text-decoration:none;}
|
||||
|
||||
a.ur_icon_de{ background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px;}
|
||||
a.ur_icon_de{ background:url(images/icons.png) 0px -338px no-repeat; width:16px; height:27px; display:block;float:right; margin-right:10px;}
|
||||
a:hover.ur_icon_de{ background:url(images/icons.png) -20px -338px no-repeat;}
|
||||
.ur_icon_edit{ background:url(images/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;}
|
||||
.ur_icon_edit{ background:url(images/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right;}
|
||||
a:hover.ur_icon_edit{ background:url(images/icons.png) -21px -272px no-repeat;}
|
||||
.ur_icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:right; margin-top:15px; margin-right:10px;}
|
||||
.ur_icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:right; margin-right:10px;}
|
||||
a:hover.ur_icon_add{background:url(images/icons.png) -20px -310px no-repeat;}
|
||||
.up_and_down{float: right; margin-top: 5px; margin-right: 10px;}
|
||||
|
||||
/***弹框***/
|
||||
.popbox_polls{width:300px;height:100px;position:fixed !important;z-index:100;left:50%;top:50%;margin:-100px 0 0 -150px; background:#fff; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; box-shadow:0px 0px 8px #194a81; overflow:auto;}
|
||||
|
@ -153,4 +154,12 @@ a:hover.btn_pu{ background:#3cb761;}
|
|||
|
||||
.import_poll_div{width: 430px; max-height: 550px; overflow-x:hidden; overflow-y: auto; margin: 10px auto;}
|
||||
|
||||
/*测验*/
|
||||
.exercise_inputs{ color:#666;}
|
||||
.exercise_inputs tr td{ width:98%; float: right;}
|
||||
.exercise_inputs label{ padding-left:10px;}
|
||||
.exercise_inputs input{ float: left;}
|
||||
.border_b{border-bottom: 1px solid #dcdcdc; padding-bottom: 10px;}
|
||||
.multi_input label{float: left;}
|
||||
.multi_input textarea{line-height: 30px;}
|
||||
|
||||
|
|
Loading…
Reference in New Issue