Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
80be46dc92
|
@ -123,7 +123,9 @@ class StudentWorkController < ApplicationController
|
||||||
#-1 默认值 0全部正确并结束 2 超时 -2 编译错误
|
#-1 默认值 0全部正确并结束 2 超时 -2 编译错误
|
||||||
resultObj[:status] = -1
|
resultObj[:status] = -1
|
||||||
resultObj[:results] = result["results"].first #本次测试结果
|
resultObj[:results] = result["results"].first #本次测试结果
|
||||||
result["error_msg"] = result["error_msg"][0..2047]
|
if result["status"].to_i == -2 #编译错误
|
||||||
|
result["error_msg"] = result["error_msg"][0..2047]
|
||||||
|
end
|
||||||
resultObj[:error_msg] = result["error_msg"] #编译错误时的信息
|
resultObj[:error_msg] = result["error_msg"] #编译错误时的信息
|
||||||
|
|
||||||
#该状态用于存入CodeTests
|
#该状态用于存入CodeTests
|
||||||
|
|
|
@ -2618,9 +2618,6 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# 获取我的资源
|
# 获取我的资源
|
||||||
def get_my_resources author_id, user_course_ids, user_project_ids, order, score
|
def get_my_resources author_id, user_course_ids, user_project_ids, order, score
|
||||||
unless author_id.to_i.to_s == author_id
|
|
||||||
author_id = User.find_by_login(author_id).id
|
|
||||||
end
|
|
||||||
attachments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('OrgSubfield','Principal','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
attachments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('OrgSubfield','Principal','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
|
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
|
||||||
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
|
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
|
||||||
|
@ -2628,7 +2625,6 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# 获取我的资源查询结果
|
# 获取我的资源查询结果
|
||||||
def get_my_resources_search (author_id, user_course_ids, user_project_ids, order, score, search)
|
def get_my_resources_search (author_id, user_course_ids, user_project_ids, order, score, search)
|
||||||
author_id = User.find_by_login(author_id).id
|
|
||||||
@attachments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
@attachments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
||||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
|
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}) and is_publish = 1 and container_id is not null)" +
|
||||||
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)) and (filename like :p)" ,:p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
|
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')}) and is_publish = 1 and container_id is not null)) and (filename like :p)" ,:p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
|
||||||
|
@ -2636,7 +2632,6 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# 获取我的课程资源
|
# 获取我的课程资源
|
||||||
def get_course_resources author_id, user_course_ids, order, score
|
def get_course_resources author_id, user_course_ids, order, score
|
||||||
author_id = User.find_by_login(author_id).id
|
|
||||||
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Course')"+
|
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Course')"+
|
||||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})
|
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})
|
||||||
and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
|
and is_publish = 1 and container_id is not null)" ).order("#{order.nil? ? 'created_on' : order} #{score}")
|
||||||
|
@ -2644,7 +2639,6 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# 获取我的课程资源中搜索结果
|
# 获取我的课程资源中搜索结果
|
||||||
def get_course_resources_search author_id, user_course_ids, order, score, search
|
def get_course_resources_search author_id, user_course_ids, order, score, search
|
||||||
author_id = User.find_by_login(author_id).id
|
|
||||||
attchments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Course')"+
|
attchments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Course')"+
|
||||||
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})
|
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')})
|
||||||
and is_publish = 1 and container_id is not null)) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
|
and is_publish = 1 and container_id is not null)) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
|
||||||
|
@ -2662,7 +2656,6 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# 获取我的项目资源
|
# 获取我的项目资源
|
||||||
def get_project_resources author_id, user_project_ids, order, score
|
def get_project_resources author_id, user_project_ids, order, score
|
||||||
author_id = User.find_by_login(author_id).id
|
|
||||||
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Project') "+
|
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Project') "+
|
||||||
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')})
|
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')})
|
||||||
and is_publish = 1 and container_id is not null)").order("#{order.nil? ? 'created_on' : order} #{score}")
|
and is_publish = 1 and container_id is not null)").order("#{order.nil? ? 'created_on' : order} #{score}")
|
||||||
|
@ -2670,7 +2663,6 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# 获取我的项目资源搜索
|
# 获取我的项目资源搜索
|
||||||
def get_project_resources_search author_id, user_project_ids, order, score, search
|
def get_project_resources_search author_id, user_project_ids, order, score, search
|
||||||
author_id = User.find_by_login(author_id).id
|
|
||||||
attchments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Project') "+
|
attchments = Attachment.where("((author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Project') "+
|
||||||
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')})
|
"or (container_type = 'Project' and container_id in (#{user_project_ids.empty? ? '0': user_project_ids.join(',')})
|
||||||
and is_publish = 1 and container_id is not null)) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
|
and is_publish = 1 and container_id is not null)) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
|
||||||
|
@ -2688,14 +2680,12 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# 获取我上传的附件
|
# 获取我上传的附件
|
||||||
def get_attch_resources author_id, order, score
|
def get_attch_resources author_id, order, score
|
||||||
author_id = User.find_by_login(author_id).id
|
|
||||||
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue',
|
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue',
|
||||||
'Document','Message','News','StudentWorkScore','HomewCommon'))").order("#{order.nil? ? 'created_on' : order} #{score}")
|
'Document','Message','News','StudentWorkScore','HomewCommon'))").order("#{order.nil? ? 'created_on' : order} #{score}")
|
||||||
end
|
end
|
||||||
|
|
||||||
# 获取我上传的附件搜索结果
|
# 获取我上传的附件搜索结果
|
||||||
def get_attch_resources_search author_id, order, score, search
|
def get_attch_resources_search author_id, order, score, search
|
||||||
author_id = User.find_by_login(author_id).id
|
|
||||||
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue',
|
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type in('Project','OrgSubfield','Principal','Course','Issue',
|
||||||
'Document','Message','News','StudentWorkScore','HomewCommon')) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
|
'Document','Message','News','StudentWorkScore','HomewCommon')) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}")
|
||||||
end
|
end
|
||||||
|
@ -2714,13 +2704,11 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# 获取我的用户类型资源
|
# 获取我的用户类型资源
|
||||||
def get_principal_resources author_id, order, score
|
def get_principal_resources author_id, order, score
|
||||||
author_id = User.find_by_login(author_id).id
|
|
||||||
attchments = Attachment.where("author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal'").order("#{order.nil? ? 'created_on' : order} #{score}")
|
attchments = Attachment.where("author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal'").order("#{order.nil? ? 'created_on' : order} #{score}")
|
||||||
end
|
end
|
||||||
|
|
||||||
# 获取我的用户类型资源搜索
|
# 获取我的用户类型资源搜索
|
||||||
def get_principal_resources_search author_id, order, score, search
|
def get_principal_resources_search author_id, order, score, search
|
||||||
author_id = User.find_by_login(author_id).id
|
|
||||||
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal') and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
|
attchments = Attachment.where("(author_id = #{author_id} and is_publish = 1 and container_id is not null and container_type = 'Principal') and (filename like :p)", :p => search).order("#{order.nil? ? 'created_on' : order} #{score}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@ class HomeworkCommon < ActiveRecord::Base
|
||||||
:description => :description,
|
:description => :description,
|
||||||
:author => :author,
|
:author => :author,
|
||||||
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
|
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
|
||||||
after_create :act_as_activity, :send_mail, :act_as_course_message
|
after_create :act_as_activity, :send_mail
|
||||||
after_update :update_activity, :wechat_message
|
after_update :update_activity
|
||||||
after_save :act_as_course_activity
|
after_save :act_as_course_activity
|
||||||
after_destroy :delete_kindeditor_assets
|
after_destroy :delete_kindeditor_assets
|
||||||
|
|
||||||
|
@ -60,11 +60,11 @@ class HomeworkCommon < ActiveRecord::Base
|
||||||
self.course.members.each do |m|
|
self.course.members.each do |m|
|
||||||
# if m.user_id != self.user_id
|
# if m.user_id != self.user_id
|
||||||
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
||||||
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
|
#count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
|
||||||
if count == 0
|
#if count == 0
|
||||||
ws = WechatService.new
|
# ws = WechatService.new
|
||||||
ws.homework_template(m.user_id, "homework", self.id, "#{l(:label_new_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59")
|
# ws.homework_template(m.user_id, "homework", self.id, "#{l(:label_new_homework_template)}", self.course.name, self.name.html_safe, self.end_time.to_s + " 23:59:59")
|
||||||
end
|
#end
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<div class="sn-news-txt">
|
<div class="sn-news-txt">
|
||||||
<div class="sn-news-wrap"><%= activity.description.to_s.html_safe %></div>
|
<div class="sn-news-wrap"><%= activity.description.to_s.html_safe %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="sn-read-more"><%=link_to "查看全文>>", activity.name.to_s, student_work_index_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
|
<div class="sn-read-more"><%=link_to "查看全文>>", student_work_index_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %></div>
|
||||||
</div>
|
</div>
|
||||||
<% elsif act.org_act_type == "Message" %>
|
<% elsif act.org_act_type == "Message" %>
|
||||||
<% activity = Message.find(act.org_act_id) %>
|
<% activity = Message.find(act.org_act_id) %>
|
||||||
|
|
|
@ -416,9 +416,11 @@ function uploadpic(piclist,myself) {
|
||||||
that.attr("src", str[tIndex]);
|
that.attr("src", str[tIndex]);
|
||||||
that.attr("data-ke-src", str[tIndex]);
|
that.attr("data-ke-src", str[tIndex]);
|
||||||
|
|
||||||
|
//复制过来带的链接class等都要去掉 和视频图片有关系
|
||||||
that.removeAttr("class");
|
that.removeAttr("class");
|
||||||
that.parent().removeAttr("class");
|
that.parent().removeAttr("class");
|
||||||
that.parent().removeAttr("href");
|
that.parents().removeAttr("href"); //删除所有父节点的href
|
||||||
|
// that.parent().removeAttr("href");
|
||||||
that.parent().removeAttr("data-ke-src");
|
that.parent().removeAttr("data-ke-src");
|
||||||
tIndex = tIndex + 1;
|
tIndex = tIndex + 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1045,6 +1045,7 @@ function showNormalImage(id) {
|
||||||
$(image).attr('src',_src);
|
$(image).attr('src',_src);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//无格式的图片不让点击显示大图,显示的话会有问题
|
||||||
var tmpsrc = image.attr('src');
|
var tmpsrc = image.attr('src');
|
||||||
if (tmpsrc.indexOf('.gif') >= 0 || tmpsrc.indexOf('.jpg') >= 0 || tmpsrc.indexOf('.jpeg') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.bmp') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.BMP') >= 0 || tmpsrc.indexOf('.JPEG') >= 0 || tmpsrc.indexOf('.JPG') >= 0 || tmpsrc.indexOf('.PNG') >= 0 || tmpsrc.indexOf('.GIF') >= 0) {
|
if (tmpsrc.indexOf('.gif') >= 0 || tmpsrc.indexOf('.jpg') >= 0 || tmpsrc.indexOf('.jpeg') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.bmp') >= 0 || tmpsrc.indexOf('.png') >= 0 || tmpsrc.indexOf('.BMP') >= 0 || tmpsrc.indexOf('.JPEG') >= 0 || tmpsrc.indexOf('.JPG') >= 0 || tmpsrc.indexOf('.PNG') >= 0 || tmpsrc.indexOf('.GIF') >= 0) {
|
||||||
var element = $("<a></a>").attr("href", image.attr('src'));
|
var element = $("<a></a>").attr("href", image.attr('src'));
|
||||||
|
|
Loading…
Reference in New Issue