dev_zanle
huang 10 years ago
commit ea51b24a4e

@ -16,10 +16,7 @@ class ExerciseController < ApplicationController
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
end end
end end
end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
end_exercises.each do |exercise|
exercise.update_column('exercise_status', 3)
end
if @course.is_public == 0 && !(User.current.member_of_course?(@course)||User.current.admin?) if @course.is_public == 0 && !(User.current.member_of_course?(@course)||User.current.admin?)
render_403 render_403
return return
@ -46,10 +43,7 @@ class ExerciseController < ApplicationController
exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2) exercise.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
end end
end end
end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
end_exercises.each do |exercise|
exercise.update_column('exercise_status', 3)
end
unless User.current.member_of_course?(@course) || User.current.admin? unless User.current.member_of_course?(@course) || User.current.admin?
render_403 render_403
return return

@ -120,15 +120,16 @@ class SchoolController < ApplicationController
condition.scan(/./).each_with_index do |char,index| condition.scan(/./).each_with_index do |char,index|
if char =~ /[a-zA-Z0-9]/ if char =~ /[a-zA-Z0-9]/
pinyin << char pinyin << char
elsif char =~ /\'/
else else
chinese << char chinese << char
end end
end end
if(condition == '') if(condition == '')
@school = School.page((params[:page].to_i || 1) - 1).per(100) @school = School.reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100)
@school_count = School.count @school_count = School.count
else else
@school = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").page((params[:page].to_i || 1) - 1).per(100) @school = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('pinyin').page((params[:page].to_i || 1) - 1).per(100)
@school_count = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count @school_count = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count
end end

