Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
commit
65548cd8c3
@ -0,0 +1,8 @@
|
|||||||
|
class ExerciseAnswer < ActiveRecord::Base
|
||||||
|
#学生答题
|
||||||
|
include Redmine::SafeAttributes
|
||||||
|
|
||||||
|
belongs_to :user
|
||||||
|
belongs_to :exercise_question
|
||||||
|
belongs_to :exercise_choice
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
class ExerciseChoice < ActiveRecord::Base
|
||||||
|
include Redmine::SafeAttributes
|
||||||
|
|
||||||
|
belongs_to :exercise_question
|
||||||
|
has_many :exercise_answers, :dependent => :destroy
|
||||||
|
has_many :exercise_standard_answers, :dependent => :destroy
|
||||||
|
end
|
@ -0,0 +1,8 @@
|
|||||||
|
class ExerciseQuestion < ActiveRecord::Base
|
||||||
|
include Redmine::SafeAttributes
|
||||||
|
|
||||||
|
belongs_to :exercise
|
||||||
|
has_many :exercise_choices, :order => "#{ExerciseChoice.table_name}.choice_position",:dependent => :destroy
|
||||||
|
has_many :exercise_answers, :dependent => :destroy
|
||||||
|
has_many :exercise_standard_answers, :dependent => :destroy
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
class ExerciseStandardAnswer < ActiveRecord::Base
|
||||||
|
#标准答案
|
||||||
|
include Redmine::SafeAttributes
|
||||||
|
|
||||||
|
belongs_to :exercise_question
|
||||||
|
belongs_to :exercise_choice
|
||||||
|
end
|
@ -0,0 +1,6 @@
|
|||||||
|
class ExerciseUser < ActiveRecord::Base
|
||||||
|
include Redmine::SafeAttributes
|
||||||
|
|
||||||
|
belongs_to :user
|
||||||
|
belongs_to :exercise
|
||||||
|
end
|
@ -0,0 +1,27 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
function close_alert_form(){hideModal("#alert_form");}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="alert_form">
|
||||||
|
<div class="upload_con">
|
||||||
|
<div class="polls_alert_upload_box">
|
||||||
|
<p class="polls_alert_box_p">
|
||||||
|
<%= message%>
|
||||||
|
</p>
|
||||||
|
<div class="polls_alert_btn_box">
|
||||||
|
<a class="upload_btn" onclick="close_alert_form();">
|
||||||
|
确 定
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
<div id="popbox" style="text-align: center;margin-top: 25px">
|
||||||
|
<% if status == 0 %>
|
||||||
|
<h3 style="font-weight: normal;color: green">提交成功!您的分数是:<%=@score %>分。</h3>
|
||||||
|
<%= link_to "确定", exercise_path(),:class => 'commit'%>
|
||||||
|
<% elsif status == 1 %>
|
||||||
|
<h3 style="font-weight: normal;color: red">您还有尚未作答的题目请完成后再提交!</h3>
|
||||||
|
<%= link_to "确定", "javascript:void(0)",:onclick => 'hidden_atert_form();',:class => 'commit'%>
|
||||||
|
<% else %>
|
||||||
|
<h3 style="font-weight: normal;color: red">发生未知错误,请检查您的网络。</h3>
|
||||||
|
<%= link_to "确定", "javascript:void(0)",:onclick => 'hidden_atert_form();',:class => 'commit'%>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
@ -0,0 +1,61 @@
|
|||||||
|
<%# has_commit = has_commit_poll?(poll.id ,User.current)%>
|
||||||
|
<% exercise_name = exercise.exercise_name.empty? ? l(:label_poll_new) : exercise.exercise_name%>
|
||||||
|
<% if @is_teacher%>
|
||||||
|
<li title="<%= exercise.exercise_name %>">
|
||||||
|
<div style="width: 310px;float: left;">
|
||||||
|
<%# if has_commit %>
|
||||||
|
<%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue"%>
|
||||||
|
<%# else %>
|
||||||
|
<%#= link_to poll_name, exercise_path(poll.id), :class => "polls_title polls_title_w fl c_dblue" %>
|
||||||
|
<%# end %>
|
||||||
|
<%= link_to exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_w fl c_dblue" %>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<% if exercise.exercise_status == 1%>
|
||||||
|
<li class="pollsbtn fl ml10 pollsbtn_grey">统计结果</li>
|
||||||
|
<% else %>
|
||||||
|
<li><%= link_to l(:label_statistical_results), student_exercise_list_exercise_path(exercise.id,:course_id => @course.id), :class => "pollsbtn fl ml10"%></li>
|
||||||
|
<% end%>
|
||||||
|
|
||||||
|
<% if exercise.exercise_status == 1 %>
|
||||||
|
<li><a href="javascript:" class="pollsbtn btn_pu fl ml5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>);">发布试卷</a></li>
|
||||||
|
<% elsif exercise.exercise_status == 2%>
|
||||||
|
<li><a href="javascript:" class="pollsbtn btn_de fl ml5" onclick="republish_exercise(<%= exercise.id%>);">取消发布</a></li>
|
||||||
|
<% else%>
|
||||||
|
<li class="pollsbtn fl ml10 pollsbtn_grey" style="margin-left: 5px;" >发布试卷</li>
|
||||||
|
<% end%>
|
||||||
|
|
||||||
|
<%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %>
|
||||||
|
|
||||||
|
<% if exercise.exercise_status == 1 %>
|
||||||
|
<li><%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "polls_de fr ml5"%></li>
|
||||||
|
<% else%>
|
||||||
|
<li class="polls_de_grey fr ml5" title="未发布的试卷才能进行编辑">编辑</li>
|
||||||
|
<% end%>
|
||||||
|
|
||||||
|
<%# if exercise.exercise_status == 2 %>
|
||||||
|
<!--<li><a class="polls_de fr ml5" onclick="" href="javascript:">关闭</a></li>-->
|
||||||
|
<%# else %>
|
||||||
|
<!--<li class="polls_de_grey fr ml5" title="发布的问卷才能进行关闭">关闭</li>-->
|
||||||
|
<%# end%>
|
||||||
|
|
||||||
|
<%# if exercise.exercise_status == 1%>
|
||||||
|
<!--<li class="polls_de_grey fr ml5">导出</li>-->
|
||||||
|
<%# elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %>
|
||||||
|
<!--<li><%#= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%></li>-->
|
||||||
|
<%# end%>
|
||||||
|
|
||||||
|
|
||||||
|
<li class="polls_date fr"><%= format_date exercise.created_at.to_date%></li>
|
||||||
|
<% else%>
|
||||||
|
<% if exercise.exercise_status == 2%>
|
||||||
|
<%# if has_commit%>
|
||||||
|
<!--li><%#= link_to poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_st fl c_dblue" %></li>
|
||||||
|
<li class="pollsbtn_tip fl ml5">已答</li-->
|
||||||
|
<%#else%>
|
||||||
|
<%= link_to exercise_name, exercise_path(exercise.id), :class => "polls_title polls_title_st fl c_dblue"%>
|
||||||
|
<%#end%>
|
||||||
|
<% end%>
|
||||||
|
<li class="polls_date fr mr10"><%= format_date exercise.created_at.to_date%></li>
|
||||||
|
<% end%>
|
@ -0,0 +1,42 @@
|
|||||||
|
<% mc_question_list = exercise.exercise_questions.where("question_type=1") %>
|
||||||
|
<% mcq_question_list = exercise.exercise_questions.where("question_type=2") %>
|
||||||
|
<% single_question_list = exercise.exercise_questions.where("question_type=3") %>
|
||||||
|
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
|
||||||
|
<h3 class="fontGrey3">单选题</h3>
|
||||||
|
<% mc_question_list.each do |exercise_question| %>
|
||||||
|
<div id="poll_questions_<%= exercise_question.id%>">
|
||||||
|
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||||
|
<%= render :partial => 'show_MC', :locals => {:exercise_question => exercise_question} %>
|
||||||
|
</div>
|
||||||
|
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
|
||||||
|
<%= render :partial => 'edit_MC', :locals => {:exercise_question => exercise_question} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
|
||||||
|
<h3 class="fontGrey3">多选题</h3>
|
||||||
|
<% mcq_question_list.each do |exercise_question| %>
|
||||||
|
<div id="poll_questions_<%= exercise_question.id%>">
|
||||||
|
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||||
|
<%= render :partial => 'show_MCQ', :locals => {:exercise_question => exercise_question} %>
|
||||||
|
</div>
|
||||||
|
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
|
||||||
|
<%= render :partial => 'edit_MCQ', :locals => {:exercise_question => exercise_question} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
|
||||||
|
<h3 class="fontGrey3">填空题</h3>
|
||||||
|
<% single_question_list.each do |exercise_question| %>
|
||||||
|
<div id="poll_questions_<%= exercise_question.id%>">
|
||||||
|
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||||
|
<%= render :partial => 'show_single', :locals => {:exercise_question => exercise_question} %>
|
||||||
|
</div>
|
||||||
|
<div id="edit_poll_questions_<%= exercise_question.id %>" style="display: none;">
|
||||||
|
<%= render :partial => 'edit_single', :locals => {:exercise_question => exercise_question} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
@ -0,0 +1,208 @@
|
|||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$("#RSide").removeAttr("id");
|
||||||
|
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||||
|
$("#Container").css("width","1000px");
|
||||||
|
/*start_time = new Date();
|
||||||
|
start_time.setFullYear(<%#=exercise_user.start_at.year%>);
|
||||||
|
start_time.setMonth(<%#=exercise_user.start_at.month%>);
|
||||||
|
start_time.setDate(<%#=exercise_user.start_at.day%>);
|
||||||
|
start_time.setHours(<%#=exercise_user.start_at.hour%>);
|
||||||
|
start_time.setMinutes(<%#=exercise_user.start_at.min%>);
|
||||||
|
start_time.setSeconds(<%#=exercise_user.start_at.sec%>);
|
||||||
|
//alert(start_time);
|
||||||
|
end_time = start_time.getTime() + 1000*60*<%#=exercise.time %>;
|
||||||
|
getTime(end_time);*/
|
||||||
|
});
|
||||||
|
function getTime(end_time) {
|
||||||
|
//alert(end_time);
|
||||||
|
now = new Date();
|
||||||
|
var total_seconds = (now.getTime() - end_time)/1000;
|
||||||
|
//start = new Date(start_time);
|
||||||
|
//end_time = start_time;
|
||||||
|
//var total_seconds = total_seconds - 1;
|
||||||
|
var hours = total_seconds / 60 / 60;
|
||||||
|
var hoursRound = Math.floor(hours);
|
||||||
|
var minutes = total_seconds /60 - (60 * hoursRound);
|
||||||
|
var minutesRound = Math.floor(minutes);
|
||||||
|
var seconds = total_seconds - (60 * 60 * hoursRound) - (60 * minutesRound);
|
||||||
|
var secondsRound = Math.round(seconds);
|
||||||
|
$("#rest_hours").html(hoursRound);
|
||||||
|
$("#rest_minutes").html(minutesRound);
|
||||||
|
$("#rest_seconds").html(secondsRound);
|
||||||
|
//if(total_seconds >0) {
|
||||||
|
setTimeout("getTime("+end_time+");", 1000);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<div class="homepageRight mt0 ml10">
|
||||||
|
<div class="resources">
|
||||||
|
<div class="testStatus"><!--头部显示 start-->
|
||||||
|
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||||
|
<div id="start_time" style="display: none"><%=exercise_user.start_at %></div>
|
||||||
|
<div class="fontGrey2">
|
||||||
|
<span class="mr130">开始时间:<%=format_time(exercise_user.start_at.to_s)%></span>
|
||||||
|
<span class="mr130">测验时长:<%=exercise.time %>分钟</span>
|
||||||
|
<!--
|
||||||
|
<span class="fr">剩余时长:<span class="c_red" id="rest_hours"></span> 小时 <span class="c_red" id="rest_minutes"></span> 分钟 <span class="c_red" id="rest_seconds"></span> 秒</span>
|
||||||
|
-->
|
||||||
|
</div>
|
||||||
|
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
<% mc_question_list = exercise.exercise_questions.where("question_type=1").shuffle %>
|
||||||
|
<% mcq_question_list = exercise.exercise_questions.where("question_type=2").shuffle %>
|
||||||
|
<% single_question_list = exercise.exercise_questions.where("question_type=3").shuffle %>
|
||||||
|
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
|
||||||
|
<h3 class="fontGrey3">单选题</h3>
|
||||||
|
<% mc_question_list.each_with_index do |exercise_question, list_index| %>
|
||||||
|
<div id="poll_questions_<%= exercise_question.id%>">
|
||||||
|
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||||
|
<div>
|
||||||
|
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="ur_inputs">
|
||||||
|
<table class="ur_table" style="width:675px;">
|
||||||
|
<tbody>
|
||||||
|
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<script>
|
||||||
|
function click_<%= exercise_choice.id %>(obj)
|
||||||
|
{
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "<%= commit_answer_exercise_path(exercise) %>",
|
||||||
|
data: {
|
||||||
|
exercise_choice_id: <%= exercise_choice.id %>,
|
||||||
|
exercise_question_id: <%= exercise_question.id %>
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
var dataObj = eval(data);
|
||||||
|
if(dataObj.text == "ok")
|
||||||
|
{
|
||||||
|
obj.checked = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
obj.checked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<%= radio_button "exercise",exercise_question.id.to_s+"exercise_choice_id",exercise_choice.id,:class=>"ur_radio",:onclick =>"click_#{exercise_choice.id}(this);return false;",:checked => answer_be_selected?(exercise_choice,User.current),:disabled => !@can_edit_excercise %>
|
||||||
|
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
|
||||||
|
<h3 class="fontGrey3">多选题</h3>
|
||||||
|
<% mcq_question_list.each_with_index do |exercise_question,list_index| %>
|
||||||
|
<div id="poll_questions_<%= exercise_question.id%>">
|
||||||
|
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||||
|
<div>
|
||||||
|
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="ur_inputs">
|
||||||
|
<table class="ur_table" style="width:675px;">
|
||||||
|
<tbody>
|
||||||
|
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<script>
|
||||||
|
function click_<%= exercise_choice.id %>(obj)
|
||||||
|
{
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "<%= commit_answer_exercise_path(exercise) %>",
|
||||||
|
data: {
|
||||||
|
exercise_choice_id: <%= exercise_choice.id %>,
|
||||||
|
exercise_question_id: <%= exercise_question.id %>
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
var dataObj = eval(data);
|
||||||
|
if(dataObj.text == "ok")
|
||||||
|
{
|
||||||
|
obj.checked = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
obj.checked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<input class="ur_radio" type="checkbox" onclick="click_<%= exercise_choice.id %>(this);return false;" <%= answer_be_selected?(exercise_choice,User.current) ? "checked":"" %> <%= @can_edit_excercise?"":"disabled=disabled" %> >
|
||||||
|
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div><!--多选题显示 end-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
|
||||||
|
<h3 class="fontGrey3">填空题</h3>
|
||||||
|
<% single_question_list.each_with_index do |exercise_question, list_index| %>
|
||||||
|
<div id="poll_questions_<%= exercise_question.id%>">
|
||||||
|
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||||
|
<div>
|
||||||
|
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div>
|
||||||
|
<script>
|
||||||
|
function onblur_<%= exercise_question.id %>(obj)
|
||||||
|
{
|
||||||
|
$(window).unbind('beforeunload');
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "<%= commit_answer_exercise_path(exercise) %>",
|
||||||
|
data: {
|
||||||
|
exercise_question_id: <%= exercise_question.id %> ,
|
||||||
|
answer_text: obj.value
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
var dataObj = eval(data);
|
||||||
|
obj.value = dataObj.text;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<input class="fillInput" placeholder="在此填入答案" type="text" value="" onblur="onblur_<%= exercise_question.id %>(this);" <%= @can_edit_excercise?"":"disabled=disabled" %>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="ur_buttons">
|
||||||
|
<%= link_to l(:button_submit),commit_exercise_exercise_path(exercise), :method => :post,:class => "ur_button_submit",:style => "margin-left:80px;",:format => 'js',:remote=>true %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<!--contentbox end-->
|
||||||
|
</div>
|
||||||
|
<!--RSide end-->
|
||||||
|
</div>
|
@ -0,0 +1,37 @@
|
|||||||
|
<%= form_for('',
|
||||||
|
:html => { :multipart => true },
|
||||||
|
:url => {:controller => 'exercise',
|
||||||
|
:action => 'commit_exercise',
|
||||||
|
:id => exercise.id
|
||||||
|
},:remote=>true ) do |f| %>
|
||||||
|
<div class="ur_buttons">
|
||||||
|
<a class="ur_button_submit" onclick="poll_submit();"> 提交 </a>
|
||||||
|
<div class="polls_cha">
|
||||||
|
<%= f.check_box 'show_result', :value => exercise.show_result%>
|
||||||
|
<%= label_tag '_show_result', '允许学生查看测验结果' %>
|
||||||
|
<!--<input name="exercise[show_result]" value="<%#exercise.show_result %>" type="checkbox" checked="true">
|
||||||
|
<label for="">允许学生查看测验结果</label>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function poll_submit() {
|
||||||
|
var question_form = $("form.new_exercise_question");
|
||||||
|
if($("#polls_head_edit").is(":visible")){
|
||||||
|
alert("请先保存测验标题及测验基本信息。");
|
||||||
|
} else if(question_form.length > 0) {
|
||||||
|
alert("请先保存正在编辑的题目。");
|
||||||
|
} else{
|
||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'exercise_submit_info', locals: { :exercise => exercise}) %>');
|
||||||
|
showModal('ajax-modal', '400px');
|
||||||
|
//$('#ajax-modal').css('height','120px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||||
|
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||||
|
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,45 @@
|
|||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
function clickCanel(){hideModal("#popbox02");}
|
||||||
|
function exercise_submit(){
|
||||||
|
$("#exercise_submit>form")[0].submit();
|
||||||
|
hideModal("#popbox02");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="popbox02">
|
||||||
|
<div class="upload_con">
|
||||||
|
<div class="upload_box">
|
||||||
|
<% current_score = get_current_score exercise %>
|
||||||
|
<% question_count = exercise.exercise_questions.count %>
|
||||||
|
<% mc_count = exercise.exercise_questions.where("question_type=1").count %>
|
||||||
|
<% mcq_count = exercise.exercise_questions.where("question_type=2").count %>
|
||||||
|
<% single_count = exercise.exercise_questions.where("question_type=3").count %>
|
||||||
|
<p class="f14">当前测验
|
||||||
|
<% if question_count > 0 %>共有<%= question_count %>道题,其中<% end %>
|
||||||
|
<% if mc_count > 0 %><%= mc_count %>道单选、<% end %>
|
||||||
|
<% if mcq_count > 0 %><%= mcq_count %>道多选、<% end %>
|
||||||
|
<% if single_count > 0%><%= single_count %>道填空,<% end %>
|
||||||
|
总分为<span class="c_red"><%=current_score %></span>分。
|
||||||
|
<br /><br />
|
||||||
|
是否确定提交该测验?
|
||||||
|
</p>
|
||||||
|
<div class="polls_btn_box">
|
||||||
|
<a class="upload_btn" onclick="exercise_submit();">
|
||||||
|
确 定
|
||||||
|
</a>
|
||||||
|
<a class="upload_btn upload_btn_grey" onclick="clickCanel();">
|
||||||
|
取 消
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -0,0 +1,121 @@
|
|||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$("#RSide").removeAttr("id");
|
||||||
|
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||||
|
$("#Container").css("width","1000px");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<div class="homepageRight mt0 ml10">
|
||||||
|
<div class="resources">
|
||||||
|
<div class="testStatus"><!--头部显示 start-->
|
||||||
|
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||||
|
<div class="fontGrey2">
|
||||||
|
<span class="mr130">发布时间:<%=format_time(exercise.publish_time.to_s) %></span>
|
||||||
|
<span class="mr130">截止时间:<%=format_time(exercise.end_time.to_s) %></span>
|
||||||
|
<span class="fr">测验时长:<%=exercise.time %>分钟</span>
|
||||||
|
</div>
|
||||||
|
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
<% mc_question_list = exercise.exercise_questions.where("question_type=1") %>
|
||||||
|
<% mcq_question_list = exercise.exercise_questions.where("question_type=2") %>
|
||||||
|
<% single_question_list = exercise.exercise_questions.where("question_type=3") %>
|
||||||
|
<div class="testStatus" id="mc_question_list" style="display: <%=mc_question_list.count > 0 ? "" : "none" %>">
|
||||||
|
<h3 class="fontGrey3">单选题</h3>
|
||||||
|
<% mc_question_list.each_with_index do |exercise_question, list_index| %>
|
||||||
|
<div id="poll_questions_<%= exercise_question.id%>">
|
||||||
|
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||||
|
<div>
|
||||||
|
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||||
|
<br />
|
||||||
|
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="ur_inputs">
|
||||||
|
<table class="ur_table" style="width:675px;">
|
||||||
|
<tbody>
|
||||||
|
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="ur_radio" type="radio" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
|
||||||
|
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
|
||||||
|
<h3 class="fontGrey3">多选题</h3>
|
||||||
|
<% mcq_question_list.each_with_index do |exercise_question, list_index| %>
|
||||||
|
<div id="poll_questions_<%= exercise_question.id%>">
|
||||||
|
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||||
|
<div>
|
||||||
|
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||||
|
<br />
|
||||||
|
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="ur_inputs">
|
||||||
|
<table class="ur_table" style="width:675px;">
|
||||||
|
<tbody>
|
||||||
|
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="ur_radio" type="checkbox" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
|
||||||
|
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div><!--多选题显示 end-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
|
||||||
|
<h3 class="fontGrey3">填空题</h3>
|
||||||
|
<% single_question_list.each_with_index do |exercise_question, list_index| %>
|
||||||
|
<div id="poll_questions_<%= exercise_question.id%>">
|
||||||
|
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||||
|
<div>
|
||||||
|
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %> (<%= exercise_question.question_score %>分)
|
||||||
|
<br />
|
||||||
|
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div>
|
||||||
|
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
|
||||||
|
候选答案:<%= exercise_choice.answer_text%><br />
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="ur_buttons">
|
||||||
|
<%= link_to "确定",exercise_index_path(:course_id => @course.id),:class => "ur_button_submit" %>
|
||||||
|
<% if exercise.exercise_status == 1 %>
|
||||||
|
<%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "ur_button_submit", :style => "float:right"%>
|
||||||
|
<% else %>
|
||||||
|
<span class="ur_button_submit" style="float:right; background:#a3a3a3" title="测验已发布,不可再编辑">编辑</span>
|
||||||
|
<%#= link_to l(:button_edit), '', :class => "ur_button_submit", :style => "float:right; background:#a3a3a3"%>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<!--contentbox end-->
|
||||||
|
</div>
|
||||||
|
<!--RSide end-->
|
||||||
|
</div>
|
@ -0,0 +1,45 @@
|
|||||||
|
<ul class="tabs_list">
|
||||||
|
<li class="tab_item02 mr118"> <a title="单选题" class="tab_icon icon_radio" onclick="add_MC();"> 新建单选题 </a> </li>
|
||||||
|
<li class="tab_item02 mr118"> <a title="多选题" class=" tab_icon icon_checkbox" onclick="add_MCQ();"> 新建多选题 </a> </li>
|
||||||
|
<li class="tab_item02 "> <a title="单行主观" class="tab_icon icon_text" onclick="add_single();"> 新建填空题 </a> </li>
|
||||||
|
</ul>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function add_MC(){
|
||||||
|
var forms = $("form.new_exercise_question");
|
||||||
|
if($("#polls_head_edit").is(":visible")){
|
||||||
|
alert("请先保存测验标题及测验基本信息。");
|
||||||
|
}else if(forms.length > 0){
|
||||||
|
alert("请先保存正在编辑的题目再新建。");
|
||||||
|
} else{
|
||||||
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>exercise}) %>");
|
||||||
|
$("#poll_questions_title").focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_MCQ(){
|
||||||
|
var forms = $("form.new_exercise_question");
|
||||||
|
if($("#polls_head_edit").is(":visible")){
|
||||||
|
alert("请先保存测验标题及测验基本信息。");
|
||||||
|
}else if(forms.length > 0){
|
||||||
|
alert("请先保存正在编辑的题目再新建。");
|
||||||
|
} else{
|
||||||
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>exercise}) %>");
|
||||||
|
$("#poll_questions_title").focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_single(){
|
||||||
|
var forms = $("form.new_exercise_question");
|
||||||
|
if($("#polls_head_edit").is(":visible")){
|
||||||
|
alert("请先保存测验标题及测验基本信息。");
|
||||||
|
}else if(forms.length > 0){
|
||||||
|
alert("请先保存正在编辑的题目再新建。");
|
||||||
|
} else{
|
||||||
|
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>exercise}) %>");
|
||||||
|
$("#poll_questions_title").focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
@ -0,0 +1,12 @@
|
|||||||
|
<div class="testStatus"><!--头部显示 start-->
|
||||||
|
<a href="javascript:" class="testEdit" title="编辑" onclick="pollsEdit();"></a>
|
||||||
|
<!-- <a class='ur_icon_add' title='导入' id="import_btn" onclick="importPoll();"></a> -->
|
||||||
|
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||||
|
<div class="fontGrey2">
|
||||||
|
<span class="mr100">发布时间:<%=Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.publish_time%></span>
|
||||||
|
<span class="mr100">截止时间:<%=Time.parse(format_time(exercise.end_time)).strftime("%Y-%m-%d %H:%M:%S") if exercise.end_time %></span>
|
||||||
|
<span>测验时长:<%= exercise.time %>分钟</span></div>
|
||||||
|
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
@ -0,0 +1,73 @@
|
|||||||
|
<div class="fl" style="padding-bottom:10px; width:720px;">
|
||||||
|
<span class="c_dark f14 fb fl mr30">
|
||||||
|
测验
|
||||||
|
<font class="f12 c_red">
|
||||||
|
(<%= @exercise_count%>人已交)
|
||||||
|
</font>
|
||||||
|
<% if !@is_teacher && @exercise_users_list.empty?%>
|
||||||
|
<span class="f12 c_red">您尚未提交</span>
|
||||||
|
<% elsif !@is_teacher && !@exercise_users_list.empty?%>
|
||||||
|
<span class="f12 c_red">您已提交</span>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
<%#if @is_teacher || @exercise.exercise_status == 3%>
|
||||||
|
<!--<div class="hworkSearchBox">
|
||||||
|
<input type="text" id="course_student_name" value="<%#= @name%>" placeholder="姓名、学号、邮箱" class="hworkSearchInput" onkeypress="SearchByName('<%#= student_work_index_path(:homework => @homework.id)%>',event);"/>
|
||||||
|
<a class="hworkSearchIcon" id="search_in_student_work" onclick="SearchByName_1('<%#= student_work_index_path(:homework => @homework.id)%>');" href="javascript:void(0)"></a>
|
||||||
|
</div>-->
|
||||||
|
<%#= select_tag(:student_work_in_group,options_for_select(course_group_list(@course),@group), {:class => "classSplit"}) unless course_group_list(@course).empty? %>
|
||||||
|
<%# end%>
|
||||||
|
<span class="fr c_grey"> <a href="javascript:void(0);" class="linkGrey2" id="homework_info_show" style="display: none">[ 显示测验信息 ]</a> </span>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<div class="fl">
|
||||||
|
<%= render :partial => "student_table"%>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
|
||||||
|
<% @exercise_users_list.each do |exercise|%>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(".student_work_<%= exercise.id%>").mouseenter(function(){
|
||||||
|
$("#work_click_<%= exercise.id%>").show();
|
||||||
|
}).mouseleave(function(){
|
||||||
|
$("#work_click_<%= exercise.id%>").hide();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<ul class="hworkListRow" id="student_work_<%= exercise.id%>">
|
||||||
|
<li class="hworkList340 width530">
|
||||||
|
<ul>
|
||||||
|
<li class="hworkPortrait mt15 mr10">
|
||||||
|
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40"),user_activities_path(exercise.user)) %>
|
||||||
|
</li>
|
||||||
|
<div onclick="" style="cursor: pointer;" class="student_work_<%= exercise.id%>">
|
||||||
|
<li>
|
||||||
|
<ul class="mt10 fl">
|
||||||
|
<li class="hworkStName mr15 mt16" title="姓名">
|
||||||
|
<%= exercise.user.show_name%>
|
||||||
|
</li>
|
||||||
|
<li class="hworkStID mr10 mt16" title="学号">
|
||||||
|
<%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%>
|
||||||
|
</li>
|
||||||
|
<li class="hworkStID mt16" title="班级">
|
||||||
|
--
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</div>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<li class="hworkList130 c_grey student_work_<%= exercise.id%>" onclick="" style="cursor: pointer;">
|
||||||
|
<% if exercise.created_at%>
|
||||||
|
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="hworkList50 <%= score_color exercise.score%> student_final_scor_info">
|
||||||
|
<%= exercise.score.nil? ? "--" : format("%.1f",exercise.score)%>
|
||||||
|
</li>
|
||||||
|
<li class="hworkTip" style="display: none" id="work_click_<%= exercise.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="cl"></div>
|
||||||
|
<% end%>
|
@ -0,0 +1,22 @@
|
|||||||
|
<ul class="hworkUl">
|
||||||
|
<li class="hworkList340 hworkH30 width530">
|
||||||
|
<span class="c_dark f14 fb fl mr55"> </span>
|
||||||
|
<span class="c_dark f14 fb fl mr60">姓名</span>
|
||||||
|
<span class="c_dark f14 fb fl mr60">学号</span>
|
||||||
|
<span class="c_dark f14 fb fl">班级</span>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="hworkList130 hworkH30">
|
||||||
|
<%= link_to "时间",'',:class => "c_dark f14 fb fl ml50" ,:remote => true%>
|
||||||
|
<%# if @show_all && @order == "created_at"%>
|
||||||
|
<%#= link_to "", student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%>
|
||||||
|
<%# end%>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="hworkList50 hworkH30">
|
||||||
|
<%= link_to "成绩",'',:class => "c_dark f14 fb fl ml10",:remote => true%>
|
||||||
|
<%# if @show_all && @order == "score"%>
|
||||||
|
<%#= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10",:remote => true%>
|
||||||
|
<%# end%>
|
||||||
|
</li>
|
||||||
|
</ul>
|
@ -0,0 +1,9 @@
|
|||||||
|
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'commit_alert',:locals => {:status => @status}) %>');
|
||||||
|
showModal('ajax-modal', '270px');
|
||||||
|
$('#ajax-modal').css('height','110px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||||
|
"<a href='javascript:' onclick='hidden_atert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||||
|
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("alert_box");
|
@ -0,0 +1,4 @@
|
|||||||
|
$("#polls_head_show").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:exercise => @exercise}) %>");
|
||||||
|
$("#polls_head_edit").html("<%= escape_javascript(render :partial => 'edit_head', :locals => {:exercise => @exercise}) %>");
|
||||||
|
$("#polls_head_edit").hide();
|
||||||
|
$("#polls_head_show").show();
|
@ -0,0 +1,42 @@
|
|||||||
|
<% if @is_insert %>
|
||||||
|
$("#poll_content").html('<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise})%>');
|
||||||
|
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
|
||||||
|
$("#current_score_div").show();
|
||||||
|
$("#current_score").html("<%=get_current_score @exercise %>分");
|
||||||
|
<% else %>
|
||||||
|
$("#new_exercise_question").html('<%= escape_javascript(render :partial => 'new_question', :locals => {:exercise => @exercise}) %>');
|
||||||
|
$("#new_poll_question").html("");
|
||||||
|
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
|
||||||
|
<%if @exercise_questions.question_type == 1%>
|
||||||
|
$("#mc_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
|
||||||
|
"<div id='show_poll_questions_<%= @exercise_questions.id %>'>" +
|
||||||
|
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||||
|
"</div>" +
|
||||||
|
"<div id='edit_poll_questions_<%= @exercise_questions.id %>' style='display: none;'>" +
|
||||||
|
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>");
|
||||||
|
<% end %>
|
||||||
|
<%if @exercise_questions.question_type == 2%>
|
||||||
|
$("#mcq_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
|
||||||
|
"<div id='show_poll_questions_<%= @exercise_questions.id %>'>" +
|
||||||
|
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||||
|
"</div>" +
|
||||||
|
"<div id='edit_poll_questions_<%= @exercise_questions.id %>' style='display: none;'>" +
|
||||||
|
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>");
|
||||||
|
<% end %>
|
||||||
|
<%if @exercise_questions.question_type == 3%>
|
||||||
|
$("#single_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +
|
||||||
|
"<div id='show_poll_questions_<%= @exercise_questions.id %>'>" +
|
||||||
|
"<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||||
|
"</div>" +
|
||||||
|
"<div id='edit_poll_questions_<%= @exercise_questions.id %>' style='display: none;'>" +
|
||||||
|
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:exercise_question => @exercise_questions}) %>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>");
|
||||||
|
<% end %>
|
||||||
|
$("#current_score_div").show();
|
||||||
|
$("#current_score").html("<%=get_current_score @exercise %>分");
|
||||||
|
<% end %>
|
@ -0,0 +1,3 @@
|
|||||||
|
$("#poll_content").html("<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise}) %>");
|
||||||
|
$("#current_score").html("<%=get_current_score @exercise %>分");
|
||||||
|
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
|
@ -0,0 +1 @@
|
|||||||
|
$("#exercise").html("<%= escape_javascript(render :partial => 'exercises_list') %>");
|
@ -0,0 +1 @@
|
|||||||
|
<%= render :partial => 'exercise_form'%>
|
@ -0,0 +1,63 @@
|
|||||||
|
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function republish_exercise(exercise_id)
|
||||||
|
{
|
||||||
|
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||||
|
"<div class='upload_con'>" +
|
||||||
|
"<div class='upload_box'>" +
|
||||||
|
"<p class='polls_box_p'>取消发布后学生答题将会被清空<br />是否确定取消发布该测验?</p>" +
|
||||||
|
"<div class='polls_btn_box'>" +
|
||||||
|
"<a href='/exercise/"+ exercise_id +"/republish_exercise' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||||
|
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||||
|
"</div>" +
|
||||||
|
"<div class='cl'></div>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>");
|
||||||
|
showModal('ajax-modal', '310px');
|
||||||
|
$('#ajax-modal').css('height','120px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||||
|
"<a onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||||
|
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||||
|
}
|
||||||
|
|
||||||
|
function clickCanel(){hideModal("#popbox02");}
|
||||||
|
|
||||||
|
function exercise_submit(exercise_id,exercise_name)
|
||||||
|
{
|
||||||
|
if(exercise_name == 0)
|
||||||
|
{
|
||||||
|
alert("试卷标题不能为空");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$('#ajax-modal').html("<div id='popbox02'>" +
|
||||||
|
"<div class='upload_con'>" +
|
||||||
|
"<div class='upload_box'>" +
|
||||||
|
"<p class='polls_box_p'>测验发布后将不能对测验进行修改,<br />是否确定发布该测验?</p>" +
|
||||||
|
"<div class='polls_btn_box'>" +
|
||||||
|
"<a href='/exercise/"+ exercise_id +"/publish_exercise' class='upload_btn' onclick='clickCanel();' data-remote='true'>确 定</a>" +
|
||||||
|
"<a class='upload_btn upload_btn_grey' onclick='clickCanel();'>取 消</a>" +
|
||||||
|
"</div>" +
|
||||||
|
"<div class='cl'></div>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>" +
|
||||||
|
"</div>");
|
||||||
|
showModal('ajax-modal', '310px');
|
||||||
|
$('#ajax-modal').css('height','120px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||||
|
"<a href='javascript:' onclick='clickCanel();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||||
|
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<div class="polls_content02" id="exercise">
|
||||||
|
<%= render :partial => 'exercises_list'%>
|
||||||
|
</div><!--问卷内容end-->
|
@ -0,0 +1 @@
|
|||||||
|
<%= render :partial => 'exercise_form'%>
|
@ -0,0 +1,10 @@
|
|||||||
|
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise}) %>");
|
||||||
|
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_memo_create_succ)}) %>");
|
||||||
|
showModal('ajax-modal', '250px');
|
||||||
|
//$('#ajax-modal').css('height','111px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||||
|
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||||
|
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("poll_alert_form");
|
@ -0,0 +1,10 @@
|
|||||||
|
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise}) %>");
|
||||||
|
$('#ajax-modal').html("<%= escape_javascript(render :partial => 'alert', locals: { :message => l(:label_poll_republish_success)}) %>");
|
||||||
|
showModal('ajax-modal', '250px');
|
||||||
|
//$('#ajax-modal').css('height','80px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<span style='float: right;cursor:pointer;'>" +
|
||||||
|
"<a href='javascript:' onclick='close_alert_form();'><img src='/images/bid/close.png' width='26px' height='26px' /></a></span>");
|
||||||
|
$('#ajax-modal').parent().removeClass("alert_praise");
|
||||||
|
$('#ajax-modal').parent().css("top","").css("left","");
|
||||||
|
$('#ajax-modal').parent().addClass("poll_alert_form");
|
@ -0,0 +1,10 @@
|
|||||||
|
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||||
|
<% if @is_teacher %>
|
||||||
|
<%= render :partial => 'exercise_teacher', :locals =>{:exercise =>@exercise, :exercise_questions => @exercise_questions} %>
|
||||||
|
<% else %>
|
||||||
|
<% if @can_edit_excercise %>
|
||||||
|
<%=render :partial => 'exercise_student', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user} %>
|
||||||
|
<% else %>
|
||||||
|
<%=render :partial => 'exercise_student_result', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_user => @exercise_user} %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
@ -0,0 +1,5 @@
|
|||||||
|
$("#polls_head_show").html("<%= escape_javascript(render :partial => 'show_head', :locals => {:exercise => @exercise}) %>");
|
||||||
|
$("#polls_head_edit").html("<%= escape_javascript(render :partial => 'edit_head', :locals => {:exercise => @exercise}) %>");
|
||||||
|
$("#polls_head_edit").hide();
|
||||||
|
$("#polls_head_show").show();
|
||||||
|
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
|
@ -0,0 +1,20 @@
|
|||||||
|
$("#poll_questions_<%= @exercise_question.id%>").html("<div id='show_poll_questions_<%= @exercise_question.id %>'>" +
|
||||||
|
"<% if @exercise_question.question_type == 1%>" +
|
||||||
|
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||||
|
"<% elsif @exercise_question.question_type == 2%>" +
|
||||||
|
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||||
|
"<% elsif @exercise_question.question_type == 3%>" +
|
||||||
|
"<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||||
|
"<% end%>" +
|
||||||
|
"</div>" +
|
||||||
|
"<div id='edit_poll_questions_<%= @exercise_question.id %>' style='display: none;'>" +
|
||||||
|
"<% if @exercise_question.question_type == 1%>" +
|
||||||
|
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||||
|
"<% elsif @exercise_question.question_type == 2%>" +
|
||||||
|
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||||
|
"<% elsif @exercise_question.question_type == 3%>" +
|
||||||
|
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:exercise_question => @exercise_question}) %>" +
|
||||||
|
"<% end%>" +
|
||||||
|
"</div>");
|
||||||
|
$("#current_score").html("<%=get_current_score @exercise_question.exercise %>分");
|
||||||
|
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise_question.exercise}) %>");
|
@ -0,0 +1,17 @@
|
|||||||
|
class Exercise < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
create_table :exercises do |t|
|
||||||
|
t.string :exercise_name
|
||||||
|
t.text :exercise_description
|
||||||
|
t.integer :course_id
|
||||||
|
t.integer :exercise_status
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :time
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
drop_table :exercise
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,15 @@
|
|||||||
|
class ExerciseQuestion < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
create_table :exercise_questions do |t|
|
||||||
|
t.string :question_title
|
||||||
|
t.integer :question_type
|
||||||
|
t.integer :question_number
|
||||||
|
t.integer :exercise_id
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
drop_table :exercise_question
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,14 @@
|
|||||||
|
class ExerciseChoices < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
create_table :exercise_choices do |t|
|
||||||
|
t.integer :exercise_question_id
|
||||||
|
t.text :choice_text
|
||||||
|
t.integer :choice_position
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
drop_table :exercise_choices
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,14 @@
|
|||||||
|
class ExerciseStandardAnswer < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
create_table :exercise_standard_answers do |t|
|
||||||
|
t.integer :exercise_question_id
|
||||||
|
t.integer :exercise_choice_id
|
||||||
|
t.text :answer_text
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
drop_table :exercise_standard_answer
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,15 @@
|
|||||||
|
class ExerciseAnswer < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
create_table :exercise_answers do |t|
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :exercise_question_id
|
||||||
|
t.integer :exercise_choice_id
|
||||||
|
t.text :answer_text
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
drop_table :exercise_answer
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,15 @@
|
|||||||
|
class UserExercise < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
create_table :exercise_users do |t|
|
||||||
|
t.integer :user_id
|
||||||
|
t.integer :exercise_id
|
||||||
|
t.integer :score
|
||||||
|
t.datetime :start_at
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
drop_table :exercise_user
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,6 @@
|
|||||||
|
class AddPublishTimeEndTimeToExercise < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :exercises, :publish_time, :timestamp
|
||||||
|
add_column :exercises, :end_time, :timestamp
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddShowResultToExercise < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :exercises, :show_result, :integer
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddQuestionScoreToExerciseQuestion < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :exercise_questions, :question_score, :integer
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddEndAtToExerciseUser < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :exercise_users, :end_at, :datetime
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddStatusToExerciseUser < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :exercise_users, :status, :integer
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue