在线试卷

This commit is contained in:
cxt 2017-09-28 16:51:15 +08:00
parent 8496663455
commit 7aef72d7a3
27 changed files with 1213 additions and 390 deletions

View File

@ -4,34 +4,35 @@ class ExerciseController < ApplicationController
before_filter :find_exercise_and_course, :only => [:create_exercise_question, :edit, :update, :show, :destroy,
:commit_exercise, :commit_answer,:publish_exercise,:republish_exercise,
:show_student_result,:student_exercise_list, :update_question_num,
:send_to_course, :get_student_uncomplete_question, :edit_question_score]
:send_to_course, :get_student_uncomplete_question, :edit_question_score, :setting, :set_public,
:ex_setting]
before_filter :find_course, :only => [:index,:new,:create]
include ExerciseHelper
def index
publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
publish_exercises.each do |exercise|
exercise.update_column('exercise_status', 2)
course = exercise.course
course.members.each do |m|
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
end
end
if @course.is_public == 0 && !(User.current.member_of_course?(@course)||User.current.admin?)
render_403
return
end
remove_invalid_exercise(@course)
@is_teacher = User.current.allowed_to?(:as_teacher,@course)
if @is_teacher || User.current.admin?
exercises = @course.exercises.order("created_at asc")
#remove_invalid_exercise(@course)
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if @is_teacher
exercises = @course.exercises.order("created_at desc")
else
exercises = @course.exercises.where("exercise_status <> 1").order("created_at asc")
exercises = @course.exercises.where("exercise_status <> 1").order("created_at desc")
end
@exercises = paginateHelper exercises,20 #分页
if params[:type]
@type = params[:type]
exercises = exercises.where(:exercise_status => params[:type])
end
@search = params[:search] ? params[:search].to_s.strip : ""
if params[:search]
exercises = exercises.where("exercise_name like '%#{@search}%'")
end
@exercises = paginateHelper exercises,15 #分页
@left_nav_type = 8
respond_to do |format|
format.js
format.html
end
end
@ -82,33 +83,29 @@ class ExerciseController < ApplicationController
end
def new
option = {
:exercise_name => "",
:course_id => @course.id,
:exercise_status => 1,
:user_id => User.current.id,
:time => "",
:end_time => "",
:publish_time => "",
:exercise_description => "",
:show_result => 1
}
@exercise = Exercise.create option
if @exercise
redirect_to edit_exercise_url @exercise.id
# option = {
# :exercise_name => "",
# :course_id => @course.id,
# :exercise_status => 1,
# :user_id => User.current.id,
# :time => "",
# :end_time => "",
# :publish_time => "",
# :exercise_description => "",
# :show_result => 1
# }
@exercise = Exercise.new
respond_to do |format|
format.html{render :layout => 'base_edu'}
end
end
def create
if params[:exercise]
exercise = Exercise.find(params[:exercise_id]) if params[:exercise_id]
exercise ||= Exercise.new
exercise = Exercise.new
exercise.exercise_name = params[:exercise][:exercise_name]
exercise.exercise_description = params[:exercise][:exercise_description]
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]
exercise.course_id = params[:course_id]
exercise.exercise_status = 1
if exercise.save
@ -123,19 +120,14 @@ class ExerciseController < ApplicationController
def edit
@left_nav_type = 8
respond_to do |format|
format.html{render :layout => 'base_courses'}
format.html{render :layout => 'base_edu'}
end
end
def update
@exercise.exercise_name = params[:exercise][:exercise_name]
@exercise.exercise_description = params[:exercise][:exercise_description]
@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[:show_result] ? 1 : 0
@exercise.question_random = params[:question_random] ? 0 : 1
@exercise.choice_random = params[:choice_random] ? 0 : 1
if @exercise.save
respond_to do |format|
format.js
@ -148,15 +140,34 @@ class ExerciseController < ApplicationController
def destroy
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if @exercise && @exercise.destroy
if @is_teacher
exercises = Exercise.where("course_id =?", @course.id)
else
exercises = Exercise.where("course_id =? and exercise_status =?", @course.id, 2)
end
@exercises = paginateHelper exercises,20 #分页
respond_to do |format|
format.js
end
redirect_to exercise_index_path(:course_id => @course.id)
end
end
def setting
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
@is_new = params[:is_new] ? true : false
respond_to do |format|
format.html{render :layout => 'base_edu'}
end
end
def ex_setting
@exercise.publish_time = params[:exercise_publish_time] if params[:exercise_publish_time]
@exercise.end_time = params[:exercise_end_time] if params[:exercise_end_time]
@exercise.time = params[:time] != "" ? params[:time] : -1
@exercise.question_random = params[:question_random] ? 1 : 0
@exercise.choice_random = params[:choice_random] ? 1 : 0
@exercise.score_open = params[:score_open] ? 1 : 0
@exercise.answer_open = params[:answer_open] ? 1 : 0
if @exercise.save
redirect_to student_exercise_list_exercise_path(@exercise)
end
end
def set_public
if User.current.admin? || User.current.allowed_to?(:as_teacher, @course)
@exercise.update_attributes(:is_public => true)
end
end

View File

@ -535,7 +535,7 @@ module ApplicationHelper
style = 'edu-filter-btn-red'
when '评阅中'
style = 'edu-filter-btn-green'
when '已结束'
when '已结束', '已截止'
style = 'edu-filter-btn-end'
when '已开启补交'
style = 'edu-filter-btn-late'
@ -606,6 +606,28 @@ module ApplicationHelper
result
end
# 试卷:该阶段还有多长时间结束/距下一阶段还有多长时间
def exercise_curr_time exercise
result = {}
status = ""
time = ""
case exercise.exercise_status
when 1
status = "未发布"
when 2
if exercise.end_time && exercise.end_time >= Time.now
status = "提交中"
time = how_much_time(exercise.end_time)
end
when 3
status = "已截止"
time = format_time exercise.end_time
end
result[:status] = status
result[:time] = time
result
end
# 公共分页
def paginator_list objs, objs_count, limit, is_remote
@is_remote = is_remote
@ -4750,9 +4772,19 @@ def get_work_index(hw,is_teacher)
return index
end
def get_ex_index(exercise, course, is_teacher)
if is_teacher
exercises = course.exercises.order("created_at asc")
else
exercises = course.exercises.where("exercise_status > 0").order("created_at asc")
end
ex_ids = exercises.map{|ex| ex.id} if !exercises.blank?
index = ex_ids.index(exercise.id)
return index
end
def get_hw_index(hw,is_teacher,type=0)
homework_commons = hw.course.homework_commons
Rails.logger.info("----------------------------------------------"+hw.course.to_s)
if is_teacher
if type != 0
homeworks = homework_commons.where("homework_commons.homework_type = #{type}").order("created_at asc")
@ -4766,7 +4798,6 @@ def get_hw_index(hw,is_teacher,type=0)
homeworks = homework_commons.where("publish_time <= '#{Time.now}'").order("created_at asc")
end
end
Rails.logger.info("----------------------------------------------"+homeworks.count.to_s)
hw_ids = homeworks.map{|hw| hw.id} if !homeworks.blank?
index = hw_ids.index(hw.id)
return index

View File

@ -16,4 +16,5 @@ module OwnerTypeHelper
STUDENTWORK = 15
HOMEWORKBANK = 16
SUBJECT = 17
EXERCISEQUESTION = 18
end

View File

@ -1,41 +1,12 @@
<%= form_for @exercise, :remote=>true do |f| %>
<div class="testContainer">
<div>
<input name="exercise[exercise_name]" maxlength="100" id="exercise_name" class="testTitle mb10" type="text" placeholder="测验标题" value="<%=@exercise.exercise_name%>" />
</div>
<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 %>"/>
<%= calendar_for('exercise_end_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">
<input type="checkbox" name="question_random" <%= exercise.question_random == 0 ? 'checked' : '' %> id="edit_question_random">
<label for="edit_question_random" class="mt10 mr30">题目不随机打乱</label>
<input type="checkbox" name="choice_random" <%= exercise.choice_random == 0 ? 'checked' : '' %> id="edit_choice_random">
<label for="edit_choice_random" class="mt10 mr30">选项不随机打乱</label>
<input type="checkbox" name="show_result" <%= exercise.show_result == 1 ? 'checked' : '' %> id="edit_show_result">
<label for="edit_show_result" class="mt10">允许学生查看测验结果</label>
<a data-button="ok" onclick="pollsSubmit($(this));" class="big_blue_btn fr borderRadius">保存</a>
<a data-button="cancel" onclick="pollsCancel();" class="big_grey_btn fr borderRadius mr10">取消</a>
</div>
<div class="cl"></div>
<%= form_for(@exercise, :html => {:multipart => true, :id => "exercise_head_form"}, :remote => true) do |f| %>
<div class="ml15 mr15 mb15">
<input class="panel-box-sizing panel-form-width-100" name="exercise[exercise_name]" maxlength="100" id="exercise_name" value="<%= @exercise.try(:exercise_name) %>" placeholder="试卷标题" style="text-align: center;"/>
</div>
<% 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 %>");*/
}
</script>
<div class="ml15 mr15">
<textarea id="mustBe" name="exercise[exercise_description]" class="panel-box-sizing panel-form-width-100" placeholder="试卷须知共有选择、填空、简答3种题型其中选择题包括单选题和多选题;您可以在此处填写本次试卷答题的相关说明"><%= @exercise.try(:exercise_description) %></textarea>
</div>
<p class="fr">
<a href="javascript:void(0)" onclick="pollsSubmit($(this));" class="fr task-btn mr15 task-btn-blue">保存</a>
<a href="javascript:void(0)" onclick="pollsCancel();" class="fr task-btn mr10">取消</a>
</p>
<% end %>