@ -1,20 +1,3 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: true, prettify: false) %>
<%= javascript_include_tag "init_activity_KindEditor" %>
<% end %>
<style type="text/css">
/*回复框*/
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-outline {border: none;}
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
.homepagePostReplyInputContainer .ke-container {float: left;}
</style>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
$("#RSide").removeAttr("id"); $("#RSide").removeAttr("id");
@ -45,61 +28,7 @@
<% if User.current.logged? %> <% if User.current.logged? %>
<%= labelled_form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, <%= labelled_form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},
:html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %> :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
<%= render :partial => 'course_new', :locals => {:f => f, :topic => @message, :edit_mode => false, :course => course} %> <%= render :partial => 'course_new', :locals => {:f => f, :topic => @message, :edit_mode => false, :course => @board.course} %>
<% end %> <% end %>
<% end %> <% end %>
<%= render :partial=> 'course_show_detail',:locals =>{:topics => @topics, :page => 0} %></div>
<% if topics%>
<% topics.each do |topic| %>
<script>
function expand_reply(container, btnid) {
var target = $(container);
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复');
target.show();
} else {
btn.data('init', 0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
function expand_reply_input(id) {
$(id).toggle();
}
$(function () {
init_activity_KindEditor_data(<%= topic.id%>, null, "87%", "<%=topic.class.to_s%>");
showNormalImage('activity_description_<%= topic.id %>');
/*var description_images=$("div#activity_description_<%#= topic.id %>").find("img");
if (description_images.length>0) {
for (var i=0; i<description_images.length; i++){
var image=$(description_images[i]);
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
}
}
$('#activity_description_<%#= topic.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});*/
});
</script>
<% if topic %>
<%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id} %>
<% end %>
<% end %>
<% if topics.count == 10 %>
<div id="show_more_course_topic" class="loadMore mt10 f_grey">展开更多<%= link_to "", boards_topic_path(@board, :course_id => @board.course.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %></div>
<% end %>
<% end%>
</div>
<script type="text/javascript">
$("#show_more_course_topic").mouseover(function () {
$("#more_topic_link").click();
});
</script>

@ -0,0 +1,70 @@
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
<%= javascript_include_tag "init_activity_KindEditor" %>
<% end %>
<style type="text/css">
/*回复框*/
.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}
.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}
.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}
.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}
.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}
.homepagePostReplyInputContainer .ke-outline {border: none;}
.homepagePostReplyInputContainer .ke-inline-block {display: none;}
.homepagePostReplyInputContainer .ke-container {float: left;}
</style>
<% if topics%>
<% topics.each do |topic| %>
<script>
function expand_reply(container, btnid) {
var target = $(container);
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复');
target.show();
} else {
btn.data('init', 0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
function expand_reply_input(id) {
$(id).toggle();
}
$(function () {
init_activity_KindEditor_data(<%= topic.id%>, null, "87%");
showNormalImage('activity_description_<%= topic.id %>');
/*var description_images=$("div#activity_description_<%#= topic.id %>").find("img");
if (description_images.length>0) {
for (var i=0; i<description_images.length; i++){
var image=$(description_images[i]);
var element=$("<a></a>").attr("href",image.attr('src'));
image.wrap(element);
}
}
$('#activity_description_<%#= topic.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false});*/
});
</script>
<% if topic %>
<%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id} %>
<% end %>
<% end %>
<% if topics.count == 10 %>
<div id="show_more_course_topic" class="loadMore mt10 f_grey">展开更多<%= link_to "", boards_topic_path(@board, :course_id => @board.course.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %></div>
<% end %>
<% end%>
<script type="text/javascript">
$("#show_more_course_topic").mouseover(function () {
$("#more_topic_link").click();
});
</script>

@ -1 +1 @@
$("#show_more_course_topic").replaceWith("<%= escape_javascript( render :partial => 'boards/course_show',:locals => {:topics => @topics, :page => @page} )%>"); $("#show_more_course_topic").replaceWith("<%= escape_javascript( render :partial => 'boards/course_show_detail',:locals => {:topics => @topics, :page => @page} )%>");

@ -75,6 +75,9 @@
<li class="hworkList130 c_grey student_work_<%= exercise.id%>"> <li class="hworkList130 c_grey student_work_<%= exercise.id%>">
<% if exercise.created_at%> <% if exercise.created_at%>
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>&nbsp; <%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% if @exercise.end_time <= exercise.created_at %>
<span class="c_red">[未答]</span>
<% end %>
<% end %> <% end %>
</li> </li>

@ -18,7 +18,7 @@
} }
$(function () { $(function () {
init_activity_KindEditor_data(<%= issue.id%>, null, "87%"); init_activity_KindEditor_data(<%= issue.id%>, null, "87%", "<%= issue.class.name %>");
showNormalImage('activity_description_<%= issue.id %>'); showNormalImage('activity_description_<%= issue.id %>');
if ($("#intro_content_<%= issue.id %>").height() > 360) { if ($("#intro_content_<%= issue.id %>").height() > 360) {
$("#intro_content_show_<%= issue.id %>").show(); $("#intro_content_show_<%= issue.id %>").show();

@ -1,9 +1,9 @@
<%= content_for(:header_tags) do %> <%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false) %> <%= import_ke(enable_at: true) %>
<%= javascript_include_tag 'create_kindeditor'%> <%= javascript_include_tag 'create_kindeditor'%>
<% end %> <% end %>
<script> <script>
sd_create_editor_from_data(<%= @issue.id%>, null, "100%"); sd_create_editor_from_data(<%= @issue.id%>, null, "100%", "<%= @issue.class.name %>");
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){

@ -642,45 +642,45 @@
$("#hint").hide(); $("#hint").hide();
} }
}); });
// $("input[name='province']").on('focus', function (e) { $("input[name='province']").on('focus', function (e) {
// if($(e.target).val() == ''){ // if( $("input[name='occupation']").val() != ''){ //如果已经有id了。肯定存在不用去找了。
// return; return;
// } }
// if( $("input[name='occupation']").val() != ''){ //如果已经有id了。肯定存在不用去找了。
// return; $.ajax({
// } url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value+'&page='+page,
// type: 'post',
// $.ajax({ success: function (data) {
// url: '<%#= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value, schoolsResult = data.schools;
// type: 'post', count = data.count;
// success: function (data) { maxPage = Math.ceil(count/100) //最大页码值
// if(data.length != undefined && data.length != 0) { if(schoolsResult.length != undefined && schoolsResult.length != 0) {
// var i = 0; var i = 0;
// $("#search_school_result_list").html(''); $("#search_school_result_list").html('');
// for (; i < data.length; i++) { for (; i < schoolsResult.length; i++) {
// link = '<a onclick="window.changeValue(\'' + data[i].school.name.replace(/\s/g," ") + '\',\'' + data[i].school.id + '\')" href="javascript:void(0)">' + data[i].school.name + '</a><br/>'; link = '<a onclick="window.changeValue(\'' + schoolsResult[i].school.name.replace(/\s/g," ") + '\',\'' + schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + schoolsResult[i].school.name + '</a><br/>';
// $("#search_school_result_list").append(link); $("#search_school_result_list").append(link);
// } }
// $("#search_school_result_list").css('left', $(e.target).offset().left); $("#search_school_result_list").css('left', $(e.target).offset().left);
// $("#search_school_result_list").css('top', $(e.target).offset().top + 28); $("#search_school_result_list").css('top', $(e.target).offset().top + 28);
// $("#search_school_result_list").css("position", "absolute"); $("#search_school_result_list").css("position", "absolute");
// $("#search_school_result_list").show(); $("#search_school_result_list").show();
// if ($(e.target).val().trim() != '') { if($(e.target).val().trim() != '') {
// str = e.target.value.length > 8 ? e.target.value.substr(0, 6) + "..." : e.target.value; str = e.target.value.length > 8 ? e.target.value.substr(0, 6)+"..." : e.target.value;
// $("#hint").html('找到了' + data.length + '个包含"' + str + '"的高校'); $("#hint").html('找到了' + count + '个包含"' + str + '"的高校');
// $("#hint").show(); $("#hint").show();
// } else { }else{
// $("#hint").hide(); $("#hint").hide();
// } }
// }else { }else{
// $("#search_school_result_list").html(''); $("#search_school_result_list").html('');
// str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value; str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
// $("#hint").html('没有找到包含"'+str+'"的高校,<a style="color:#64bdd9" onclick="add_school(\''+ e.target.value+'\');" href="javascript:void(0);">创建高校</a>'); $("#hint").html('没有找到包含"'+str+'"的高校,<a style="color:#64bdd9" onclick="add_school(\''+ e.target.value+'\');" href="javascript:void(0);">创建高校</a>');
// $("#hint").show(); $("#hint").show();
// } }
// } }
// }); });
// }); });
// $("#province").leanModal({top: 100, closeButton: ".modal_close"}); // $("#province").leanModal({top: 100, closeButton: ".modal_close"});

