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

This commit is contained in:
huang 2015-11-19 11:39:04 +08:00
commit 4c71d8a85e
9 changed files with 254 additions and 241 deletions

View File

@ -54,223 +54,6 @@
} }
} }
function add_MC(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC') %>");
$("#poll_questions_title").focus();
}
function insert_MC(quest_type,quest_num,quest_id){
if($.trim($("#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|%>'+
' <div class="questionContainer" style="width: 680px;"> '+
'<div class="ur_editor_title"> '+
'<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="1"/>'+
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入单选题题目" type="text"/>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
'</li>'+
'<li class="ur_item">'+
'<label>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>标准答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input name="exercise_choice" placeholder="若标准答案为A在此输入A即可" type="text">'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'保存'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
}
else {
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
}
$("#poll_questions_title").focus();
}
function add_MCQ(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ') %>");
$("#poll_questions_title").focus();
}
function insert_MCQ(quest_type,quest_num,quest_id){
if($.trim($("#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|%>'+
' <div class="questionContainer" style="width: 680px;"> '+
'<div class="ur_editor_title"> '+
'<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="2"/>'+
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入多选题题目" type="text"/>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
'</li>'+
'<li class="ur_item">'+
'<label>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>标准答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input name="exercise_choice" placeholder="若标准答案为A,B,C在答案输入框填入ABC即可" type="text">'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'保存'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
} else {
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
}
$("#poll_questions_title").focus();
}
function add_single(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single') %>");
$("#poll_questions_title").focus();
}
function insert_SINGLE(quest_type,quest_num,quest_id){
if($.trim($("#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|%>'+
' <div class="questionContainer" style="width: 680px;"> '+
'<div class="ur_editor_title"> '+
'<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="3"/>'+
'<input name="question_title" id="poll_questions_title" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text"/>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
'</li>'+
'<li class="ur_item">'+
'<label>候选答案一<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="text" name="exercise_choice[0]" placeholder="请输入候选答案一"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>候选答案二<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="text" name="exercise_choice[1]" placeholder="请输入候选答案二(选填)"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>候选答案三<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="exercise_choice[2]" placeholder="请输入候选答案三(选填)"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this));">'+
'保存'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
} else {
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
}
$("#poll_questions_title").focus();
}
//选择导入调查问卷 //选择导入调查问卷
function importPoll(){ function importPoll(){
importPollPopWindow = $("#import_poll"); importPollPopWindow = $("#import_poll");
@ -297,10 +80,15 @@
} }
//添加标题时确定按钮 //添加标题时确定按钮
function add_poll_question(doc) function add_poll_question(doc,quest_type,quest_id)
{ {
var title = $.trim($("#poll_questions_title").val()); if(arguments[1] && arguments[2]){
if(title.length == 0){alert("题目标题不能为空");}else{doc.parent().parent().parent().submit();} var title = $.trim($("#poll_questions_title_"+quest_type+"_"+quest_id));
if(title.length == 0){alert("题目标题不能为空");}else{doc.parent().parent().parent().submit();}
} else {
var title = $.trim($("#poll_questions_title").val());
if(title.length == 0){alert("题目标题不能为空");}else{doc.parent().parent().parent().submit();}
}
} }
//修改标题时确定按钮 //修改标题时确定按钮
function edit_poll_question(doc,id) function edit_poll_question(doc,id)
@ -394,13 +182,8 @@
<%= render :partial => 'exercise_content', :locals => {:exercise => @exercise}%> <%= render :partial => 'exercise_content', :locals => {:exercise => @exercise}%>
</div> </div>
<div class="testQuestion"> <div class="testQuestion" id="new_exercise_question">
<ul class="tabs_list"> <%= render :partial => 'new_question', :locals => {:exercise => @exercise} %>
<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>
</div><!--选项 end--> </div><!--选项 end-->
<!-- 新增问题 --> <!-- 新增问题 -->

View File

@ -13,8 +13,9 @@
<div class="ur_editor_content"> <div class="ur_editor_content">
<ul> <ul>
<li class="ur_item"> <li class="ur_item">
<% score = exercise.exercise_questions.where("question_type=1").last.nil? ? "": exercise.exercise_questions.where("question_type=1").last.question_score %>
<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分 <input value="<%=score %>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ur_item"> <li class="ur_item">

View File

@ -13,8 +13,9 @@
<div class="ur_editor_content"> <div class="ur_editor_content">
<ul> <ul>
<li class="ur_item"> <li class="ur_item">
<% score = exercise.exercise_questions.where("question_type=2").last.nil? ? "": exercise.exercise_questions.where("question_type=2").last.question_score %>
<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分 <input value="<%=score %>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ur_item"> <li class="ur_item">

View File

@ -0,0 +1,24 @@
<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(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MC', :locals => {:exercise=>exercise}) %>");
$("#poll_questions_title").focus();
}
function add_MCQ(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_MCQ', :locals => {:exercise=>exercise}) %>");
$("#poll_questions_title").focus();
}
function add_single(){
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_single', :locals => {:exercise=>exercise}) %>");
$("#poll_questions_title").focus();
}
</script>

View File

@ -13,8 +13,9 @@
<div class="ur_editor_content"> <div class="ur_editor_content">
<ul> <ul>
<li class="ur_item"> <li class="ur_item">
<% score = exercise.exercise_questions.where("question_type=3").last.nil? ? "": exercise.exercise_questions.where("question_type=3").last.question_score %>
<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label> <label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>
<input type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分 <input value="<%= score%>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;">分
</li> </li>
<div class="cl"></div> <div class="cl"></div>
<li class="ur_item"> <li class="ur_item">

View File

@ -28,4 +28,79 @@
</div><!--单选题显示 end--> </div><!--单选题显示 end-->
<!-- 新增问题 --> <!-- 新增问题 -->
<div id="insert_new_poll_question_mc_<%=exercise_question.id%>"> <div id="insert_new_poll_question_mc_<%=exercise_question.id%>">
</div> </div>
<script type="text/javascript">
function insert_MC(quest_type,quest_num,quest_id){
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
<% score =@exercise.exercise_questions.where("question_type=1").last.nil? ? "": @exercise.exercise_questions.where("question_type=1").last.question_score %>
$("#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|%>'+
' <div class="questionContainer" style="width: 680px;"> '+
'<div class="ur_editor_title"> '+
'<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="1"/>'+
'<input name="question_title" id="poll_questions_title_'+quest_type+"_"+quest_id+'" class="questionTitle" placeholder="请输入单选题题目" type="text"/>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input value="<%=score %>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
'</li>'+
'<li class="ur_item">'+
'<label>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>标准答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input name="exercise_choice" placeholder="若标准答案为A在此输入A即可" type="text">'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),\''+quest_type+'\','+quest_id+');">'+
'保存'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
}
else {
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
}
$("#poll_questions_title_"+quest_type+"_"+quest_id).focus();
}
</script>

View File

@ -28,12 +28,77 @@
<!-- 新增问题 --> <!-- 新增问题 -->
<div id="insert_new_poll_question_mcq_<%=exercise_question.id%>"> <div id="insert_new_poll_question_mcq_<%=exercise_question.id%>">
</div> </div>
<div id="div_mcq_<%=exercise_question.id%>" style="width: 50px;border: 1px solid #cbcbcb; display:none;position: absolute;padding: 5px;background: white">
<ul> <script type="text/javascript">
<!-- function insert_MCQ(quest_type,quest_num,quest_id){
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%#=poll_question.id%>);insert_MC('mcq',<%#=poll_question.question_number%>,<%#=poll_question.id%>);">单选</a></li> if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == ""){
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%#=exercise_question.id%>);insert_MCQ('mcq',<%#=exercise_question.question_number%>,<%#=exercise_question.id%>);">多选</a></li> <% score =@exercise.exercise_questions.where("question_type=2").last.nil? ? "" : @exercise.exercise_questions.where("question_type=2").last.question_score %>
<li><a href="javascript:void(0);" onclick=" dismiss('mcq',<%#=poll_question.id%>);insert_SINGLE('mcq',<%#=poll_question.question_number%>,<%#=poll_question.id%>);">单行主观</a></li> $("#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|%>'+
</ul> ' <div class="questionContainer" style="width: 680px;"> '+
</div> '<div class="ur_editor_title"> '+
'<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="2"/>'+
'<input name="question_title" id="poll_questions_title_'+quest_type+"_"+quest_id+'" class="questionTitle" placeholder="请输入多选题题目" type="text"/>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input value="<%= score %>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
'</li>'+
'<li class="ur_item">'+
'<label>选项A<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[0]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项B<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[1]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项C<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[2]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>选项D<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="question_answer[3]" placeholder="输入选项内容"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>标准答案<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input name="exercise_choice" placeholder="若标准答案为A,B,C在答案输入框填入ABC即可" type="text">'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),\''+quest_type+'\','+quest_id+');">'+
'保存'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
} else {
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
}
$("#poll_questions_title_"+quest_type+"_"+quest_id).focus();
}
</script>

View File

@ -15,4 +15,66 @@
</div> </div>
<!-- 新增问题 --> <!-- 新增问题 -->
<div id="insert_new_poll_question_single_<%=exercise_question.id%>"> <div id="insert_new_poll_question_single_<%=exercise_question.id%>">
</div> </div>
<script type="text/javascript">
function insert_SINGLE(quest_type,quest_num,quest_id){
if($.trim($("#insert_new_poll_question_"+quest_type+"_"+quest_id).html()) == "") {
<% score = @exercise.exercise_questions.where("question_type=3").last.nil? ? "" : @exercise.exercise_questions.where("question_type=3").last.question_score %>
$("#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|%>'+
' <div class="questionContainer" style="width: 680px;"> '+
'<div class="ur_editor_title"> '+
'<label>问题:&nbsp;&nbsp;</label>'+
'<input type="hidden" name="quest_id" value="'+quest_id+'"/>'+
'<input type="hidden" name="quest_num" value="'+quest_num+'"/>'+
'<input type="hidden" name="question_type" value="3"/>'+
'<input name="question_title" id="poll_questions_title_'+quest_type+"_"+quest_id+'" class="questionTitle" placeholder="请输入填空题的内容(注意:目前填空题暂时仅支持一个空)" type="text"/>'+
'</div>'+
'<div class="ur_editor_content">'+
'<ul>'+
'<li class="ur_item">'+
'<label>分数<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input value="<%= score %>" type="text" name="question_score" style="width:40px; text-align:center; padding-left:0px;"/>分'+
'</li>'+
'<li class="ur_item">'+
'<label>候选答案一<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="text" name="exercise_choice[0]" placeholder="请输入候选答案一"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>候选答案二<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input type="text" name="exercise_choice[1]" placeholder="请输入候选答案二(选填)"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'<li class="ur_item">'+
'<label>候选答案三<span class="ur_index"></span>&nbsp;&nbsp;&nbsp;</label>'+
'<input maxlength="200" type="text" name="exercise_choice[2]" placeholder="请输入候选答案三(选填)"/>'+
'<a class="icon_add" title="向下插入选项" onclick="add_single_answer($(this));"></a>'+
'<a class="icon_remove" title="删除" onclick="remove_single_answer($(this))"></a>'+
'</li>'+
'<div class="cl"></div>'+
'</ul>'+
'</div>'+
'<div class="ur_editor_footer">'+
'<a class="btn btn_dark btn_submit c_white" data-button="ok" onclick="add_poll_question($(this),\''+quest_type+'\','+quest_id+');">'+
'保存'+
'</a>'+
'<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">'+
'<%= l(:button_cancel)%>'+
'</a>'+
'</div>'+
'<div class="cl"></div>'+
'</div>'+
'<% end%>'
);
} else {
$("#insert_new_poll_question_"+quest_type+"_"+quest_id).html("");
}
$("#poll_questions_title_"+quest_type+"_"+quest_id).focus();
}
</script>

View File

@ -1,6 +1,7 @@
<% if @is_insert %> <% if @is_insert %>
$("#poll_content").html('<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise})%>'); $("#poll_content").html('<%= escape_javascript(render :partial => 'exercise_content', :locals => {:exercise => @exercise})%>');
<% else %> <% else %>
$("#new_exercise_question").html('<%= escape_javascript(render :partial => 'new_question', :locals => {:exercise => @exercise}) %>');
$("#new_poll_question").html(""); $("#new_poll_question").html("");
<%if @exercise_questions.question_type == 1%> <%if @exercise_questions.question_type == 1%>
$("#mc_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" + $("#mc_question_list").show().append("<div id='poll_questions_<%= @exercise_questions.id%>'>" +