diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 1efbc9c48..8a64918ae 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -50,11 +50,15 @@ class CommentsController < ApplicationController # # ������ض�̬�ļ�¼add end flash[:notice] = l(:label_comment_added) course_activity = CourseActivity.where("course_act_type='News' and course_act_id =#{@news.id}").first - course_activity.updated_at = Time.now - course_activity.save + if course_activity + course_activity.updated_at = Time.now + course_activity.save + end user_activity = UserActivity.where("act_type='News' and act_id =#{@news.id}").first - user_activity.updated_at = Time.now - user_activity.save + if user_activity + user_activity.updated_at = Time.now + user_activity.save + end end if params[:user_activity_id] diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index c6ac8b906..4f3f3ec0d 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -163,11 +163,15 @@ class MessagesController < ApplicationController # @reply.reply_id = params[:id] @topic.children << @reply course_activity = CourseActivity.where("course_act_type='Message' and course_act_id =#{@topic.id}").first - course_activity.updated_at = Time.now - course_activity.save + if course_activity + course_activity.updated_at = Time.now + course_activity.save + end user_activity = UserActivity.where("act_type='Message' and act_id =#{@topic.id}").first - user_activity.updated_at = Time.now - user_activity.save + if user_activity + user_activity.updated_at = Time.now + user_activity.save + end #@topic.update_attribute(:updated_on, Time.now) if !@reply.new_record? if params[:asset_id] diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index d39d8fe3b..f2858d097 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -174,11 +174,15 @@ class StudentWorkController < ApplicationController if student_work.save course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework.id}").first - course_activity.updated_at = Time.now - course_activity.save + if course_activity + course_activity.updated_at = Time.now + course_activity.save + end user_activity = UserActivity.where("act_type='HomeworkCommon' and act_id =#{@homework.id}").first - user_activity.updated_at = Time.now - user_activity.save + if user_activity + user_activity.updated_at = Time.now + user_activity.save + end respond_to do |format| format.html { flash[:notice] = l(:notice_successful_create) diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb index a0ce8d18e..a59f507df 100644 --- a/app/controllers/words_controller.rb +++ b/app/controllers/words_controller.rb @@ -55,12 +55,16 @@ class WordsController < ApplicationController @jfm = add_reply_adapter options @save_succ = true if @jfm.errors.empty? if @save_succ - course_activity = CourseActivity.where("course_act_type='JournalsForMessage' and course_act_id =#{parent_id}").first - course_activity.updated_at = Time.now - course_activity.save - user_activity = UserActivity.where("act_type='JournalsForMessage' and act_id =#{parent_id}").first - user_activity.updated_at = Time.now - user_activity.save + course_activity = CourseActivity.where("course_act_type='JournalsForMessage' and course_act_id =#{parent_id}").first + if course_activity + course_activity.updated_at = Time.now + course_activity.save + end + user_activity = UserActivity.where("act_type='JournalsForMessage' and act_id =#{parent_id}").first + if user_activity + user_activity.updated_at = Time.now + user_activity.save + end end respond_to do |format| # format.html { diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 52b7242dd..a8ba4f4ee 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -89,7 +89,7 @@ class Mailer < ActionMailer::Base recipients ||= [] # 只给该课程的老师发送邮件提醒 course.members.each do |member| - if m.user.allowed_to?(:as_teacher,course) + if member.user.allowed_to?(:as_teacher,course) user = User.find(member.user_id) #@subject = "[#{l(:mail_homework)} #{homework_common.name}] #{l(:mail_anonymous_comment_failed)}" @token = Token.get_token_from_user(user, 'autologin') diff --git a/app/views/courses/_course_activity.html.erb b/app/views/courses/_course_activity.html.erb index 1a033b372..e2e1dcfc2 100644 --- a/app/views/courses/_course_activity.html.erb +++ b/app/views/courses/_course_activity.html.erb @@ -73,6 +73,25 @@ $(function () { init_activity_KindEditor_data(<%= activity.id%>, null, "87%"); + var description_images=$("div#activity_description_<%= activity.id %>").find("img"); + if (description_images.length>0) { + for (var i=0; i").attr("href",image.attr('src')); + image.wrap(element); + } + } + $('#activity_description_<%= activity.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); + + var reply_images=$("div#reply_content_<%= activity.id %>").find("img"); + if (reply_images.length>0) { + for (var i=0; i").attr("href",image.attr('src')); + image.wrap(element); + } + } + $('#reply_content_<%= activity.id %> a').colorbox({rel:'nofollow', close: "关闭", returnFocus: false}); }); <% if activity %> diff --git a/app/views/forums/_forum_list.html.erb b/app/views/forums/_forum_list.html.erb index 7934a80fe..ec9f4f7de 100644 --- a/app/views/forums/_forum_list.html.erb +++ b/app/views/forums/_forum_list.html.erb @@ -10,7 +10,7 @@ <%=forum.name.gsub(/(\r\n)/,'
').html_safe %>
<%#= link_to forum.name.gsub(/(\r\n|\s+)/,'
'), forum_path(forum),:class=>"f16 linkBlue" %> -
<%= textAreailizable forum.description%>
+
<%= textAreailizable forum.description%>
diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb index c31790f30..c2997ac25 100644 --- a/app/views/forums/index.html.erb +++ b/app/views/forums/index.html.erb @@ -135,7 +135,7 @@