@ -1,3 +1,4 @@
<% if @homework.homework_detail_group %>
<div id="popbox02"> <div id="popbox02">
<div> <div>
<div class="relateText fl">请从<%= @homework.homework_detail_group.base_on_project == 1 ? '项目成员':'课程成员' %>中添加小组成员</div> <div class="relateText fl">请从<%= @homework.homework_detail_group.base_on_project == 1 ? '项目成员':'课程成员' %>中添加小组成员</div>
@ -105,4 +106,5 @@
<% end %> <% end %>
<% end %> <% end %>
}); });
</script> </script>
<% end %>

@ -97,11 +97,21 @@
<div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div> <div id="intro_content_show_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div> <div id="intro_content_hide_<%= user_activity_id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div> <div class="cl"></div>
<div class="mt5">
<div class="mt10">
<div class="homepagePostDeadline"> <div class="homepagePostDeadline">
迟交扣分:<%= activity.late_penalty%>分
</div>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;">
匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%>&nbsp;00:00 匿评开启时间:<%= activity.homework_detail_manual.evaluation_start%>&nbsp;00:00
</div> </div>
<div class="homepagePostDeadline ml15"> </div>
<div class="cl"></div>
<div>
<div class="homepagePostDeadline">
缺评扣分:<%= activity.homework_detail_manual.absence_penalty%>分/作品
</div>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;">
匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%>&nbsp;23:59 匿评关闭时间:<%= activity.homework_detail_manual.evaluation_end%>&nbsp;23:59
</div> </div>
</div> </div>

