1.组织下的课程作业,设置评分等按钮点击没反应的问题修复;更新项目/课程的活动,相应地更新组织的活动的更新时间

This commit is contained in:
ouyangxuhua 2016-03-10 16:43:50 +08:00
parent 6cf518e2e4
commit 766569afa6
6 changed files with 128 additions and 8 deletions

View File

@ -3058,11 +3058,11 @@ end
def course_boards_url_in_org(course_id)
if Rails.env.development?
return "http://localhost:3000/courses/" + news_id.to_s + "/boards"
return "http://localhost:3000/courses/" + course_id.to_s + "/boards"
elsif Rails.env.test?
return "https://test.forge.trustie.net/courses/" + news_id.to_s + "/boards"
return "https://test.forge.trustie.net/courses/" + course_id.to_s + "/boards"
else
return "https://www.trustie.net/courses/" + news_id.to_s + "/boards"
return "https://www.trustie.net/courses/" + course_id.to_s + "/boards"
end
end

View File

@ -5,7 +5,7 @@ class CourseActivity < ActiveRecord::Base
belongs_to :course
belongs_to :user
has_many :user_acts, :class_name => 'UserAcivity',:as =>:act
after_save :add_user_activity, :add_course_activity
after_save :add_user_activity, :add_org_activity
after_create :add_course_lead
before_destroy :destroy_user_activity, :destroy_org_activity
@ -31,14 +31,16 @@ class CourseActivity < ActiveRecord::Base
end
end
def add_course_activity
def add_org_activity
org_activity = OrgActivity.where("org_act_type = '#{self.course_act_type.to_s}' and org_act_id = '#{self.course_act_id}'").first
if org_activity
org_activity.updated_at = self.updated_at
org_activity.save
else
if self.course_act_type == 'Message' && !self.course_act.parent_id.nil?
org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.course_act.parent.id}").first
org_activity.created_at = self.created_at
org_activity.updated_at = self.updated_at
org_activity.save
else
OrgActivity.create(:user_id => self.user_id,

View File

@ -48,7 +48,7 @@ class ForgeActivity < ActiveRecord::Base
def add_org_activity
org_activity = OrgActivity.where("org_act_type = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first
if org_activity
org_activity.created_at = self.created_at
org_activity.updated_at = self.updated_at
org_activity.save
else
if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil?

View File

@ -37,3 +37,120 @@ function regexTopicSubject() {
function reset_topic(){
}
(function(){
//提交匿评参数设置
function submit_set_evaluation_attr(end_time){
if(!regex_evaluation_start(end_time)){
$("#evaluation_start_time").focus();
}
else if(!regex_evaluation_end()){
$("#evaluation_end_time").focus();
}
else if(!regex_evaluation_num()){
$("#evaluation_num").focus();
}
else{
$('#popbox02 form').submit();
hideModal();
}
}
//验证匿评开启时间:大于截止时间,或者为空
function regex_evaluation_start(end_time){
var evaluation_start = $.trim($("#evaluation_start_time").val());
if(evaluation_start == ""){
$("#homework_evaluation_start_time").text("开启匿评日期不能为空");
return false;
}
var end_time = new Date(end_time);
var evaluation_start_time = new Date(evaluation_start);
if(evaluation_start_time > end_time){
$("#homework_evaluation_start_time").text("");
return true;
}else{
$("#homework_evaluation_start_time").text("开启匿评日期必须大于截止日期");
return false;
}
}
//验证匿评结束时间:大于匿评开启时间,或者为空。当匿评开启时间为空时,匿评结束时间必须为空
function regex_evaluation_end(){
var evaluation_start = $.trim($("#evaluation_start_time").val());
var evaluation_end = $.trim($("#evaluation_end_time").val());
if(evaluation_end == ""){
$("#homework_evaluation_end_time").text("关闭匿评日期不能为空");
return true;
}
var evaluation_start_time = new Date(evaluation_start);
var evaluation_end_time = new Date(evaluation_end);
if(evaluation_end_time >= evaluation_start_time){
$("#homework_evaluation_end_time").text("");
return true;
}else{
$("#homework_evaluation_end_time").text("关闭匿评日期不能小于开启匿评日期");
return false;
}
}
//验证匿评数量
function regex_evaluation_num(){
var evaluation_num = $.trim($("#evaluation_num").val());
var regex = /^\d+$/;
if(evaluation_num==""){
$("#evaluation_num_notice").text("匿评人数不能为空");
return false;
}
else if(regex.test(evaluation_num)){
if(evaluation_num > 0){
$("#evaluation_num_notice").html("");
return true;
}
else{
$("#evaluation_num_notice").text("匿评人数必须为大于0");
return false;
}
}
else{
$("#evaluation_num_notice").text("匿评人数只能为数字");
return false;
}
}
window.submit_set_evaluation_attr=submit_set_evaluation_attr;
})();
//处理迟交、缺评扣分
function check_late_penalty(id)
{
var obj = $("#" + id);
var regex = /^\d+$/;
if(regex.test(obj.val()))
{
if(obj.val() > 50)
{
obj.val("50");
}
}
else
{
obj.val("0");
}
}
//匿评弹框确定按钮
function clickOK(path)
{
clickCanel();
$.ajax({
type: "GET",
url: path,
data: 'text',
success: function (data) {
}
});
}
//匿评弹框取消按钮
function clickCanel(){hideModal("#popbox02");}

View File

@ -1205,7 +1205,6 @@ a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no-
.addMemberC li:hover {cursor:pointer; background-color:#cccccc;}
.addMemberCP {width:514px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:fixed !important;left:50%;top:50%;margin:-100px 0 0 -150px; -moz-border-radius:5px;}
.rightArrow {margin:50px 15px 0px 15px; float:left;}
.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;}
.maxHeight100 {max-height:100px; overflow-x:hidden; overflow-y:auto;}
.resubAtt {border-top:1px solid #dddddd; position:relative; margin-top:15px;}
.resubTitle {position:absolute; top:-10px; left:5px; background-color:#ffffff; display:block; font-weight:bold; padding:0px 2px;}

View File

@ -50,4 +50,6 @@ a.resourcesTypeAll {background:url(images/homepage_icon.png) -180px -89px no-rep
.codeIcon {background:url(../images/hwork_icon.png) -78px -160px no-repeat; padding-left:23px;}
.othersIcon {background:url(../images/hwork_icon.png) -3px -210px no-repeat; padding-left:23px;}
.thesisIcon {background:url(../images/hwork_icon.png) -78px -212px no-repeat; padding-left:23px;}
.softwareIcon {background:url(../images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;}
.softwareIcon {background:url(../images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;}
.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;}