From 2c7a964470b2f76c0de351058f47f5c1d746c460 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 13 May 2016 16:59:59 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=A4=8D=E5=88=B6=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/kindeditor/pasteimg.js | 1 + public/javascripts/application.js | 1 + 2 files changed, 2 insertions(+) diff --git a/public/assets/kindeditor/pasteimg.js b/public/assets/kindeditor/pasteimg.js index 8831ba300..51f717086 100644 --- a/public/assets/kindeditor/pasteimg.js +++ b/public/assets/kindeditor/pasteimg.js @@ -416,6 +416,7 @@ function uploadpic(piclist,myself) { that.attr("src", str[tIndex]); that.attr("data-ke-src", str[tIndex]); + //复制过来带的链接class等都要去掉 和视频图片有关系 that.removeAttr("class"); that.parent().removeAttr("class"); that.parent().removeAttr("href"); diff --git a/public/javascripts/application.js b/public/javascripts/application.js index c43e0a6a2..4cf64abb7 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1019,6 +1019,7 @@ function showNormalImage(id) { $(image).attr('src',_src); return; } + //无格式的图片不让点击显示大图,显示的话会有问题 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) { var element = $("").attr("href", image.attr('src')); From 6056505f967ceb731514bebf24cfd76af5ac6b9d Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 13 May 2016 19:07:36 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=A4=8D=E5=88=B6=E7=B2=98=E8=B4=B4?= =?UTF-8?q?=E6=97=B6=E5=B0=86=E5=9B=BE=E7=89=87=E6=89=80=E5=B8=A6=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E5=88=A0=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/kindeditor/pasteimg.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/assets/kindeditor/pasteimg.js b/public/assets/kindeditor/pasteimg.js index 51f717086..7165b142a 100644 --- a/public/assets/kindeditor/pasteimg.js +++ b/public/assets/kindeditor/pasteimg.js @@ -419,7 +419,8 @@ function uploadpic(piclist,myself) { //复制过来带的链接class等都要去掉 和视频图片有关系 that.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"); tIndex = tIndex + 1; } From e24470db4c9067f08e6f04e20289be77bae4ab9c Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Sun, 15 May 2016 00:00:16 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=88=AA=E5=8F=96ERROR=5FMSG=E6=97=B6=E5=8F=AA=E5=9C=A8?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF=E4=B8=8B=E6=88=AA=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index ba2999577..589f232c5 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -123,7 +123,9 @@ class StudentWorkController < ApplicationController #-1 默认值 0全部正确并结束 2 超时 -2 编译错误 resultObj[:status] = -1 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"] #编译错误时的信息 #该状态用于存入CodeTests From 09c462ebad05354c83ecbce9a1cd18b6b0a61c35 Mon Sep 17 00:00:00 2001 From: huang Date: Sun, 15 May 2016 08:50:10 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E8=B5=84=E6=BA=90=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a81ade3fa..dd1d8f876 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2618,9 +2618,6 @@ class UsersController < ApplicationController # 获取我的资源 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')) "+ "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}") @@ -2628,7 +2625,6 @@ class UsersController < ApplicationController # 获取我的资源查询结果 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')) "+ "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}") @@ -2636,7 +2632,6 @@ class UsersController < ApplicationController # 获取我的课程资源 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')"+ "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}") @@ -2644,7 +2639,6 @@ class UsersController < ApplicationController # 获取我的课程资源中搜索结果 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')"+ "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}") @@ -2662,7 +2656,6 @@ class UsersController < ApplicationController # 获取我的项目资源 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') "+ "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}") @@ -2670,7 +2663,6 @@ class UsersController < ApplicationController # 获取我的项目资源搜索 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') "+ "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}") @@ -2688,14 +2680,12 @@ class UsersController < ApplicationController # 获取我上传的附件 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', 'Document','Message','News','StudentWorkScore','HomewCommon'))").order("#{order.nil? ? 'created_on' : order} #{score}") end # 获取我上传的附件搜索结果 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', 'Document','Message','News','StudentWorkScore','HomewCommon')) and (filename like :p)", :p => search ).order("#{order.nil? ? 'created_on' : order} #{score}") end @@ -2714,13 +2704,11 @@ class UsersController < ApplicationController # 获取我的用户类型资源 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}") end # 获取我的用户类型资源搜索 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}") end From 5e56e1198233eb875af02ffd4cbf5222d9c36e0c Mon Sep 17 00:00:00 2001 From: cxt Date: Mon, 16 May 2016 11:14:21 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=9A=82=E6=97=B6=E7=A6=81=E6=8E=89?= =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=9A=84=E6=A8=A1=E6=9D=BF=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=92=8C=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/homework_common.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 998ace441..f11a48a80 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -29,8 +29,8 @@ class HomeworkCommon < ActiveRecord::Base :description => :description, :author => :author, :url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}} - after_create :act_as_activity, :send_mail, :act_as_course_message - after_update :update_activity, :wechat_message + after_create :act_as_activity, :send_mail + after_update :update_activity after_save :act_as_course_activity after_destroy :delete_kindeditor_assets @@ -60,11 +60,11 @@ class HomeworkCommon < ActiveRecord::Base self.course.members.each do |m| # if m.user_id != self.user_id 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 - if count == 0 - 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") - end + #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 + # 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") + #end # end end end From 2484d642a1df27a81733aec21afcbff9eca840b3 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 16 May 2016 14:19:04 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E7=BB=84=E7=BB=87500=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_org_subfield_leftM1.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/organizations/_org_subfield_leftM1.html.erb b/app/views/organizations/_org_subfield_leftM1.html.erb index e7481ce0a..a2822f5ba 100644 --- a/app/views/organizations/_org_subfield_leftM1.html.erb +++ b/app/views/organizations/_org_subfield_leftM1.html.erb @@ -26,7 +26,7 @@
<%= activity.description.to_s.html_safe %>
-
<%=link_to "查看全文>>", activity.name.to_s, student_work_index_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %>
+
<%=link_to "查看全文>>", student_work_index_url_in_org(activity.id), :target => "_blank", :class => "sn-link-grey2 sn-fr" %>
<% elsif act.org_act_type == "Message" %> <% activity = Message.find(act.org_act_id) %>