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/files_controller.rb b/app/controllers/files_controller.rb index 7b81d12db..0f8330afe 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -176,12 +176,6 @@ class FilesController < ApplicationController def index @flag = params[:flag] || false - #sort_init 'filename', 'asc' - # sort_init 'created_on', 'desc' - # sort_update 'created_on' => "#{Attachment.table_name}.created_on", - # 'filename' => "#{Attachment.table_name}.filename", - # 'size' => "#{Attachment.table_name}.filesize", - # 'downloads' => "#{Attachment.table_name}.downloads" sort = "" @sort = "" @order = "" diff --git a/app/controllers/git_usage_controller.rb b/app/controllers/git_usage_controller.rb deleted file mode 100644 index 56aaa56f1..000000000 --- a/app/controllers/git_usage_controller.rb +++ /dev/null @@ -1,12 +0,0 @@ -#added by baiyu -class GitUsageController < ApplicationController - layout "new_base" - def ch_usage - - end - - def en_usage - - end -end -#end \ No newline at end of file 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..17f179492 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) @@ -267,6 +271,7 @@ class StudentWorkController < ApplicationController end @is_new = false else + @is_last_a = @work.student_works_scores.empty? @score = StudentWorksScore.new @score.score = params[:score] if params[:score] @score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index 0ffa334c2..4f1a343d5 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -246,7 +246,7 @@ class TagsController < ApplicationController if @taggable_id.blank? #如果没有传tag_id,那么直接更新tag_name就好了。但是要防止 重命名后的tag存在。 #看重命名后的tag是否存在。如果存在的话,只需要更改taggings里边的id即可 if @rename_tag - @taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_type(@tag_id,@taggable_id,@taggable_type) + @taggings = ActsAsTaggableOn::Tagging.find_by_tag_id_and_taggable_type(@tag_id,@taggable_type) @taggings.update_attributes({:tag_id=>@rename_tag.id}) else #如果不存在,那么就直接更新该tag名称为新的名称 (ActsAsTaggableOn::Tag.find_by_name(@tag_name)).update_attributes(:name=>@rename_tag_name) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4f3df3bd4..73a26b52c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -358,6 +358,7 @@ class UsersController < ApplicationController #导入作业 def user_import_homeworks + @select_course = params[:select_course] ? 1 : 0 @user_homeworks = HomeworkCommon.where(:user_id => @user.id).order("created_at desc") respond_to do |format| format.js @@ -377,6 +378,7 @@ class UsersController < ApplicationController homework = HomeworkCommon.find_by_id params[:checkMenu] homework_detail_programing = homework.homework_detail_programing @homework = HomeworkCommon.new + @select_course = params[:select_course] || 0 if homework @homework.name = homework.name @homework.description = homework.description 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/models/memo.rb b/app/models/memo.rb index c30616558..33b24db50 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -79,7 +79,7 @@ class Memo < ActiveRecord::Base receivers << self.forum.creator end # 添加发帖人 - if self.author_id != self.parent.author_id + if self.author_id != self.parent.author_id && self.parent.author_id != self.forum.creator_id receivers << self.parent.author end end diff --git a/app/views/avatar/_new_avatar_form.html.erb b/app/views/avatar/_new_avatar_form.html.erb index 64abfbc30..2593bf1f5 100644 --- a/app/views/avatar/_new_avatar_form.html.erb +++ b/app/views/avatar/_new_avatar_form.html.erb @@ -2,10 +2,10 @@ <%= image_tag(url_to_avatar(source), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%> <%#= link_to l(:button_delete_file),{:controller => :avatar,:action => :delete_image,:remote=>true,:source_type=> source.class,:source_id=>source.id},:confirm => l(:text_are_you_sure), :method => :post, :class => "upbtn fl" %> -<%= l(:button_upload_photo) %> +<%= l(:button_upload_photo) %> <%= file_field_tag 'avatar[image]', - :id => nil, - :class => 'upload_file', + :id => 'upload_course_logo', + :class => 'undis upload_file', :size => "1", :multiple => true, :data => { 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/courses/show.html.erb b/app/views/courses/show.html.erb index bb8bb546a..78f44aa31 100644 --- a/app/views/courses/show.html.erb +++ b/app/views/courses/show.html.erb @@ -17,9 +17,9 @@
  • <%= link_to "全部动态", {:controller => "courses", :action => "show", :type => nil}, :class =>"homepagePostTypeAll postTypeGrey"%>
  • <%= link_to "作业动态", {:controller => "courses", :action => "show", :type => "homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
  • <%= link_to "通知动态", {:controller => "courses", :action => "show", :type => "news"}, :class => "homepagePostTypeNotice postTypeGrey"%>
  • -
  • <%= link_to "资源库动态", {:controller => "courses", :action => "show", :type => "attachment"}, :class => "resourcesTypeAtt resourcesGrey"%>
  • +
  • <%= link_to "资源库动态", {:controller => "courses", :action => "show", :type => "attachment"}, :class => "homepagePostTypeResource resourcesGrey"%>
  • <%= link_to "论坛动态", {:controller => "courses", :action => "show", :type => "message"}, :class => "homepagePostTypeForum postTypeGrey"%>
  • -
  • <%= link_to "留言动态", {:controller => "courses", :action => "show", :type => "journalsForMessage"}, :class => "homepagePostTypeQuiz postTypeGrey"%>
  • +
  • <%= link_to "留言动态", {:controller => "courses", :action => "show", :type => "journalsForMessage"}, :class => "homepagePostTypeMessage postTypeGrey"%>
  • <%= link_to "问卷动态", {:controller => "courses", :action => "show", :type => "poll"}, :class => "homepagePostTypeQuiz postTypeGrey"%>
  • diff --git a/app/views/files/_tag_yun.html.erb b/app/views/files/_tag_yun.html.erb index f5e22002a..159384c6e 100644 --- a/app/views/files/_tag_yun.html.erb +++ b/app/views/files/_tag_yun.html.erb @@ -1,9 +1,12 @@ <% unless tag_list.nil?%> <% tag_list.each do |k,v|%> <% if tag_name && tag_name == k%> - <%= k%>×<%= v%> + <%= k%>×<%= v%> <% else%> - <%= k%>×<%= v%> + + <%= k%>×<%= v%> <% end%> <% end%> <% end%> \ No newline at end of file diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 34f7452a7..6b1fdb2e9 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -234,6 +234,8 @@ //第二种是改变某个tag名称。其他所有的资源如果拥有这个tag。那么对应的tag名也要改掉。 //目前这两种依据 的来源就是 是否 传了参数 id。如果有id。就指定了资源id,就是第一种情况。如果没有id。就是第二种情况 function rename_tag(domEle,name,id,type){ + isdb = true; //这是双击 + //clearTimeout(clickFunction); if(domEle.children().get(0) != undefined ){ //已经是编辑框的情况下不要动 return; } @@ -250,8 +252,10 @@ } //监听所有的单击事件 $(document.body).click(function(e){ + isdb = false; //这是单击 node = document.elementFromPoint(e.clientX, e.clientY); if(node.tagName == "INPUT"){ //如果是输入框的聚焦,那么就不要进行下去了 + isdb = true; //为了防止在编辑的时候又去单击其他tag去过滤。导致tag过滤不可用 return; } if($("#renameTagName")[0] != undefined ){//存在renameTagName,则处于编辑状态 @@ -260,15 +264,15 @@ ele.parent().html(tagNameHtml); }else{ //否则就要更新tag名称了 - if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){ +// if(confirm("是否将标签改为 "+ $("#renameTagName").val().trim())){ 去掉询问 $.post( '<%= update_tag_name_path %>', {"taggableId": tagId, "taggableType": taggableType, "tagName": tagName, "renameName": $("#renameTagName").val().trim(),"courseId":<%= @course.id%>} ) - }else{ - ele.parent().css("border",""); - ele.parent().html(tagNameHtml); - } +// }else{ +// ele.parent().css("border",""); +// ele.parent().html(tagNameHtml); +// } } } }); 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 @@