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/news_controller.rb b/app/controllers/news_controller.rb index d5c248f77..5d83c1320 100644 --- a/app/controllers/news_controller.rb +++ b/app/controllers/news_controller.rb @@ -175,19 +175,19 @@ class NewsController < ApplicationController update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS end # ������ض�̬�ļ�¼add start - teachers = searchTeacherAndAssistant(@course) - for teacher in teachers - if(teacher.user_id != User.current.id) - notify = ActivityNotify.new() - notify.activity_container_id = @course.id - notify.activity_container_type = 'Course' - notify.activity_id = @news.id - notify.activity_type = 'News' - notify.notify_to = teacher.user_id - notify.is_read = 0 - notify.save() - end - end + # teachers = searchTeacherAndAssistant(@course) + # for teacher in teachers + # if(teacher.user_id != User.current.id) + # notify = ActivityNotify.new() + # notify.activity_container_id = @course.id + # notify.activity_container_type = 'Course' + # notify.activity_id = @news.id + # notify.activity_type = 'News' + # notify.notify_to = teacher.user_id + # notify.is_read = 0 + # notify.save() + # end + # end # ������ض�̬�ļ�¼add end render_attachment_warning_if_needed(@news) flash[:notice] = l(:notice_successful_create) 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/homework_common.rb b/app/models/homework_common.rb index c1e5666ac..796080645 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -40,9 +40,9 @@ class HomeworkCommon < ActiveRecord::Base def act_as_course_message if self.course 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) - end + # end end end end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 52b7242dd..39e709beb 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -53,7 +53,7 @@ class Mailer < ActionMailer::Base recipients ||= [] course.members.each do |member| user = User.find(member.user_id) - # @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}" + @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}" @token = Token.get_token_from_user(user, 'autologin') @anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value)) @anonymous_comment_close_name = homework_common.name @@ -62,7 +62,7 @@ class Mailer < ActionMailer::Base recipients << user.mail end mail :to => recipients, - :subject => "[#{l(:mail_homework)}#{homework_common.name}] #{l(:mail_anonymous_comment_open)}" + :subject => @subject end # 作业匿评关闭 @@ -71,7 +71,7 @@ class Mailer < ActionMailer::Base recipients ||= [] course.members.each do |member| user = User.find(member.user_id) - #@subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}" + @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_close)}" @token = Token.get_token_from_user(user, 'autologin') @anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value)) @anonymous_comment_close_name = homework_common.name @@ -80,7 +80,7 @@ class Mailer < ActionMailer::Base recipients << user.mail end mail :to => recipients, - :subject => "[#{l(:mail_homework)}#{homework_common.name}] #{l(:mail_anonymous_comment_open)}" + :subject => @subject end # 匿评失败给老师发送邮件通知 @@ -89,9 +89,9 @@ 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)}" + @subject = "[#{l(:mail_homework)} #{homework_common.name}] #{l(:mail_anonymous_comment_failed)}" @token = Token.get_token_from_user(user, 'autologin') @anonymous_comment_fail_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value)) @anonymous_comment_fail_name = homework_common.name @@ -101,7 +101,7 @@ class Mailer < ActionMailer::Base end end mail :to => recipients, - :subject => "[#{l(:mail_homework)} #{homework_common.name}] #{l(:mail_anonymous_comment_failed)}" + :subject => @subject end # author: alan 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 @@