Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course
This commit is contained in:
commit
08c7eb8d40
|
@ -375,7 +375,7 @@ class ExerciseController < ApplicationController
|
||||||
ea.answer_text = params[:answer_text]
|
ea.answer_text = params[:answer_text]
|
||||||
if ea.save
|
if ea.save
|
||||||
@percent = get_percent(@exercise,User.current)
|
@percent = get_percent(@exercise,User.current)
|
||||||
render :json => {:text => pv.vote_text,:percent => format("%.2f",@percent)}
|
render :json => {:text => ea.answer_text,:percent => format("%.2f",@percent)}
|
||||||
else
|
else
|
||||||
render :json => {:text => "failure"}
|
render :json => {:text => "failure"}
|
||||||
end
|
end
|
||||||
|
@ -417,13 +417,13 @@ class ExerciseController < ApplicationController
|
||||||
# 答题过程中需要统计完成量
|
# 答题过程中需要统计完成量
|
||||||
@uncomplete_question = get_uncomplete_question(@exercise, User.current)
|
@uncomplete_question = get_uncomplete_question(@exercise, User.current)
|
||||||
# 获取改学生的考试得分
|
# 获取改学生的考试得分
|
||||||
score = calculate_student_score(@exercise, User.current)
|
@score = calculate_student_score(@exercise, User.current)
|
||||||
if @uncomplete_question.count < 1
|
if @uncomplete_question.count < 1
|
||||||
# 查看是否有已提交记录
|
# 查看是否有已提交记录
|
||||||
eu = get_exercise_user(@exercise.id, User.current.id)
|
eu = get_exercise_user(@exercise.id, User.current.id)
|
||||||
eu.user_id = User.current.id
|
eu.user_id = User.current.id
|
||||||
eu.exercise_id = @exercise.id
|
eu.exercise_id = @exercise.id
|
||||||
eu.score = score
|
eu.score = @score
|
||||||
if eu.save
|
if eu.save
|
||||||
#redirect_to poll_index_path(:polls_group_id => @course.id,:polls_type => 'Course')
|
#redirect_to poll_index_path(:polls_group_id => @course.id,:polls_type => 'Course')
|
||||||
@status = 0 #提交成功
|
@status = 0 #提交成功
|
||||||
|
|
|
@ -74,4 +74,23 @@ module ExerciseHelper
|
||||||
return score
|
return score
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def answer_be_selected?(answer,user)
|
||||||
|
pv = answer.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id} ")
|
||||||
|
if !pv.nil? && pv.count > 0
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#获取文本题答案
|
||||||
|
def get_anwser_vote_text(question_id,user_id)
|
||||||
|
pv = ExerciseAnswer.find_by_exercise_question_id_and_user_id(question_id,user_id)
|
||||||
|
if pv.nil?
|
||||||
|
''
|
||||||
|
else
|
||||||
|
pv.answer_text
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -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>
|
|
@ -4,33 +4,15 @@
|
||||||
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||||
$("#Container").css("width","1000px");
|
$("#Container").css("width","1000px");
|
||||||
});
|
});
|
||||||
function click_<%= pa.id %>(obj)
|
|
||||||
{
|
|
||||||
$.ajax({
|
|
||||||
type: "post",
|
|
||||||
url: "<%= commit_answer_poll_path(@poll) %>",
|
|
||||||
data: {
|
|
||||||
poll_answer_id: <%= pa.id %>,
|
|
||||||
poll_question_id: <%= pq.id %>
|
|
||||||
},
|
|
||||||
success: function (data) {
|
|
||||||
var dataObj = eval(data);
|
|
||||||
obj.checked = true;
|
|
||||||
var span = $('#percent');
|
|
||||||
span.html(dataObj.percent);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function student_submit_exercise(){
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
<div class="homepageRight mt0 ml10">
|
<div class="homepageRight mt0 ml10">
|
||||||
<div class="resources">
|
<div class="resources">
|
||||||
<div class="testStatus"><!--头部显示 start-->
|
<div class="testStatus"><!--头部显示 start-->
|
||||||
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||||
<div class="fontGrey2"><span class="mr130">开始时间:<%=format_time(exercise_student.start_at.to_s) %></span><span class="mr130">测验时长:<%=exercise.time %>分钟</span>
|
<div class="fontGrey2">
|
||||||
<div class="fr"><span>剩余时长:<span class="c_red">1</span> 小时 <span class="c_red">30</span> 分钟 <span class="c_red">0</span> 秒</span></div>
|
<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">1</span> 小时 <span class="c_red">30</span> 分钟 <span class="c_red">0</span> 秒</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
@ -56,7 +38,31 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input class="ur_radio" type="radio" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
|
<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 == "true")
|
||||||
|
{
|
||||||
|
obj.checked = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
obj.checked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<%= radio_button "poll_vote","poll_answer_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%>
|
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
|
@ -87,7 +93,31 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<label>
|
<label>
|
||||||
<input class="ur_radio" type="checkbox" name="<%= exercise_question %>" value="<%= exercise_choice.choice_text%>" >
|
<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 == "true")
|
||||||
|
{
|
||||||
|
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_poll?"":"disabled=disabled" %> >
|
||||||
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
|
@ -112,14 +142,35 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div>
|
<div>
|
||||||
<input type="text" name="answer_text" class="fillInput" placeholder="在此填入答案" />
|
<script>
|
||||||
|
function onblur_<%= exercise_question.id %>(obj)
|
||||||
|
{
|
||||||
|
$(window).unbind('beforeunload');
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "<%= commit_answer_exercise_path(exercise) %>",
|
||||||
|
data: {
|
||||||
|
exercise_question_id: <%= exercise_question.id %> ,
|
||||||
|
answer_text: obj.value
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
var dataObj = eval(data);
|
||||||
|
// obj.value = dataObj.text;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(exercise_question.id,User.current.id).html_safe %>" onblur="onblur_<%= exercise_question.id %>(this);" <%= @can_edit_poll?"":"disabled=disabled" %>>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_buttons"> <a class="ur_button_submit" style="margin-left:80px;" onclick="student_submit_exercise()"> 提交 </a> </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>
|
<div class="cl"></div>
|
||||||
<!--contentbox end-->
|
<!--contentbox end-->
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,135 @@
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
$("#RSide").removeAttr("id");
|
||||||
|
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
|
||||||
|
$("#Container").css("width","1000px");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<div class="homepageRight mt0 ml10">
|
||||||
|
<div class="resources">
|
||||||
|
<div class="testStatus"><!--头部显示 start-->
|
||||||
|
<h1 class="ur_page_title" id="polls_name_h"><%= exercise.exercise_name%></h1>
|
||||||
|
<div class="fontGrey2">
|
||||||
|
<span class="mr130">开始时间:<%=format_time(exercise_user.start_at.to_s) %></span>
|
||||||
|
<span class="mr130">测验时长:<%=exercise.time %>分钟</span>
|
||||||
|
<% time = exercise_user.end_at - exercise_user.start_at %>
|
||||||
|
<span class="fr">测验用时:<span class="c_red"><%= (time % (24*60*60)) / (60*60)%></span> 小时 <span class="c_red"><%= ((time % (24*60*60)) % (60*60)) / 60%></span> 分钟 <span class="c_red"><%= ((time % (24*60*60)) % (60*60)) % 60%></span> 秒</span>
|
||||||
|
</div>
|
||||||
|
<div class="testDesEdit mt5"><%= exercise.exercise_description.nil? ? "" : exercise.exercise_description.html_safe%></div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
<div class="mb5">得分:<span class="c_red"><%=exercise_user.score %>分</span></div>
|
||||||
|
<% mc_question_list = exercise_questions.where("question_type=1") %>
|
||||||
|
<% mcq_question_list = exercise_questions.where("question_type=2") %>
|
||||||
|
<% single_question_list = 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 %>">
|
||||||
|
<div>
|
||||||
|
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||||
|
<%= exercise_question.question_title %>
|
||||||
|
<span class="ml15 c_red">
|
||||||
|
<% if exercise_question.exercise_standard_answers.first.exercise_choice_id == exercise_question.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{User.current.id}.first.exercise_choice_id ") %>
|
||||||
|
√
|
||||||
|
<% else %>
|
||||||
|
×
|
||||||
|
<% end %></span><br />
|
||||||
|
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="ur_inputs">
|
||||||
|
<table class="ur_table" style="width:675px;">
|
||||||
|
<tbody>
|
||||||
|
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<%= radio_button "poll_vote","poll_answer_id",exercise_choice.id,:class=>"ur_radio",:checked => answer_be_selected?(exercise_choice,User.current),:disabled => !@can_edit_excercise %>
|
||||||
|
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
|
||||||
|
<h3 class="fontGrey3">多选题</h3>
|
||||||
|
<% mcq_question_list.each do |exercise_question| %>
|
||||||
|
<div id="poll_questions_<%= exercise_question.id%>">
|
||||||
|
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||||
|
<div>
|
||||||
|
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||||
|
<%= exercise_question.question_title %>
|
||||||
|
<span class="ml15 c_red">
|
||||||
|
<% if exercise_question.exercise_standard_answers.first.exercise_choice_id == exercise_question.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{User.current.id}.first.exercise_choice_id ") %>
|
||||||
|
√
|
||||||
|
<% else %>
|
||||||
|
×
|
||||||
|
<% end %></span><br />
|
||||||
|
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="ur_inputs">
|
||||||
|
<table class="ur_table" style="width:675px;">
|
||||||
|
<tbody>
|
||||||
|
<% exercise_question.exercise_choices.reorder("choice_position").each_with_index do |exercise_choice,index| %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input class="ur_radio" type="checkbox" <%= answer_be_selected?(exercise_choice,User.current) ? "checked":"" %> <%= @can_edit_poll?"":"disabled=disabled" %> >
|
||||||
|
<%= convert_to_char((index+1).to_s)%> <%= exercise_choice.choice_text%>
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div><!--多选题显示 end-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
|
||||||
|
<h3 class="fontGrey3">填空题</h3>
|
||||||
|
<% single_question_list.each do |exercise_question| %>
|
||||||
|
<div id="poll_questions_<%= exercise_question.id%>">
|
||||||
|
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||||
|
<div>
|
||||||
|
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||||
|
<%= exercise_question.question_title %>
|
||||||
|
<span class="ml15 c_red">
|
||||||
|
<% if exercise_question.exercise_standard_answers.first.exercise_choice_id == exercise_question.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{User.current.id}.first.exercise_choice_id ") %>
|
||||||
|
√
|
||||||
|
<% else %>
|
||||||
|
×
|
||||||
|
<% end %></span><br />
|
||||||
|
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div>
|
||||||
|
<% exercise_question.exercise_standard_answers.reorder("created_at").each_with_index do |exercise_choice,index| %>
|
||||||
|
候选答案:<%= exercise_choice.answer_text%><br />
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(exercise_question.id,User.current.id).html_safe %>" <%= @can_edit_poll?"":"disabled=disabled" %>>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<!--contentbox end-->
|
||||||
|
</div>
|
||||||
|
<!--RSide end-->
|
||||||
|
</div>
|
|
@ -1,7 +1,8 @@
|
||||||
<%= form_for("",
|
<%= form_for("",
|
||||||
:html => { :multipart => true },
|
:html => { :multipart => true },
|
||||||
:url => {:controller => 'exercise',
|
:url => {:controller => 'exercise',
|
||||||
:action => 'commit_exercise'
|
:action => 'commit_exercise',
|
||||||
|
:id => exercise.id
|
||||||
},:remote=>true ) do |f| %>
|
},:remote=>true ) do |f| %>
|
||||||
<div class="ur_buttons">
|
<div class="ur_buttons">
|
||||||
<a class="ur_button_submit" onclick="poll_submit();"> 提交 </a>
|
<a class="ur_button_submit" onclick="poll_submit();"> 提交 </a>
|
||||||
|
|
|
@ -0,0 +1,117 @@
|
||||||
|
<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>
|
||||||
|
<% time = exercise_user.end_at - exercise_user.start_at %>
|
||||||
|
<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_questions.where("question_type=1") %>
|
||||||
|
<% mcq_question_list = exercise_questions.where("question_type=2") %>
|
||||||
|
<% single_question_list = 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 %>">
|
||||||
|
<div>
|
||||||
|
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||||
|
<%= exercise_question.question_title %><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 do |exercise_question| %>
|
||||||
|
<div id="poll_questions_<%= exercise_question.id%>">
|
||||||
|
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||||
|
<div>
|
||||||
|
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||||
|
<%= exercise_question.question_title %><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 do |exercise_question| %>
|
||||||
|
<div id="poll_questions_<%= exercise_question.id%>">
|
||||||
|
<div id="show_poll_questions_<%= exercise_question.id %>">
|
||||||
|
<div>
|
||||||
|
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
|
||||||
|
<%= exercise_question.question_title %><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 l(:button_submit),exercise_index_path(:course_id => @course.id),:class => "ur_button_submit" %>
|
||||||
|
<%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "ur_button_submit fr"%>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<!--contentbox end-->
|
||||||
|
</div>
|
||||||
|
<!--RSide end-->
|
||||||
|
</div>
|
|
@ -1,9 +1,7 @@
|
||||||
<%= form_for(ExerciseQuestion.new,
|
<%= form_for(ExerciseQuestion.new,
|
||||||
:html => { :multipart => true },
|
:html => { :multipart => true },
|
||||||
:url => {:controller => 'exercise',
|
:url=>create_exercise_question_exercise_path(exercise_question.id),
|
||||||
:action => 'create_exercise_question',
|
:remote=>true ) do |f| %>
|
||||||
:course_id => @course.id
|
|
||||||
},:remote=>true ) do |f| %>
|
|
||||||
<div class="questionContainer">
|
<div class="questionContainer">
|
||||||
<div class="ur_editor_title">
|
<div class="ur_editor_title">
|
||||||
<label>问题: </label>
|
<label>问题: </label>
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
<%= form_for(ExerciseQuestion.new,
|
<%= form_for(ExerciseQuestion.new,
|
||||||
:html => { :multipart => true },
|
:html => { :multipart => true },
|
||||||
:url => {:controller => 'exercise',
|
:url=>create_exercise_question_exercise_path(exercise_question.id),
|
||||||
:action => 'create_exercise_question',
|
:remote=>true ) do |f| %>
|
||||||
:course_id => @course.id
|
|
||||||
},:remote=>true ) do |f| %>
|
|
||||||
<div class="questionContainer">
|
<div class="questionContainer">
|
||||||
<div class="ur_editor_title">
|
<div class="ur_editor_title">
|
||||||
<label>问题: </label>
|
<label>问题: </label>
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
<%= form_for(ExerciseQuestion.new,
|
<%= form_for(ExerciseQuestion.new,
|
||||||
:html => { :multipart => true },
|
:html => { :multipart => true },
|
||||||
:url => {:controller => 'exercise',
|
:url=>create_exercise_question_exercise_path(exercise_question.id),
|
||||||
:action => 'create_exercise_question',
|
:remote=>true ) do |f| %>
|
||||||
:course_id => @course.id
|
|
||||||
},:remote=>true ) do |f| %>
|
|
||||||
<div class="questionContainer">
|
<div class="questionContainer">
|
||||||
<div class="ur_editor_title">
|
<div class="ur_editor_title">
|
||||||
<label>问题: </label>
|
<label>问题: </label>
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
} else{
|
} else{
|
||||||
<% score =exercise_question.question_score %>
|
<% score =exercise_question.question_score %>
|
||||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
||||||
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>{:controller=> 'exercise',:action=>'create_exercise_question',:course_id=>@course.id},:remote=>true) do |f|%>'+
|
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.id),:remote=>true) do |f|%>'+
|
||||||
' <div class="questionContainer" style="width: 680px;"> '+
|
' <div class="questionContainer" style="width: 680px;"> '+
|
||||||
'<div class="ur_editor_title"> '+
|
'<div class="ur_editor_title"> '+
|
||||||
'<label>问题: </label>'+
|
'<label>问题: </label>'+
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
} else {
|
} else {
|
||||||
<% score =exercise_question.question_score %>
|
<% score =exercise_question.question_score %>
|
||||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
||||||
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>{:controller=> 'exercise',:action=>'create_exercise_question',:course_id=>@course.id},:remote=>true) do |f|%>'+
|
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.id),:remote=>true) do |f|%>'+
|
||||||
' <div class="questionContainer" style="width: 680px;"> '+
|
' <div class="questionContainer" style="width: 680px;"> '+
|
||||||
'<div class="ur_editor_title"> '+
|
'<div class="ur_editor_title"> '+
|
||||||
'<label>问题: </label>'+
|
'<label>问题: </label>'+
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
} else {
|
} else {
|
||||||
<% score =exercise_question.question_score %>
|
<% score =exercise_question.question_score %>
|
||||||
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html(
|
||||||
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>{:controller=> 'exercise',:action=>'create_exercise_question',:course_id=>@course.id},:remote=>true) do |f|%>'+
|
'<%= form_for(ExerciseQuestion.new,:html=>{:multipart=>true},:url=>create_exercise_question_exercise_path(exercise_question.id),:remote=>true) do |f|%>'+
|
||||||
' <div class="questionContainer" style="width: 680px;"> '+
|
' <div class="questionContainer" style="width: 680px;"> '+
|
||||||
'<div class="ur_editor_title"> '+
|
'<div class="ur_editor_title"> '+
|
||||||
'<label>问题: </label>'+
|
'<label>问题: </label>'+
|
||||||
|
|
|
@ -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");
|
|
@ -1,5 +1,9 @@
|
||||||
<% if @is_teacher %>
|
<% if @is_teacher %>
|
||||||
|
<%= render :partial => 'exercise_teacher', :locals =>{:exercise =>@exercise, :exercise_questions => @exercise_questions} %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%=render :partial => 'exercise_student', :locals => {:exercise =>@exercise, :exercise_questions => @exercise_questions,:exercise_student => @exercise_student} %>
|
<% 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 %>
|
<% end %>
|
|
@ -17,4 +17,4 @@ $("#poll_questions_<%= @exercise_question.id%>").html("<div id='show_poll_questi
|
||||||
"<% end%>" +
|
"<% end%>" +
|
||||||
"</div>");
|
"</div>");
|
||||||
$("#current_score").html("<%=get_current_score @exercise %>分");
|
$("#current_score").html("<%=get_current_score @exercise %>分");
|
||||||
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise}) %>");
|
$("#exercise_submit").html("<%= escape_javascript(render :partial => 'exercise_submit', :locals => {:exercise => @exercise_question.exercise}) %>");
|
||||||
|
|
Loading…
Reference in New Issue