@ -26,7 +26,7 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<% count=course.journals_for_messages.where('m_parent_id IS NULL').count %> <% count = fetch_user_leaveWord_reply(activity).count %>
<div class="homepagePostReply"> <div class="homepagePostReply">
<div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div> <div class="topBorder" style="display: <%= count>0 ? 'none': '' %>"></div>
<div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>"> <div class="homepagePostReplyBanner" style="display: <%= count>0 ? '': 'none' %>">
@ -47,7 +47,7 @@
<% if count > 0 %> <% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>"> <div class="" id="reply_div_<%= user_activity_id %>">
<ul> <ul>
<% course.journals_for_messages.where('m_parent_id IS NULL').reorder("created_on desc").each do |comment| %> <% fetch_user_leaveWord_reply(activity).each do |comment| unless fetch_user_leaveWord_reply(activity).nil? %>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
showNormalImage('reply_content_<%= comment.id %>'); showNormalImage('reply_content_<%= comment.id %>');
@ -68,43 +68,12 @@
<%= format_time(comment.created_on) %> <%= format_time(comment.created_on) %>
</div> </div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>"> <div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<%= comment.notes.html_safe %></div> <%= comment.notes.html_safe %>
<% fetch_user_leaveWord_reply(comment).each do |reply| unless fetch_user_leaveWord_reply(comment).nil? %> </div>
<script type="text/javascript">
$(function(){
showNormalImage('reply_to_content_<%= reply.id %>');
});
</script>
<div class="recall">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.user), :width => "33", :height => "33", :class =>"mt8"), user_path(reply.user_id), :alt => "用户头像" %>
</div>
<div class="homepagePostReplyjournal">
<div class="homepagePostReplyPublisher">
<% if reply.try(:user).try(:realname) == ' ' %>
<%= link_to reply.try(:user), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
<% else %>
<%= link_to reply.try(:user).try(:realname), user_path(reply.user_id), :class => "newsBlue mr10 f14" %>
<% end %>
<%= l(:label_reply_to)%>
<% if comment.try(:user).try(:realname) == ' ' %>
<%= link_to comment.try(:user), user_path(comment.user_id), :class => "newsBlue mr10 f14 ml10" %>
<% else %>
<%= link_to comment.try(:user).try(:realname), user_path(comment.user_id), :class => "newsBlue mr10 f14 ml10" %>
<% end %>
<%= format_time reply.created_on %>
</div>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" style="max-width: 580px;" id="reply_to_content_<%= reply.id %>">
<%= reply.notes.html_safe %></div>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<% end %>
<% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<% end %>
<% end %> <% end %>
</ul> </ul>
</div> </div>

@ -10,7 +10,7 @@
</div> </div>
<div class="mb10 mt10"> <div class="mb10 mt10">
<label> <label>
<input type="checkbox" class="mr5" name="base_on_project" value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.base_on_project : 0 %>" id="base_on_project"/> <input type="checkbox" class="mr5" name="base_on_project" checked value="<%=(edit_mode && homework.is_group_homework?) ? homework.homework_detail_group.base_on_project : 1 %>" id="base_on_project"/>
<span class="f14 fontGrey3 mr10">基于项目实施</span> <span class="f14 fontGrey3 mr10">基于项目实施</span>
</label> </label>
<p class="c_red">提醒勾选后各小组必须在Trustie平台创建项目教师可随时观察平台对各小组最新进展的实时统计。</p> <p class="c_red">提醒勾选后各小组必须在Trustie平台创建项目教师可随时观察平台对各小组最新进展的实时统计。</p>

