Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
commit
d845b8373a
@ -1,3 +1,3 @@
|
|||||||
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_news', :locals => {:activity => @news,:user_activity_id =>@user_activity_id}) %>");
|
||||||
|
|
||||||
init_KindEditor_data(<%= @user_activity_id%>);
|
init_KindEditor_data('<%= @user_activity_id%>');
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
<div class="homepageRight">
|
||||||
|
<div class="HomeWork">
|
||||||
|
<div class="RightBanner">
|
||||||
|
<div class="NewsBannerName">发布作业</div>
|
||||||
|
</div>
|
||||||
|
<div class="HomeWorkCon">
|
||||||
|
<div class="mt15">
|
||||||
|
<textarea class="InputBox W700 " placeholder="请输入作业标题" name="homework_common[name]" id="homework_name" maxlength="255" onkeyup="regex_homework_name();" value="<%= homework.name%>"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class=" mt10">
|
||||||
|
<a href="javascript:void(0);" class="BlueCirBtn fl mr10">导入作业</a>
|
||||||
|
<input type="text" name="homework_common[end_time]" id="homework_end_time" class="InputBox fl W120 date-input" readonly="readonly" value="<%= homework.end_time%>" placeholder="截止日期"></input>
|
||||||
|
<div class="fl DateBorder mr10"><a href="javascript:void(0);" class="pic_date"></a></div>
|
||||||
|
<input type="text" name="homework_common[publish_time]" id="homework_publish_time" class="InputBox fl W120 date-input" readonly="readonly" value="<%= homework.publish_time%>" placeholder="发布日期"></input>
|
||||||
|
<div class="fl DateBorder"><a href="javascript:void(0);" class="pic_date"></a></div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
<div class="mt10">
|
||||||
|
<% if edit_mode %>
|
||||||
|
<%= f.kindeditor :description,:editor_id => 'homework_description_editor',:owner_id => homework.id,:owner_type =>OwnerTypeHelper::HOMEWORKCOMMON %>
|
||||||
|
<% else %>
|
||||||
|
<%= hidden_field_tag :asset_id,params[:asset_id],:required => false,:style => 'display:none' %>
|
||||||
|
<%= f.kindeditor :description,:editor_id => 'homework_description_editor' %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<div class="mt10">
|
||||||
|
<textarea class="InputBox W700 SearchIcon" placeholder="发送到课程" style="margin-top: 0px; margin-bottom: 0px; height: 29px;"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="mt5">
|
||||||
|
<a href="javascript:void(0);" class="AnnexBtn fl mt3">上传附件</a>
|
||||||
|
<a href="javascript:void(0);" class="FilesBtn fl mr15 mt3">资源库</a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt10">
|
||||||
|
<a href="javascript:void(0);" class=" fl DropBtn">高级功能</a>
|
||||||
|
<div class="DropLine"></div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
<div class="advanced_option" style="display:none;">
|
||||||
|
<div class="mt10">
|
||||||
|
<select class="InputBox W120" required="true">
|
||||||
|
<option value="语言选择">语言选择</option>
|
||||||
|
<option value="C语言">C语言</option>
|
||||||
|
<option value="C++">C++</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt10">
|
||||||
|
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" required></textarea><textarea class="InputBox W320 fl mr5" placeholder="测试输出" required></textarea>
|
||||||
|
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
|
||||||
|
<a href="javascript:void(0);" class=" fl icon_remove" title="删除测试组"></a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mt10">
|
||||||
|
<a href="javascript:void(0);" onClick="submit_homework('new_homework_common');" class="BlueCirBtnMini fr">发布</a>
|
||||||
|
<span class="fr mr10 mt3">或</span><%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'fr mr10 mt3'%>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!----HomeWork end-->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script id="t:test-answer-list" type="text/html">
|
||||||
|
<div class="mt10">
|
||||||
|
<textarea class="InputBox W320 fl mr10" placeholder="测试输入" required></textarea><textarea class="InputBox W320 fl mr5" placeholder="测试输出" required></textarea>
|
||||||
|
<a href="javascript:void(0);" class=" fl icon_add" title="增加测试组"></a>
|
||||||
|
<a href="javascript:void(0);" class=" fl icon_remove" title="删除测试组"></a>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
|
@ -1,17 +1,16 @@
|
|||||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
|
<% content_for :header_tags do %>
|
||||||
|
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg' %>
|
||||||
|
<%= javascript_include_tag 'homework','baiduTemplate' %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= error_messages_for 'homework_common' %>
|
<%= error_messages_for 'homework_common' %>
|
||||||
<div class="project_r_h">
|
|
||||||
<h2 class="project_h2">
|
|
||||||
<%= l(:label_course_homework_new)%>
|
|
||||||
</h2>
|
|
||||||
</div>
|
|
||||||
<div class="hwork_new">
|
<div class="hwork_new">
|
||||||
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
|
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %>
|
||||||
<%= hidden_field_tag "course",@course.id%>
|
<%= hidden_field_tag "course",@course.id%>
|
||||||
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
|
<%= render :partial => 'homework_common/new_homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %>
|
||||||
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a>
|
|
||||||
<%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%>
|
|
||||||
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%>
|
|
||||||
<% end%>
|
<% end%>
|
||||||
</div><!--hwork_new end-->
|
</div><!--hwork_new end-->
|
||||||
|
|
||||||
|
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
class ChangeStudentWorkTests < ActiveRecord::Migration
|
||||||
|
|
||||||
|
def change
|
||||||
|
change_table :student_work_tests do |t|
|
||||||
|
t.remove :error_msg
|
||||||
|
t.remove :result
|
||||||
|
t.remove :homework_test_id
|
||||||
|
t.integer :status, default: 9
|
||||||
|
t.text :results
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddSrcToStudentWorkTests < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :student_work_tests, :src, :text
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,133 @@
|
|||||||
|
$(function(){
|
||||||
|
//提交作业
|
||||||
|
|
||||||
|
var bt=baidu.template;
|
||||||
|
bt.LEFT_DELIMITER='<!';
|
||||||
|
bt.RIGHT_DELIMITER='!>';
|
||||||
|
|
||||||
|
var tested = false;
|
||||||
|
var valid_form = function() {
|
||||||
|
var src = $('#program-src').val();
|
||||||
|
var title = $('#program-title').val();
|
||||||
|
|
||||||
|
if (!src) {
|
||||||
|
alert('请输入正确的代码');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!title) {
|
||||||
|
alert('请输入标题');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var test_program = function(cb){
|
||||||
|
var homework_id = $('#test-program-btn').attr('data-homework-id');
|
||||||
|
var student_work_id = $('#test-program-btn').attr('data-student-work-id');
|
||||||
|
var src = $('#program-src').val();
|
||||||
|
var title = $('#program-title').val();
|
||||||
|
|
||||||
|
if(!valid_form()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.post(
|
||||||
|
'/student_work/program_test',
|
||||||
|
{homework: homework_id, student_work_id: student_work_id, src: src, title: title},
|
||||||
|
function(data,status){
|
||||||
|
tested = true;
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
if (typeof cb == 'function') {cb(); return;}
|
||||||
|
|
||||||
|
|
||||||
|
var html=bt('t:result-list',data);
|
||||||
|
$('.ProResult').prepend(html);
|
||||||
|
|
||||||
|
if (data.status==0) {
|
||||||
|
var r=confirm("答题正确,是否立刻提交?");
|
||||||
|
if (r) {
|
||||||
|
$(".HomeWorkCon form").submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
$('#test-program-btn').on('click', test_program);
|
||||||
|
|
||||||
|
|
||||||
|
$('#commit-program-work-btn').on('click', function(){
|
||||||
|
if(!valid_form()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if($('.ProResult .ProResultTop').length<=0){
|
||||||
|
var r=confirm("测试后才能提交,是否立刻测试?");
|
||||||
|
if (r) {
|
||||||
|
test_program();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tested) {
|
||||||
|
test_program(function(){
|
||||||
|
$(".HomeWorkCon form").submit();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(".HomeWorkCon form").submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('form.edit_student_work').on('keydown', '#program-src', function(){
|
||||||
|
tested = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//发布作业
|
||||||
|
var isProgramHomework = function(){
|
||||||
|
return !$(".advanced_option").is(":hidden");
|
||||||
|
}
|
||||||
|
|
||||||
|
var submit_comm_homework = function(id){
|
||||||
|
var valid = true;
|
||||||
|
if (isProgramHomework()) {
|
||||||
|
$.each($('.advanced_option textarea.InputBox'), function(i, val){
|
||||||
|
if ($(val).val().length<=0) {
|
||||||
|
$(val).focus();
|
||||||
|
valid = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (valid) {
|
||||||
|
$('input[name=homework_type]').val(2);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (valid) {
|
||||||
|
submit_homework(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.submit_comm_homework = submit_comm_homework;
|
||||||
|
|
||||||
|
var datepickerOptions={dateFormat:'yy-mm-dd',firstDay:0,showWeek:true,showOtherMonths:true,selectOtherMonths:true};
|
||||||
|
|
||||||
|
$('input.date-input').datepicker(datepickerOptions);
|
||||||
|
|
||||||
|
$('a.pic_date').on('click', function(){
|
||||||
|
$(this).parent().prev().first().focus();
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
$('a.DropBtn').on('click', function(){
|
||||||
|
$(".advanced_option").toggle();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".HomeWork").on('click', 'a.icon_add', function(){
|
||||||
|
var html = bt('t:test-answer-list', null);
|
||||||
|
$(this).parent('.mt10').after(html);
|
||||||
|
|
||||||
|
});
|
||||||
|
$(".HomeWork").on('click', 'a.icon_remove', function(){
|
||||||
|
$(this).parent('.mt10').remove();
|
||||||
|
});
|
||||||
|
});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue