Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course

This commit is contained in:
huang 2015-11-20 15:14:07 +08:00
commit 74f6cb2e64
4 changed files with 57 additions and 40 deletions

View File

@ -3,35 +3,55 @@
$("#RSide").removeAttr("id");
$("#homework_page_right").css("min-height",$("#LSide").height()-30);
$("#Container").css("width","1000px");
var time = <%=exercise.time %>;
var total_seconds = time * 60;
getTime(total_seconds);
});
function getTime() {
function getTime(total_seconds) {
start_time = new Date($("#start_time").html());
end_time = start_time + 60*60*<%=exercise.time %>;
now = new Date();
//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("+total_seconds+");", 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">开始时间:<%=format_time(exercise_user.start_at.to_s)%></span>
<span class="mr130">测验时长:<%=exercise.time %>分钟</span>
<span class="fr">剩余时长:<span class="c_red">1</span>&nbsp;小时&nbsp;<span class="c_red">30</span>&nbsp;分钟&nbsp;<span class="c_red">0</span>&nbsp;秒</span>
<span class="fr">剩余时长:<span class="c_red" id="rest_hours"></span>&nbsp;小时&nbsp;<span class="c_red" id="rest_minutes"></span>&nbsp;分钟&nbsp;<span class="c_red" id="rest_seconds"></span>&nbsp;秒</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") %>
<% mcq_question_list = exercise.exercise_questions.where("question_type=2") %>
<% single_question_list = exercise.exercise_questions.where("question_type=3") %>
<% 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 do |exercise_question| %>
<% 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"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
<%= exercise_question.question_title %>
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
</div>
<div class="cl"></div>
<div class="ur_inputs">
@ -65,7 +85,7 @@
});
}
</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 %>
<%= 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)%>&nbsp;&nbsp;<%= exercise_choice.choice_text%>
</label>
</td>
@ -81,12 +101,11 @@
</div>
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多选题</h3>
<% mcq_question_list.each do |exercise_question| %>
<% mcq_question_list.each_with_index do |exercise_question,list_index| %>
<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 %>
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
</div>
<div class="cl"></div>
<div class="ur_inputs">
@ -136,12 +155,11 @@
</div>
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">填空题</h3>
<% single_question_list.each do |exercise_question| %>
<% single_question_list.each_with_index do |exercise_question, list_index| %>
<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 %>
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
</div>
<div class="cl"></div>
<div>
@ -158,13 +176,13 @@
},
success: function (data) {
var dataObj = eval(data);
// obj.value = dataObj.text;
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" %>>
<input class="fillInput" placeholder="在此填入答案" type="text" value="<%= get_anwser_vote_text(exercise_question.id,User.current.id).html_safe %>" onblur="onblur_<%= exercise_question.id %>(this);" <%= @can_edit_excercise?"":"disabled=disabled" %>>
</div>
</div>
</div>

View File

@ -24,12 +24,11 @@
<% 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| %>
<% 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"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
<%= exercise_question.question_title %>
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
<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 ") %>
@ -62,12 +61,11 @@
</div>
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多选题</h3>
<% mcq_question_list.each do |exercise_question| %>
<% mcq_question_list.each_wtih_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"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
<%= exercise_question.question_title %>
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
<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 ") %>
@ -100,12 +98,11 @@
</div>
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">填空题</h3>
<% single_question_list.each do |exercise_question| %>
<% single_question_list.each_with_index do |exercise_question,list_index| %>
<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 %>
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
<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 ") %>

View File

@ -1,4 +1,4 @@
<%= form_for("",
<%= form_for(exercise,
:html => { :multipart => true },
:url => {:controller => 'exercise',
:action => 'commit_exercise',
@ -7,8 +7,10 @@
<div class="ur_buttons">
<a class="ur_button_submit" onclick="poll_submit();"> 提交 </a>
<div class="polls_cha">
<input name="exercise[show_result]" value="1" type="checkbox" checked="true">
<label for="">允许学生查看测验结果</label>
<%= f.check_box :show_result, :value => exercise.show_result%>
<%= label_tag 'exercise_show_result', '允许学生查看测验结果' %>
<!--<input name="exercise[show_result]" value="<%#exercise.show_result %>" type="checkbox" checked="true">
<label for="">允许学生查看测验结果</label>-->
</div>
</div>
<% end %>

View File

@ -22,12 +22,12 @@
<% 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| %>
<% 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"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
<%= exercise_question.question_title %><br />
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
<br />
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
</div>
<div class="cl"></div>
@ -54,12 +54,12 @@
</div>
<div class="testStatus" id="mcq_question_list" style="display: <%=mcq_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">多选题</h3>
<% mcq_question_list.each do |exercise_question| %>
<% mcq_question_list.each_with_index do |exercise_question, index| %>
<div id="poll_questions_<%= exercise_question.id%>">
<div id="show_poll_questions_<%= exercise_question.id %>">
<div>
<div class="testEditTitle"> 第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)<br />
<%= exercise_question.question_title %><br />
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
<br />
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
</div>
<div class="cl"></div>
@ -86,12 +86,12 @@
</div>
<div class="testStatus" id="single_question_list" style="display: <%=single_question_list.count > 0 ? "" : "none" %>">
<h3 class="fontGrey3">填空题</h3>
<% single_question_list.each do |exercise_question| %>
<% single_question_list.each_with_index do |exercise_question, list_index| %>
<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 />
<div class="testEditTitle"> 第<%= list_index+1%>题:<%= exercise_question.question_title %>&nbsp;&nbsp;(<%= exercise_question.question_score %>分)
<br />
标准答案:<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>
</div>
<div class="cl"></div>