View File

@ -0,0 +1,202 @@
<% content_for :header_tags do %>
<%= import_ke(enable_at: false, prettify: false, init_activity: true) %>
<% end %>
<div class="edu-con-top user_bg_shadow bor-grey-e clearfix mb20" id="exercise_head">
<div class="<%= is_edit ? '' : 'none' %>" id="exercise_head_show">
<%= render :partial => 'show_head', :locals => {:exercise => @exercise} %>
</div>
<div class="<%= is_edit ? 'none' : '' %>" id="exercise_head_edit">
<% if is_edit %>
<%= render :partial => 'edit_head', :locals => {:exercise => @exercise} %>
<% else %>
<%= render :partial => 'new_head', :locals => {:exercise => @exercise} %>
<% end %>
</div>
</div>
<div id="exercise_question_list">
</div>
<div class="edu-con-top user_bg_shadow bor-grey-e clearfix mb20" id="new_exercise_question">
<%= render :partial => "exercise/new_question" %>
</div>
<div id="new_poll_question">
</div>
<script id="t:set-option-list" type="text/html">
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" name="option_span" data-tip-down="点击设置答案">A</span></label>
<input type="hidden" name="choice[answer][]">
<textarea class="panel-form-width2-690 fl panel-box-sizing" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
</script>
<script id="t:set-option-lists" type="text/html">
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="option-item fr mr10 color-grey select-choice" name="option_spans" data-tip-down="点击设置答案">A</span></label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
</script>
<script id="t:set-fillin-lists" type="text/html">
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="fr mr10 color-grey" name="fill_span">答案 2</span></label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="fill[cnt][]" placeholder="请输入参考答案(可选)"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
</script>
<div class="edu-con-top user_bg_shadow bor-grey-e color-grey clearfix mb20 font-12">
<p class="ml15 fl">
<span class="mr20">单选题<span>&nbsp;3&nbsp;</span>题,共<span>&nbsp;15&nbsp;</span>分</span>
<span class="mr20">多选题<span>&nbsp;5&nbsp;</span>题,共<span>&nbsp;25&nbsp;</span>分</span>
<span class="mr20">填空题<span>&nbsp;10&nbsp;</span>题,共<span>&nbsp;25&nbsp;</span>分</span>
<span>简答题<span>&nbsp;10&nbsp;</span>题,共<span>&nbsp;25&nbsp;</span>分</span>
</p>
<a class="fr mr15">
<span>合计<span class="color-orange03">&nbsp;10&nbsp;</span>题,共<span class="color-orange03">&nbsp;100&nbsp;</span>分</span>
</a>
</div>
<script>
$(function(){
var bt = baidu.template;
bt.LEFT_DELIMITER = '<!';
bt.RIGHT_DELIMITER = '!>';
/*新建单选题选项*/
$(".single_Temp").on('click',"a.option_icon_add", function () {
var html = bt('t:set-option-list', null);
$(this).parent().parent('.clearfix').before(html);
var inputs = document.getElementsByName("question_answer[]");
var inputs_spans = document.getElementsByName("option_span");
for (var j = 0; j < inputs_spans.length; j++) {
if(j >= 0 && j <= 26){
$(inputs_spans[j]).html(String.fromCharCode(65 + j));
}
}
$(inputs[inputs.length - 1]).focus();
});
$(".single_Temp").on('click',"a.option_icon_remove", function () {
var temp=$(this).parents("li").siblings("div").find(".current-option");
var singl=$(this).parents(".single_Temp").find(".check-option-bg");
temp.html("");
$(this).parents('li').remove();
var inputs_spans = document.getElementsByName("option_span");
for (var j = 0; j < inputs_spans.length; j++) {
if(j >= 0 && j <= 26){
if(j >= 0 && j <= 26){
$(inputs_spans[j]).html(String.fromCharCode(65 + j));
}
}
}
if(singl.length>0){
for(var i=0;i<singl.length;i++){
temp.html(temp.html()+singl.eq(i).html());
}
}else{
temp.html("请点击正确选项");
}
});
$(".single_Temp").find("li label").live("click",function(){
var temp=$(this).parents(".single_Temp");
if($(this).index()!=temp.find("li").length){
temp.find("li span").removeClass("check-option-bg");
$(this).find("span").toggleClass("check-option-bg");
}
temp.find(".current-option").html("");
if(temp.find(".check-option-bg").length>0){
for(var i=0;i<temp.find(".check-option-bg").length;i++){
temp.find(".current-option").html(temp.find(".current-option").html()+temp.find(".check-option-bg").eq(i).html());
}
$("#exercise_choice_1").val(temp.find(".current-option").html());
}else{
temp.find(".current-option").html("请点击正确选项");
}
});
/*新建多选题选项*/
$(".multiple_Temp").on('click',"a.option_icon_add", function () {
var html = bt('t:set-option-lists', null);
$(this).parent().parent('.clearfix').before(html);
var inputs = document.getElementsByName("question_answer[]");
var inputs_spans = document.getElementsByName("option_spans");
for (var j = 0; j < inputs_spans.length; j++) {
if(j >= 0 && j <= 26){
$(inputs_spans[j]).html(String.fromCharCode(65 + j));
}
}
$(inputs[inputs.length - 1]).focus();
});
$(".multiple_Temp").on('click',"a.option_icon_remove", function () {
var temp=$(this).parents("li").siblings("div").find(".current-option");
var muil=$(this).parents(".multiple_Temp").find(".check-option-bg");
var count=0;
if($(this).parents("li").find(".check-option-bg").length>0){
alert($(this).parents("li").find("label span").html());
count++;
}
temp.html("");
$(this).parents('li').remove();
var inputs_spans = document.getElementsByName("option_spans");
for (var j = 0; j < inputs_spans.length; j++) {
if(j >= 0 && j <= 26){
if(j >= 0 && j <= 26){
$(inputs_spans[j]).html(String.fromCharCode(65 + j));
}
}
}
if(parseInt(muil.length)-count>0){
for(var i=0;i<parseInt(muil.length)-count;i++){
temp.html(temp.html()+muil.eq(i).html());
}
}else{
temp.html("请点击正确选项");
}
});
$("#multiple_Temp").find("li label").live("click",function(){
if($(this).index()!=$("#multiple_Temp").find("li").length){
$(this).find("span").toggleClass("check-option-bg");
}
$("#multiple_Temp").find(".current-option").html("");
if($("#multiple_Temp").find(".check-option-bg").length>0){
for(var i=0;i<$("#multiple_Temp").find(".check-option-bg").length;i++){
$("#multiple_Temp").find(".current-option").html($("#multiple_Temp").find(".current-option").html()+$("#multiple_Temp").find(".check-option-bg").eq(i).html());
}
$("#exercise_choice_2").val($("#multiple_Temp").find(".current-option").html());
}else{
$("#multiple_Temp").find(".current-option").html("请点击正确选项");
}
})
/*新建填空题答案项*/
$(".fillin_Temp").on('click',"a.option_fillin_add", function () {
var html = bt('t:set-fillin-lists', null);
$(this).parent().parent('.clearfix').before(html);
var inputs = document.getElementsByName("fill[cnt][]");
var inputs_spans = document.getElementsByName("fill_span");
for (var j = 0; j < inputs_spans.length; j++) {
$(inputs_spans[j]).html("答案 "+(j+1));
}
for (var i = 0; i < inputs.length; i++) {
autoTextarea(inputs[i], 0, 140);
}
$(inputs[inputs.length - 1]).focus();
});
$(".fillin_Temp").on('click',"a.option_icon_remove", function () {
$(this).parents('li').remove();
var inputs_spans = document.getElementsByName("fill_span");
for (var j = 0; j < inputs_spans.length; j++) {
$(inputs_spans[j]).html("答案 "+(j+1));
}
});
})
</script>

View File

@ -0,0 +1,21 @@
<p class="fl task-form-60 mt3 ml15" id="exercise_index_tab">
<a href="<%= exercise_index_path(:course_id => @course.id, :search => @search) %>" class="<%= @type.nil? ? "active" : "" %> edu-filter-cir-grey mr5 font-12 fl" data-remote="true">全部</a>
<% if @is_teacher %>
<a href="<%= exercise_index_path(:course_id => @course.id, :search => @search, :type => 1) %>" class="<%= @type == '1' ? "active" : "" %> edu-filter-cir-grey mr5 font-12 fl" data-remote="true">未发布</a>
<% end %>
<a href="<%= exercise_index_path(:course_id => @course.id, :search => @search, :type => 2) %>" class="<%= @type == '2' ? "active" : "" %> edu-filter-cir-grey mr5 font-12 fl" data-remote="true">提交中</a>
<a href="<%= exercise_index_path(:course_id => @course.id, :search => @search, :type => 3) %>" class="<%= @type == '3' ? "active" : "" %> edu-filter-cir-grey mr5 font-12 fl" data-remote="true">已截止</a>
<!--<a href="javascript:void(0)" class=" edu-filter-cir-grey mr5 font-12 fl" data-remote="true">评阅中</a>-->
<!--<a href="javascript:void(0)" class=" edu-filter-cir-grey mr5 font-12 fl" data-remote="true">已结束</a>-->
</p>
<div id="search_div" class="edu-position fr task-form-30 mr15" style="padding: 0px">
<%= form_tag(exercise_index_path(:course_id => @course.id, :type => @type), :remote => true , :method => 'get', :id => 'exercise_search_form') do %>
<div class="edu-find fr with95 mr20 pr">
<div class="edu-find-input">
<input type="text" class="task-form-100 panel-box-sizing" name="search" placeholder="输入试卷名称进行搜索" value="<%= @search %>" id="exercise_name_search">
<i class="fa fa-close mr5 color-grey edu-close" onclick="close_searchbox();"></i>
</div>
<a href="javascript:void(0);" onclick="$('#exercise_search_form').submit();" class="edu-open font-16 color-grey "><i class="fa fa-search"></i></a>
</div>
<% end %>
</div>