@ -102,11 +102,21 @@
<div id="intro_content_show_<%= homework_common.id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div> <div id="intro_content_show_<%= homework_common.id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[展开]</a></div>
<div id="intro_content_hide_<%= homework_common.id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div> <div id="intro_content_hide_<%= homework_common.id%>" class="fr" style="display:none;"><a href="javascript:void(0);" class="linkBlue">[收起]</a></div>
<div class="cl"></div> <div class="cl"></div>
<div class="mt5">
<div class="mt10">
<div class="homepagePostDeadline"> <div class="homepagePostDeadline">
迟交扣分:<%= homework_common.late_penalty%>分
</div>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;">
匿评开启时间:<%= homework_common.homework_detail_manual.evaluation_start%>&nbsp;00:00 匿评开启时间:<%= homework_common.homework_detail_manual.evaluation_start%>&nbsp;00:00
</div> </div>
<div class="homepagePostDeadline ml15"> </div>
<div class="cl"></div>
<div>
<div class="homepagePostDeadline">
缺评扣分:<%= homework_common.homework_detail_manual.absence_penalty%>分/作品
</div>
<div class="homepagePostDeadline" style="float: right; margin-right: 220px;">
匿评关闭时间:<%= homework_common.homework_detail_manual.evaluation_end%>&nbsp;23:59 匿评关闭时间:<%= homework_common.homework_detail_manual.evaluation_end%>&nbsp;23:59
</div> </div>
</div> </div>

@ -1,7 +1,15 @@
# encoding: utf-8 # encoding: utf-8
class BatchDeleteProjectJournalActivities < ActiveRecord::Migration class BatchDeleteProjectJournalActivities < ActiveRecord::Migration
def up def up
ForgeActivity.where('forge_act_type = \'Journal\'').destroy_all #需要触发回调 #ForgeActivity.where('forge_act_type = \'Journal\'').destroy_all #需要触发回调
count = ForgeActivity.where('forge_act_type = \'Journal\'').count / 30 + 2
transaction do
for i in 1 ... count do i
ForgeActivity.where('forge_act_type = \'Journal\'').page(i).per(30).each do |activity|
activity.destroy
end
end
end
end end
def down def down

@ -558,23 +558,26 @@ ActiveRecord::Schema.define(:version => 20151218022014) do
add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
add_index "documents", ["project_id"], :name => "documents_project_id" add_index "documents", ["project_id"], :name => "documents_project_id"
create_table "dts", :force => true do |t| create_table "dts", :primary_key => "Num", :force => true do |t|
t.string "IPLineCode" t.string "Defect", :limit => 50
t.string "Description" t.string "Category", :limit => 50
t.string "Num"
t.string "Variable"
t.string "TraceInfo"
t.string "Method"
t.string "File" t.string "File"
t.string "IPLine" t.string "Method"
t.string "Review" t.string "Module", :limit => 20
t.string "Category" t.string "Variable", :limit => 50
t.string "Defect" t.integer "StartLine"
t.string "PreConditions" t.integer "IPLine"
t.string "StartLine" t.string "IPLineCode", :limit => 200
t.string "Judge", :limit => 15
t.integer "Review", :limit => 1
t.string "Description"
t.text "PreConditions", :limit => 2147483647
t.text "TraceInfo", :limit => 2147483647
t.text "Code", :limit => 2147483647
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", :null => false t.datetime "created_at"
t.datetime "updated_at", :null => false t.datetime "updated_at"
t.integer "id", :null => false
end end
create_table "editor_of_documents", :force => true do |t| create_table "editor_of_documents", :force => true do |t|
@ -923,16 +926,6 @@ ActiveRecord::Schema.define(:version => 20151218022014) do
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id" add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_details_copy", :force => true do |t|
t.integer "journal_id", :default => 0, :null => false
t.string "property", :limit => 30, :default => "", :null => false
t.string "prop_key", :limit => 30, :default => "", :null => false
t.text "old_value"
t.text "value"
end
add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
create_table "journal_replies", :id => false, :force => true do |t| create_table "journal_replies", :id => false, :force => true do |t|
t.integer "journal_id" t.integer "journal_id"
t.integer "user_id" t.integer "user_id"

