Merge branch 'develop' into gitlab_guange
This commit is contained in:
commit
c5ebfeb29c
|
@ -1,18 +1,21 @@
|
|||
class ExerciseController < ApplicationController
|
||||
layout "base_courses"
|
||||
|
||||
before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy, :commit_exercise, :commit_answer,:publish_exercise,:republish_exercise]
|
||||
before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy, :commit_exercise, :commit_answer,:publish_exercise,:republish_exercise,:show_student_result]
|
||||
before_filter :find_course, :only => [:index,:new,:create,:student_exercise_list]
|
||||
include ExerciseHelper
|
||||
|
||||
include ExerciseHelper
|
||||
def index
|
||||
if @course.is_public == 0 && !User.current.member_of_course?(@course)
|
||||
render_403
|
||||
return
|
||||
end
|
||||
remove_invalid_exercise(@course)
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
if @is_teacher
|
||||
exercises = @course.exercises
|
||||
exercises = @course.exercises.order("created_at asc")
|
||||
else
|
||||
exercises = @course.exercises.where(:exercise_status => 2)
|
||||
exercises = @course.exercises.where(:exercise_status => 2).order("created_at asc")
|
||||
end
|
||||
@exercises = paginateHelper exercises,20 #分页
|
||||
respond_to do |format|
|
||||
|
@ -31,17 +34,24 @@ class ExerciseController < ApplicationController
|
|||
render_403
|
||||
return
|
||||
end
|
||||
@can_edit_excercise = (!has_commit_exercise?(@exercise.id,User.current.id)) || User.current.admin?
|
||||
exercise_end = @exercise.end_time > Time.now
|
||||
if @exercise.time == -1
|
||||
@can_edit_excercise = exercise_end
|
||||
else
|
||||
@can_edit_excercise = (!has_commit_exercise?(@exercise.id,User.current.id)&& exercise_end) || User.current.admin?
|
||||
end
|
||||
@exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
|
||||
# 学生点击的时候即创建关联,自动保存
|
||||
#eu = ExerciseUser.create(:user_id => User.current, :exercise_id => @exercise.id, :start_at => Time.now, :status => false)
|
||||
|
||||
# 已提交问卷的用户不能再访问该界面
|
||||
=begin
|
||||
if has_commit_exercise?(@exercise.id, User.current.id) && (!User.current.admin?)
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_courses'}
|
||||
end
|
||||
else
|
||||
=end
|
||||
if !@is_teacher && !has_click_exercise?(@exercise.id, User.current.id)
|
||||
eu = ExerciseUser.create(:user_id => User.current.id, :exercise_id => @exercise.id, :start_at => Time.now, :status => false)
|
||||
@exercise_user = ExerciseUser.where("user_id=? and exercise_id=?", User.current.id, @exercise.id).first
|
||||
|
@ -49,10 +59,13 @@ class ExerciseController < ApplicationController
|
|||
# @percent = get_percent(@exercise,User.current)
|
||||
exercise_questions = @exercise.exercise_questions
|
||||
@exercise_questions = paginateHelper exercise_questions,5 #分页
|
||||
score = calculate_student_score(@exercise, User.current)
|
||||
eu = get_exercise_user(@exercise.id, User.current.id)
|
||||
eu.update_attributes(:score => score)
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_courses'}
|
||||
end
|
||||
end
|
||||
#end
|
||||
end
|
||||
|
||||
def new
|
||||
|
@ -65,7 +78,6 @@ class ExerciseController < ApplicationController
|
|||
:end_time => "",
|
||||
:publish_time => "",
|
||||
:exercise_description => "",
|
||||
:show_result => "",
|
||||
:show_result => 1
|
||||
}
|
||||
@exercise = Exercise.create option
|
||||
|
@ -80,7 +92,7 @@ class ExerciseController < ApplicationController
|
|||
exercise ||= Exercise.new
|
||||
exercise.exercise_name = params[:exercise][:exercise_name]
|
||||
exercise.exercise_description = params[:exercise][:exercise_description]
|
||||
exercise.end_time = params[:exercise][:end_time]
|
||||
exercise.end_time = Time.at(params[:exercise][:end_time].to_time.to_i + 16*60*60 -1)
|
||||
exercise.publish_time = params[:exercise][:publish_time]
|
||||
exercise.user_id = User.current.id
|
||||
exercise.time = params[:exercise][:time]
|
||||
|
@ -104,10 +116,10 @@ class ExerciseController < ApplicationController
|
|||
def update
|
||||
@exercise.exercise_name = params[:exercise][:exercise_name]
|
||||
@exercise.exercise_description = params[:exercise][:exercise_description]
|
||||
@exercise.time = params[:exercise][:time]
|
||||
@exercise.end_time = params[:exercise][:end_time]
|
||||
@exercise.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]
|
||||
@exercise.show_result = params[:exercise][:show_result].blank? ? 1 : params[:exercise][:show_result]
|
||||
if @exercise.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -300,6 +312,7 @@ class ExerciseController < ApplicationController
|
|||
# 发布试卷
|
||||
def publish_exercise
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
@index = params[:index]
|
||||
@exercise.exercise_status = 2
|
||||
@exercise.publish_time = Time.now
|
||||
if @exercise.save
|
||||
|
@ -314,11 +327,13 @@ class ExerciseController < ApplicationController
|
|||
# 重新发布的时候会删除所有的答题
|
||||
def republish_exercise
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
|
||||
@index = params[:index]
|
||||
@exercise.exercise_questions.each do |exercise_question|
|
||||
exercise_question.exercise_answers.destroy_all
|
||||
end
|
||||
@exercise.exercise_users.destroy_all
|
||||
@exercise.exercise_status = 1
|
||||
@exercise.publish_time = nil
|
||||
@exercise.save
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
@ -328,12 +343,12 @@ class ExerciseController < ApplicationController
|
|||
def student_exercise_list
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
@exercise = Exercise.find params[:id]
|
||||
@all_exercises = @course.exercises.order("created_at desc")
|
||||
@all_exercises = @course.exercises.where("exercise_status > 1").order("created_at desc")
|
||||
@exercise_count = @exercise.exercise_users.where('score is not NULL').count
|
||||
if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && Time.parse(@exercise.end_time.to_s).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S"))
|
||||
if @is_teacher || (!@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time <= Time.now)
|
||||
@exercise_users_list = @exercise.exercise_users.where('score is not NULL')
|
||||
@show_all = true;
|
||||
elsif !@exercise.exercise_users.where(:user_id => User.current.id).empty? && Time.parse(@exercise.end_time.to_s).strftime("%Y-%m-%d-%H-%M-%S") > Time.now.strftime("%Y-%m-%d-%H-%M-%S")
|
||||
elsif !@exercise.exercise_users.where(:user_id => User.current.id).empty? && @exercise.end_time > Time.now
|
||||
@exercise_users_list = @exercise.exercise_users.where("user_id = ? and score is not NULL",User.current.id)
|
||||
else
|
||||
@exercise_users_list = []
|
||||
|
@ -346,8 +361,8 @@ class ExerciseController < ApplicationController
|
|||
# 学生提交答卷,选中答案的过程中提交
|
||||
def commit_answer
|
||||
eq = ExerciseQuestion.find(params[:exercise_question_id])
|
||||
# 已提交过的则不允许答题
|
||||
if has_commit_exercise?(@exercise.id,User.current.id) && (!User.current.admin?)
|
||||
# 已提交过的且是限时的则不允许答题
|
||||
if (has_commit_exercise?(@exercise.id,User.current.id) && (!User.current.admin?) && @exercise.time != -1) || @exercise.end_time < Time.now
|
||||
render :json => {:text => "failure"}
|
||||
return
|
||||
end
|
||||
|
@ -364,8 +379,14 @@ class ExerciseController < ApplicationController
|
|||
ea.exercise_choice_id = params[:exercise_choice_id]
|
||||
if ea.save
|
||||
# 保存成功返回成功信息及当前以答题百分比
|
||||
uncomplete_question = get_uncomplete_question(@exercise, User.current)
|
||||
if uncomplete_question.count < 1
|
||||
complete = 1;
|
||||
else
|
||||
complete = 0;
|
||||
end
|
||||
@percent = get_percent(@exercise,User.current)
|
||||
render :json => {:text => "ok" ,:percent => format("%.2f" ,@percent)}
|
||||
render :json => {:text => "ok" ,:complete => complete,:percent => format("%.2f" ,@percent)}
|
||||
else
|
||||
#返回失败信息
|
||||
render :json => {:text => "failure"}
|
||||
|
@ -380,8 +401,14 @@ class ExerciseController < ApplicationController
|
|||
ea.exercise_question_id = params[:exercise_question_id]
|
||||
ea.exercise_choice_id = params[:exercise_choice_id]
|
||||
if ea.save
|
||||
uncomplete_question = get_uncomplete_question(@exercise, User.current)
|
||||
if uncomplete_question.count < 1
|
||||
complete = 1;
|
||||
else
|
||||
complete = 0;
|
||||
end
|
||||
@percent = get_percent(@exercise,User.current)
|
||||
render :json => {:text => "ok",:percent => format("%.2f" ,@percent)}
|
||||
render :json => {:text => "ok",:complete => complete,:percent => format("%.2f" ,@percent)}
|
||||
else
|
||||
render :json => {:text => "failure"}
|
||||
end
|
||||
|
@ -410,8 +437,14 @@ class ExerciseController < ApplicationController
|
|||
ea.exercise_question_id = params[:exercise_question_id]
|
||||
ea.answer_text = params[:answer_text]
|
||||
if ea.save
|
||||
uncomplete_question = get_uncomplete_question(@exercise, User.current)
|
||||
if uncomplete_question.count < 1
|
||||
complete = 1;
|
||||
else
|
||||
complete = 0;
|
||||
end
|
||||
@percent = get_percent(@exercise,User.current)
|
||||
render :json => {:text => ea.answer_text,:percent => format("%.2f",@percent)}
|
||||
render :json => {:text => ea.answer_text,:complete => complete,:percent => format("%.2f",@percent)}
|
||||
else
|
||||
render :json => {:text => "failure"}
|
||||
end
|
||||
|
@ -447,6 +480,17 @@ class ExerciseController < ApplicationController
|
|||
def commit_exercise
|
||||
# 老师不需要提交
|
||||
if User.current.allowed_to?(:as_teacher,@course)
|
||||
if @exercise.publish_time.nil?
|
||||
@exercise.update_attributes(:show_result => params[:show_result])
|
||||
@exercise.update_attributes(:exercise_status => 2)
|
||||
@exercise.update_attributes(:publish_time => Time.now)
|
||||
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)
|
||||
# REDO: 提示提交成功
|
||||
|
@ -480,6 +524,20 @@ class ExerciseController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#查看学生的答卷情况
|
||||
def show_student_result
|
||||
@user = User.find params[:user_id]
|
||||
@can_edit_excercise = false
|
||||
@exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", @user.id, @exercise.id).first
|
||||
@exercise_questions = @exercise.exercise_questions
|
||||
score = calculate_student_score(@exercise, @user)
|
||||
eu = get_exercise_user(@exercise.id, @user.id)
|
||||
eu.update_attributes(:score => score)
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_courses'}
|
||||
end
|
||||
end
|
||||
|
||||
# 计算学生得分
|
||||
def calculate_student_score(exercise, user)
|
||||
score = 0
|
||||
|
@ -490,7 +548,7 @@ class ExerciseController < ApplicationController
|
|||
exercise_qustions.each do |question|
|
||||
answer = get_user_answer(question, user)
|
||||
standard_answer = get_user_standard_answer(question, user)
|
||||
unless answer.nil?
|
||||
unless answer.empty?
|
||||
# 问答题有多个答案
|
||||
if question.question_type == 3
|
||||
if standard_answer.include?(answer.first.answer_text)
|
||||
|
@ -532,19 +590,6 @@ class ExerciseController < ApplicationController
|
|||
eu
|
||||
end
|
||||
|
||||
#获取未完成的题目
|
||||
def get_uncomplete_question exercise,user
|
||||
all_questions = exercise.exercise_questions
|
||||
uncomplete_question = []
|
||||
all_questions.each do |question|
|
||||
answers = get_user_answer(question, user)
|
||||
if answers.nil?
|
||||
uncomplete_question << question
|
||||
end
|
||||
end
|
||||
uncomplete_question
|
||||
end
|
||||
|
||||
# 获取当前学生回答问题的答案
|
||||
def get_user_answer(question,user)
|
||||
# user_answer = ExerciseAnswer.where("user_id=? and exercise_question_id=?", user.id, question.id).first
|
||||
|
@ -563,7 +608,8 @@ class ExerciseController < ApplicationController
|
|||
standard_answer = question.exercise_standard_answers.first
|
||||
end
|
||||
standard_answer
|
||||
end # 是否完成了答题
|
||||
end
|
||||
# 是否完成了答题
|
||||
def get_complete_question(exercise,user)
|
||||
questions = exercise.exercise_questions
|
||||
complete_question = []
|
||||
|
|
|
@ -39,7 +39,7 @@ class OrgDocumentCommentsController < ApplicationController
|
|||
end
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
if params[:flag] == 0
|
||||
if params[:flag].to_i == 0
|
||||
redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id)
|
||||
else
|
||||
redirect_to org_document_comment_path(@org_document.root.id, :organization_id => @org_document.organization.id)
|
||||
|
|
|
@ -161,7 +161,7 @@ class OrganizationsController < ApplicationController
|
|||
def more_org_projects
|
||||
@organization = Organization.find params[:id]
|
||||
@page = params[:page]
|
||||
@org_projects = @organization.projects.reorder('created_at').page((params[:page].to_i || 1) +1).per(5)
|
||||
@org_projects = @organization.projects.reorder('created_at').uniq.page((params[:page].to_i || 1) +1).per(5)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -170,7 +170,7 @@ class OrganizationsController < ApplicationController
|
|||
def more_org_courses
|
||||
@organization = Organization.find(params[:id])
|
||||
@page = params[:page]
|
||||
@org_courses = @organization.courses.reorder('created_at').page((params[:page].to_i || 1) + 1 ).per(5)
|
||||
@org_courses = @organization.courses.reorder('created_at').uniq.page((params[:page].to_i || 1) + 1 ).per(5)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
@ -189,16 +189,17 @@ class OrganizationsController < ApplicationController
|
|||
if !params[:name].nil?
|
||||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
#sql = "select courses.* from courses inner join members on courses.id = members.course_id inner join org_courses on courses.id = org_courses.course_id where org_courses.organization_id != #{@organization.id} and members.user_id = #{User.current.id} and courses.name like '#{condition}'"
|
||||
sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'"
|
||||
user_courses = Course.find_by_sql(sql)
|
||||
@added_course_ids = @organization.courses.map(&:id)
|
||||
@courses = []
|
||||
user_courses.each do |course|
|
||||
if !@added_course_ids.include?(course.id)
|
||||
@courses << course
|
||||
end
|
||||
end
|
||||
sql = "select courses.* from courses inner join members on courses.id = members.course_id where members.user_id = #{User.current.id} and courses.name like '#{condition}'"+
|
||||
"and courses.id not in (select distinct org_courses.course_id from org_courses where org_courses.organization_id = #{@organization.id})"
|
||||
#user_courses = Course.find_by_sql(sql)
|
||||
@courses = Course.find_by_sql(sql)
|
||||
# @added_course_ids = @organization.courses.map(&:id)
|
||||
# @courses = []
|
||||
# user_courses.each do |course|
|
||||
# if !@added_course_ids.include?(course.id)
|
||||
# @courses << course
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def join_courses
|
||||
|
@ -225,15 +226,17 @@ class OrganizationsController < ApplicationController
|
|||
if !params[:name].nil?
|
||||
condition = "%#{params[:name].strip}%".gsub(" ","")
|
||||
end
|
||||
sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'"
|
||||
user_projects = Course.find_by_sql(sql)
|
||||
@added_course_ids = @organization.projects.map(&:id)
|
||||
@projects = []
|
||||
user_projects.each do |project|
|
||||
if !@added_course_ids.include?(project.id)
|
||||
@projects << project
|
||||
end
|
||||
end
|
||||
sql = "select projects.* from projects inner join members on projects.id = members.project_id where members.user_id = #{User.current.id} and projects.status != 9 and projects.name like '#{condition}'" +
|
||||
" and projects.id not in (select org_projects.project_id from org_projects where organization_id = #{@organization.id})"
|
||||
#user_projects = Course.find_by_sql(sql)
|
||||
@projects = Course.find_by_sql(sql)
|
||||
# @added_course_ids = @organization.projects.map(&:id)
|
||||
# @projects = []
|
||||
# user_projects.each do |project|
|
||||
# if !@added_course_ids.include?(project.id)
|
||||
# @projects << project
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
def join_projects
|
||||
|
|
|
@ -76,7 +76,7 @@ class StudentWorkController < ApplicationController
|
|||
end
|
||||
##################################################################################################################
|
||||
@order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group]
|
||||
@homework_commons = @course.homework_commons.order("created_at desc")
|
||||
@homework_commons = @course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).order("created_at desc")
|
||||
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
|
||||
@is_evaluation = @homework.homework_detail_manual && @homework.homework_detail_manual.comment_status == 2 && !@is_teacher #是不是匿评
|
||||
@show_all = false
|
||||
|
|
|
@ -107,6 +107,19 @@ module ExerciseHelper
|
|||
end
|
||||
end
|
||||
|
||||
#获取未完成的题目
|
||||
def get_uncomplete_question exercise,user
|
||||
all_questions = exercise.exercise_questions
|
||||
uncomplete_question = []
|
||||
all_questions.each do |question|
|
||||
answers = get_user_answer(question, user)
|
||||
if answers.empty?
|
||||
uncomplete_question << question
|
||||
end
|
||||
end
|
||||
uncomplete_question
|
||||
end
|
||||
|
||||
#获取文本题答案
|
||||
def get_anwser_vote_text(question_id,user_id)
|
||||
pv = ExerciseAnswer.find_by_exercise_question_id_and_user_id(question_id,user_id)
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<% if show_nav?(course_feedback_count) %>
|
||||
<div class="subNav">
|
||||
<%= link_to l(:label_course_feedback), course_feedback_path(@course), :class => "f14 c_blue02 ml10" %>
|
||||
<%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_message_new)}", :id => "course_jour_count"%>
|
||||
<%= link_to "", course_feedback_path(@course), :class => 'courseMenuSetting', :title =>"#{l(:label_course_feedback)}", :id => "course_jour_count"%>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if show_nav?(course_poll_count) %>
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
<div id="popbox" style="text-align: center;margin-top: 25px">
|
||||
<% if status == 0 %>
|
||||
<% if status == 0 && exercise.time != -1%>
|
||||
<h3 style="font-weight: normal;color: green">提交成功!您的分数是:<%=@score %>分。</h3>
|
||||
<%= link_to "确定", exercise_path(),:class => 'commit'%>
|
||||
<% elsif status == 1 %>
|
||||
<h3 style="font-weight: normal;color: red">您还有尚未作答的题目请完成后再提交!</h3>
|
||||
<%= link_to "确定", "javascript:void(0)",:onclick => 'hidden_atert_form();',:class => 'commit'%>
|
||||
<% else %>
|
||||
<% elsif status == 0 && Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") > Time.now.strftime("%Y-%m-%d %H:%M:%S") %>
|
||||
<h3 style="font-weight: normal;color: green">提交成功!</h3>
|
||||
<%= link_to "确定", exercise_index_path(:course_id => @course.id),:class => 'commit'%>
|
||||
<% elsif status == 1 && Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") > Time.now.strftime("%Y-%m-%d %H:%M:%S")%>
|
||||
<h3 style="font-weight: normal;color: red">保存成功!</h3>
|
||||
<%= link_to "确定",exercise_index_path(:course_id => @course.id),:class => 'commit'%>
|
||||
<% elsif status == 1 && Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") <= Time.now.strftime("%Y-%m-%d %H:%M:%S")%>
|
||||
<h3 style="font-weight: normal;color: red">时间已到!</h3>
|
||||
<%= link_to "确定", exercise_path(),:class => 'commit'%>
|
||||
<% elsif status == 2 %>
|
||||
<h3 style="font-weight: normal;color: red">发生未知错误,请检查您的网络。</h3>
|
||||
<%= link_to "确定", "javascript:void(0)",:onclick => 'hidden_atert_form();',:class => 'commit'%>
|
||||
<% else %>
|
||||
<h3 style="font-weight: normal;color: green">时间已到!您的分数是:<%=@score %>分。</h3>
|
||||
<%= link_to "确定", exercise_path(),:class => 'commit'%>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -1,63 +1,63 @@
|
|||
<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
|
||||
<!--编辑单选start-->
|
||||
<script type="text/javascript">
|
||||
function resetQuestion<%=exercise_question.id%>()
|
||||
{
|
||||
$("#poll_questions_title_<%=exercise_question.id%>").val("<%= exercise_question.question_title%>")
|
||||
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>")
|
||||
$("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>")
|
||||
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<label>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>: </label>" +
|
||||
"<input maxlength='200' type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
"</li>" +
|
||||
"<div class='cl'></div>" +
|
||||
"<% end%>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="questionContainer" style="width: 680px;">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入单选题题目" type="text" value="<%=exercise_question.question_title %>">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input type="text" id="poll_question_score_<%=exercise_question.id %>" name="question_score" style="width:40px; text-align:center; padding-left:0px;" value="<%= exercise_question.question_score %>">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<div id="poll_answers_<%=exercise_question.id%>">
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input id="poll_question_standard_answer_<%=exercise_question.id %>" name="exercise_choice" placeholder="若标准答案为A,在此输入A即可" type="text" value="<%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,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>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<!--编辑单选 end-->
|
||||
<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
|
||||
<!--编辑单选start-->
|
||||
<script type="text/javascript">
|
||||
function resetQuestion<%=exercise_question.id%>()
|
||||
{
|
||||
$("#poll_questions_title_<%=exercise_question.id%>").val("<%= exercise_question.question_title%>")
|
||||
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>")
|
||||
$("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>")
|
||||
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<label>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>: </label>" +
|
||||
"<input maxlength='200' type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
"</li>" +
|
||||
"<div class='cl'></div>" +
|
||||
"<% end%>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="questionContainer" style="width: 680px;">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入单选题题目" type="text" value="<%=exercise_question.question_title %>">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input type="text" id="poll_question_score_<%=exercise_question.id %>" name="question_score" style="width:40px; text-align:center; padding-left:0px;" value="<%= exercise_question.question_score %>">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<div id="poll_answers_<%=exercise_question.id%>">
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[<%=exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input id="poll_question_standard_answer_<%=exercise_question.id %>" name="exercise_choice" placeholder="若标准答案为A,在此输入A即可" type="text" value="<%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,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>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<!--编辑单选 end-->
|
||||
<% end%>
|
|
@ -1,63 +1,63 @@
|
|||
<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
|
||||
<!--编辑单选start-->
|
||||
<script type="text/javascript">
|
||||
function resetQuestion<%=exercise_question.id%>()
|
||||
{
|
||||
$("#poll_questions_title_<%=exercise_question.id%>").val("<%= exercise_question.question_title%>")
|
||||
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>")
|
||||
$("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>")
|
||||
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<label>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>: </label>" +
|
||||
"<input maxlength='200' type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
"</li>" +
|
||||
"<div class='cl'></div>" +
|
||||
"<% end%>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="questionContainer" style="width: 680px;">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入多选题题目" type="text" value="<%=exercise_question.question_title %>">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input type="text" id="poll_question_score_<%=exercise_question.id %>" name="question_score" style="width:40px; text-align:center; padding-left:0px;" value="<%= exercise_question.question_score %>">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<div id="poll_answers_<%=exercise_question.id%>">
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input id="poll_question_standard_answer_<%=exercise_question.id %>" name="exercise_choice" placeholder="若标准答案为A,B,C,在答案输入框填入ABC即可" type="text" value="<%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,2);">
|
||||
保存
|
||||
</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<!--编辑单选 end-->
|
||||
<%= form_for("",:url => update_exercise_question_exercise_index_path(:exercise_question => exercise_question.id),:remote => true) do |f|%>
|
||||
<!--编辑单选start-->
|
||||
<script type="text/javascript">
|
||||
function resetQuestion<%=exercise_question.id%>()
|
||||
{
|
||||
$("#poll_questions_title_<%=exercise_question.id%>").val("<%= exercise_question.question_title%>")
|
||||
$("#poll_question_score_<%=exercise_question.id %>").val("<%= exercise_question.question_score%>")
|
||||
$("#poll_question_standard_answer_<%=exercise_question.id %>").val("<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s)%>")
|
||||
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<label>选项<%=convert_to_char (index+1).to_s %><span class='ur_index'></span>: </label>" +
|
||||
"<input maxlength='200' type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value='<%=exercise_choice.choice_text %>'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
"</li>" +
|
||||
"<div class='cl'></div>" +
|
||||
"<% end%>");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="questionContainer" style="width: 680px;">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入多选题题目" type="text" value="<%=exercise_question.question_title %>">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input type="text" id="poll_question_score_<%=exercise_question.id %>" name="question_score" style="width:40px; text-align:center; padding-left:0px;" value="<%= exercise_question.question_score %>">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<div id="poll_answers_<%=exercise_question.id%>">
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label>选项<%=convert_to_char (index+1).to_s %><span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[<%= exercise_choice.id %>]' placeholder='输入选项内容' value="<%=exercise_choice.choice_text %>">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% end %>
|
||||
</div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input id="poll_question_standard_answer_<%=exercise_question.id %>" name="exercise_choice" placeholder="若标准答案为A,B,C,在答案输入框填入ABC即可" type="text" value="<%=convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="edit_poll_question($(this),<%= exercise_question.id %>,2);">
|
||||
保存
|
||||
</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=exercise_question.id%>();pollQuestionCancel(<%= exercise_question.id%>);">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<!--编辑单选 end-->
|
||||
<% end%>
|
|
@ -3,31 +3,38 @@
|
|||
<div>
|
||||
<input name="exercise[exercise_name]" maxlength="100" id="exercise_name" class="testTitle mb10" type="text" placeholder="测验标题" value="<%=@exercise.exercise_name%>" />
|
||||
</div>
|
||||
<%# if edit_mode %>
|
||||
<!--<label class="fl c_grey f14" style="margin-top: 4px;">发布日期(可选):</label>-->
|
||||
<%# end %>
|
||||
<div class="calendar_div fl mr10">
|
||||
<input type="text" name="exercise[publish_time]" id="exercise_publish_time" placeholder="发布时间" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if exercise.publish_time %>" >
|
||||
<%= calendar_for('exercise_publish_time')%>
|
||||
</div>
|
||||
<%# if edit_mode %>
|
||||
<!--<label class="fl c_grey f14" style="margin-top: 4px;">截止日期:</label>-->
|
||||
<%# end %>
|
||||
<label class="fl c_grey f14" style="margin-top: 4px;">截止时间:</label>
|
||||
<div class="calendar_div fl">
|
||||
<input type="text" name="exercise[end_time]" id="exercise_end_time" placeholder="截止时间" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d") if exercise.end_time %>" >
|
||||
<input type="text" name="exercise[end_time]" id="exercise_end_time" placeholder="截止时间" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d") if exercise.end_time %>"/>
|
||||
<%= calendar_for('exercise_end_time')%>
|
||||
</div>
|
||||
<div class="fl ml10 f14 fontGrey2"><span class="mr5">测验时长:</span><input name="exercise[time]" id="exercise_time" type="text" class="examTime mr5" value="<%=exercise.time %>" />分钟</div>
|
||||
<div class="fl ml15 f14 fontGrey2"><span class="mr5">测验时长:</span><input name="exercise[time]" id="exercise_time" type="text" class="examTime mr5" placeholder="不填即不限时" value="<%=exercise.time if exercise.time!= -1 %>" />分钟</div>
|
||||
<label class="fl c_grey ml15 f14" style="margin-top: 4px;">发布时间(可选):</label>
|
||||
<div class="calendar_div fl">
|
||||
<input type="text" name="exercise[publish_time]" id="exercise_publish_time" placeholder="发布时间(可选)" class="InputBox fl W120 calendar_input" readonly="readonly" value="<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if !exercise.publish_time.nil? %>"/>
|
||||
<%= calendar_for('exercise_publish_time')%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<textarea class="testDes mt10" name="exercise[exercise_description]" id="exercise_description" placeholder="发布须知:试题类型有选择和填空两种,其中选择题包括单选题和多选题。您可以在此处填写测验相关说明。" ><%=exercise.exercise_description %></textarea>
|
||||
<div class="ur_editor_footer" style="padding-top: 10px;">
|
||||
<a class="btn_submit c_white" data-button="ok" onclick="pollsSubmit($(this));">
|
||||
保存
|
||||
</a>
|
||||
<a class="btn_cancel" data-button="cancel" onclick="pollsCancel();">
|
||||
<a class="btn_cancel" data-button="cancel" onclick="resetHead();pollsCancel();">
|
||||
<%= l(:button_cancel)%>
|
||||
</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
function resetHead()
|
||||
{
|
||||
$("#exercise_name").val("<%=exercise.exercise_name%>");
|
||||
$("#exercise_end_time").val("<%= Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d") if exercise.end_time %>");
|
||||
$("#exercise_time").val("<%=exercise.time if exercise.time!= -1 %>");
|
||||
$("#exercise_publish_time").val("<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if !exercise.publish_time.nil?%>");
|
||||
/*$("#exercise_description").text("<%#=exercise.exercise_description.html_safe %>");*/
|
||||
document.getElementById("exercise_description").innerText = <%=exercise.exercise_description.html_safe %>;
|
||||
}
|
||||
</script>
|
|
@ -8,7 +8,7 @@
|
|||
$("#poll_answers_<%=exercise_question.id%>").html("<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>" +
|
||||
"<li class='ur_item'>" +
|
||||
"<label>候选答案<span class='ur_index'></span>: </label>" +
|
||||
"<input name='exercise_choice[<%=exercise_choice.id %>]' placeholder='请输入候选答案' type='text' value='<%=exercise_choice.answer_text %>'/>" +
|
||||
"<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>" +
|
||||
"<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>" +
|
||||
|
@ -24,7 +24,7 @@
|
|||
<input name="question_type" value="<%=exercise_question.question_type %>" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title_<%=exercise_question.id %>" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text" value="<%=exercise_question.question_title %>">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<div class="ur_editor_content" id="edit_single">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
|
||||
<li class="ur_item">
|
||||
<label>候选答案<span class="ur_index"></span>: </label>
|
||||
<input name="exercise_choice[<%=exercise_choice.id %>]" placeholder="请输入候选答案" type="text" value="<%=exercise_choice.answer_text %>"/>
|
||||
<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>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this));"></a>
|
||||
</li>
|
||||
|
|
|
@ -1,61 +1,60 @@
|
|||
<%# has_commit = has_commit_poll?(poll.id ,User.current)%>
|
||||
<% exercise_name = exercise.exercise_name.empty? ? l(:label_poll_new) : exercise.exercise_name%>
|
||||
<% if @is_teacher%>
|
||||
<li title="<%= exercise.exercise_name %>">
|
||||
<div style="width: 310px;float: left;">
|
||||
<%# if has_commit %>
|
||||
<%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
|
||||
<%# else %>
|
||||
<%#= link_to poll_name, exercise_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
|
||||
<%# end %>
|
||||
<%= link_to exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<% if exercise.exercise_status == 1%>
|
||||
<li class="pollsbtn fl ml10 pollsbtn_grey">统计结果</li>
|
||||
<% else %>
|
||||
<li><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fl ml10"%></li>
|
||||
<% end%>
|
||||
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<li><a href="javascript:" class="pollsbtn btn_pu fl ml5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>);">发布试卷</a></li>
|
||||
<% elsif exercise.exercise_status == 2%>
|
||||
<li><a href="javascript:" class="pollsbtn btn_de fl ml5" onclick="republish_exercise(<%= exercise.id%>);">取消发布</a></li>
|
||||
<% else%>
|
||||
<li class="pollsbtn fl ml10 pollsbtn_grey" style="margin-left: 5px;" >发布试卷</li>
|
||||
<% end%>
|
||||
|
||||
<%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %>
|
||||
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<li><%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml5"%></li>
|
||||
<% else%>
|
||||
<li class="polls_de_grey fr ml5" title="未发布的试卷才能进行编辑">编辑</li>
|
||||
<% end%>
|
||||
|
||||
<%# if exercise.exercise_status == 2 %>
|
||||
<!--<li><a class="polls_de fr ml5" onclick="" href="javascript:">关闭</a></li>-->
|
||||
<%# else %>
|
||||
<!--<li class="polls_de_grey fr ml5" title="发布的问卷才能进行关闭">关闭</li>-->
|
||||
<%# end%>
|
||||
|
||||
<%# if exercise.exercise_status == 1%>
|
||||
<!--<li class="polls_de_grey fr ml5">导出</li>-->
|
||||
<%# elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %>
|
||||
<!--<li><%#= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%></li>-->
|
||||
<%# end%>
|
||||
|
||||
|
||||
<li class="polls_date fr"><%= format_date exercise.created_at.to_date%></li>
|
||||
<% else%>
|
||||
<% if exercise.exercise_status == 2%>
|
||||
<%# if has_commit%>
|
||||
<!--li><%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue" %></li>
|
||||
<li class="pollsbtn_tip fl ml5">已答</li-->
|
||||
<%#else%>
|
||||
<%= link_to exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%>
|
||||
<%#end%>
|
||||
<% end%>
|
||||
<li class="polls_date fr mr10"><%= format_date exercise.created_at.to_date%></li>
|
||||
<%# has_commit = has_commit_poll?(poll.id ,User.current)%>
|
||||
<% exercise_name = exercise.exercise_name.empty? ? l(:label_poll_new) : exercise.exercise_name%>
|
||||
<% if @is_teacher%>
|
||||
<li title="<%= exercise.exercise_name %>">
|
||||
<div style="width: 310px;float: left;">
|
||||
<%# if has_commit %>
|
||||
<%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
|
||||
<%# else %>
|
||||
<%#= link_to poll_name, exercise_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
|
||||
<%# end %>
|
||||
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<%# if exercise.exercise_status == 2 %>
|
||||
<!--<li><a class="polls_de fr ml5" onclick="" href="javascript:">关闭</a></li>-->
|
||||
<%# else %>
|
||||
<!--<li class="polls_de_grey fr ml5" title="发布的问卷才能进行关闭">关闭</li>-->
|
||||
<%# end%>
|
||||
|
||||
<%# if exercise.exercise_status == 1%>
|
||||
<!--<li class="polls_de_grey fr ml5">导出</li>-->
|
||||
<%# elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %>
|
||||
<!--<li><%#= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%></li>-->
|
||||
<%# end%>
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<li><a href="javascript:" class="pollsbtn btn_pu fr mr5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></li>
|
||||
<% elsif exercise.exercise_status == 2%>
|
||||
<li><a href="javascript:" class="pollsbtn btn_de fr mr5" onclick="republish_exercise(<%= exercise.id%>,<%=index.to_i %>);">取消发布</a></li>
|
||||
<% else%>
|
||||
<li class="pollsbtn fr mr10 pollsbtn_grey" style="margin-left: 5px;" >发布试卷</li>
|
||||
<% end%>
|
||||
|
||||
<% if exercise.exercise_status == 1%>
|
||||
<li class="pollsbtn fr mr10 pollsbtn_grey">统计结果</li>
|
||||
<% else %>
|
||||
<li><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fr mr10"%></li>
|
||||
<% end%>
|
||||
|
||||
<%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %>
|
||||
|
||||
<% if exercise.exercise_status == 1 %>
|
||||
<li><%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml10"%></li>
|
||||
<li class="polls_date fr"><%=exercise.publish_time.nil? ? "未发布" : "将于"+format_time(exercise.publish_time.to_s)+"发布"%></li>
|
||||
<% else%>
|
||||
<li class="polls_de_grey fr ml10" title="未发布的试卷才能进行编辑">编辑</li>
|
||||
<li class="polls_date fr">已发布</li>
|
||||
<% end%>
|
||||
|
||||
<% else%>
|
||||
<% if exercise.exercise_status == 2%>
|
||||
<%# if has_commit%>
|
||||
<!--li><%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue" %></li>
|
||||
<li class="pollsbtn_tip fl ml5">已答</li-->
|
||||
<%#else%>
|
||||
<%= link_to (index.to_i+1).to_s+". "+exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%>
|
||||
<%#end%>
|
||||
<% end%>
|
||||
<li class="polls_date fr mr10">截止时间:<%= format_time(exercise.end_time.to_s)%></li>
|
||||
<% end%>
|
|
@ -1,194 +1,219 @@
|
|||
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
//编辑问卷描述之后
|
||||
var popWindow ; //弹出框的引用
|
||||
var importPollPopWindow; //选择导入的弹出框引用
|
||||
function edit_head(){
|
||||
$("#polls_description").val($("#polls_description_div").html());
|
||||
}
|
||||
$(function(){
|
||||
//点击空白处
|
||||
$(document).bind('click',function(e){
|
||||
//弹出框非空 不是a标签 点击的不是弹出框 ,那么弹出框就会隐藏
|
||||
if(popWindow && e.target.nodeName != 'A' && !popWindow.is(e.target) && popWindow.has(e.target).length === 0){ // Mark 1
|
||||
popWindow.css('display', 'none');
|
||||
}
|
||||
if(importPollPopWindow && e.target.nodeName != 'A' && !importPollPopWindow.is(e.target) && importPollPopWindow.has(e.target).length === 0){
|
||||
importPollPopWindow.css('display', 'none');
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
function dismiss(quest_type,quest_id){
|
||||
popWindow = $("#div_"+quest_type+"_"+quest_id);
|
||||
if(popWindow){
|
||||
popWindow.css('display', 'none');
|
||||
}
|
||||
}
|
||||
|
||||
function chooseQuestionType(quest_type,quest_id){
|
||||
//quest_type 分为 mc mcq single multi
|
||||
//quest_id 是quetion的id 下同
|
||||
if(popWindow){
|
||||
popWindow.css('display', 'none');
|
||||
}
|
||||
popWindow = $("#div_"+quest_type+"_"+quest_id);
|
||||
$("#div_"+quest_type+"_"+quest_id).click(function(e){
|
||||
e.stopPropagation(); //组织冒泡到document.body中去
|
||||
});
|
||||
$("#div_"+quest_type+"_"+quest_id).css("position", "absolute");
|
||||
|
||||
$("#div_"+quest_type+"_"+quest_id).css("top", $("#add_"+quest_type+"_"+quest_id).offset().top+30);
|
||||
|
||||
$("#div_"+quest_type+"_"+quest_id).css("left", $("#add_"+quest_type+"_"+quest_id).offset().left-10);
|
||||
if( $("#div_"+quest_type+"_"+quest_id).css('display') == 'block') {
|
||||
$("#div_"+quest_type+"_"+quest_id).css('display', 'none');
|
||||
}
|
||||
else{
|
||||
$("#div_"+quest_type+"_"+quest_id).css('display', 'block');
|
||||
}
|
||||
}
|
||||
|
||||
//选择导入调查问卷
|
||||
function importPoll(){
|
||||
importPollPopWindow = $("#import_poll");
|
||||
$("#import_poll").css("position", "absolute");
|
||||
|
||||
$("#import_poll").css("top", $("#import_btn").offset().top+30);
|
||||
|
||||
$("#import_poll").css("left", $("#import_btn").offset().left-65);
|
||||
$("#import_poll").css("display","block")
|
||||
}
|
||||
|
||||
function remote_import(){
|
||||
importPollPopWindow.css('display', 'none');
|
||||
if($("#import_poll").val() === 0){
|
||||
return;
|
||||
}else{
|
||||
if(confirm("确认导入问卷"+$("#import_poll").find("option:selected").text()+"?")){
|
||||
$("#import_form").submit();
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//添加标题时确定按钮
|
||||
function add_poll_question(doc,quest_type)
|
||||
{
|
||||
var title = $.trim($("#poll_questions_title").val());
|
||||
var score = $.trim($("#question_score").val());
|
||||
var standard_ans = $.trim($("#question_standard_ans").val());
|
||||
if(title.length == 0 || score.length == 0){
|
||||
alert("题目标题/分数不能为空");
|
||||
}else if(quest_type !=3 && standard_ans.length == 0) {
|
||||
alert("标准答案不能为空");
|
||||
}else{
|
||||
doc.parent().parent().parent().submit();}
|
||||
}
|
||||
//修改标题时确定按钮
|
||||
function edit_poll_question(doc,id,quest_type)
|
||||
{
|
||||
var title = $.trim($("#poll_questions_title_" + id).val());
|
||||
var score = $.trim($("#poll_question_score_"+ id).val());
|
||||
var standard_ans = $.trim($("#poll_question_standard_answer_" + id).val());
|
||||
if(title.length == 0 || score.length == 0){
|
||||
alert("题目标题/分数不能为空");
|
||||
}else if(quest_type !=3 && standard_ans.length == 0) {
|
||||
alert("标准答案不能为空");
|
||||
}else{
|
||||
doc.parent().parent().parent().submit();}
|
||||
}
|
||||
|
||||
//问卷头
|
||||
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
|
||||
function pollsSubmit(doc){
|
||||
var title = $.trim($("#exercise_name").val());
|
||||
if(title.length == 0){
|
||||
alert("测验标题不能为空");
|
||||
} else if($.trim($("#exercise_publish_time").val()) =="") {
|
||||
alert("发布时间不能为空");
|
||||
} else if($.trim($("#exercise_end_time").val()) =="") {
|
||||
alert("截止时间不能为空");
|
||||
} else if($.trim($("#exercise_time").val()) =="") {
|
||||
alert("考试时长不能为空");
|
||||
} else if(Date.parse($("#exercise_end_time").val()) <= Date.parse($("#exercise_publish_time").val())) {
|
||||
alert("截止时间必须大于发布时间");
|
||||
}
|
||||
else {
|
||||
doc.parent().parent().parent().submit();
|
||||
}
|
||||
}
|
||||
function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();}
|
||||
//
|
||||
function pollQuestionCancel(question_id){
|
||||
$("#show_poll_questions_"+question_id).show();
|
||||
$("#edit_poll_questions_"+question_id).hide();
|
||||
}
|
||||
function pollQuestionEdit(question_id){
|
||||
$("#show_poll_questions_"+question_id).hide();
|
||||
$("#edit_poll_questions_"+question_id).show();
|
||||
$("#poll_questions_title_"+question_id).focus();
|
||||
}
|
||||
//单选题
|
||||
function add_single_answer(doc)
|
||||
{
|
||||
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span>: </label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
|
||||
"</li><div class='cl'></div>");
|
||||
}
|
||||
function add_candidate_answer(doc)
|
||||
{
|
||||
doc.parent().after("<li class='ur_item'><label>候选答案<span class='ur_index'></span>: </label><input maxlength='200' type='text' name='exercise_choice["+new Date().getTime()+"]' placeholder='请输入候选答案(选填)'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_candidate_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
|
||||
"</li><div class='cl'></div>");
|
||||
}
|
||||
function remove_single_answer(doc)
|
||||
{
|
||||
if(doc.parent().siblings("li").length == 0)
|
||||
{
|
||||
alert("选择题至少有一个选项");
|
||||
}
|
||||
else
|
||||
{
|
||||
doc.parent().remove();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="resources">
|
||||
<!-- 头部 -->
|
||||
<div id="polls_head_show" style="display: none;">
|
||||
<%= render :partial => 'show_head', :locals => {:exercise => @exercise}%>
|
||||
</div>
|
||||
<div id="polls_head_edit">
|
||||
<%= render :partial => 'edit_head', :locals => {:exercise => @exercise}%>
|
||||
</div>
|
||||
<% current_score = get_current_score @exercise %>
|
||||
<div class="mb5" style="display: <%= current_score == 0 ? "none" : "" %>" id="current_score_div">目前试卷总分:<span class="c_red" id="current_score"><%=current_score %>分</span></div>
|
||||
<!-- 问题 -->
|
||||
<div id="poll_content">
|
||||
<%= render :partial => 'exercise_content', :locals => {:exercise => @exercise}%>
|
||||
</div>
|
||||
|
||||
<div class="testQuestion" id="new_exercise_question">
|
||||
<%= render :partial => 'new_question', :locals => {:exercise => @exercise} %>
|
||||
</div><!--选项 end-->
|
||||
|
||||
<!-- 新增问题 -->
|
||||
<div id="new_poll_question">
|
||||
</div>
|
||||
|
||||
<div id="exercise_submit">
|
||||
<%= render :partial => 'exercise_submit', :locals => {:exercise => @exercise} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<!--contentbox end-->
|
||||
</div>
|
||||
</div><!--编辑end-->
|
||||
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
//编辑问卷描述之后
|
||||
var popWindow ; //弹出框的引用
|
||||
var importPollPopWindow; //选择导入的弹出框引用
|
||||
function edit_head(){
|
||||
$("#exercise_description").val($("#exercise_description_div").html());
|
||||
}
|
||||
$(function(){
|
||||
//点击空白处
|
||||
$(document).bind('click',function(e){
|
||||
//弹出框非空 不是a标签 点击的不是弹出框 ,那么弹出框就会隐藏
|
||||
if(popWindow && e.target.nodeName != 'A' && !popWindow.is(e.target) && popWindow.has(e.target).length === 0){ // Mark 1
|
||||
popWindow.css('display', 'none');
|
||||
}
|
||||
if(importPollPopWindow && e.target.nodeName != 'A' && !importPollPopWindow.is(e.target) && importPollPopWindow.has(e.target).length === 0){
|
||||
importPollPopWindow.css('display', 'none');
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
function dismiss(quest_type,quest_id){
|
||||
popWindow = $("#div_"+quest_type+"_"+quest_id);
|
||||
if(popWindow){
|
||||
popWindow.css('display', 'none');
|
||||
}
|
||||
}
|
||||
|
||||
function chooseQuestionType(quest_type,quest_id){
|
||||
//quest_type 分为 mc mcq single multi
|
||||
//quest_id 是quetion的id 下同
|
||||
if(popWindow){
|
||||
popWindow.css('display', 'none');
|
||||
}
|
||||
popWindow = $("#div_"+quest_type+"_"+quest_id);
|
||||
$("#div_"+quest_type+"_"+quest_id).click(function(e){
|
||||
e.stopPropagation(); //组织冒泡到document.body中去
|
||||
});
|
||||
$("#div_"+quest_type+"_"+quest_id).css("position", "absolute");
|
||||
|
||||
$("#div_"+quest_type+"_"+quest_id).css("top", $("#add_"+quest_type+"_"+quest_id).offset().top+30);
|
||||
|
||||
$("#div_"+quest_type+"_"+quest_id).css("left", $("#add_"+quest_type+"_"+quest_id).offset().left-10);
|
||||
if( $("#div_"+quest_type+"_"+quest_id).css('display') == 'block') {
|
||||
$("#div_"+quest_type+"_"+quest_id).css('display', 'none');
|
||||
}
|
||||
else{
|
||||
$("#div_"+quest_type+"_"+quest_id).css('display', 'block');
|
||||
}
|
||||
}
|
||||
|
||||
//选择导入调查问卷
|
||||
function importPoll(){
|
||||
importPollPopWindow = $("#import_poll");
|
||||
$("#import_poll").css("position", "absolute");
|
||||
|
||||
$("#import_poll").css("top", $("#import_btn").offset().top+30);
|
||||
|
||||
$("#import_poll").css("left", $("#import_btn").offset().left-65);
|
||||
$("#import_poll").css("display","block")
|
||||
}
|
||||
|
||||
function remote_import(){
|
||||
importPollPopWindow.css('display', 'none');
|
||||
if($("#import_poll").val() === 0){
|
||||
return;
|
||||
}else{
|
||||
if(confirm("确认导入问卷"+$("#import_poll").find("option:selected").text()+"?")){
|
||||
$("#import_form").submit();
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//添加标题时确定按钮
|
||||
function add_poll_question(doc,quest_type)
|
||||
{
|
||||
var title = $.trim($("#poll_questions_title").val());
|
||||
var score = $.trim($("#question_score").val());
|
||||
var standard_ans = $.trim($("#question_standard_ans").val());
|
||||
if(title.length == 0 || score.length == 0){
|
||||
alert("题目标题/分数不能为空");
|
||||
}else if(!/^[1-9][0-9]*$/.test(score)) {
|
||||
alert("分数必须是非零开头的数字");
|
||||
}else if(quest_type !=3 && standard_ans.length == 0) {
|
||||
alert("标准答案不能为空");
|
||||
}else{
|
||||
doc.parent().parent().parent().submit();}
|
||||
}
|
||||
//修改标题时确定按钮
|
||||
function edit_poll_question(doc,id,quest_type)
|
||||
{
|
||||
var title = $.trim($("#poll_questions_title_" + id).val());
|
||||
var score = $.trim($("#poll_question_score_"+ id).val());
|
||||
var standard_ans = $.trim($("#poll_question_standard_answer_" + id).val());
|
||||
if(title.length == 0 || score.length == 0){
|
||||
alert("题目标题/分数不能为空");
|
||||
}else if(!/^[1-9][0-9]*$/.test(score)) {
|
||||
alert("分数必须是非零开头的数字");
|
||||
}else if(quest_type !=3 && standard_ans.length == 0) {
|
||||
alert("标准答案不能为空");
|
||||
}else if(quest_type ==3) {
|
||||
var div = $("#poll_answers_" + id);
|
||||
var candiate_answer = $(".candiate_answer",div);
|
||||
if(candiate_answer.length > 0) {
|
||||
for(i=0;i<candiate_answer.length;i++) {
|
||||
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("候选答案不能为空");
|
||||
} else if($.trim($(candiate_answer[i]).val()) != ""){
|
||||
doc.parent().parent().parent().submit();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
} else{
|
||||
alert("候选答案不能为空");
|
||||
}
|
||||
}else{
|
||||
doc.parent().parent().parent().submit();}
|
||||
}
|
||||
|
||||
//问卷头
|
||||
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
|
||||
function pollsSubmit(doc){
|
||||
var title = $.trim($("#exercise_name").val());
|
||||
if(title.length == 0){
|
||||
alert("测验标题不能为空");
|
||||
} else if($.trim($("#exercise_end_time").val()) =="") {
|
||||
alert("截止时间不能为空");
|
||||
} else if((Date.parse($("#exercise_end_time").val())+(24*60*60-1)*1000) < Date.now()) {
|
||||
alert("截止时间不能小于当前时间");
|
||||
} else if($.trim($("#exercise_time").val()) !="" && !/^[1-9][0-9]*$/.test($.trim($("#exercise_time").val()))) {
|
||||
alert("测验时长必须为非零开头的数字");
|
||||
} else if($.trim($("#exercise_publish_time").val()) !="" && Date.parse($("#exercise_publish_time").val()) < Date.now()) {
|
||||
alert("发布时间不能小于当前时间");
|
||||
} else if($.trim($("#exercise_publish_time").val()) !="" && Date.parse($("#exercise_end_time").val()) < Date.parse($("#exercise_publish_time").val())) {
|
||||
alert("截止时间不能小于发布时间");
|
||||
} else {
|
||||
doc.parent().parent().parent().submit();
|
||||
}
|
||||
}
|
||||
function pollsEdit(){$("#polls_head_edit").show();$("#polls_head_show").hide();}
|
||||
//
|
||||
function pollQuestionCancel(question_id){
|
||||
$("#show_poll_questions_"+question_id).show();
|
||||
$("#edit_poll_questions_"+question_id).hide();
|
||||
}
|
||||
function pollQuestionEdit(question_id){
|
||||
$("#show_poll_questions_"+question_id).hide();
|
||||
$("#edit_poll_questions_"+question_id).show();
|
||||
$("#poll_questions_title_"+question_id).focus();
|
||||
}
|
||||
//单选题
|
||||
function add_single_answer(doc)
|
||||
{
|
||||
doc.parent().after("<li class='ur_item'><label>选项<span class='ur_index'></span>: </label><input maxlength='200' type='text' name='question_answer["+new Date().getTime()+"]' placeholder='输入选项内容'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
|
||||
"</li><div class='cl'></div>");
|
||||
}
|
||||
function add_candidate_answer(doc)
|
||||
{
|
||||
doc.parent().after("<li class='ur_item'><label>候选答案<span class='ur_index'></span>: </label><input maxlength='200' type='text' name='exercise_choice["+new Date().getTime()+"]' placeholder='请输入候选答案(选填)'/>" +
|
||||
"<a class='icon_add' title='向下插入选项' onclick='add_candidate_answer($(this));'></a><a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>"+
|
||||
"</li><div class='cl'></div>");
|
||||
}
|
||||
function remove_single_answer(doc)
|
||||
{
|
||||
if(doc.parent().siblings("li").length == 0)
|
||||
{
|
||||
alert("至少有一个选项或一个候选答案");
|
||||
}
|
||||
else
|
||||
{
|
||||
doc.parent().remove();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="resources">
|
||||
<!-- 头部 -->
|
||||
<div id="polls_head_show" style="display: none;">
|
||||
<%= render :partial => 'show_head', :locals => {:exercise => @exercise} %>
|
||||
</div>
|
||||
<div id="polls_head_edit">
|
||||
<%= render :partial => 'edit_head', :locals => {:exercise => @exercise} %>
|
||||
</div>
|
||||
<% current_score = get_current_score @exercise %>
|
||||
<div class="mb5" style="display: <%= current_score == 0 ? "none" : "" %>" id="current_score_div">目前试卷总分:<span class="c_red" id="current_score"><%= current_score %>
|
||||
分</span></div>
|
||||
<!-- 问题 -->
|
||||
<div id="poll_content">
|
||||
<%= render :partial => 'exercise_content', :locals => {:exercise => @exercise} %>
|
||||
</div>
|
||||
|
||||
<div class="testQuestion" id="new_exercise_question">
|
||||
<%= render :partial => 'new_question', :locals => {:exercise => @exercise} %>
|
||||
</div>
|
||||
<!--选项 end-->
|
||||
|
||||
<!-- 新增问题 -->
|
||||
<div id="new_poll_question">
|
||||
</div>
|
||||
|
||||
<div id="exercise_submit">
|
||||
<%= render :partial => 'exercise_submit', :locals => {:exercise => @exercise} %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<!--contentbox end-->
|
||||
</div>
|
||||
</div><!--编辑end-->
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
$("#RSide").removeAttr("id");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#Container").css("width","1000px");
|
||||
<%uncomplete_question =get_uncomplete_question(exercise, User.current) %>;
|
||||
<% if (uncomplete_question.count < 1) %>
|
||||
$("#exercise_submit_btn").html("提交");
|
||||
<% end %>
|
||||
var end_time = <%=exercise.end_time.to_i%>;
|
||||
getTime(end_time);
|
||||
/*start_time = new Date();
|
||||
start_time.setFullYear(<%#=exercise_user.start_at.year%>);
|
||||
start_time.setMonth(<%#=exercise_user.start_at.month%>);
|
||||
|
@ -17,11 +23,16 @@
|
|||
function getTime(end_time) {
|
||||
//alert(end_time);
|
||||
now = new Date();
|
||||
var total_seconds = (now.getTime() - end_time)/1000;
|
||||
var total_seconds = now.getTime()/1000 - end_time;
|
||||
if (total_seconds > 0) {
|
||||
$("#exercise_submit_btn").click();
|
||||
return;
|
||||
}
|
||||
setTimeout("getTime("+end_time+");", 1000);
|
||||
//start = new Date(start_time);
|
||||
//end_time = start_time;
|
||||
//var total_seconds = total_seconds - 1;
|
||||
var hours = total_seconds / 60 / 60;
|
||||
/*var hours = total_seconds / 60 / 60;
|
||||
var hoursRound = Math.floor(hours);
|
||||
var minutes = total_seconds /60 - (60 * hoursRound);
|
||||
var minutesRound = Math.floor(minutes);
|
||||
|
@ -29,9 +40,9 @@
|
|||
var secondsRound = Math.round(seconds);
|
||||
$("#rest_hours").html(hoursRound);
|
||||
$("#rest_minutes").html(minutesRound);
|
||||
$("#rest_seconds").html(secondsRound);
|
||||
$("#rest_seconds").html(secondsRound);*/
|
||||
//if(total_seconds >0) {
|
||||
setTimeout("getTime("+end_time+");", 1000);
|
||||
//setTimeout("getTime("+end_time+");", 1000);
|
||||
//}
|
||||
}
|
||||
</script>
|
||||
|
@ -41,8 +52,11 @@
|
|||
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||
<div id="start_time" style="display: none"><%=exercise_user.start_at %></div>
|
||||
<div class="fontGrey2">
|
||||
<span class="mr130">开始时间:<%=format_time(exercise_user.start_at.to_s)%></span>
|
||||
<span class="mr130">测验时长:<%=exercise.time %>分钟</span>
|
||||
<span class="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>
|
||||
<% unless exercise.time == -1 %>
|
||||
<span class="fr">测验时长:<%=exercise.time %>分钟</span>
|
||||
<% end %>
|
||||
<!--
|
||||
<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>
|
||||
-->
|
||||
|
@ -90,6 +104,11 @@
|
|||
{
|
||||
obj.checked = false;
|
||||
}
|
||||
if(dataObj.complete == 1) {
|
||||
$("#exercise_submit_btn").html("提交");
|
||||
} else {
|
||||
$("#exercise_submit_btn").html("保存");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -144,6 +163,11 @@
|
|||
{
|
||||
obj.checked = false;
|
||||
}
|
||||
if(dataObj.complete == 1) {
|
||||
$("#exercise_submit_btn").html("提交");
|
||||
} else {
|
||||
$("#exercise_submit_btn").html("保存");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -186,12 +210,17 @@
|
|||
success: function (data) {
|
||||
var dataObj = eval(data);
|
||||
obj.value = dataObj.text;
|
||||
if(dataObj.complete == 1) {
|
||||
$("#exercise_submit_btn").html("提交");
|
||||
} else {
|
||||
$("#exercise_submit_btn").html("保存");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
<input class="fillInput" placeholder="在此填入答案" type="text" value="" onblur="onblur_<%= exercise_question.id %>(this);" <%= @can_edit_excercise?"":"disabled=disabled" %>>
|
||||
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(exercise_question.id,User.current.id).html_safe %>" onblur="onblur_<%= exercise_question.id %>(this);" <%= @can_edit_excercise?"":"disabled=disabled" %>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -199,7 +228,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div class="ur_buttons">
|
||||
<%= link_to l(:button_submit),commit_exercise_exercise_path(exercise), :method => :post,:class => "ur_button_submit",:style => "margin-left:80px;",:format => 'js',:remote=>true %>
|
||||
<%= link_to "保存",commit_exercise_exercise_path(exercise),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:80px;",:format => 'js',:remote=>true %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<!--contentbox end-->
|
||||
|
|
|
@ -10,8 +10,11 @@
|
|||
<div class="testStatus"><!--头部显示 start-->
|
||||
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||
<div class="fontGrey2">
|
||||
<span class="mr130">开始时间:<%=format_time(exercise_user.start_at.to_s) %></span>
|
||||
<span class="mr130">测验时长:<%=exercise.time %>分钟</span>
|
||||
<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>
|
||||
<% unless exercise.time == -1 %>
|
||||
<span class="fr">测验时长:<%=exercise.time %>分钟</span>
|
||||
<% 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>
|
||||
|
@ -29,14 +32,14 @@
|
|||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
<span class="ml15 c_red">
|
||||
<% answer = get_user_answer(exercise_question, User.current)%>
|
||||
<% standard_answer = get_user_standard_answer(exercise_question, User.current)%>
|
||||
<% if answer.first.exercise_choice.choice_position == standard_answer.first.exercise_choice_id %>
|
||||
<% 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) %>
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) if exercise_question.exercise_standard_answers.first %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
|
@ -46,7 +49,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<%= radio_button "exercise",exercise_question.id.to_s+"exercise_choice_id",exercise_choice.id,:class=>"ur_radio",:checked => answer_be_selected?(exercise_choice,User.current),:disabled => !@can_edit_excercise %>
|
||||
<%= radio_button "exercise",exercise_question.id.to_s+"exercise_choice_id",exercise_choice.id,:class=>"ur_radio",:checked => answer_be_selected?(exercise_choice,user),:disabled => !@can_edit_excercise %>
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
|
@ -68,9 +71,9 @@
|
|||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
<span class="ml15 c_red">
|
||||
<% answer = get_user_answer(exercise_question, User.current)%>
|
||||
<% standard_answer = get_user_standard_answer(exercise_question, User.current)%>
|
||||
<% if get_mulscore(exercise_question, User.current).to_i == standard_answer.first.exercise_choice_id %>
|
||||
<% 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 %>
|
||||
×
|
||||
|
@ -85,7 +88,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<input class="ur_radio" type="checkbox" <%= answer_be_selected?(exercise_choice,User.current) ? "checked":"" %> <%= @can_edit_poll?"":"disabled=disabled" %> >
|
||||
<input class="ur_radio" type="checkbox" <%= answer_be_selected?(exercise_choice,user) ? "checked":"" %> <%= @can_edit_excercise?"":"disabled=disabled" %> >
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
|
@ -107,14 +110,14 @@
|
|||
<div>
|
||||
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||
<span class="ml15 c_red">
|
||||
<% answer = get_user_answer(exercise_question, User.current)%>
|
||||
<% standard_answer = get_user_standard_answer(exercise_question, User.current)%>
|
||||
<% if standard_answer.include?(answer.first.answer_text) %>
|
||||
<% 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><br />
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) if exercise_question.exercise_standard_answers.first %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
|
@ -123,7 +126,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div>
|
||||
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(exercise_question.id,User.current.id).html_safe %>" <%= @can_edit_poll?"":"disabled=disabled" %>>
|
||||
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(exercise_question.id,user.id).html_safe %>" <%= @can_edit_excercise?"":"disabled=disabled" %>>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -19,14 +19,9 @@
|
|||
<% mc_count = exercise.exercise_questions.where("question_type=1").count %>
|
||||
<% mcq_count = exercise.exercise_questions.where("question_type=2").count %>
|
||||
<% single_count = exercise.exercise_questions.where("question_type=3").count %>
|
||||
<p class="f14">当前测验
|
||||
<% if question_count > 0 %>共有<%= question_count %>道题,其中<% end %>
|
||||
<% if mc_count > 0 %><%= mc_count %>道单选、<% end %>
|
||||
<% if mcq_count > 0 %><%= mcq_count %>道多选、<% end %>
|
||||
<% if single_count > 0%><%= single_count %>道填空,<% end %>
|
||||
总分为<span class="c_red"><%=current_score %></span>分。
|
||||
<p class="f14">当前测验<%if question_count >0%>共有<%= question_count %>道题,其中<%end%><%if mc_count > 0%><%=mc_count %>道单选、<%end%><%if mcq_count > 0%><%=mcq_count %>道多选、<%end%><%if single_count > 0%><%=single_count %>道填空,<%end%>总分为<span class="c_red"><%=current_score %></span>分。
|
||||
<br /><br />
|
||||
是否确定提交该测验?
|
||||
<% if exercise.publish_time.nil? %>点击提交后测验将立即发布,<% end %>是否确定提交该测验?
|
||||
</p>
|
||||
<div class="polls_btn_box">
|
||||
<a class="upload_btn" onclick="exercise_submit();">
|
||||
|
|
|
@ -10,9 +10,13 @@
|
|||
<div class="testStatus"><!--头部显示 start-->
|
||||
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||
<div class="fontGrey2">
|
||||
<span class="mr130">发布时间:<%=format_time(exercise.publish_time.to_s) %></span>
|
||||
<span class="mr130">截止时间:<%=format_time(exercise.end_time.to_s) %></span>
|
||||
<span class="fr">测验时长:<%=exercise.time %>分钟</span>
|
||||
<% unless exercise.publish_time.nil? %>
|
||||
<span class="mr100">发布时间:<%=Time.parse(h(exercise.publish_time)).strftime("%Y-%m-%d %H:%M:%S") %></span>
|
||||
<% end %>
|
||||
<span class="mr100">截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") %></span>
|
||||
<% if exercise.time != -1 %>
|
||||
<span class="fr">测验时长:<%=exercise.time %>分钟</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||
<div class="cl"></div>
|
||||
|
@ -92,7 +96,7 @@
|
|||
<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) %>
|
||||
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) if exercise_question.exercise_standard_answers.first%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
<div class="polls_head">
|
||||
<h2>所有试卷
|
||||
<span>(<%= @obj_count%>)</span>
|
||||
</h2>
|
||||
<% if @is_teacher%>
|
||||
<%#= link_to "导入", other_poll_poll_index_path(:polls_group_id => @course.id), :remote=>true,:class => "newbtn"%>
|
||||
<%= link_to "新建试卷 ", new_exercise_path(:course_id => @course.id), :class => "newbtn" %>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div id="polls_list" class="polls_list">
|
||||
|
||||
<% @exercises.each do |exercise|%>
|
||||
<ul id="exercises_<%= exercise.id %>" class="polls_list_ul">
|
||||
<%= render :partial => 'exercise', :locals => {:exercise => exercise} %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
||||
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
|
||||
<div class="cl"></div>
|
||||
<div class="polls_head" style="width:730px;">
|
||||
<h2>所有试卷
|
||||
<span>(<%= @obj_count%>)</span>
|
||||
</h2>
|
||||
<% if @is_teacher%>
|
||||
<%#= link_to "导入", other_poll_poll_index_path(:polls_group_id => @course.id), :remote=>true,:class => "newbtn"%>
|
||||
<%= link_to "新建试卷 ", new_exercise_path(:course_id => @course.id), :class => "newbtn" %>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div id="polls_list" class="polls_list">
|
||||
|
||||
<% @exercises.each_with_index do |exercise,index|%>
|
||||
<ul id="exercises_<%= exercise.id %>" class="polls_list_ul">
|
||||
<%= render :partial => 'exercise', :locals => {:exercise => exercise,:index => index} %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
||||
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
|
||||
</ul>
|
||||
|
||||
<div class="cl"></div>
|
||||
</div><!--列表end-->
|
|
@ -1,60 +1,62 @@
|
|||
<%= form_for(ExerciseQuestion.new,
|
||||
:html => { :multipart => true },
|
||||
:url=>create_exercise_question_exercise_path(exercise.id),
|
||||
:remote=>true ) do |f| %>
|
||||
<div class="questionContainer">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="1" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题题目" type="text">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<% score = exercise.exercise_questions.where("question_type=1").last.nil? ? "": exercise.exercise_questions.where("question_type=1").last.question_score %>
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项A<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项B<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项C<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'/>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项D<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'/>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input id="question_standard_ans" name="exercise_choice" placeholder="若标准答案为A,在此输入A即可" type="text">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),1);"> 保存 </a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<%= form_for(ExerciseQuestion.new,
|
||||
:html => { :multipart => true },
|
||||
:url=>create_exercise_question_exercise_path(exercise.id),
|
||||
:remote=>true ) do |f| %>
|
||||
<div class="questionContainer">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="1" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题题目" type="text">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<% score = exercise.exercise_questions.where("question_type=1").last.nil? ? "": exercise.exercise_questions.where("question_type=1").last.question_score %>
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<li class="ur_item">
|
||||
<label>选项A<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项B<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项C<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'/>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项D<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'/>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input id="question_standard_ans" name="exercise_choice" placeholder="若标准答案为A,在此输入A即可" type="text">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),1);"> 保存 </a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -1,60 +1,62 @@
|
|||
<%= form_for(ExerciseQuestion.new,
|
||||
:html => { :multipart => true },
|
||||
:url=>create_exercise_question_exercise_path(exercise.id),
|
||||
:remote=>true ) do |f| %>
|
||||
<div class="questionContainer">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="2" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题题目" type="text">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<% score = exercise.exercise_questions.where("question_type=2").last.nil? ? "": exercise.exercise_questions.where("question_type=2").last.question_score %>
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项A<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项B<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项C<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项D<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input id="question_standard_ans" name="exercise_choice" placeholder="若标准答案为A,B,C,在答案输入框填入ABC即可" type="text">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),2);"> 保存 </a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<%= form_for(ExerciseQuestion.new,
|
||||
:html => { :multipart => true },
|
||||
:url=>create_exercise_question_exercise_path(exercise.id),
|
||||
:remote=>true ) do |f| %>
|
||||
<div class="questionContainer">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
<input name="question_type" value="2" type="hidden">
|
||||
<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题题目" type="text">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<% score = exercise.exercise_questions.where("question_type=2").last.nil? ? "": exercise.exercise_questions.where("question_type=2").last.question_score %>
|
||||
<label>分数<span class="ur_index"></span>: </label>
|
||||
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<li class="ur_item">
|
||||
<label>选项A<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[0]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项B<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[1]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项C<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[2]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>选项D<span class="ur_index"></span>: </label>
|
||||
<input maxlength="200" type='text' name='question_answer[3]' placeholder='输入选项内容'>
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>标准答案<span class="ur_index"></span>: </label>
|
||||
<input id="question_standard_ans" name="exercise_choice" placeholder="若标准答案为A,B,C,在答案输入框填入ABC即可" type="text">
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),2);"> 保存 </a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();"> 取消 </a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -8,7 +8,7 @@
|
|||
<input name="question_type" value="3" type="hidden">
|
||||
<input maxlength="250" class="questionTitle" name="question_title" id="poll_questions_title" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text">
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<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 %>
|
||||
|
@ -16,26 +16,28 @@
|
|||
<input id="question_score" value="<%= score%>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>候选答案一<span class="ur_index"></span>: </label>
|
||||
<input name="exercise_choice[0]" placeholder="请输入候选答案一" type="text">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>候选答案二<span class="ur_index"></span>: </label>
|
||||
<input name="exercise_choice[1]" placeholder="请输入候选答案二(选填)" type="text">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>候选答案三<span class="ur_index"></span>: </label>
|
||||
<input name="exercise_choice[2]" placeholder="请输入候选答案三(选填)" type="text">
|
||||
<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div>
|
||||
<li class="ur_item">
|
||||
<label>候选答案一<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>
|
||||
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label>候选答案二<span class="ur_index"></span>: </label>
|
||||
<input 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>候选答案三<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>
|
||||
</li>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -1,111 +1,111 @@
|
|||
<div>
|
||||
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||
<%= exercise_question.question_title %>
|
||||
<span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span>
|
||||
</div>
|
||||
|
||||
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :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;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<input class="ur_radio" type="radio" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!--单选题显示 end-->
|
||||
<!-- 新增问题 -->
|
||||
<div id="insert_new_poll_question_mc_<%=exercise_question.id%>">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function insert_MC(quest_type,quest_num,quest_id){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
} else{
|
||||
<% score =exercise_question.question_score %>
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
||||
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.exercise.id),:remote=>true) do |f|%>'+
|
||||
' <div class="questionContainer" style="width: 680px;"> '+
|
||||
'<div class="ur_editor_title"> '+
|
||||
'<label>问题: </label>'+
|
||||
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
|
||||
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
|
||||
'<input type="hidden" name="question_type" value="1"/>'+
|
||||
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题题目" type="text"/>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_content">'+
|
||||
'<ul>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>分数<span class="ur_index"></span>: </label>'+
|
||||
'<input value="<%=score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
|
||||
'</li>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项A<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项B<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项C<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项D<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>标准答案<span class="ur_index"></span>: </label>'+
|
||||
'<input name="exercise_choice" id="question_standard_ans" placeholder="若标准答案为A,在此输入A即可" type="text">'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</ul>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_footer">'+
|
||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),1);">'+
|
||||
'保存'+
|
||||
'</a>'+
|
||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<%= l(:button_cancel)%>'+
|
||||
'</a>'+
|
||||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<% end%>'
|
||||
);
|
||||
$("#poll_questions_title").focus();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
||||
}
|
||||
}
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||
<%= exercise_question.question_title %>
|
||||
<span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span>
|
||||
</div>
|
||||
|
||||
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :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;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<input class="ur_radio" type="radio" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!--单选题显示 end-->
|
||||
<!-- 新增问题 -->
|
||||
<div id="insert_new_poll_question_mc_<%=exercise_question.id%>">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function insert_MC(quest_type,quest_num,quest_id){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
} else{
|
||||
<% score =exercise_question.question_score %>
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
||||
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.exercise.id),:remote=>true) do |f|%>'+
|
||||
' <div class="questionContainer" style="width: 680px;"> '+
|
||||
'<div class="ur_editor_title"> '+
|
||||
'<label>问题: </label>'+
|
||||
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
|
||||
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
|
||||
'<input type="hidden" name="question_type" value="1"/>'+
|
||||
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题题目" type="text"/>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_content">'+
|
||||
'<ul>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>分数<span class="ur_index"></span>: </label>'+
|
||||
'<input value="<%=score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
|
||||
'</li><div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项A<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项B<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项C<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项D<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li></div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>标准答案<span class="ur_index"></span>: </label>'+
|
||||
'<input name="exercise_choice" id="question_standard_ans" placeholder="若标准答案为A,在此输入A即可" type="text">'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</ul>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_footer">'+
|
||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),1);">'+
|
||||
'保存'+
|
||||
'</a>'+
|
||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<%= l(:button_cancel)%>'+
|
||||
'</a>'+
|
||||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<% end%>'
|
||||
);
|
||||
$("#poll_questions_title").focus();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -1,109 +1,109 @@
|
|||
<div>
|
||||
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||
<%= exercise_question.question_title %>
|
||||
<span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span>
|
||||
</div>
|
||||
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :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_mcq_<%=exercise_question.id%>" onclick="dismiss('mcq',<%=exercise_question.id%>);insert_MCQ('mcq',<%=exercise_question.question_number%>,<%=exercise_question.id%>);"></a>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table" style="width:675px;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<input class="ur_radio" type="checkbox" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!--多选题显示 end-->
|
||||
<!-- 新增问题 -->
|
||||
<div id="insert_new_poll_question_mcq_<%=exercise_question.id%>">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function insert_MCQ(quest_type,quest_num,quest_id){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == ""){
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
} else {
|
||||
<% score =exercise_question.question_score %>
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
||||
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.exercise.id),:remote=>true) do |f|%>'+
|
||||
' <div class="questionContainer" style="width: 680px;"> '+
|
||||
'<div class="ur_editor_title"> '+
|
||||
'<label>问题: </label>'+
|
||||
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
|
||||
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
|
||||
'<input type="hidden" name="question_type" value="2"/>'+
|
||||
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题题目" type="text"/>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_content">'+
|
||||
'<ul>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>分数<span class="ur_index"></span>: </label>'+
|
||||
'<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
|
||||
'</li>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项A<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项B<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项C<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项D<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>标准答案<span class="ur_index"></span>: </label>'+
|
||||
'<input name="exercise_choice" id="question_standard_ans" placeholder="若标准答案为A,B,C,在答案输入框填入ABC即可" type="text">'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</ul>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_footer">'+
|
||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),2);">'+
|
||||
'保存'+
|
||||
'</a>'+
|
||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<%= l(:button_cancel)%>'+
|
||||
'</a>'+
|
||||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<% end%>'
|
||||
);
|
||||
$("#poll_questions_title").focus();
|
||||
}
|
||||
}else {
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
||||
}
|
||||
}
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||
<%= exercise_question.question_title %>
|
||||
<span class="ml10">(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)</span>
|
||||
</div>
|
||||
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :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;">
|
||||
<tbody>
|
||||
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<input class="ur_radio" type="checkbox" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
|
||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div><!--多选题显示 end-->
|
||||
<!-- 新增问题 -->
|
||||
<div id="insert_new_poll_question_mcq_<%=exercise_question.id%>">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function insert_MCQ(quest_type,quest_num,quest_id){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == ""){
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
} else {
|
||||
<% score =exercise_question.question_score %>
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
||||
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.exercise.id),:remote=>true) do |f|%>'+
|
||||
' <div class="questionContainer" style="width: 680px;"> '+
|
||||
'<div class="ur_editor_title"> '+
|
||||
'<label>问题: </label>'+
|
||||
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
|
||||
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
|
||||
'<input type="hidden" name="question_type" value="2"/>'+
|
||||
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题题目" type="text"/>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_content">'+
|
||||
'<ul>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>分数<span class="ur_index"></span>: </label>'+
|
||||
'<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
|
||||
'</li><div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项A<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项B<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项C<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>选项D<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li></div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>标准答案<span class="ur_index"></span>: </label>'+
|
||||
'<input name="exercise_choice" id="question_standard_ans" placeholder="若标准答案为A,B,C,在答案输入框填入ABC即可" type="text">'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</ul>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_footer">'+
|
||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),2);">'+
|
||||
'保存'+
|
||||
'</a>'+
|
||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<%= l(:button_cancel)%>'+
|
||||
'</a>'+
|
||||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<% end%>'
|
||||
);
|
||||
$("#poll_questions_title").focus();
|
||||
}
|
||||
}else {
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -3,10 +3,14 @@
|
|||
<!-- <a class='ur_icon_add' title='导入' id="import_btn" onclick="importPoll();"></a> -->
|
||||
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||
<div class="fontGrey2">
|
||||
<span class="mr100">发布时间:<%=Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.publish_time%></span>
|
||||
<span class="mr100">截止时间:<%=Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.end_time %></span>
|
||||
<span>测验时长:<%= exercise.time %>分钟</span></div>
|
||||
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||
<div class="cl"></div>
|
||||
<% unless exercise.publish_time.nil? %>
|
||||
<span class="mr100">发布时间:<%=Time.parse(h(exercise.publish_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.publish_time%></span>
|
||||
<% end %>
|
||||
<span class="mr100">截止时间:<%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.end_time %></span>
|
||||
<% if exercise.time != -1 %>
|
||||
<span>测验时长:<%= exercise.time %>分钟</span>
|
||||
<% end %>
|
||||
</div>
|
||||
<pre class="fontGrey2 font_cus"><%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%></pre>
|
||||
<div class="cl"></div>
|
||||
</div>
|
|
@ -1,85 +1,85 @@
|
|||
<div>
|
||||
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||
<%= exercise_question.question_title %>
|
||||
</div>
|
||||
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :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_single_<%=exercise_question.id%>" onclick="dismiss('single',<%=exercise_question.id%>);insert_SINGLE('single',<%=exercise_question.question_number%>,<%=exercise_question.id%>);"></a>
|
||||
<div class="cl"></div>
|
||||
<div>
|
||||
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
|
||||
候选答案:<%= exercise_choice.answer_text%><br />
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 新增问题 -->
|
||||
<div id="insert_new_poll_question_single_<%=exercise_question.id%>">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function insert_SINGLE(quest_type,quest_num,quest_id){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
} else {
|
||||
<% score =exercise_question.question_score %>
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
||||
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.exercise.id),:remote=>true) do |f|%>'+
|
||||
' <div class="questionContainer" style="width: 680px;"> '+
|
||||
'<div class="ur_editor_title"> '+
|
||||
'<label>问题: </label>'+
|
||||
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
|
||||
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
|
||||
'<input type="hidden" name="question_type" value="3"/>'+
|
||||
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text"/>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_content">'+
|
||||
'<ul>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>分数<span class="ur_index"></span>: </label>'+
|
||||
'<input value="<%= score %>" id="question_score" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
|
||||
'</li>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>候选答案一<span class="ur_index"></span>: </label>'+
|
||||
'<input type="text" name="exercise_choice[0]" placeholder="请输入候选答案一"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>候选答案二<span class="ur_index"></span>: </label>'+
|
||||
'<input type="text" name="exercise_choice[1]" placeholder="请输入候选答案二(选填)"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>候选答案三<span class="ur_index"></span>: </label>'+
|
||||
'<input maxlength="200" type="text" name="exercise_choice[2]" placeholder="请输入候选答案三(选填)"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</ul>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_footer">'+
|
||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),3);">'+
|
||||
'保存'+
|
||||
'</a>'+
|
||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<%= l(:button_cancel)%>'+
|
||||
'</a>'+
|
||||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<% end%>'
|
||||
);
|
||||
$("#poll_questions_title").focus();
|
||||
}
|
||||
} else {
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
||||
}
|
||||
}
|
||||
<div>
|
||||
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||
<%= exercise_question.question_title %>
|
||||
</div>
|
||||
<%= link_to("", delete_exercise_question_exercise_index_path(:exercise_question => exercise_question.id, :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| %>
|
||||
候选答案:<%= exercise_choice.answer_text%><br />
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 新增问题 -->
|
||||
<div id="insert_new_poll_question_single_<%=exercise_question.id%>">
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function insert_SINGLE(quest_type,quest_num,quest_id){
|
||||
var forms = $("form.new_exercise_question");
|
||||
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
|
||||
if(forms.length > 0){
|
||||
alert("请先保存正在编辑的题目再新建。");
|
||||
} else {
|
||||
<% score =exercise_question.question_score %>
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
||||
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.exercise.id),:remote=>true) do |f|%>'+
|
||||
' <div class="questionContainer" style="width: 680px;"> '+
|
||||
'<div class="ur_editor_title"> '+
|
||||
'<label>问题: </label>'+
|
||||
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
|
||||
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
|
||||
'<input type="hidden" name="question_type" value="3"/>'+
|
||||
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text"/>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_content" 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>候选答案一<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>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>候选答案二<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer" type="text" name="exercise_choice[1]" placeholder="请输入候选答案二(选填)"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li>'+
|
||||
'<div class="cl"></div>'+
|
||||
'<li class="ur_item">'+
|
||||
'<label>候选答案三<span class="ur_index"></span>: </label>'+
|
||||
'<input class="candiate_answer" type="text" name="exercise_choice[2]" placeholder="请输入候选答案三(选填)"/>'+
|
||||
'<a class="icon_add" title="向下插入选项" onclick="add_candidate_answer($(this));"></a>'+
|
||||
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
|
||||
'</li></div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</ul>'+
|
||||
'</div>'+
|
||||
'<div class="ur_editor_footer">'+
|
||||
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),3);">'+
|
||||
'保存'+
|
||||
'</a>'+
|
||||
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
|
||||
'<%= l(:button_cancel)%>'+
|
||||
'</a>'+
|
||||
'</div>'+
|
||||
'<div class="cl"></div>'+
|
||||
'</div>'+
|
||||
'<% end%>'
|
||||
);
|
||||
$("#poll_questions_title").focus();
|
||||
}
|
||||
} else {
|
||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -44,7 +44,13 @@
|
|||
<li>
|
||||
<ul class="mt10 fl">
|
||||
<li class="hworkStName mr15 mt16" title="姓名">
|
||||
<%= exercise.user.show_name%>
|
||||
<% name = exercise.user.show_name %>
|
||||
<% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
|
||||
<%= link_to name,show_student_result_exercise_path(@exercise,:user_id => exercise.user.id) %>
|
||||
<% else %>
|
||||
<span title="截止日期未到,暂不能查看学生答题结果。"><%=name%></span>
|
||||
<%#= link_to name,'',:title=>"截止日期未到,暂不能查看学生答题结果。" %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="hworkStID mr10 mt16" title="学号">
|
||||
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status}) %>');
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status,:exercise =>@exercise}) %>');
|
||||
showModal('ajax-modal', '270px');
|
||||
$('#ajax-modal').css('height','110px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
|
|
|
@ -1,63 +1,68 @@
|
|||
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||
<script type="text/javascript">
|
||||
function republish_exercise(exercise_id)
|
||||
{
|
||||
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||
"<div class='upload_con'>" +
|
||||
"<div class='upload_box'>" +
|
||||
"<p class='polls_box_p'>取消发布后学生答题将会被清空<br />是否确定取消发布该测验?</p>" +
|
||||
"<div class='polls_btn_box'>" +
|
||||
"<a href='/exercise/"+ exercise_id +"/republish_exercise' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||
"</div>" +
|
||||
"<div class='cl'></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
showModal('ajax-modal', '310px');
|
||||
$('#ajax-modal').css('height','120px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
||||
function clickCanel(){hideModal("#popbox02");}
|
||||
|
||||
function exercise_submit(exercise_id,exercise_name)
|
||||
{
|
||||
if(exercise_name == 0)
|
||||
{
|
||||
alert("试卷标题不能为空");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||
"<div class='upload_con'>" +
|
||||
"<div class='upload_box'>" +
|
||||
"<p class='polls_box_p'>测验发布后将不能对测验进行修改,<br />是否确定发布该测验?</p>" +
|
||||
"<div class='polls_btn_box'>" +
|
||||
"<a href='/exercise/"+ exercise_id +"/publish_exercise' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||
"</div>" +
|
||||
"<div class='cl'></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
showModal('ajax-modal', '310px');
|
||||
$('#ajax-modal').css('height','120px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<div class="polls_content02" id="exercise">
|
||||
<%= render :partial => 'exercises_list'%>
|
||||
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#RSide").css("width","730px");
|
||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||
$("#Container").css("width","1000px");
|
||||
});
|
||||
function republish_exercise(exercise_id,index)
|
||||
{
|
||||
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||
"<div class='upload_con'>" +
|
||||
"<div class='upload_box'>" +
|
||||
"<p class='polls_box_p'>取消发布后学生答题将会被清空<br />是否确定取消发布该测验?</p>" +
|
||||
"<div class='polls_btn_box'>" +
|
||||
"<a href='/exercise/"+ exercise_id +"/republish_exercise?index="+index+"' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||
"</div>" +
|
||||
"<div class='cl'></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
showModal('ajax-modal', '310px');
|
||||
$('#ajax-modal').css('height','120px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
||||
function clickCanel(){hideModal("#popbox02");}
|
||||
|
||||
function exercise_submit(exercise_id,exercise_name,index)
|
||||
{
|
||||
if(exercise_name == 0)
|
||||
{
|
||||
alert("试卷标题不能为空");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||
"<div class='upload_con'>" +
|
||||
"<div class='upload_box'>" +
|
||||
"<p class='polls_box_p'>测验发布后将不能对测验进行修改,<br />是否确定发布该测验?</p>" +
|
||||
"<div class='polls_btn_box'>" +
|
||||
"<a href='/exercise/"+ exercise_id +"/publish_exercise?index="+index+"' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||
"</div>" +
|
||||
"<div class='cl'></div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
showModal('ajax-modal', '310px');
|
||||
$('#ajax-modal').css('height','120px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<div class="polls_content02" id="exercise" style="width: 730px;">
|
||||
<%= render :partial => 'exercises_list'%>
|
||||
</div><!--问卷内容end-->
|
|
@ -1,4 +1,4 @@
|
|||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise}) %>");
|
||||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>");
|
||||
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
|
||||
showModal('ajax-modal', '250px');
|
||||
//$('#ajax-modal').css('height','111px');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise}) %>");
|
||||
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>");
|
||||
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
|
||||
showModal('ajax-modal', '250px');
|
||||
//$('#ajax-modal').css('height','80px');
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
<% if @can_edit_excercise %>
|
||||
<%=render :partial => 'exercise_student', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user} %>
|
||||
<% else %>
|
||||
<%=render :partial => 'exercise_student_result', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user} %>
|
||||
<%=render :partial => 'exercise_student_result', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user,:user=>User.current} %>
|
||||
<% end %>
|
||||
<% end %>
|
|
@ -0,0 +1 @@
|
|||
<%=render :partial => 'exercise_student_result', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user,:user =>@user} %>
|
|
@ -73,7 +73,7 @@
|
|||
<ul>
|
||||
<% @all_exercises.each_with_index do |exercise,index |%>
|
||||
<li class="pr10">
|
||||
<%= link_to "作业#{@all_exercises.count - index}:#{exercise.exercise_name}",''%>
|
||||
<%= link_to "测验#{@all_exercises.count - index}:#{exercise.exercise_name}",student_exercise_list_exercise_path(exercise.id,:course_id => @course.id)%>
|
||||
<%#= link_to "第#{@homework_commons.count - index}次作业",student_work_index_path(:homework => homework_common.id)%>
|
||||
</li>
|
||||
<% end%>
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
</div>
|
||||
<div class="homepageLeftMenuCourses borderBottomNone" id="homepageLeftMenuProjects">
|
||||
<ul >
|
||||
<%= render :partial => 'layouts/org_projects',:locals=>{:projects=>@organization.projects.reorder('created_at').limit(5),:org_id=>@organization.id,:page=>1}%>
|
||||
<%= render :partial => 'layouts/org_projects',:locals=>{:projects=>@organization.projects.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=>1}%>
|
||||
<!--<%#= @organization.org_projects.each do |p|%>-->
|
||||
<!--<li class="homepageLeftMenuCoursesLine"><a href="javascript:void(0);" class="coursesLineGrey"><%#= p.name%></a></li>-->
|
||||
<!--<%# end %>-->
|
||||
|
@ -131,7 +131,7 @@
|
|||
</div>
|
||||
<div class="homepageLeftMenuCourses borderBottomNone" id="homepageLeftMenuCourses">
|
||||
<ul >
|
||||
<%= render :partial => 'layouts/org_courses',:locals=>{:courses=>@organization.courses.reorder('created_at').limit(5),:org_id=>@organization.id,:page=>1}%>
|
||||
<%= render :partial => 'layouts/org_courses',:locals=>{:courses=>@organization.courses.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=>1}%>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
$("#homepageLeftMenuCourses").html("");
|
||||
$("#homepageLeftMenuCourses").append("<ul>");
|
||||
$("#homepageLeftMenuCourses").append("<%= escape_javascript(render :partial => 'layouts/org_courses',
|
||||
:locals=>{:courses=>@organization.courses.reorder('created_at').limit(5),:org_id=>@organization.id,:page=> 1}) %>");
|
||||
:locals=>{:courses=>@organization.courses.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=> 1}) %>");
|
||||
$("#homepageLeftMenuCourses").append("</ul>");
|
|
@ -1,5 +1,5 @@
|
|||
$("#homepageLeftMenuProjects").html("");
|
||||
$("#homepageLeftMenuProjects").append("<ul>");
|
||||
$("#homepageLeftMenuProjects").append("<%= escape_javascript(render :partial => 'layouts/org_projects',
|
||||
:locals=>{:projects=>@organization.projects.reorder('created_at').limit(5),:org_id=>@organization.id,:page=> 1}) %>");
|
||||
:locals=>{:projects=>@organization.projects.reorder('created_at').uniq.limit(5),:org_id=>@organization.id,:page=> 1}) %>");
|
||||
$("#homepageLeftMenuProjects").append("</ul>");
|
|
@ -1,52 +1,52 @@
|
|||
<div class="fl" style="padding-bottom:10px; width:720px;">
|
||||
<span class="c_dark f14 fb fl mr30">
|
||||
作品
|
||||
<font class="f12 c_red">
|
||||
(<%= @student_work_count%>人已交)
|
||||
</font>
|
||||
<% if !@is_teacher && @stundet_works.empty?%>
|
||||
<span class="f12 c_red">您尚未提交作品</span>
|
||||
<% elsif !@is_teacher &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<span class="f12 c_red">您已提交且不可再修改,因为截止日期已过</span>
|
||||
<% elsif !@is_teacher &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<span class="f12 c_red">您已提交,您还可以修改</span>
|
||||
<% end %>
|
||||
</span>
|
||||
<%if @is_teacher || @homework.homework_detail_manual.comment_status == 3%>
|
||||
<div class="hworkSearchBox">
|
||||
<input type="text" id="course_student_name" value="<%= @name%>" placeholder="姓名、学号、邮箱" class="hworkSearchInput" onkeypress="SearchByName('<%= student_work_index_path(:homework => @homework.id)%>',event);"/>
|
||||
<a class="hworkSearchIcon" id="search_in_student_work" onclick="SearchByName_1('<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)"></a>
|
||||
</div>
|
||||
<%= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %>
|
||||
<% end%>
|
||||
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" style="display: none">[ 显示作业信息 ]</a> </span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="fl">
|
||||
<% if @is_evaluation && !@stundet_works.empty?%>
|
||||
<%= render :partial => "evaluation_title"%>
|
||||
<% else%>
|
||||
<%= render :partial => "evaluation_un_title"%>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% @stundet_works.each do |student_work|%>
|
||||
<% if @is_evaluation%>
|
||||
<%= render :partial => "evaluation_work", :locals => {:student_work => student_work}%>
|
||||
<% else%>
|
||||
<%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work}%>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<div id="about_hwork_<%= student_work.id%>">
|
||||
<% if student_work.user == User.current && !@is_evaluation %>
|
||||
<% if @homework.homework_type == 2%>
|
||||
<%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
|
||||
<% else %>
|
||||
<%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="fl" style="padding-bottom:10px; width:720px;">
|
||||
<span class="c_dark f14 fb fl mr15">
|
||||
作品
|
||||
<font class="f12 c_red">
|
||||
(<%= @student_work_count%>人已交)
|
||||
</font>
|
||||
<% if !@is_teacher && @stundet_works.empty?%>
|
||||
<span class="f12 c_red">您尚未提交作品</span>
|
||||
<% elsif !@is_teacher &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<span class="f12 c_red">您已提交且不可再修改,因为截止日期已过</span>
|
||||
<% elsif !@is_teacher &&Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.parse(Time.now.to_s).strftime("%Y-%m-%d") && !@stundet_works.empty?%>
|
||||
<span class="f12 c_red">您已提交,您还可以修改</span>
|
||||
<% end %>
|
||||
</span>
|
||||
<%if @is_teacher || @homework.homework_detail_manual.comment_status == 3%>
|
||||
<div class="hworkSearchBox">
|
||||
<input type="text" id="course_student_name" value="<%= @name%>" placeholder="姓名、学号、邮箱" class="hworkSearchInput" onkeypress="SearchByName('<%= student_work_index_path(:homework => @homework.id)%>',event);"/>
|
||||
<a class="hworkSearchIcon" id="search_in_student_work" onclick="SearchByName_1('<%= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)"></a>
|
||||
</div>
|
||||
<%= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %>
|
||||
<% end%>
|
||||
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" style="display: none">[ 显示作业信息 ]</a> </span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<div class="fl">
|
||||
<% if @is_evaluation && !@stundet_works.empty?%>
|
||||
<%= render :partial => "evaluation_title"%>
|
||||
<% else%>
|
||||
<%= render :partial => "evaluation_un_title"%>
|
||||
<% end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<% @stundet_works.each do |student_work|%>
|
||||
<% if @is_evaluation%>
|
||||
<%= render :partial => "evaluation_work", :locals => {:student_work => student_work}%>
|
||||
<% else%>
|
||||
<%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work}%>
|
||||
<% end%>
|
||||
<div class="cl"></div>
|
||||
<div id="about_hwork_<%= student_work.id%>">
|
||||
<% if student_work.user == User.current && !@is_evaluation %>
|
||||
<% if @homework.homework_type == 2%>
|
||||
<%=render :partial => 'programing_work_show', :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
|
||||
<% else %>
|
||||
<%=render :partial => 'show' , :locals=> {:work => student_work, :score =>student_work_score(student_work,User.current),:student_work_scores => student_work.student_works_scores.order("updated_at desc")} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% end%>
|
|
@ -411,7 +411,9 @@
|
|||
<!-- 创建课程消息 -->
|
||||
<% if ma.course_message_type == "Course" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"></a></li>
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div></a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="newsBlue homepageNewsPublisher">系统提示</span>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">您成功创建了课程:</span>
|
||||
|
@ -443,7 +445,7 @@
|
|||
<% end %>
|
||||
<% if ma.course_message_type == "JoinCourseRequest" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"></a></li>
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div></a></li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="newsBlue homepageNewsPublisher">系统提示</span>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">您有了新的课程成员申请:</span>
|
||||
|
@ -482,7 +484,7 @@
|
|||
<% end %>
|
||||
<% if ma.course_message_type == "CourseRequestDealResult" %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"></a></li>
|
||||
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div></a></li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="newsBlue homepageNewsPublisher">系统提示</span>
|
||||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">
|
||||
|
@ -548,7 +550,7 @@
|
|||
<% if ma.course_message_type == "JoinCourse" and ma.status == 1 %>
|
||||
<ul class="homepageNewsList fl">
|
||||
<li class="homepageNewsPortrait fl">
|
||||
<a href="javascript:void(0);"></a>
|
||||
<a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div></a>
|
||||
</li>
|
||||
<li class="homepageNewsPubType fl">
|
||||
<span class="newsBlue homepageNewsPublisher">系统提示</span>
|
||||
|
|
|
@ -174,6 +174,7 @@ RedmineApp::Application.routes.draw do
|
|||
get 'export_exercise'
|
||||
get 'publish_exercise'
|
||||
get 'republish_exercise'
|
||||
get 'show_student_result'
|
||||
post 'create_exercise_question'
|
||||
post 'commit_answer'
|
||||
post 'commit_exercise'
|
||||
|
|
|
@ -14,7 +14,7 @@ class AddCourseContributorTotalScore < ActiveRecord::Migration
|
|||
message_reply_count = Message.find_by_sql("select DISTINCT me.* from messages me, boards b where b.id = me.board_id and b.course_id = #{course.id} and b.project_id = '-1' and me.author_id = #{s.student_id} and me.parent_id is not null").count * 1
|
||||
common_reply_count = Comment.find_by_sql("select cm.* from comments cm, news n where cm.author_id = #{s.student_id} and n.course_id = #{course.id} and cm.commented_id = n.id and cm.commented_type ='News'").count * 1
|
||||
# attachment_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "Attachment").count * 5
|
||||
attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.student_id};").count * 5
|
||||
attachment_count = Attachment.find_by_sql("SELECT * FROM `attachments` where container_id = #{course.id} and author_id = #{s.student_id} and container_type ='Course'").count * 5
|
||||
journal_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? ", s.student_id, course.id, "Course").count * 1
|
||||
# journal_count = CourseActivity.where("user_id =? and course_id =? and course_act_type =?", s.student_id, course.id, "JournalsForMessage").count * 1
|
||||
# journal_reply_count = JournalsForMessage.where("user_id =? and jour_id =? and jour_type =? and status =?", s.student_id, course.id, "Course",1).count * 1
|
||||
|
|
|
@ -60,11 +60,11 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;}
|
|||
.hworkStName {width:60px; max-width:60px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;}
|
||||
.hworkStID {width:80px; max-width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:18px; line-height:18px; font-size:12px; color:#888888; text-align:center;}
|
||||
.hworkDate {max-width:150px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:14px; line-height:14px; font-size:12px; color:#888888;}
|
||||
.hworkMenu {width:100px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 20px; left:-110px; font-size:12px; color:#888888; display:none; line-height:2;}
|
||||
.hworkMenu {width:100px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 20px; left:-110px; font-size:12px; color:#888888; display:none; line-height:2; z-index:99;}
|
||||
a.hworkExport {background:url(../images/homepage_icon2.png) -10px -401px no-repeat; padding-left:23px;}
|
||||
a.hworkSetting {background:url(../images/homepage_icon2.png) -10px -450px no-repeat; padding-left:23px;}
|
||||
.hworkInfor {font-size:12px; color:#269ac9; width:80px; height:40px; vertical-align:middle; float:left; line-height:40px; text-align:center; font-weight:bold;}
|
||||
.infoNi{ width:100px; padding:5px;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left; line-height:2; position:absolute; margin-top:-24px;margin-left: 40px;}
|
||||
.infoNi{ width:100px; padding:5px;-moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; box-shadow:0px 0px 5px #194a81; color:#666; background:#fff; text-align:left; line-height:2; position:absolute; margin-top:-24px;margin-left: 40px; z-index:99;}
|
||||
.problemTxt {width:660px; margin-left:10px; color:#777777; position:relative;}
|
||||
.rTxtTit{width:560px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color:#15bccf; float:left; color:#269ac9; font-size:14px;}
|
||||
.hworkSearchBox {border:1px solid #e6e6e6; width:185px; float:left; background-color:#ffffff;}
|
||||
|
@ -1156,7 +1156,7 @@ a:hover.btn_cancel{ color:#666;}
|
|||
.mr118 {margin-right:118px !important;}
|
||||
.questionContainer {width:698px; border:1px solid #cbcbcb;background:#eeeeee; padding:10px; margin-bottom:10px;}
|
||||
.questionTitle{ width:644px; height:30px; border:1px solid #cbcbcb; padding-left:5px; background:#fff;}
|
||||
.examTime {width:40px; border:1px solid #cbcbcb; outline:none; height:28px; text-align:center; padding-left:0px; }
|
||||
.examTime {width:90px; border:1px solid #cbcbcb; outline:none; height:28px; text-align:center; padding-left:0px; }
|
||||
.testStatus{width:698px; border:1px solid #cbcbcb; padding:10px; margin-bottom:10px; background:#ffffff; position:relative; color:#767676;}
|
||||
.testEdit{ background:url(images/icons.png) 0px -272px no-repeat; width:16px; height:27px; display:block;float:right; bottom:10px; right:10px; position:absolute;}
|
||||
a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;}
|
||||
|
@ -1167,7 +1167,6 @@ a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;}
|
|||
.fillInput {border:1px solid #cbcbcb; padding-left:5px; background-color:#ffffff; width:693px; height:30px; color:#888888;}
|
||||
.mr130 {margin-right:130px;}
|
||||
.ur_button_submit{ display:block; width:106px; height:31px; margin:0 auto; background:#15bccf; color:#fff; font-size:16px; text-align:center; padding-top:4px; margin-bottom:10px; }
|
||||
|
||||
/*20151123课程排行榜Tim*/
|
||||
.courseMenuSetting {background:url(../images/homepage_icon2.png) -190px -365px no-repeat; width:15px; height:15px; margin-top:3px; float:right; margin-right:5px;}
|
||||
.courseMenuSetting:hover {background:url(../images/homepage_icon2.png) -190px -407px no-repeat;}
|
||||
|
@ -1175,4 +1174,5 @@ a:hover.testEdit{ background:url(images/icons.png) -21px -272px no-repeat;}
|
|||
.rankList li {width:73px; padding:8px 0px 0px 0px; text-align:center; float:left; position:relative;}
|
||||
.rankList li p {width:100%; overflow:hidden; white-space:normal; text-overflow:ellipsis; color:#585858;word-wrap: normal; word-break: normal;}
|
||||
.rankPortrait {border-radius:50%; width:35px; height:35px;}
|
||||
.numIntro {position:absolute; text-align:left; z-index:999; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); border:1px solid #eaeaea; background-color:#ffffff; padding:3px 5px; left:15px; color:#585858; white-space: nowrap;}
|
||||
.numIntro {position:absolute; text-align:left; z-index:999; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); border:1px solid #eaeaea; background-color:#ffffff; padding:3px 5px; left:15px; color:#585858; white-space: nowrap;}
|
||||
.font_cus {font-family: "微软雅黑","宋体"; font-size: 12px; line-height: 1.5;}
|
||||
|
|
|
@ -89,7 +89,7 @@ a:hover.btn_cancel{ color:#666;}
|
|||
.ur_question_title{ width:534px; height:30px; border:1px solid #cbcbcb; padding-left:5px; margin-right:10px; background:#fff;}
|
||||
.ur_editor_title{ margin-bottom:10px;}
|
||||
.ur_editor_content{ }
|
||||
.ur_item{ margin-bottom:5px; height:32px; }
|
||||
.ur_item{ margin-bottom:5px; height:32px; line-height: 32px; vertical-align: middle; }
|
||||
.ur_item input{ width:324px; height:30px;border:1px solid #cbcbcb; padding-left:5px; float:left; margin-right:10px; background:#fff;}
|
||||
.ur_item label{ float:left;}
|
||||
.icon_add{ background:url(images/icons.png) 0px -310px no-repeat; width:16px; height:27px; display:block;float:left; margin-right:5px;}
|
||||
|
|
Loading…
Reference in New Issue