View File

@ -1,28 +1,66 @@
<div class="polls_head" style="width:980px;">
<h2>所有试卷
<span><%= @obj_count%></span>
</h2>
<% if @is_teacher%>
<%= link_to "新建试卷 ", new_exercise_path(:course_id => @course.id), :class => "newbtn" %>
<%= link_to "导入试卷", other_exercise_exercise_index_path(:course_id => @course.id), :remote=>true,:class => "newbtn"%>
<% end%>
</div>
<div class="cl"></div>
<div id="polls_list" class="polls_list">
<% if @exercises.count != 0 %>
<% @exercises.each_with_index do |exercise,index|%>
<ul id="exercises_<%= exercise.id %>" class="exercise_list_div" onmouseover="$('#exercise_opr_<%=exercise.id %>').show();" onmouseout="$('#exercise_opr_<%=exercise.id %>').hide();">
<%= render :partial => 'exercise', :locals => {:exercise => exercise,:index => index} %>
</ul>
<div class="cl"></div>
<% end%>
<% if @exercises.count != 0 %>
<div class="mh550">
<% @exercises.each do |exercise| %>
<div class="clearfix edu-class-con-list pr">
<div class="fl ml15 task-form-90 ">
<span class="fl mr10 mt3 color-grey3"># <%= get_ex_index(exercise, @course, @is_teacher) + 1 %></span>
<%= link_to exercise.exercise_name, student_exercise_list_exercise_path(exercise), :class => "edu-class-inner-list fl color-grey3" %>
<% unless exercise.is_public %>
<i id="exercise_public_icon_<%= exercise.id %>" class="fa fa-lock color-grey fl mt8 ml15 font-18"></i>
<% end %>
<% ex_curr_status = exercise_curr_time exercise %>
<% if ex_curr_status[:status] != "" %>
<span class="edu-filter-btn <%= homework_status_color ex_curr_status[:status] %> ml10 fl mt3"><%= ex_curr_status[:status] %></span>
<% end %>
<div class="cl"></div>
<p class="color-grey font-12 mt20">
<span>创建于<%=time_from_now exercise.created_at %></span>
<span class="ml25">更新于<%=time_from_now exercise.updated_at %></span>
<span class="ml50"><a href="javascript:void(0)" class="color-orange05 mr3"><%= exercise.exercise_users.where("commit_status = 1").count %></a>已答</span>
<span class="ml50"><a href="javascript:void(0)" class="color-orange05 mr3"><%= exercise.course.student.count - exercise.exercise_users.where("commit_status = 1").count %></a>未答</span>
<% count = exercise.exercise_users.where("commit_status = 1 and subjective_score = -1").count %>
<span class="ml50"><a href="javascript:void(0)" class="color-orange05 mr3"><%= count %></a>未评</span>
<span class="ml50 <%= exercise.try(:exercise_status) == 3 ? 'color-grey' : 'color-orange' %>"><%= ex_curr_status[:time] %></span>
<% if exercise.try(:exercise_status) == 0 && exercise.publish_time %>
<span class="ml50 color-grey">将于&nbsp;<span class="color-orange"><%= format_time(exercise.publish_time).to_s %></span>&nbsp;发布</span>
<% end %>
</p>
</div>
<div class="fr edu-position edu-position-hidebox mr20 mt5">
<a href="javascript:void(0);"><i class="fa fa-bars font-16"></i></a>
<ul class="edu-position-hide undis">
<% if @is_teacher %>
<% if exercise.exercise_status == 1 %>
<li><%= link_to "编辑", edit_exercise_path(exercise) %></li>
<% end %>
<li><%= link_to "预览", exercise_path(exercise) %></li>
<li><%= link_to "设置", setting_exercise_path(exercise) %></li>
<li><%= link_to "导出成绩", student_exercise_list_exercise_path(exercise.id,:course_id => @course.id, :format => 'xls') %></li>
<% unless exercise.is_public %>
<li id="set_exercise_public_<%= exercise.id %>">
<a href="javascript:void(0);" onclick="delete_confirm_box('<%= set_public_exercise_path(exercise) %>', '您确定要公开吗?<br/>公开后不能重设为私有')">设为公开</a>
</li>
<% end %>
<!--<li><a href="javascript:void(0)">加入题库</a></li>-->
<li><a href="javascript:void(0)" onclick="delete_confirm_box_3('<%= exercise_path(exercise) %>', '确定要删除该试卷吗?')">删除</a></li>
<% else %>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
<% else %>
<%= render :partial => "welcome/no_data" %>
<% end %>
</div><!--列表end-->
<% end %>
</ul>
</div>
</div>
<% end %>
</div>
<div style="text-align:center;">
<div class="pages_user_show" style="width:auto; display:inline-block;margin: 18px 0;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>
<% else %>
<div style="background-color: #fff;padding-bottom: 10px;">
<%= render :partial => "welcome/no_data" %>
</div>
<% end %>

View File