@ -14,9 +14,21 @@ namespace :exercise_publish do
end end
task :end => :environment do task :end => :environment do
include ExerciseHelper
exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now) exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
exercises.each do |exercise| exercises.each do |exercise|
course = exercise.course
exercise.update_column('exercise_status', 3) exercise.update_column('exercise_status', 3)
course.student.each do |student|
if ExerciseUser.where("user_id = ? && exercise_id = ?",student.student_id,exercise.id).empty?
ExerciseUser.create(:user_id => student.student_id, :exercise_id => exercise.id, :start_at => exercise.end_time, :status => true,:score=>0)
end
=begin
s_score = calculate_student_score(exercise, student.student)
exercise_user = ExerciseUser.where("user_id =? and exercise_id=?", student.student_id, exercise.id).first
exercise_user.update_attributes(:score => s_score)
=end
end
end end
end end
end end

@ -260,7 +260,7 @@ K.options = {
bodyClass : 'ke-content', bodyClass : 'ke-content',
indentChar : '\t', indentChar : '\t',
cssPath : K.basePath +'plugins/code/previewcode.css', cssPath : K.basePath +'plugins/code/previewcode.css',
cssData : '', cssData : 'font{color:black;}',
minWidth : 650, minWidth : 650,
minHeight : 100, minHeight : 100,
minChangeSize : 1, minChangeSize : 1,

@ -3,6 +3,7 @@ function sd_create_editor(params){
// var minHeight; //最小高度 // var minHeight; //最小高度
var paramsHeight = params.height; //设定的高度 var paramsHeight = params.height; //设定的高度
var id = arguments[1] ? arguments[1] : undefined; var id = arguments[1] ? arguments[1] : undefined;
var type = arguments[2] ? arguments[2] : '';
var paramsWidth = params.width == undefined ? "100%" : params.width; var paramsWidth = params.width == undefined ? "100%" : params.width;
var editor = params.kindutil.create(params.textarea, { var editor = params.kindutil.create(params.textarea, {
@ -74,7 +75,9 @@ function sd_create_editor(params){
edit.html("<span id='hint' style='color: #999999; font-size: 12px'>我要回复</span>"); edit.html("<span id='hint' style='color: #999999; font-size: 12px'>我要回复</span>");
this.resize(null,paramsHeight);// Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ paramsHeight , paramsHeight) this.resize(null,paramsHeight);// Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ paramsHeight , paramsHeight)
// params.toolbar_container.hide(); // params.toolbar_container.hide();
if(typeof enableAt === 'function'){
enableAt(this, id, type);
}
} }
}).loadPlugin('paste'); }).loadPlugin('paste');
return editor; return editor;
@ -136,6 +139,7 @@ function sd_reset_editor_form(params){
function sd_create_editor_from_data(id){ function sd_create_editor_from_data(id){
var height = arguments[1] ? arguments[1] : undefined; var height = arguments[1] ? arguments[1] : undefined;
var width = arguments[2] ? arguments[2] : undefined; var width = arguments[2] ? arguments[2] : undefined;
var type = arguments[3] ? arguments[3] : undefined;
KindEditor.ready(function (K) { KindEditor.ready(function (K) {
$("div[nhname='new_message_" + id + "']").each(function () { $("div[nhname='new_message_" + id + "']").each(function () {
var params = {}; var params = {};
@ -153,7 +157,7 @@ function sd_create_editor_from_data(id){
params.height = height; params.height = height;
params.width = width; params.width = width;
if (params.textarea.data('init') == undefined) { if (params.textarea.data('init') == undefined) {
params.editor = sd_create_editor(params,id); params.editor = sd_create_editor(params,id, type);
sd_create_form(params); sd_create_form(params);
params.cancel_btn.click(function () { params.cancel_btn.click(function () {
sd_reset_editor_form(params); sd_reset_editor_form(params);

Loading…
Cancel
Save