@ -1,65 +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="mb10 ur_item">
<% score = exercise.exercise_questions.where("question_type=1").last.nil? ? "": exercise.exercise_questions.where("question_type=1").last.question_score %>
<label>分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<span class="fr c_red" style="width: 60px;" id="question_standard_answer_1">请点击选项</span>
<span class="fr">标准答案:</span>
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="1" type="hidden">
<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</div>
<div class="ur_editor_content">
<ul>
<div>
<input style="display: none;" name="exercise_choice" id="exercise_choice_1"/>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">A</a>
<input maxlength="200" class="w600" type='text' name='question_answer[0]' placeholder='输入选项内容'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">B</a>
<input maxlength="200" class="w600" type='text' name='question_answer[1]' placeholder='输入选项内容'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">C</a>
<input maxlength="200" class="w600" type='text' name='question_answer[2]' placeholder='输入选项内容'/>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 1, 1);">D</a>
<input maxlength="200" class="w600" type='text' name='question_answer[3]' placeholder='输入选项内容'/>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
</li>
<div class='cl'></div>
<li class="ur_item">
<a class="question_choice_dash fl mr10 choice_btn">E</a>
<div class="dash-block new-question w600" onclick='add_single_answer($(this), 1);'>新建选项</div>
</li>
<div class='cl'></div>
</div>
<div class="cl"></div>
</ul>
</div>
<div class="ur_editor_footer">
<span class="fl c_red mt10">温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案</span>
<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">保存</a>
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
</div>
<div class="cl"></div>
</div>
<% if exercise.id %>
<%= form_for(ExerciseQuestion.new,
:html => {:multipart => true},
:url => create_exercise_question_exercise_path(exercise.id),
:remote => true ) do |f| %>
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 single_Temp" id="single_Temp">
<div class="clearfix">
<p class="fl mt15 font-16 mb10">单选题</p>
<input name="question_type" value="1" type="hidden">
<label class="fr mt15">标准答案:<span class="color-orange current-option">请点击正确选项</span></label>
</div>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="mr10">题目</span></label>
<textarea name="question_title" id="poll_questions_title" class="panel-form-width2-690 fl panel-box-sizing" placeholder="请输入单选题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</li>
<input style="display: none;" name="exercise_choice" id="exercise_choice_1"/>
<li class="clearfix pr mb20">
<label class="panel-form-label fl">
<span class="option-item fr mr10 color-grey select-choice " name="option_span" data-tip-down="点击设置答案">A</span>
</label>
<textarea maxlength="200" name='question_answer[0]' class="panel-form-width2-690 fl panel-box-sizing" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" onclick="remove_single_answer($(this))" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<li class="clearfix pr mb20">
<label class="panel-form-label fl">
<span class="option-item fr mr10 color-grey select-choice " name="option_span" data-tip-down="点击设置答案">B</span>
</label>
<textarea maxlength="200" name='question_answer[1]' class="panel-form-width2-690 fl panel-box-sizing" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" onclick="remove_single_answer($(this))" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<li class="clearfix pr mb20">
<label class="panel-form-label fl">
<span class="option-item fr mr10 color-grey select-choice" name="option_span" data-tip-down="点击设置答案">C</span>
</label>
<textarea maxlength="200" name='question_answer[2]' class="panel-form-width2-690 fl panel-box-sizing" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" onclick="remove_single_answer($(this))" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<li class="clearfix mb20">
<label class="panel-form-label fl">
<span class="add-option-item fr mr10 color-grey border-dash-orange">D</span>
</label>
<div class="fl panel-box-sizing add-option-input border-dash-orange">
<a title="新增" href="javascript:void(0)" class="option_icon_add">新增选项</a>
</div>
</li>
<li class="clearfix mb20">
<% score = exercise.exercise_questions.where("question_type=1").last.nil? ? "": exercise.exercise_questions.where("question_type=1").last.question_score %>
<label class="panel-form-label fl"><span class="mr10">分值</span></label>
<input id="question_score" value="<%=score %>" type="text" class="with10 mr5 pl10 fl panel-box-sizing task-height-40" name="question_score" />
<label class="fl" style="line-height: 40px;">分</label>
<p class="fr">
<span class="font-12 color-grey mb10" style="display: block;">温馨提示:[单选题]属于客观题将由系统自动评分,请设置标准答案</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-blue" id="add_new_question">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$(this).parent().parent().parent().parent().remove();">取消</a>
</p>
</li>
<div class="cl"></div>
</div>
<% end %>
<% end %>
<script type="text/javascript">
$(function(){

View File

@ -1,64 +1,59 @@
<%= form_for(ExerciseQuestion.new,
<% if exercise.id %>
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url=>create_exercise_question_exercise_path(exercise.id),
:remote=>true ) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% score = exercise.exercise_questions.where("question_type=2").last.nil? ? "": exercise.exercise_questions.where("question_type=2").last.question_score %>
<label>分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<span class="fr c_red" style="width: 60px;" id="question_standard_answer_2">请点击选项</span>
<span class="fr">标准答案:</span>
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="2" type="hidden">
<textarea name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</div>
<div class="ur_editor_content">
<ul>
<div>
<input style="display: none;" name="exercise_choice" id="exercise_choice_2"/>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">A</a>
<input maxlength="200" class="w600" type='text' name='question_answer[0]' placeholder='输入选项内容'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 multiple_Temp" id="multiple_Temp">
<div class="clearfix">
<p class="fl mt15 font-16 mb10">多选题</p>
<input name="question_type" value="2" type="hidden">
<label class="fr mt15">标准答案:<span class="color-orange current-option">请点击正确选项</span></label>
<input style="display: none;" name="exercise_choice" id="exercise_choice_2"/>
</div>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="mr10">题目</span></label>
<textarea name="question_title" id="poll_questions_title" class="panel-form-width2-690 fl panel-box-sizing" placeholder="请输入多选题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">B</a>
<input maxlength="200" class="w600" type='text' name='question_answer[1]' placeholder='输入选项内容'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
<li class="clearfix pr mb20">
<label class="panel-form-label fl">
<span class="option-item fr mr10 color-grey select-choice " name="option_spans" data-tip-down="点击设置答案">A</span>
</label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question_answer[0]" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">C</a>
<input maxlength="200" class="w600" type='text' name='question_answer[2]' placeholder='输入选项内容'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
<li class="clearfix pr mb20">
<label class="panel-form-label fl">
<span class="option-item fr mr10 color-grey select-choice " name="option_spans" data-tip-down="点击设置答案">B</span>
</label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question_answer[1]" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<a class="question_choice_white fl mr10 choice_btn" title="设为答案" href="javascript:void(0)" onclick="toggle_select($(this), 2, 2);">D</a>
<input maxlength="200" class="w600" type='text' name='question_answer[3]' placeholder='输入选项内容'>
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
<li class="clearfix pr mb20">
<label class="panel-form-label fl">
<span class="option-item fr mr10 color-grey select-choice " name="option_spans" data-tip-down="点击设置答案">C</span>
</label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="question_answer[2]" placeholder="请输入选项内容"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<div class="cl"></div>
<li class="ur_item">
<a class="question_choice_dash fl mr10 choice_btn">E</a>
<div class="dash-block new-question w600" onclick='add_single_answer($(this), 2);'>新建选项</div>
<li class="clearfix mb20">
<label class="panel-form-label fl">
<span class="add-option-item fr mr10 color-grey border-dash-orange" name="option_spans">D</span>
</label>
<div class="fl panel-box-sizing add-option-input border-dash-orange"><a title="新增" href="javascript:void(0)" class="option_icon_add">新增选项</a></div>
</li>
<div class='cl'></div>
</div>
</ul>
</div>
<div class="ur_editor_footer">
<span class="fl c_red mt10">温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案</span>
<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">保存</a>
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
</div>
<div class="cl"></div>
</div>
<li class="clearfix mb20">
<% score = exercise.exercise_questions.where("question_type=2").last.nil? ? "": exercise.exercise_questions.where("question_type=2").last.question_score %>
<label class="panel-form-label fl"><span class="mr10">分值</span></label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" class="with10 mr5 fl panel-box-sizing task-height-40" />
<label class="fl" style="line-height: 40px;">分</label>
<p class="fr">
<span class="font-12 color-grey mb10" style="display: block;">温馨提示:[多选题]属于客观题将由系统自动评分,请设置标准答案</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-blue" id="add_new_question">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$(this).parent().parent().parent().parent().remove();">取消</a>
</p>
</li>
</div>
<% end %>
<% end %>
<script type="text/javascript">
$(function(){

View File

@ -0,0 +1,17 @@
<%= form_for(@exercise,
:html => {:multipart => true, :id => "exercise_head_form"},
:url => {:controller => 'exercise',
:action => 'create',
:course_id => @course.id
},
:method => :post, :remote => true) do |f| %>
<div class="ml15 mr15 mb15">
<input class="panel-box-sizing panel-form-width-100" name="exercise[exercise_name]" maxlength="100" id="exercise_name" value="<%= @exercise.try(:exercise_name) %>" placeholder="试卷标题" style="text-align: center;"/>
</div>
<div class="ml15 mr15">
<textarea id="mustBe" name="exercise[exercise_description]" class="panel-box-sizing panel-form-width-100" placeholder="试卷须知共有选择、填空、简答3种题型其中选择题包括单选题和多选题;您可以在此处填写本次试卷答题的相关说明"><%= @exercise.try(:exercise_description) %></textarea>
</div>
<p class="fr">
<a href="javascript:void(0)" onclick="pollsSubmit($(this));" class="fr task-btn mr15 task-btn-blue">保存</a>
</p>
<% end %>

View File

@ -1,33 +1,33 @@
<%= form_for(ExerciseQuestion.new,
<% if exercise.id %>
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url=>create_exercise_question_exercise_path(exercise.id),
:remote=>true ) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% score = exercise.exercise_questions.where("question_type=4").last.nil? ? "": exercise.exercise_questions.where("question_type=4").last.question_score %>
<label class="ml25">分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8 ml25">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="4" type="hidden">
<textarea maxlength="250" style="width: 619px;" class="questionTitle" name="question_title" id="poll_questions_title" placeholder="请输入问答题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</div>
<div class="ur_editor_content" id="new_multi">
<div class="multi_input">
<label name='candiate_items'>参考答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<textarea class="candiate_answer" style="width: 620px; height: 90px;" name="exercise_choice" placeholder="如有参考答案,请输入参考答案" type="text"></textarea>
</div>
<div class="cl"></div>
</div>
<div class="ur_editor_footer">
<p class="fl c_red">温馨提示:[问答题]属于主观题需要人工评分,未作答的情况下系统将自动评零分<br><span class="ml60">参考答案作为人工评分时的参考</span></p>
<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">保存</a>
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
</div>
<div class="cl"></div>
</div>
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 answer_Temp" id="answer_Temp">
<p class="fl mt15 font-16 mb10">简答题</p>
<input name="question_type" value="4" type="hidden">
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="mr10">题目</span></label>
<textarea maxlength="250" class="panel-form-width2-690 fl panel-box-sizing" name="question_title" id="poll_questions_title" placeholder="请输入简答题的题干" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</li>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="fr mr10 color-grey" name="option_spans">参考答案</span></label>
<textarea class="fl panel-box-sizing with90 task-height-150 pl5 pt5" name="exercise_choice" placeholder="如有参考答案,请输入参考答案"></textarea>
</li>
<li class="clearfix mb20">
<% score = exercise.exercise_questions.where("question_type=4").last.nil? ? "": exercise.exercise_questions.where("question_type=4").last.question_score %>
<label class="panel-form-label fl"><span class="mr10">分值</span></label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" class="with10 mr5 fl panel-box-sizing task-height-40" />
<label class="fl" style="line-height: 40px;">分</label>
<p class="fr">
<span class="font-12 color-grey" style="display: block;">温馨提示:[简答题]属于主观题需要人工评分,未作答的情况下系统将自动评分</span>
<span class="font-12 color-grey mb10 ml50" style="display: block;">&nbsp;&nbsp;参考答案仅作为人工评分的参考</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-blue" id="add_new_question">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$(this).parent().parent().parent().parent().remove();">取消</a>
</p>
</li>
</div>
<% end %>
<% end %>
<script type="text/javascript">
$(function(){

View File

@ -1,57 +1,52 @@
<ul class="tabs_list">
<li class="tab_item02 mr27"> <a title="单选题" class="tab_icon icon_radio" onclick="add_MC();"> 新建单选题 </a> </li>
<li class="tab_item02 mr27"> <a title="多选题" class=" tab_icon icon_checkbox" onclick="add_MCQ();"> 新建多选题 </a> </li>
<li class="tab_item02 mr27"> <a title="单行主观" class="tab_icon icon_text" onclick="add_single();"> 新建填空题 </a> </li>
<li class="tab_item02 "> <a title="问答题" class="tab_icon icon_text" onclick="add_multi();"> 新建问答题 </a> </li>
</ul>
<div class="cl"></div>
<a href="javascript:void(0);" class="fl mr20 add_item_part" onclick="add_MC();"><i class="fa fa-plus-circle color-light-green mr5"></i>单选题</a>
<a href="javascript:void(0);" class="fl mr20 add_item_part" onclick="add_MCQ();"><i class="fa fa-plus-circle color-light-green mr5"></i>多选题</a>
<a href="javascript:void(0);" class="fl mr20 add_item_part" onclick="add_single();"><i class="fa fa-plus-circle color-light-green mr5"></i>填空题</a>
<a href="javascript:void(0);" class="fl add_item_part" onclick="add_multi();"><i class="fa fa-plus-circle color-light-green mr5"></i>简答题</a>
<script type="text/javascript">
function add_MC(){
var forms = $("form.new_exercise_question");
if($("#polls_head_edit").is(":visible")){
notice_box("请先保存测验标题及测验基本信息。");
if($("#exercise_head_edit").is(":visible")){
notice_box("请先保存试卷标题等信息。");
}else if(forms.length > 0){
notice_box("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>exercise}) %>");
$("#question_score").focus();
//$.get("<%#= new_exercise_question_path(:exercise => @exercise, :type => "MC") %>");
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>@exercise}) %>");
//sd_create_editor_from_data(<%#= @exercise.id %>, null, "100%", "<%#= @exercise.class.to_s %>");
}
}
function add_MCQ(){
var forms = $("form.new_exercise_question");
if($("#polls_head_edit").is(":visible")){
notice_box("请先保存测验标题及测验基本信息。");
if($("#exercise_head_edit").is(":visible")){
notice_box("请先保存试卷标题等信息。");
}else if(forms.length > 0){
notice_box("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>exercise}) %>");
$("#question_score").focus();
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>@exercise}) %>");
}
}
function add_single(){
var forms = $("form.new_exercise_question");
if($("#polls_head_edit").is(":visible")){
notice_box("请先保存测验标题及测验基本信息。");
if($("#exercise_head_edit").is(":visible")){
notice_box("请先保存试卷标题等信息。");
}else if(forms.length > 0){
notice_box("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>exercise}) %>");
$("#question_score").focus();
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>@exercise}) %>");
}
}
function add_multi(){
var forms = $("form.new_exercise_question");
if($("#polls_head_edit").is(":visible")){
notice_box("请先保存测验标题及测验基本信息。");
if($("#exercise_head_edit").is(":visible")){
notice_box("请先保存试卷标题等信息。");
}else if(forms.length > 0){
notice_box("请先保存正在编辑的题目再新建。");
} else{
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_multi', :locals => {:exercise=>exercise}) %>");
$("#question_score").focus();
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_multi', :locals => {:exercise=>@exercise}) %>");
}
}

View File

@ -1,55 +1,42 @@
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url=>create_exercise_question_exercise_path(exercise.id),
:remote=>true ) do |f| %>
<div class="questionContainer">
<div class="mb10 ur_item">
<% score = exercise.exercise_questions.where("question_type=3").last.nil? ? "": exercise.exercise_questions.where("question_type=3").last.question_score %>
<label class="ml36">分值<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" style="width:60px; text-align:center; padding-left:0px;">分
<div class="cl"></div>
</div>
<div class="ur_editor_title">
<label class="questionLabel mt8 ml36">问题:&nbsp;&nbsp;</label>
<input name="question_type" value="3" type="hidden">
<textarea maxlength="250" style="width: 608px;" class="questionTitle" name="question_title" id="poll_questions_title" placeholder="请输入填空题的题干(注意:目前仅支持一个空)" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</div>
<div class="ur_editor_content" id="new_single">
<ul>
<div>
<li class="ur_item new_answer">
<label name='candiate_items'>参考答案一<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer w560" name="exercise_choice[0]" placeholder="请输入参考答案" type="text">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
<% if exercise.id %>
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url=>create_exercise_question_exercise_path(exercise.id),
:remote=>true ) do |f| %>
<div class="user_bg_shadow bor-grey-e pl15 pr30 mb20 fillin_Temp" id="fillin_Temp">
<p class="fl mt15 font-16 mb10">填空题</p>
<li class="clearfix pr mb20">
<input name="question_type" value="3" type="hidden">
<label class="panel-form-label fl"><span class="mr10">题目</span></label>
<textarea maxlength="250" class="panel-form-width2-690 fl panel-box-sizing" name="question_title" id="poll_questions_title" placeholder="请输入填空题的题干(注意:目前仅支持一个空)" type="text" oninput="autoHeight('#poll_questions_title',30)"></textarea>
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<label name='candiate_items'>参考答案二<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer w560" name="exercise_choice[1]" placeholder="请输入参考答案(选填)" type="text">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="fr mr10 color-grey" name="fill_span">答案 1</span></label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="exercise_choice[0]" placeholder="请输入参考答案"></textarea>
<!--<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>-->
</li>
<div class="cl"></div>
<li class="ur_item new_answer">
<label name='candiate_items'>参考答案三<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input class="candiate_answer w560" name="exercise_choice[2]" placeholder="请输入参考答案(选填)" type="text">
<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>
<li class="clearfix pr mb20">
<label class="panel-form-label fl"><span class="fr mr10 color-grey" name="fill_span">答案 2</span></label>
<textarea class="panel-form-width2-690 fl panel-box-sizing" name="exercise_choice[1]" placeholder="请输入参考答案(可选)"></textarea>
<a title="移除" href="javascript:void(0)" class="position-delete option_icon_remove"><i class="fa fa-times-circle color-orange font-16 fl"></i></a>
</li>
<div class="cl"></div>
<li class="ur_item">
<div class="dash-block new-question w560" style="margin-left: 82px;" onclick="add_candidate_answer($(this));">新建参考答案</div>
<li class="clearfix mb20">
<label class="panel-form-label fl"><span>&nbsp;</span></label>
<div class="fl panel-box-sizing add-option-input border-dash-orange"><a title="新增" href="javascript:void(0)" class="option_fillin_add">新增参考答案</a></div>
</li>
<div class='cl'></div>
</div>
<div class="cl"></div>
</ul>
</div>
<div class="ur_editor_footer">
<span class="fl c_red mt10">温馨提示:[填空题]属于客观题将由系统自动评分,请输入参考答案</span>
<a class="big_blue_btn borderRadius fr" data-button="ok" id="add_new_question">保存</a>
<a class="big_grey_btn borderRadius fr mr10" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
</div>
<div class="cl"></div>
</div>
<li class="clearfix mb20">
<% score = exercise.exercise_questions.where("question_type=3").last.nil? ? "": exercise.exercise_questions.where("question_type=3").last.question_score %>
<label class="panel-form-label fl"><span class="mr10">分值</span></label>
<input id="question_score" value="<%=score %>" type="text" name="question_score" class="with10 mr5 fl panel-box-sizing task-height-40"/>
<label class="fl" style="line-height: 40px;">分</label>
<p class="fr">
<span class="font-12 color-grey mb10" style="display: block;">温馨提示:[填空题]属于客观题将由系统自动评分,请设置标准答案</span>
<a href="javascript:void(0)" class="fr task-btn task-btn-blue" id="add_new_question">保存</a>
<a href="javascript:void(0)" class="fr task-btn mr10" onclick="$(this).parent().parent().parent().parent().remove();">取消</a>
</p>
</li>
</div>
<% end %>
<% end %>
<script type="text/javascript">
$(function(){

View File

@ -1,24 +1,15 @@
<div class="testStatus" onmouseover="$('#poll_head_edit_pen').show();" onmouseout="$('#poll_head_edit_pen').hide();"><!--头部显示 start-->
<a href="javascript:" class="testEdit" title="编辑" id="poll_head_edit_pen" onclick="pollsEdit();" style="top:0;display:none"></a>
<!-- <a class='ur_icon_add' title='导入' id="import_btn" onclick="importPoll();"></a> -->
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
<div class="fontGrey2">
<% 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">截止时间:<font id="show_exercise_time"><%=Time.parse(h(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.end_time %></font></span>
<% if exercise.time != -1 %>
<span>测验时长:<%= exercise.time %>分钟</span>
<% end %>
</div>
<pre class="fontGrey2 font_cus" style="white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= exercise.exercise_description.nil? ? "" :exercise.exercise_description.html_safe%></pre>
<div class="ur_editor_footer mt10">
<input type="checkbox" name="question_random" disabled <%= exercise.question_random == 0 ? 'checked' : '' %> id="show_question_random">
<label for="show_question_random" class="mr30">题目不随机打乱</label>
<input type="checkbox" name="choice_random" disabled <%= exercise.choice_random == 0 ? 'checked' : '' %> id="show_question_random">
<label for="show_question_random" class="mr30">选项不随机打乱</label>
<input type="checkbox" name="show_result" disabled <%= exercise.show_result == 1 ? 'checked' : '' %> id="show_question_random">
<label for="show_question_random">允许学生查看测验结果</label>
</div>
<div class="cl"></div>
</div>
<div class="ml15 mr15">
<p style="text-align: center; font-size: 16px; width: 98%;" class="fl"><%= @exercise.try(:exercise_name) %></p>
<a href="javascript:void(0)" class="fl" onclick="pollsEdit();" data-tip-down="编辑"><i class="fa fa-pencil color-orange05"></i></a>
</div>
<div class="cl"></div>
<div class="ml15 mr15 mt15">
<pre class="color-grey font-14" style="font-family: '微软雅黑','宋体';white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:pre-wrap;white-space:-o-pre-wrap;word-break:normal;word-wrap: break-word;"><%= @exercise.try(:exercise_description).nil? ? "" : @exercise.try(:exercise_description).html_safe%></pre>
</div>
<script>
function pollsEdit(){
$("#exercise_head_edit").show();
$("#exercise_head_show").hide();
}
</script>

View File

@ -1,4 +1,5 @@
$("#polls_head_show").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:exercise => @exercise}) %>");
$("#polls_head_edit").html("<%= escape_javascript(render :partial => 'edit_head', :locals => {:exercise => @exercise}) %>");
$("#polls_head_edit").hide();
$("#polls_head_show").show();
$("#exercise_head_show").html("<%= escape_javascript(render :partial => 'show_head') %>");
$("#exercise_head_edit").html("<%= escape_javascript(render :partial => 'edit_head') %>");
$("#exercise_head_edit").hide();
$("#exercise_head_show").show();
$("#new_exercise_question").html("<%= escape_javascript(render :partial => 'exercise/new_question') %>");

View File

@ -6,10 +6,10 @@
<% else %>
$("#new_exercise_question").html('<%= escape_javascript(render :partial => 'new_question', :locals => {:exercise => @exercise}) %>');
$("#new_poll_question").html("");
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
//$("#exercise_submit").html("<%#= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
<%if @exercise_questions.question_type == 1%>
$("#mc_question_list>div").last().children().first().addClass("border_b");
$("#mc_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
//$("#mc_question_list>div").last().children().first().addClass("border_b");
$("#exercise_question_list").append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
"<div id='show_poll_questions_<%= @exercise_questions.id %>'>" +
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_questions}) %>" +
"</div>" +

View File

@ -1,2 +0,0 @@
hideModal();
$("#exercise").html("<%= escape_javascript(render :partial => 'exercises_list') %>");

View File

@ -1,9 +1,14 @@
<%= render :partial => 'exercise_form'%>
<script type="text/javascript">
$(function() {
<% if @exercise.exercise_name != "" && @exercise.end_time != "" %>
$("#polls_head_show").show();
$("#polls_head_edit").hide();
<% end %>
});
</script>
<%#= render :partial => 'exercise_form'%>
<div class="edu-class-container edu-position">
<p class="mb10 font-14">
<i class="fa fa-map-marker mr5 color-grey"></i>
<%= link_to @course.name, course_path(@course) %> &gt; <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> &gt; <%= link_to @exercise.exercise_name, student_exercise_list_exercise_path(@exercise) %> &gt; 编辑
</p>
<div class="edu-con-top user_bg_shadow bor-grey-e clearfix mb20">
<p class="ml15 color-grey3 fl">编辑试卷</p>
<%= link_to "返回", student_exercise_list_exercise_path(@exercise), :class => "fr font-12 color-grey mr15 mt5" %>
</div>
<%= render :partial => "exercise/edu_edit_form", :locals => {:is_edit => true} %>
</div>

View File

@ -1,8 +1,12 @@
<%= stylesheet_link_tag 'polls', :media => 'all' %>
<script type="text/javascript">
$(function(){
$("#homework_page_right").css("min-height",$("#courseLSide").height()-33);
});
function close_searchbox(){
if($("#exercise_name_search").val() != ""){
$("#exercise_name_search").val("");
$('#exercise_search_form').submit();
}
}
function republish_exercise(exercise_id,index)
{
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
@ -48,8 +52,24 @@
pop_box_new(htmlvalue, 300, 140);
}
</script>
<div class="courseRSide fl" id="homework_page_right">
<div class="polls_content02" id="exercise" style="width: 980px;">
<%= render :partial => 'exercises_list'%>
</div><!--问卷内容end-->
<div class="with85 fl">
<div class="ml15 user_bg_shadow bor-grey-e">
<div class="edu-con-top clearfix">
<p class="ml15 color-grey3 fl">试卷列表</p>
<% if @is_teacher %>
<a href="<%= new_exercise_path(:course_id => @course.id) %>" class="white-btn orange-btn fr mr20 mt3" title="新建">+&nbsp;新建</a>
<!--<a href="javascript:void(0)" class="white-btn orange-btn fr mr20 mt3" data-remote="true" title="题库选用">+&nbsp;题库选用</a>-->
<!--<a href="javascript:void(0)" class="white-btn orange-btn fr mr20 mt3" data-remote="true" title="导出成绩">导出成绩</a>-->
<% end %>
</div>
<div class="edu-class-innner-conbox">
<div class="edu-con-top clearfix" id="exercise_index_tab">
<%= render :partial => "exercise/exercise_index_tab" %>
</div>
<div id="exercise_index_list" class="mh550 clearfix">
<%= render :partial => "exercise/exercises_list" %>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,4 @@
<% unless params[:page] %>
$("#exercise_index_tab").html("<%= j(render :partial => 'exercise/exercise_index_tab') %>");
<% end %>
$("#exercise_index_list").html("<%= j(render :partial => 'exercise/exercises_list') %>");

View File

@ -1 +1,13 @@
<%= render :partial => 'exercise_form'%>
<%#= render :partial => 'exercise_form'%>
<div class="edu-class-container edu-position">
<p class="mb10 font-14">
<i class="fa fa-map-marker mr5 color-grey"></i>
<%= link_to @course.name, course_path(@course) %> &gt; <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> &gt; 新建
</p>
<div class="edu-con-top user_bg_shadow bor-grey-e clearfix mb20">
<p class="ml15 color-grey3 fl">新建试卷</p>
<%= link_to "返回", exercise_index_path(:course_id => @course.id), :class => "fr font-12 color-grey mr15 mt5" %>
</div>
<%= render :partial => "exercise/edu_edit_form", :locals =>{:is_edit => false} %>
</div>

View File

@ -0,0 +1,2 @@
$("#set_exercise_public_<%= @exercise.id %>").remove();
$("#exercise_public_icon_<%= @exercise.id %>").remove();

View File

@ -0,0 +1,376 @@
<style>
.magic-radio + label:before, .magic-checkbox_show + label:before{
width: 16px;
height: 16px;
}
</style>
<div class="edu-class-container edu-position">
<p class="mb10 font-14">
<i class="fa fa-map-marker mr5 color-grey"></i>
<%= link_to @course.name, course_path(@course) %> &gt; <%= link_to "试卷列表", exercise_index_path(:course_id => @course.id) %> &gt; #<%= get_ex_index(@exercise, @course, @is_teacher) + 1 %>
</p>
<div class="edu-con-top user_bg_shadow bor-grey-e clearfix mb20">
<p class="ml15 fl color-grey3">
<i class="fa fa-lock mr5 color-grey"></i>
<%= @exercise.exercise_name %>
</p>
<%= link_to "返回", student_exercise_list_exercise_path(@exercise), :class => "fr font-12 mr15 mt3 color-grey" %>
</div>
<div class="user_bg_shadow bor-grey-e clearfix">
<% edit_mode = @is_new && @is_teacher %>
<div id="homework_publish_setting">
<!--发布设置-->
<div>
<div class="<%= edit_mode ? 'none' : '' %>" id="show_exercise_setting">
<div class="bor-bottom-greyE pt10 pb10 pr10">
<div class="clearfix mb15">
<p class="ml15 fl font-16 mt5">发布设置</p>
<a href="javascript:void(0);" class="white-btn orange-btn fr mr15 mt15" title="编辑" onclick="show_ex_edit_setting();">编辑</a>
</div>
<div class="ml30 mr30">
<div class="clearfix">
<ul>
<li class="clearfix mb15 edu-position pl30">
<label class="panel-form-label fl mr10">发布时间</label>
<input type="text" class="disabled-bg fl task-form-15 task-height-40 panel-box-sizing" value="<%= format_time @exercise.publish_time %>" disabled>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px; width:405px;">
<em></em>
<span></span>
<p>发布之前,学生不会收到试卷</p>
</div>
</li>
<li class="clearfix mb15 edu-position pl30">
<label class=" panel-form-label fl mr10">截止时间</label>
<input type="text" class="disabled-bg fl task-form-15 task-height-40 panel-box-sizing" id="show_end_time" value="<%= format_time @exercise.end_time %>" disabled>
<div class="cl"></div>
</li>
<!--<li class="clearfix mb15 edu-position pl30">-->
<!--<label class=" panel-form-label fl mr10">结束时间</label>-->
<!--<input type="text" class="disabled-bg fl task-form-15 task-height-40 panel-box-sizing" id="show_archive_time" value="" disabled="">-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>结束之后,系统自动归档试卷</p>-->
<!--</div>-->
<!--</li>-->
</ul>
</div>
</div>
</div>
<div class="bor-bottom-greyE pt10 pb10 pr10">
<div class="clearfix mb15">
<p class="ml15 fl font-16 mt10">答题设置</p>
</div>
<div class="ml30 mr30" style="padding-bottom:20px;">
<div class="clearfix">
<ul>
<li class="clearfix mb20 edu-position pl30">
<label class="panel-form-label fl mr10">答题时长</label>
<input type="text" value="<%= @exercise.time.to_i == -1 ? '' : @exercise.time %>" disabled class="fl task-form-15 task-height-40 panel-box-sizing disabled-bg">
<label class="fl mt8 ml5">分钟</label>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>答题时长不填写,则表示不限时长</p>
<p>学生答题时间即使没有超过答题时长的限制</p>
<p>但是已到截止时间点,则系统自动为正在答题的学生提交试卷</p>
</div>
</li>
<li class="clearfix mb20 edu-position pl30">
<label class="panel-form-label fl mr10">答题显示</label>
<input class="magic-checkbox fl mt5 magic-checkbox_show" id="dt_1" disabled type="checkbox" <%= @exercise.question_random == 1 ? 'checked' : '' %>>
<label class="fl" for="dt_1">题目顺序随机打乱</label>
<span class="fl color-grey mt5">(选中则学生答题时,题目顺序按照题型随机显示)</span>
<div class="cl"></div>
<input class="magic-checkbox fl mt5 magic-checkbox_show" id="dt_2" disabled type="checkbox" <%= @exercise.choice_random == 1 ? 'checked' : '' %>>
<label class="fl" for="dt_2" style="margin-left: 11%;">选项顺序随机打乱</label>
<span class="fl color-grey mt5">(选中则学生答题时,选项顺序随机显示)</span>
</li>
</ul>
<!--<ul>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">补交答题</label>-->
<!--<input id="edit_allow_late_1" disabled="" class="magic-radio fl" type="radio" name="homework_allow_late" value="1">-->
<!--<label for="edit_allow_late_1" class="fl mr30">允许</label>-->
<!--<input id="edit_allow_late_0" disabled="" class="magic-radio fl" type="radio" name="homework_allow_late" value="0" checked="">-->
<!--<label for="edit_allow_late_0" class="fl">禁止</label>-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>允许补交,则在补交截止日期之前,未答题的学生可以补交答题</p>-->
<!--<p>但是在发布截止日期~补交截止时间内才答题的学生,将被扣迟交分</p>-->
<!--</div>-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">截止时间</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing disabled-bg" disabled="" placeholder="5">-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">迟交扣分</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing disabled-bg" disabled="" placeholder="5">-->
<!--</li>-->
<!--</ul>-->
</div>
</div>
</div>
<div class="bor-bottom-greyE pt10 pb10 pr10">
<div class="clearfix mb15">
<p class="ml15 fl font-16 mt10">公开设置</p>
</div>
<div class="ml30 mr30 mb15">
<div class="clearfix">
<ul>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input class="magic-checkbox fl mt5 magic-checkbox_show" type="checkbox" disabled <%= @exercise.score_open ? 'checked' : '' %>>
<label class="fl">公开成绩</label>
<span class="fl color-grey">(选中则在截止时间之后对班级学生公开所有成员的成绩,否则不公开)</span>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input class="magic-checkbox fl mt5 magic-checkbox_show" type="checkbox" disabled <%= @exercise.answer_open ? 'checked' : '' %>>
<label class="fl">公开答案</label>
<span class="fl color-grey">(选中则在截止时间之后对班级学生公开试卷题目的答案,否则不公开)</span>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="<%= edit_mode ? '' : 'none' %>" id="edit_exercise_setting">
<%= form_tag(ex_setting_exercise_path(@exercise), :method => "post", :id => 'exercise_setting_form') do |f| %>
<div class="bor-bottom-greyE pt10 pb10 pr10">
<div class="clearfix mb15">
<p class="ml15 fl font-16 mt5">发布设置</p>
</div>
<div class="ml30 mr30">
<div class="clearfix">
<ul>
<li class="clearfix mb15 edu-position pl30">
<label class="panel-form-label fl mr10">发布时间</label>
<input type="text" name="exercise_publish_time" readonly value="<%= format_time @exercise.publish_time %>" <%= @exercise.try(:exercise_status) > 1 ? 'disabled' : '' %> class="fl task-form-15 task-height-40 panel-box-sizing <%= @exercise.try(:exercise_status) > 1 ? 'disabled-bg' : '' %>" placeholder="请选择发布时间">
<span class="color-orange fl ml20 mt5 none" id="exercise_publish_time_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px; width:405px;">
<em></em>
<span></span>
<p>发布之前,学生不会收到试卷</p>
</div>
</li>
<li class="clearfix mb15 edu-position pl30">
<label class="panel-form-label fl mr10">截止时间</label>
<input type="text" name="exercise_end_time" readonly value="<%= format_time @exercise.end_time %>" <%= @exercise.try(:exercise_status) == 3 ? 'disabled' : '' %> class="fl task-form-15 task-height-40 panel-box-sizing <%= @exercise.try(:exercise_status) == 3 ? 'disabled-bg' : '' %>" placeholder="请选择截止时间">
<span class="color-orange fl ml20 mt5 none" id="exercise_end_time_notice">
<i class="fa fa-exclamation-circle mr5 color-orange"></i>
</span>
<span class="color-orange fl mt5 none">不能早于发布时间</span>
</li>
<!--<li class="clearfix mb15 edu-position pl30">-->
<!--<label class=" panel-form-label fl mr10">结束时间</label>-->
<!--<input type="text" name="homework_archive_time" readonly="" value="" class=" fl task-form-15 task-height-40 panel-box-sizing" placeholder="请选择结束时间">-->
<!--<span class="color-orange fl ml20 mt5 none" id="homework_archive_time_notice"><i class="fa fa-exclamation-circle mr5 color-orange"></i></span>-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>结束之后,系统自动归档试卷</p>-->
<!--</div>-->
<!--</li>-->
</ul>
</div>
</div>
</div>
<div class="bor-bottom-greyE pt10 pb10 pr10">
<div class="clearfix mb15">
<p class="ml15 fl font-16 mt10">答题设置</p>
</div>
<div class="ml30 mr30" style="padding-bottom:20px;">
<div class="clearfix">
<ul>
<li class="clearfix mb20 edu-position pl30">
<label class="panel-form-label fl mr10">答题时长</label>
<input type="text" name="time" <%= @exercise.try(:exercise_status) == 3 ? 'disabled' : '' %> value="<%= @exercise.time.to_i == -1 ? '' : @exercise.time %>" class="fl task-form-15 task-height-40 panel-box-sizing" placeholder="60">
<label class="fl mt8 ml5">分钟</label>
<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">
<em></em>
<span></span>
<p>答题时长不填写,则表示不限时长</p>
<p>学生答题时间即使没有超过答题时长的限制</p>
<p>但是已到截止时间点,则系统自动为正在答题的学生提交试卷</p>
</div>
</li>
<li class="clearfix mb20 edu-position pl30">
<label class="panel-form-label fl mr10">答题显示</label>
<input name="question_random" <%= @exercise.try(:exercise_status) == 3 ? 'disabled' : '' %> class="magic-checkbox fl mt5 magic-checkbox_show" id="dt_3" type="checkbox" <%= @exercise.question_random == 1 ? 'checked' : '' %>>
<label class="fl" for="dt_3">题目顺序随机打乱</label>
<span class="fl color-grey mt5">(选中则学生答题时,题目顺序按照题型随机显示)</span>
<div class="cl"></div>
<input name="choice_random" <%= @exercise.try(:exercise_status) == 3 ? 'disabled' : '' %> class="magic-checkbox fl mt5 magic-checkbox_show" id="dt_4" type="checkbox" <%= @exercise.choice_random == 1 ? 'checked' : '' %>>
<label class="fl" for="dt_4" style="margin-left: 11%;">选项顺序随机打乱</label>
<span class="fl color-grey mt5">(选中则学生答题时,选项顺序随机显示)</span>
</li>
</ul>
<!--<ul>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">补交答题</label>-->
<!--<input id="edit_allow_late_2" class="magic-radio fl" type="radio" name="homework_allow_late_1" value="1">-->
<!--<label for="edit_allow_late_2" class="fl mr30 mt3">允许</label>-->
<!--<input id="edit_allow_late_3" class="magic-radio fl" type="radio" name="homework_allow_late_1" value="0" checked="">-->
<!--<label for="edit_allow_late_3" class="fl mt3">禁止</label>-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>允许补交,则在补交截止日期之前,未答题的学生可以补交答题</p>-->
<!--<p>但是在发布截止日期~补交截止时间内才答题的学生,将被扣迟交分</p>-->
<!--</div>-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">截止时间</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing" placeholder="5">-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">迟交扣分</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing" placeholder="5">-->
<!--</li>-->
<!--</ul>-->
</div>
</div>
</div>
<div class="pt10 pb10 pr10">
<div class="clearfix mb15">
<p class="ml15 fl font-16 mt10">公开设置</p>
</div>
<div class="ml30 mr30">
<div class="clearfix">
<ul>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input name="score_open" class="magic-checkbox fl magic-checkbox_show" type="checkbox" id="public_scroe" <%= @exercise.score_open ? 'checked' : '' %>>
<label class="fl" for="public_scroe" style="top:0px">公开成绩</label>
<span class="fl color-grey">(选中则在截止时间之后对班级学生公开所有成员的成绩,否则不公开)</span>
</li>
<li class="clearfix">
<label class="panel-form-label fl mr10">&nbsp;</label>
<input name="answer_open" class="magic-checkbox fl magic-checkbox_show" type="checkbox" id="public_answer" <%= @exercise.answer_open ? 'checked' : '' %>>
<label class="fl" for="public_answer" style="top:0px">公开答案</label>
<span class="fl color-grey">(选中则在截止时间之后对班级学生公开试卷题目的答案,否则不公开)</span>
</li>
</ul>
</div>
</div>
</div>
<% end %>
</div>
</div>
<!--主观题评分设置-->
<!--<div class="bor-bottom-greyE pt10 pb10 pr10">-->
<!--<div class="none" id="show_late_setting">-->
<!--<div class="clearfix mb15">-->
<!--<p class="ml15 fl font-16 mt10">主观题评分设置</p>-->
<!--</div>-->
<!--<div class="ml30 mr30" style="padding-bottom:20px;">-->
<!--<div class="clearfix">-->
<!--<ul>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">助教评分</label>-->
<!--<input class="magic-radio fl mt5 magic-checkbox_show" id="zg_1" name="zg[]_1" disabled="" type="radio" checked="">-->
<!--<label class="fl" for="zg_1">普通模式</label>-->
<!--<span class="fl color-grey mt5">(选中则取各助教最终评分的平均分)</span>-->
<!--<div class="cl"></div>-->
<!--<input class="magic-radio fl mt5 magic-checkbox_show" id="zg_2" name="zg[]_1" disabled="" type="radio">-->
<!--<label class="fl" for="zg_2" style="margin-left: 11%;">复审模式</label>-->
<!--<span class="fl color-grey mt5">(选中则只取最终次的助教评分)</span>-->
<!--</li>-->
<!--</ul>-->
<!--<ul>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">最终成绩</label>-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>计算说明</p>-->
<!--<p class="mb10">教师评分*其百分比+助教评分+其百分比+迟交扣分</p>-->
<!--<p>注意</p>-->
<!--<p>非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到另外</p><p>的评分选项上。例如教师评分60% + 助教评分40% 学生A没有得到</p><p>教师评分则最终成绩将按照助教评分100% 进行计算 </p>-->
<!--</div>-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">教师评分</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing disabled-bg" disabled="" placeholder="5">-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">助教评分</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing disabled-bg" disabled="" placeholder="5">-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="" id="edit_late_setting">-->
<!--<div class="clearfix mb15">-->
<!--<p class="ml15 fl font-16 mt10">主观题评分设置</p>-->
<!--</div>-->
<!--<div class="ml30 mr30" style="padding-bottom:20px;">-->
<!--<div class="clearfix">-->
<!--<ul>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">助教评分</label>-->
<!--<input class="magic-radio fl mt5 magic-checkbox_show" id="zg_3" name="zg[]_2" type="radio" checked="">-->
<!--<label class="fl" for="zg_3">普通模式</label>-->
<!--<span class="fl color-grey mt5">(选中则取各助教最终评分的平均分)</span>-->
<!--<div class="cl"></div>-->
<!--<input class="magic-radio fl mt5 magic-checkbox_show" id="zg_4" name="zg[]_2" type="radio" checked="">-->
<!--<label class="fl" for="zg_4" style="margin-left: 11%;">复审模式</label>-->
<!--<span class="fl color-grey mt5">(选中则只取最终次的助教评分)</span>-->
<!--</li>-->
<!--</ul>-->
<!--<ul>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">最终成绩</label>-->
<!--<div class="popup_tip_box fontGrey2" style="right:-15px; top:0px;width:405px;">-->
<!--<em></em>-->
<!--<span></span>-->
<!--<p>计算说明</p>-->
<!--<p class="mb10">教师评分*其百分比+助教评分*其百分比-迟交扣分</p>-->
<!--<p>注意</p>-->
<!--<p>非零百分比的评分选项,在没有评分记录的情况下,其百分比平摊到另外</p><p>的评分选项上。例如教师评分60% + 助教评分40% 学生A没有得到</p><p>教师评分则最终成绩将按照助教评分100% 进行计算 </p>-->
<!--</div>-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">教师评分</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing" placeholder="5">-->
<!--</li>-->
<!--<li class="clearfix mb20 edu-position pl30">-->
<!--<label class="panel-form-label fl mr10">&nbsp;</label>-->
<!--<label class="mt8 fl mr10">助教评分</label>-->
<!--<input type="text" value="10" class="fl task-form-15 task-height-40 panel-box-sizing" placeholder="5">-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<div class="clearfix mt15 mb15 mr15 pr10 <%= edit_mode ? '' : 'none' %>" id="exam_setting_submit_block">
<a href="javascript:void(0);" onclick="ex_setting_form_submit();" class="task-btn task-btn-blue fr">保存</a>
<a href="javascript:void(0);" onclick="s_op_confirm_box('<%= student_exercise_list_exercise_path(@exercise) %>', '修改的内容将全部丢失<br/>是否确认取消保存')" class="task-btn fr mr10">取消</a>
</div>
</div>
</div>
</div>

View File

@ -1,5 +1,4 @@
$("#polls_head_show").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:exercise => @exercise}) %>");
$("#polls_head_edit").html("<%= escape_javascript(render :partial => 'edit_head', :locals => {:exercise => @exercise}) %>");
$("#polls_head_edit").hide();
$("#polls_head_show").show();
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
$("#exercise_head_show").html("<%= escape_javascript(render :partial => 'show_head') %>");
$("#exercise_head_edit").html("<%= escape_javascript(render :partial => 'edit_head') %>");
$("#exercise_head_edit").hide();
$("#exercise_head_show").show();

View File

@ -531,6 +531,9 @@ RedmineApp::Application.routes.draw do
post 'send_to_course'
get 'get_student_uncomplete_question'
post 'edit_question_score'
get 'setting'
post 'ex_setting'
get 'set_public'
end
collection do #生成路径为 /exercise/方法名
@ -543,7 +546,18 @@ RedmineApp::Application.routes.draw do
end
end
resources :homework_common, :except => [:show]do
resources :exercise_question do
member do
end
collection do
end
end
resources :homework_common, :except => [:show]do
member do
get 'start_anonymous_comment'
get 'stop_anonymous_comment'

View File

@ -0,0 +1,7 @@
class AddNewColumnToExercises < ActiveRecord::Migration
def change
add_column :exercises, :is_public, :boolean, :default => false
add_column :exercises, :score_open, :boolean, :default => true
add_column :exercises, :answer_open, :boolean, :default => true
end
end

View File

@ -562,3 +562,131 @@ function delete_students(type, id, group_id){
return;
}
}
function show_ex_edit_setting(){
$("#show_exercise_setting").hide();
$("#edit_exercise_setting").show();
$("#exam_setting_submit_block").show();
$("input[name='exercise_publish_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false,
onSelectDate:function() {
if($.trim($("input[name='exercise_end_time']").val()) == ""){
var date = new Date(Date.parse($("input[name='exercise_publish_time']").val().replace(/-/g, "/")));
$("input[name='exercise_end_time']").val(formate_time(new Date(date.setDate(date.getDate()+14))));
}
// if($.trim($("input[name='homework_archive_time']").val()) == ""){
// var date = new Date(Date.parse($("input[name='homework_end_time']").val().replace(/-/g, "/")));
// $("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1))));
// }
},
onSelectTime:function() {
if($.trim($("input[name='exercise_end_time']").val()) == ""){
var date = new Date(Date.parse($("input[name='exercise_publish_time']").val().replace(/-/g, "/")));
$("input[name='exercise_end_time']").val(formate_time(new Date(date.setDate(date.getDate()+14))));
}
// if($.trim($("input[name='homework_archive_time']").val()) == ""){
// var date = new Date(Date.parse($("input[name='homework_end_time']").val().replace(/-/g, "/")));
// $("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1))));
// }
}
});
$("input[name='exercise_end_time']").datetimepicker({
allowBlank:true,
lang:'ch',
format:'Y-m-d H:i',
validateOnBlur:false,
// onSelectDate:function() {
// if($.trim($("input[name='homework_archive_time']").val()) == ""){
// var date = new Date(Date.parse($("input[name='homework_end_time']").val().replace(/-/g, "/")));
// $("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1))));
// }
// },
// onSelectTime:function() {
// if($.trim($("input[name='homework_archive_time']").val()) == ""){
// var date = new Date(Date.parse($("input[name='homework_end_time']").val().replace(/-/g, "/")));
// $("input[name='homework_archive_time']").val(formate_time(new Date(date.setMonth(date.getMonth()+1))));
// }
// }
});
}
function ex_setting_form_submit(){
var myDate = new Date();
var result = true;
if($("input[name='exercise_publish_time']").prop("disabled")==false && $.trim($("input[name='exercise_publish_time']").val()) != ""){
var publish_time = Date.parse($("input[name='exercise_publish_time']").val());
if(publish_time < myDate){
$("#exercise_publish_time_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>发布时间应晚于当前时间").show();
result = false;
} else{
$("#exercise_publish_time_notice").hide();
}
if($.trim($("input[name='exercise_end_time']").val()) == ""){
$("#exercise_end_time_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>截止时间不能为空").show();
result = false;
}
}
if($("input[name='exercise_end_time']").prop("disabled")==false && $.trim($("input[name='exercise_end_time']").val()) != ""){
if($.trim($("input[name='exercise_publish_time']").val()) == ""){
$("#exercise_publish_time").val(formate_time(myDate));
}
var publish_time = Date.parse($("input[name='exercise_publish_time']").val());
var end_time = Date.parse($("input[name='exercise_end_time']").val());
if(end_time <= publish_time){
$("#exercise_end_time_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>截止时间应晚于发布时间").show();
result = false;
} else if(end_time <= myDate) {
$("#exercise_end_time_notice").html("<i class='fa fa-exclamation-circle mr5 color-orange'></i>截止时间应晚于当前时间").show();
result = false;
} else{
$("#exercise_end_time_notice").hide();
}
}
if(result){
$("#exercise_setting_form").submit();
}
}
//添加标题时确定按钮
function add_poll_question(doc,quest_type)
{
var title = $.trim($("#poll_questions_title").val());
var score = $.trim($("#question_score").val());
var standard_ans = $.trim($("#exercise_choice_" + quest_type).val());
if(title.length == 0 || score.length == 0){
notice_box("题目标题/分数不能为空");
doc.one('click', function(){
add_poll_question($(this),quest_type);
});
}else if(!/^[1-9][0-9]*$/.test(score)) {
notice_box("分数必须是非零开头的数字");
doc.one('click', function(){
add_poll_question($(this),quest_type);
});
}else if(quest_type !=3 && quest_type !=4 && standard_ans.length == 0) {
notice_box("标准答案不能为空");
doc.one('click', function(){
add_poll_question($(this),quest_type);
});
}else{
doc.parent().parent().parent().parent().submit();
}
}
function pollsSubmit(doc){
var title = $.trim($("#exercise_name").val());
if(title.length == 0){
notice_box("试卷标题不能为空");
} else {
doc.parent().parent().submit();
}
}
function pollsCancel(){
$("#exercise_head_edit").hide();
$("#exercise_head_show").show();
}